CLAUDE.md.tpl
来自
cli/templates/level-0/
markdown
{% raw %}
# Project: {{PROJECT_NAME}}
[One-line project description].
Tech stack: {{TECH_STACK}}.
## Commands
- `npm run dev` — Dev server (port 3000)
- `npm run build` — Production build
- `npm run test` — Run Vitest unit tests
- `npm run test:e2e` — Run Playwright E2E tests
- `npm run lint` — ESLint check
{{DB_COMMANDS}}
## Architecture
- `/app` — Page routes and layouts (App Router)
- `/app/api` — API Route Handlers
- `/components` — React components
- `/components/ui` — Base UI components (shadcn/ui)
- `/lib` — Utilities, client instances, auth helpers
- `/services` — Business logic layer
- {{DB_ARCHITECTURE}}
- `/types` — Shared TypeScript type definitions
- `/hooks` — Custom React Hooks
- `/__tests__` — Test files
## Key Rules
- NEVER commit .env files or any files containing secrets
- NEVER use `any` type — TypeScript strict mode
- NEVER rewrite entire modules at once — small steps, verify each
- MUST use named exports, no default export
- MUST validate all API inputs with zod
- MUST use unified AppError class for error handling
- MUST run related tests after code changes
- File naming: kebab-case; Component naming: PascalCase
- Single file must not exceed 300 lines — split if exceeded
- {{DB_BOUNDARY_RULE}}
## Work Mode
- Produce a plan before coding (list files to modify and change points), wait for approval
- When modifying shared types/interfaces, search all references first, list impact scope
- Read the full content of any file BEFORE modifying it
- Search for existing similar functionality BEFORE implementing new features
- Verify that any referenced types/functions actually exist in the project (no fabrication)
- Commit at each working state — don't wait until everything is done
## Module Boundaries
- Components (/components) never call the database directly
- API Routes only parse requests and format responses — business logic lives in Service layer
- Service layer is the sole home of business logic
- Call direction (one-way): {{CALL_DIRECTION}}
## Project Glossary
<!-- Project-specific terms to prevent AI misunderstanding. Format: term — meaning in this project -->
## Dependency Policy
Check docs/references/approved-deps.md before introducing new dependencies. Unlisted deps require justification.
## Common Pitfalls (update when AI makes mistakes)
<!-- Format: - Describe the issue and correct approach (date) -->
## Compact Preservation
Preserve: modified file paths, current task progress, test commands, architecture decisions, failed attempts and reasons
{% endraw %}