You’ve created your CLAUDE.md file. You’re staring at a blank page. And you’re not sure what to actually write in it.
This is the most common sticking point. Most guides tell you to “add your project details” and move on, leaving you to figure out what that means. This article doesn’t do that. It walks through every meaningful section you can include, tells you why each one matters, and shows you real examples — not placeholder text.
📋 TL;DR
– CLAUDE.md has 8 core sections worth including: project overview, tech stack, coding standards, folder structure, commands, architecture notes, constraints, and business context
– Not every section belongs in every project — pick what applies to you
– Specifics always beat generics — “use 2-space indentation” helps more than “write clean code”
– Real examples are included for every section below — copy and adapt them
– The goal is to eliminate every piece of context you’d otherwise repeat in every session
This is part of our complete CLAUDE.md — The Complete Beginner’s Guide (2026). If you haven’t created your file yet, see How to Create Your First CLAUDE.md File.
The Core Principle: Be Specific
Before we walk through each section, here’s the rule that makes every section more effective.
Vague instructions produce vague results. Compare these two CLAUDE.md entries:
❌ Vague: Write clean, well-structured code
✅ Specific: Use 2-space indentation. Name boolean variables with an is/has/should prefix. Every function must have a single responsibility — if a function is longer than 30 lines, split it.
The vague version means nothing because Claude’s idea of “clean code” and yours might be completely different. The specific version leaves no room for interpretation.
Every example in this article follows this principle: specifics over generalities, always.
Section 1: Project Overview
What it is: A plain-English description of what your project does, who it’s for, and what problem it solves.
Why it matters: Claude uses this to make better judgment calls when your instruction is ambiguous. If Claude knows your project is a high-security financial app, it will be more conservative about certain suggestions than if it knows it’s a personal hobby project. Context shapes output.
Real example:
## Project Overview
This is a B2B SaaS platform for independent bookkeepers and accountants.
It allows users to connect their clients' bank accounts, categorize transactions,
and generate monthly financial reports.
The primary users are small accounting firms with 1-10 staff.
Accuracy and data integrity are the top priorities — speed of development
is secondary.
What to include:
- What the app does in one or two sentences
- Who uses it
- Any priority that should shape technical decisions (e.g. performance, security, simplicity)
- Stage of the project (early prototype, production app with paying users, internal tool)
Section 2: Tech Stack
What it is: The languages, frameworks, libraries, and infrastructure your project uses.
Why it matters: This is the single most impactful section. When Claude knows you’re using Next.js 14 with the App Router, it won’t suggest Pages Router patterns. When it knows you’re using Prisma, it won’t write raw SQL queries unless you ask.
Real example:
## Tech Stack
- Language: TypeScript 5.x (strict mode enabled, no `any` allowed)
- Frontend framework: Next.js 14 (App Router only — no Pages Router)
- Styling: Tailwind CSS v3 with a custom design system in `/src/design-system`
- State management: Zustand (no Redux, no Context API for global state)
- Database: PostgreSQL 15, accessed via Prisma ORM
- Authentication: Clerk
- Email: Resend (via react-email for templates)
- Hosting: Vercel (frontend) + Railway (database)
- Testing: Vitest + React Testing Library
What to include:
- Primary language and version
- Framework and version — including which version of the framework if that matters (e.g. Next.js App Router vs Pages Router is a significant difference)
- Key libraries for state, styling, auth, data fetching, testing
- What you’re not using, if Claude might suggest it (e.g. “no Redux”)
- Where things are hosted, if relevant to environment-specific code
Section 3: Coding Standards
What it is: The style rules, formatting preferences, naming conventions, and patterns your codebase follows.
Why it matters: This is what makes Claude’s output match your codebase. Without it, you’ll constantly be reformatting Claude’s suggestions to match your style. With it, Claude’s output slots in cleanly.
Real example:
## Coding Standards
### Formatting
- 2-space indentation
- Single quotes for strings (double quotes only inside JSX attribute values)
- No semicolons
- Max line length: 100 characters
- Trailing commas in multi-line arrays and objects
### Naming Conventions
- Components: PascalCase (`UserProfileCard`, not `userProfileCard`)
- Functions and variables: camelCase (`getUserById`, not `get_user_by_id`)
- Constants: SCREAMING_SNAKE_CASE (`MAX_RETRY_COUNT`)
- Boolean variables: prefix with `is`, `has`, or `should` (`isLoading`, `hasError`, `shouldRefetch`)
- Database tables: snake_case plural (`user_accounts`, `invoice_items`)
### TypeScript Rules
- No `any` — ever. Use `unknown` with type narrowing if needed.
- All function parameters and return types must be explicitly typed
- Use `type` for unions/intersections, `interface` for object shapes
- Generic type parameters should be descriptive: `TEntity` not just `T`
### Component Rules
- One component per file
- Named exports only — no default exports
- Props interface defined at top of file, named `[ComponentName]Props`
- No inline styles — Tailwind classes only
What to include:
- Formatting rules (indentation, quotes, semicolons)
- Naming conventions for different code elements
- Language-specific rules (TypeScript strictness, Python type hints, etc.)
- Framework-specific patterns (component structure, hook rules, etc.)
- Anything you frequently have to change in AI-generated code
Section 4: Folder Structure
What it is: A map of your project’s directory layout, explaining what belongs where.
Why it matters: Without this, Claude will guess where to put new files. Sometimes it guesses right. Often it doesn’t. This section eliminates that guessing.
Real example:
## Folder Structure
src/
├── app/ # Next.js App Router pages and layouts
│ ├── (auth)/ # Routes requiring authentication
│ ├── (public)/ # Public-facing routes
│ └── api/ # API route handlers
├── components/
│ ├── ui/ # Generic, reusable UI primitives (Button, Input, Modal)
│ └── features/ # Feature-specific components (InvoiceCard, UserAvatar)
├── lib/
│ ├── db/ # Prisma client and database utilities
│ ├── auth/ # Authentication helpers
│ └── utils/ # General utility functions
├── types/ # Shared TypeScript types and interfaces
├── hooks/ # Custom React hooks
└── config/ # App configuration (constants, feature flags)
Rules:
- New UI components go in `components/ui` if generic, `components/features` if project-specific
- Database queries belong in `lib/db` — never in component files or API routes
- Shared types go in `types/` — don't define the same interface in multiple files
What to include:
- Top-level folder structure with one-line explanations
- Rules for where new files should go
- Any non-obvious conventions (e.g. why you have two components folders)
- Paths to important configuration or entry files
Section 5: Commands
What it is: The terminal commands for common development tasks in your project.
Why it matters: Claude will often need to suggest or run commands — for tests, builds, linting, database migrations. Without this, it guesses. With it, it uses the exact commands your project needs.
Real example:
## Commands
### Development
- Start dev server: `npm run dev` (runs on port 3000)
- Start with Storybook: `npm run dev:storybook` (runs on port 6006)
### Testing
- Run all tests: `npm run test`
- Run tests in watch mode: `npm run test:watch`
- Run specific test file: `npm run test -- src/lib/utils/format.test.ts`
- Generate coverage report: `npm run test:coverage`
### Code Quality
- Lint: `npm run lint`
- Type check: `npm run typecheck`
- Format: `npm run format`
- Run all checks: `npm run validate` (lint + typecheck + test)
### Database
- Run migrations: `npx prisma migrate dev`
- Open database UI: `npx prisma studio`
- Reset database (⚠️ destroys all data): `npx prisma migrate reset`
### Build & Deploy
- Build: `npm run build`
- Preview production build: `npm run start`
⚠️ Warning: Note which commands are destructive (like database resets) with a clear warning in your CLAUDE.md. You don’t want Claude suggesting a database reset when you asked it to fix a migration issue.
Section 6: Architecture Notes
What it is: A description of how your system is structured at a higher level — the key patterns, decisions, and relationships between parts.
Why it matters: Architecture notes prevent Claude from suggesting things that are technically correct but architecturally wrong. “Why don’t you just call the API directly from the component?” is a valid technical suggestion that might violate your deliberate separation of concerns.
Real example:
## Architecture Notes
### Data Flow
All data fetching happens in Server Components or API routes — never in Client Components.
Client Components receive data as props or via React Query for client-side mutations only.
### API Layer
We use a custom API client in `lib/api/client.ts` for all external API calls.
Never call fetch() directly in components or route handlers — always use the client.
The client handles authentication headers, error normalization, and retry logic.
### Authentication
Clerk handles all auth. The `auth()` function from `@clerk/nextjs` is the only
way to access the current user — never store user data in cookies or local state.
Middleware in `middleware.ts` protects all routes under `(auth)/`.
### Error Handling
We use a Result type pattern for service functions: `{ data, error }`.
Never throw from service functions — return errors as values.
Only throw in route handlers where Next.js can catch them.
For a full guide on writing this section, see How to Add Architecture Notes to CLAUDE.md.
Section 7: Constraints and Off-Limits Rules
What it is: Things Claude must never do in this project, no exceptions.
Why it matters: This is your safety net. It protects frozen code, sensitive files, and important conventions from accidental changes. It also gives Claude clear lines it won’t cross, even if you accidentally ask it to do something that would cross them.
Real example:
## Constraints
### Files Claude Must Never Modify
- `/src/legacy/` — frozen legacy code, kept for reference only
- `/migrations/` — never edit existing migration files, only add new ones
- `/public/` — static assets managed separately, don't touch
### Things Claude Must Always Do
- Ask before installing any new npm package
- Ask before modifying the database schema
- Write tests alongside any new utility function (in the same PR)
- Run `npm run validate` before suggesting a task is complete
### Things Claude Must Never Do
- Use `any` in TypeScript
- Use `console.log` for debugging (use `logger.debug()` from `lib/logger`)
- Write inline styles or use CSS modules — Tailwind only
- Hardcode strings that should be in environment variables
- Make API calls from client components (use Server Components or API routes)
Section 8: Business Context
What it is: The non-technical context about your product, your users, and your priorities.
Why it matters: This is especially valuable for non-technical founders and solo builders. It helps Claude understand why you’re building something, which shapes the how in ways that technical specs can’t.
Real example:
## Business Context
### What We're Building
An MVP for a marketplace connecting independent tutors with K-12 students.
We're pre-revenue with 3 months of runway. Speed of iteration matters more
than architectural perfection right now.
### Current Focus
Onboarding flow for tutors — getting them to list their first session.
This is the primary thing we're working on right now.
### Technical Priorities
1. Ship fast — we'd rather have working features with some tech debt than
perfect code with missing features
2. Don't break the payment flow — Stripe integration is production-critical
3. Mobile first — 70% of our users are on mobile
### What to Avoid
- Premature optimization — don't add caching or complex abstractions until we need them
- Feature creep — if a suggestion adds scope, flag it but don't build it
Putting It All Together: A Full Real Example
Here’s a complete CLAUDE.md that combines all eight sections for a real-world project:
# CleanBooks — Claude Code Instructions
## Project Overview
CleanBooks is a web app for independent bookkeepers managing 10-50 clients.
Users import bank statements, categorize transactions, and export reports.
Data accuracy is paramount — incorrect categorizations cause real financial problems.
## Tech Stack
- Language: TypeScript (strict mode, no `any`)
- Framework: Next.js 14, App Router
- Styling: Tailwind CSS
- Database: PostgreSQL via Prisma
- Auth: NextAuth.js with Google OAuth
- File handling: AWS S3 for statement uploads
- Testing: Vitest + React Testing Library
## Coding Standards
- 2-space indentation, no semicolons, single quotes
- Named exports only, one component per file
- Boolean variables prefixed with `is`, `has`, `should`
- All async functions must handle errors explicitly
## Folder Structure
- `/src/app` — pages and API routes
- `/src/components/ui` — generic components
- `/src/components/features` — feature components
- `/src/lib/db` — database queries (queries go here, not in components)
- `/src/lib/s3` — file upload/download helpers
## Commands
- Dev: `npm run dev`
- Test: `npm run test`
- Lint + typecheck: `npm run validate`
- Migrate: `npx prisma migrate dev`
## Architecture Notes
All data fetching in Server Components. No client-side data fetching except
for mutations via React Query. Auth via NextAuth — never expose user ID directly.
## Constraints
- Never modify `/src/legacy-importer/` — frozen code
- Always ask before adding npm packages
- Never hardcode credentials — use `.env.local`
## Business Context
We have 12 paying customers. Stability and data integrity come first.
Don't suggest changes that could affect existing data without flagging the risk.
Key Takeaways
- Eight sections** cover the core of what belongs in CLAUDE.md: overview, tech stack, coding standards, folder structure, commands, architecture, constraints, and business context
- Specificity is everything** — vague rules like “write clean code” don’t help; specific rules like “use 2-space indentation and no semicolons” do
- Don’t include everything** — add sections that eliminate repeated explanations, not sections for the sake of completeness
- Real content only** — your CLAUDE.md should reflect your actual project, not a generic template
- Architecture notes and constraints are underused** — they deliver high value and most beginners skip them
Next Steps
- CLAUDE.md Templates for Beginners — Copy and Use These** — grab a pre-built template for your specific project type
- How to Structure Coding Standards in CLAUDE.md** — a deeper guide on writing effective coding rules
- How to Add Architecture Notes to CLAUDE.md** — how to explain your system structure in a way Claude can use
Return to CLAUDE.md — The Complete Beginner’s Guide (2026) for the full picture.