A CLAUDE.md is a Markdown instruction file for Claude Code. There is no required five-section schema. Put the commands, project boundaries and verification steps that a fresh session needs near the top. Keep examples aligned with the repository rather than copying a framework template unchanged.
Reviewed against current documentation on November 7, 2026. The templates below are original examples; adapt their commands to scripts that actually exist in your project.
A small template you can use first
# Working in this repository
## Start here
- Read package.json before choosing an install or test command.
- Use the Node version and package manager recorded in this repository.
- Read docs/testing.md before running integration checks.
## Project boundaries
- Keep request validation at the existing API boundary.
- Edit the source schema and regenerate generated files.
- Preserve unrelated working-tree changes.
## Verify a change
- Run the relevant existing tests and type checks.
- For UI work, inspect the rendered page on desktop and mobile.
- Check loading, empty, error and expanded states affected by the change.
- Describe actual results and any check that could not run.
This template avoids inventing a test script or deployment command. Replace its references with verified paths. It should tell a capable contributor where to look and what evidence to return, without prescribing technologies the project does not use.
For a tool-neutral policy shared by several clients, start with the AGENTS.md examples. Do not maintain two long, slightly different copies of the same rules.
Format and placement
Use the exact filename CLAUDE.md. Markdown headings, paragraphs, lists and fenced examples are enough. YAML configuration is not required.
The official memory documentation describes user, project and scoped instructions, imports, rules and auto memory. Project instructions can live at the repository root or in .claude/CLAUDE.md; user preferences can live in ~/.claude/CLAUDE.md. Ancestor instructions load at startup, while nested guidance loads when Claude reads files in its scope. Avoid contradictory instructions rather than relying on a simplistic “last file always wins” rule.
Current documentation also supports direct AGENTS.md loading from Claude Code v2.1.277, with conditions: a project CLAUDE.md or CLAUDE.local.md can take precedence. Older versions and some configurations need an explicit import. Check your installed version and the documented Project instructions setting before removing an adapter.
A Next.js project example
Use this after replacing the commands with your repository's actual scripts:
# Web application
## Commands verified for this repository
- npm ci installs the locked dependencies.
- npm run build builds the production application.
- npm run test:unit runs the unit suite once.
- npm run test:integration needs the local fixture database.
## Implementation
- Read the installed framework documentation before changing routing or caching.
- Keep secret keys on the server.
- Authorize each protected read and mutation on the server.
- Reuse the existing form and error components.
## UI verification
- Check one narrow and one wide viewport.
- Test keyboard access and focus after opening and closing dialogs.
- Give each detail and action one clear home in a screen.
Do not add test:unit or test:integration to your instructions unless they exist. A runnable package script is more useful than a plausible one. Framework rules should match the version you have installed, including the hosting adapter.
The deployment checklist supplies checks to consider when a change affects a live app. It is a reference for the relevant task, not a reason to repeat the entire checklist inside every instruction file.
A Python project example
# Inventory API
## Local workflow
- Read pyproject.toml and the lockfile before installing dependencies.
- Use the repository's supported Python version.
- Run uv run pytest for the relevant tests.
- Run uv run ruff check . before handoff.
## Boundaries
- Keep business rules in app/services.
- Use the existing migration process for database changes.
- Do not put credentials or customer records in fixtures.
- Document missing test-service prerequisites honestly.
This is an example for a project using uv, pytest and Ruff, not a universal Python setup. Run each documented command in a clean environment before sharing the file with teammates.
Split stable rules from reusable procedures
Keep durable facts in project instructions. Put a longer repeatable task into a skill when it has a clear trigger, steps and expected evidence. The skill structure guide shows how to organize that material without loading the whole procedure into every task.
For a monorepo, let the root explain shared boundaries and each package explain its own validation. For example, a frontend package can require keyboard checks while an API package names its integration fixture service. Keep the instructions compatible.
Check that the instructions were used
Start a fresh session and ask which instruction files loaded. Inspect the available context view and the actual files. Assign a small change with one observable rule, then inspect the diff and completed checks. The agent saying it followed a rule is not evidence that a command passed.
If a rule was missed, first check discovery and ambiguity. Then consider executable enforcement: a test, linter or access control can catch failures even when written instructions are ignored. A Markdown instruction is guidance, not a security boundary.
Use /memory to inspect the currently documented memory controls. Avoid building a workflow around an old # shortcut without checking the installed release. The memory guide explains the difference between team instructions and notes learned during sessions.
After a correction, retain only the general lesson that will matter again. Delete stale commands and contradictory exceptions in the same review that changes the code.