The file Claude Code reads first every session. Structure, anti-patterns, and the exact template I use to ship 170+ pages.

You will know how to write a CLAUDE.md that makes Claude Code 10x more effective — with the exact structure, anti-patterns, and template I use daily.
TL;DR: CLAUDE.md is the file Claude Code reads first. It is active operating instructions, not documentation. Keep it under 1,500 words. Front-load critical rules in the first 500 words. Update it every time you catch Claude making a project-specific mistake. This guide covers structure, anti-patterns, and a copy-paste template.
Most developers treat CLAUDE.md like documentation. That is the first mistake.
Documentation describes what something is. CLAUDE.md instructs what Claude should do. It is an operating instruction set, not a README.
I ship 170+ pages on frankx.ai across a two-repo architecture. Without CLAUDE.md, every session starts cold. The model does not know which repo deploys to production, that "AI Architect" is my title, or that I never delete pages with traffic.
With CLAUDE.md, those rules are load-bearing from the first token.
Claude Code reads from three locations, in order:
Global — ~/.claude/CLAUDE.md
Rules that apply across every project. Identity, git config, session logging.
Project root — /your-project/CLAUDE.md
Architecture decisions, deployment workflows, project-specific anti-patterns.
Local override — /your-project/.claude/CLAUDE.md
Memory context, recent session logs, overflow that would bloat the main file.
Most projects need two: global + project root.
First thing in the file. Maps actions to commands:
| Action | Command |
|---|---|
| Deploy to production | /frankx-ai-deploy |
| Create blog post | /frankx-ai-blog |
~50 tokens. Saves Claude from guessing which of your 40+ commands applies.
Two-repo architecture:
- frankxai/FrankX: private development
- frankxai/frankx.ai-vercel-website: PRODUCTION
Content must be pushed to BOTH repos to go live.
Highest-leverage section. Each entry represents a real mistake:
| Bad Instinct | Correct Behavior |
|---|---|
| Rename URLs for consistency | Never rename working URLs — SEO loss |
| Delete orphan pages | Unlink from nav, keep the page |
| Consolidate routes by deletion | Fix navigation, not routes |
Update this every time you catch Claude about to do something wrong.
Exact steps. No prose:
cp content/blog/article.mdx .worktrees/vercel-ui-ux/content/blog/
cd .worktrees/vercel-ui-ux
git add -A && git commit -m "feat: Add article"
git push origin main
Too long. A 5,000-word CLAUDE.md dilutes signal. Critical rules buried past 500 words receive less attention.
Too vague. "Write good code" tells Claude nothing. "Never use any without a comment explaining why" is actionable.
Contradictory rules. "Keep URLs short" + "never rename working URLs" = Claude picks one randomly.
Rules Claude cannot enforce. CLAUDE.md is read once. For programmatic enforcement, use pre-commit hooks.
The Decision-Making Principles section has prevented three production mistakes.
Starting from zero:
/init
Claude scans your project, identifies the stack, and writes a draft CLAUDE.md. It is a starting point — it will not know your voice or deployment nuances. But it produces a usable skeleton in 2 minutes.
CLAUDE.md is layer one. ACOS adds three things it cannot do alone:
Skills — Domain-specific rules that activate contextually (SEO loads for blog posts, not API routes).
Commands — Slash commands bundling multi-step workflows (/frankx-ai-deploy).
Agent Profiles — Named configurations weighting Claude toward specific capabilities.
CLAUDE.md is the project constitution. ACOS is the role system. They work together. Full setup: ACOS + Claude Code guide.
# [Project Name] Claude Code Configuration
## Quick Reference
| Action | Command |
|--------|---------|
| [Action] | [command] |
## Deployment
[Exact steps with code blocks]
## Tech Stack
- Framework: [e.g., Next.js 15]
- Styling: [e.g., Tailwind CSS + shadcn/ui]
- Deployment: [e.g., Vercel]
## Brand Rules
- [Non-negotiable voice constraint]
- [Terminology rule]
## Anti-Patterns
| Never | Instead |
|-------|---------|
| [Bad] | [Correct] |
## Decision Protocol
1. What specific problem?
2. Simplest fix?
3. What could go wrong?
4. Reversible?
Keep under 1,500 words. Update anti-patterns on every near-miss. Treat it as living instructions.
Under 1,500 words for the project file. Extract overflow into skills or reference documents.
Yes — global (~/.claude/CLAUDE.md), project root, and .claude/CLAUDE.md. They merge in that order.
Cursor uses .cursorrules — different syntax, same principles. The concepts transfer.
After every session where you corrected Claude on something project-specific. The anti-patterns table should grow as you discover mistakes.
CLAUDE.md loads every session. Skills activate for specific tasks. Brand rules that apply to everything go in CLAUDE.md. SEO patterns for blog posts go in a skill.
Step-by-step guide to setting up ACOS, creating your first agent, and shipping real products with AI.
Start buildingDownload AI architecture templates, multi-agent blueprints, and prompt engineering patterns.
Browse templatesConnect with creators and architects shipping AI products. Weekly office hours, shared resources, direct access.
Join the circleRead on FrankX.AI — AI Architecture, Music & Creator Intelligence
Weekly field notes on AI systems, production patterns, and builder strategy.

Most skill libraries are noise. These 10 skills changed how I ship code, content, and products — with install commands and real examples.
Read article
Step-by-step guide to building a production-grade AI coding environment with ACOS, Claude Code, MCP servers, and custom agent workflows. From zero to shipping.
Read article
Head-to-head comparison of every major AI coding agent — architecture, pricing, strengths, and which one to choose for your workflow. Updated March 2026.
Read article