# Memory File Templates Ready-to-use CLAUDE.md templates for different project types. ## Template 1: Minimal Project For simple projects with straightforward requirements. ```markdown # ProjectName Brief description. ## Tech Stack - Language/Framework - Database - Key libraries ## Common Commands ```bash start-command test-command build-command ``` ## Conventions - Code style rule 1 - Code style rule 2 - Naming convention ## IMPORTANT - Critical rule 1 - Critical rule 2 ``` **Target Size**: ~50 lines **Use For**: Small projects, prototypes, personal projects --- ## Template 2: Team Project For collaborative projects with extensive documentation. ```markdown # ProjectName @docs/overview.md ## Quick Reference ### Tech Stack @docs/tech-stack.md ### Common Commands ```bash npm run dev npm test npm run build ``` ### Coding Standards - 2-space indentation - ESLint + Prettier - Full guide: @docs/style-guide.md ### Architecture @docs/architecture.md ## IMPORTANT Team Rules - YOU MUST create PR for all changes - Tests must pass before merge - Update docs with code changes ## Git Workflow @docs/git-workflow.md ## NEVER - Commit to main directly - Merge without review - Commit secrets ``` **Target Size**: ~100 lines **Use For**: Team projects, open source, enterprise applications --- ## Template 3: Monorepo For multi-package repositories. ```markdown # MonorepoName Multi-package repository. ## Structure - `packages/frontend/` - React app → See frontend/CLAUDE.md - `packages/backend/` - API server → See backend/CLAUDE.md - `packages/shared/` - Common code ## Global Standards - Node.js 20+ - pnpm workspaces - Shared ESLint config ## Commands (from root) ```bash pnpm install pnpm test pnpm run build ``` ## Cross-Package - Import from `@myapp/shared` - See @docs/package-deps.md ## IMPORTANT - Changes affecting multiple packages need full test suite ``` **Target Size**: ~80 lines **Use For**: Monorepos, microservices, multi-tier applications --- ## Template 4: Personal Defaults For ~/.claude/CLAUDE.md (applies to all your projects). ```markdown # Personal Preferences Applied to all my projects unless overridden. ## Communication - Explain reasoning before acting - Confirm before destructive ops - Show diffs for large changes ## Code Style - Functional programming preferred - Descriptive variable names - Comments for "why", not "what" ## Git - Conventional Commits format - Squash feature branches ## Testing - Write tests alongside code - Aim for 80%+ coverage ``` **Target Size**: ~50 lines **Use For**: Personal global settings --- ## Template 5: Frontend Project ```markdown # Frontend App React/TypeScript application. ## Tech Stack - React 18 + TypeScript - Tailwind CSS - State: Redux Toolkit - Router: React Router v6 ## Commands ```bash npm run dev # Dev server (localhost:3000) npm test # Jest + RTL npm run build # Production build npm run lint # ESLint ``` ## Structure - `src/components/` - React components - `src/hooks/` - Custom hooks - `src/store/` - Redux slices - `src/utils/` - Helper functions ## Conventions - Functional components only - Custom hooks for logic reuse - 2-space indentation - Import order: external → internal → styles ## IMPORTANT - All components need tests - Accessibility: WCAG AA minimum - No inline styles (use Tailwind) ``` **Target Size**: ~100 lines **Use For**: React, Vue, Angular, or other SPA projects --- ## Template 6: Backend API ```markdown # Backend API Node.js/Express REST API. ## Tech Stack - Express + TypeScript - PostgreSQL + Sequelize - Redis for caching - JWT authentication ## Commands ```bash npm run dev # Dev server (localhost:4000) npm test # Jest npm run migrate # Run migrations npm run seed # Seed database ``` ## Structure - `src/routes/` - API endpoints - `src/controllers/` - Business logic - `src/models/` - Database models - `src/middleware/` - Express middleware - `src/utils/` - Helper functions ## Environment - See `.env.example` for required vars - Never commit `.env` ## IMPORTANT - All endpoints need rate limiting - Input validation required - Error handling middleware - Log security events ``` **Target Size**: ~110 lines **Use For**: API servers, backend services --- ## Template 7: Python Project ```markdown # Python Project Python application using modern tooling. ## Tech Stack - Python 3.11+ - uv for dependency management - pytest for testing - ruff for linting ## Commands ```bash uv run python main.py # Run application uv run pytest # Run tests uv run ruff check . # Lint ``` ## Structure - `src/` - Application code - `tests/` - Test files - `pyproject.toml` - Project config ## Conventions - Type hints required - Docstrings for public APIs - Follow PEP 8 - Max line length: 100 ## IMPORTANT - All functions need type hints - Test coverage > 80% - No bare `except:` clauses ``` **Target Size**: ~90 lines **Use For**: Python applications, CLI tools, data science projects --- ## Customization Tips ### Adding Project-Specific Rules ```markdown ## IMPORTANT Project Rules - YOU MUST [mandatory action] - NEVER [forbidden action] - ALWAYS [required practice] ``` ### Adding Tech Stack Details ```markdown ## Tech Stack - Backend: Node.js + Express - Auth: JWT + refresh tokens - ORM: Sequelize - Validation: Zod - Frontend: React + TypeScript - State: Zustand - Styling: Tailwind - Forms: React Hook Form ``` ### Adding Team Workflow ```markdown ## Git Workflow 1. Branch from `develop` 2. Name: `feature/description` or `fix/description` 3. PR requires 2 approvals 4. Squash merge to develop 5. Weekly releases to main ``` ### Referencing External Docs ```markdown ## Documentation - Architecture: @docs/architecture.md - API Reference: @docs/api.md - Contributing: @CONTRIBUTING.md - Deployment: @docs/deployment.md ``` --- ## Anti-Patterns to Avoid ### ❌ Too Verbose ```markdown # Bad: 500 lines This project is a comprehensive e-commerce platform that provides users with the ability to browse products, add them to their cart, and complete purchases securely. The architecture follows a microservices pattern with separate services for user management, product catalog, shopping cart, payment processing, and order fulfillment... [400 more lines of detailed explanation] ``` ### ✓ Concise with Imports ```markdown # Good: 100 lines E-commerce platform with microservices architecture. Tech Stack: @docs/tech-stack.md Architecture: @docs/architecture.md Conventions: @docs/conventions.md ## Quick Start ```bash npm run dev ``` ``` ### ❌ Vague Instructions ```markdown # Bad - Write clean code - Follow best practices - Be secure ``` ### ✓ Specific Instructions ```markdown # Good IMPORTANT: - All API endpoints MUST have rate limiting (100 req/min) - Passwords MUST be hashed with bcrypt (min 10 rounds) - Input validation MUST use Zod schemas - SQL queries MUST use parameterized statements ``` --- ## Quick Selection Guide | Project Type | Template | Target Size | |-------------|----------|-------------| | Personal/Small | Minimal | ~50 lines | | Team Project | Team | ~100 lines | | Monorepo | Monorepo | ~80 lines | | Frontend SPA | Frontend | ~100 lines | | Backend API | Backend | ~110 lines | | Python App | Python | ~90 lines | | Global Settings | Personal Defaults | ~50 lines | **General Rule**: Start with the appropriate template, customize for your needs, keep under 200 lines.