10 Sections Every CLAUDE.md Should Include
After reviewing hundreds of production CLAUDE.md files across open-source projects and enterprise codebases, these are the ten sections that consistently produce the best results.
1. Project Identity
A one-paragraph summary of what the project is, who it serves, and what it does. The AI needs context to make design decisions that align with your product’s purpose.
## Project Identity
WOWHOW (wowhow.cloud) -- Premium developer tools and templates marketplace.
Built for developers who ship. Next.js 16 App Router, React 19, TypeScript strict.
2. Tech Stack
List every major technology with its version. AI models are trained on multiple versions of every framework. If you do not specify that you use Next.js 16, the agent might generate Next.js 14 patterns.
## Tech Stack
- Framework: Next.js 16+ (App Router), React 19, TypeScript strict
- Styling: Tailwind CSS v4, custom design system
- Auth: NextAuth v5 (OTP + Google OAuth)
- Database: PostgreSQL via Prisma
- Deployment: Docker + Traefik on VPS
3. Architecture and File Structure
Show the directory tree and explain what goes where. This prevents the agent from creating files in wrong locations or duplicating existing patterns.
4. Code Standards and Conventions
Explicit rules about naming, typing, exports, and patterns. Be specific: “Use named exports for components” is actionable. “Write clean code” is not.
## Code Standards
- Zero `any` types -- use `unknown` + type narrowing
- `const` by default, `let` only when mutation is required
- Named exports for components (except page.tsx default exports)
- Server Components by default, 'use client' only when needed
- No console.log in committed code
- No inline styles -- use Tailwind classes
5. Forbidden Patterns
What the agent must never do. Negative constraints are surprisingly effective because they prevent the most common AI mistakes before they happen.
## Forbidden
- `any` type
- `var` keyword
- Nested ternaries
- Installing shadcn/ui (we have our own component system)
- Default exports for non-page components
- Magic numbers without named constants
6. Key Files Reference
Point the agent to the most important files in your codebase. This saves context window tokens by telling the agent exactly where to look instead of letting it search blindly.
7. Component and Pattern Library
List your existing UI components so the agent reuses them instead of building new ones. This is one of the highest-ROI sections — without it, AI agents constantly reinvent components that already exist in your codebase.
8. Git and Deployment Rules
Commit message format, branch naming, what never to commit, and how deployment works. Agents that understand your deployment pipeline make fewer mistakes that break production.
9. Testing Expectations
What testing framework you use, what coverage you expect, and how tests should be structured. Without this, agents either skip tests entirely or generate tests in the wrong framework.
10. Decision Engine
Rules for when the agent should ask for clarification versus proceeding independently. This is the section most teams skip, and it is the one that prevents the most wasted time.
## Decision Engine
Before EVERY action, run this:
- Is this a multi-file change (3+ files)? Ask before proceeding.
- Is this a bug with unclear cause? Investigate before fixing.
- Is this > 200 lines of new code? Propose a plan first.
- Am I about to delete or overwrite code? Confirm first.
The Single Source of Truth Pattern
The most effective CLAUDE.md files follow what experienced teams call the single source of truth pattern: your CLAUDE.md is the authoritative reference for how code is written in this project, and everything else — linters, CI checks, code review guidelines — aligns with it.
This works because AI agents read CLAUDE.md on every interaction, but they do not read your ESLint config, your CI pipeline, or your team wiki. If your CLAUDE.md says “use semicolons” but your ESLint config enforces no-semicolons, the agent produces code that fails linting on every commit.
The fix is straightforward: write your CLAUDE.md to match your actual enforced standards, not your aspirational ones. If your linter allows it, your CLAUDE.md should allow it. If your linter forbids it, your CLAUDE.md should forbid it. One source of truth, zero contradictions.
AGENTS.md for Multi-Agent Systems
AGENTS.md serves a different purpose than CLAUDE.md. While CLAUDE.md configures a single agent’s behavior, AGENTS.md defines how multiple agents coordinate — who does what, how work is divided, and how conflicts are resolved.
A typical AGENTS.md for a multi-agent development workflow includes:
## Agent Roles
- Architect: Designs system structure, writes specs, never writes implementation code
- Builder: Implements features from specs, writes production code, runs type checks
- Reviewer: Reviews PRs, checks for security issues, validates against standards
## Routing Rules
- New feature requests go to Architect first, then Builder
- Bug reports go directly to Builder
- Security concerns go to Reviewer
## Coordination
- Never parallelize edits to the same file
- Builder must read existing patterns before writing new code
- Reviewer blocks merge on any `any` type or missing error handling
This pattern is gaining traction in teams using Claude Code with sub-agents, OpenAI Codex with its agent framework, and custom multi-agent setups built on orchestration libraries. The AGENTS.md file becomes the operating agreement between AI agents — a contract that prevents them from stepping on each other’s work.
Common Mistakes That Make Config Files Useless
After auditing dozens of teams’ AI config files, these are the patterns that consistently produce poor results:
Being Too Vague
“Write good code” and “follow best practices” are meaningless to an AI agent. Every instruction must be specific and verifiable. “Use named exports for all non-page components” is a rule the agent can follow. “Use appropriate export patterns” is not.
Contradicting Your Toolchain
If your CLAUDE.md says one thing and your linter enforces another, every AI-generated file fails CI. Align your config file with your actual enforced standards.
Writing a Novel
A 5,000-word CLAUDE.md consumes over 6,000 tokens of context on every interaction. That is context the agent cannot use for understanding your actual code. Keep instructions concise — aim for 800 to 1,500 words. If you need more, use a hierarchical structure with @file references that the agent reads only when relevant.
Never Updating It
Your codebase evolves. Your CLAUDE.md should evolve with it. When you add a new library, change a convention, or deprecate a pattern, update the config file. Stale instructions produce stale code.
Duplicating Documentation
Do not paste your entire API documentation into CLAUDE.md. Point the agent to where documentation lives and let it read files as needed. Your config file should contain rules and conventions, not reference material.
Template Gallery: CLAUDE.md for Different Project Types
Different projects need different config files. Here are starting structures for common project types:
Next.js Application
## Project Identity
[App name] -- [one-line description]
## Tech Stack
Next.js 16, React 19, TypeScript, Tailwind v4, [database], [auth]
## Architecture
App Router, Server Components default, 'use client' only when needed
metadata exports in page.tsx only, UI in separate Client components
## Code Standards
[Your specific conventions]
## Forbidden
[Your specific prohibitions]
Python API Service
## Project Identity
[Service name] -- [one-line description]
## Tech Stack
Python 3.12, FastAPI, SQLAlchemy 2.0, Pydantic v2, PostgreSQL
## Architecture
Domain-driven design, repository pattern, dependency injection
## Code Standards
Type hints on all functions, docstrings on public APIs
Async by default, sync only when interfacing with sync libraries
Monorepo
## Project Identity
[Project name] -- [one-line description]
## Structure
packages/api -- Express API server
packages/web -- React frontend
packages/shared -- Shared types and utilities
## Rules
Shared types go in packages/shared, never duplicated
Each package has its own tsconfig extending root
Getting Started Today
If you do not have a CLAUDE.md, AGENTS.md, or .cursorrules file in your project yet, start with the ten sections outlined above. Write the first version in under an hour. It does not need to be perfect — a basic config file that covers your tech stack, code standards, and forbidden patterns will immediately improve the quality of AI-generated code in your project.
If you already have a config file, audit it against the common mistakes section. Remove vague instructions, align it with your toolchain, and trim anything over 1,500 words.
For teams that want to skip the trial-and-error phase entirely, we have built production-tested CLAUDE.md and AGENTS.md template packs for every major stack — Next.js, Python, Go, Rust, React Native, and monorepo configurations. Each template has been refined across hundreds of real coding sessions until the AI agent output consistently matches senior developer quality.
Ship better code with AI, starting today. Our CLAUDE.md and AGENTS.md template packs at wowhow.cloud include battle-tested config files for every major framework, plus the AGENTS.md multi-agent coordination templates that enterprise teams use to run parallel AI coding workflows without merge conflicts.
Blog reader exclusive: Use code BLOGREADER20 for 20% off your entire cart. No minimum, no catch.
Browse Template Packs
Comments · 0
No comments yet. Be the first to share your thoughts.