Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

A good CLAUDE.md is a short, maintained set of project instructions: it tells Claude Code what it cannot reliably infer, using concrete directions it can act on. Put recurring team guidance in the project file, scope specialized rules to the relevant paths, and use settings or hooks—not prose in the file—for controls that must be enforced.

What belongs in a CLAUDE.md file?

Record information that saves repeated explanation or prevents a known mistake. Add a direction when Claude has made the same error more than once, a review has caught an avoidable issue, you have had to repeat a correction, or a new teammate would need the information to work effectively.

Useful project context includes build and test commands, repository layout, architecture that is not obvious from the code, naming and formatting conventions, and recurring workflow requirements. Avoid general wishes such as “write good code” or “format everything properly”: they do not tell Claude what action to take.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Turn vague preferences into checkable instructions

Replace broad wording with a specific convention, action, or reference. For example, “Use 2-space indentation” is more actionable than “format code properly,” and “Run npm test before committing” names a command and a point in the workflow.

When a rule has exceptions, state the boundary or link to the more specific instruction file. Keep details accurate: an obsolete command or architecture note can misdirect work rather than help it.

Where should each instruction go?

Claude Code supports instruction files at different scopes. Choose a location based on who needs the guidance and when it should apply.

Location or mechanism Best fit When it is loaded or used
./CLAUDE.md or ./.claude/CLAUDE.md Shared conventions and context for a project Applicable ancestor project instructions load when Claude Code starts.
~/.claude/CLAUDE.md Your personal preferences across projects Applies as personal instruction context rather than project-specific team policy.
Nested CLAUDE.md files Guidance for a subdirectory or part of a repository Discovered when Claude works with files in those subdirectories.
.claude/rules/ Modular instructions, including rules limited to paths or file types Use when guidance should be organized or scoped instead of placed in the main project file.
Skills Multi-step or task-specific procedures Use when a procedure should be available only when relevant, not in every session.
Organization-managed instruction locations Centrally managed guidance Location depends on the organization’s platform and setup; see Anthropic’s Claude Code documentation.

These mechanisms complement each other. Put broadly useful project context in the project file, personal working preferences in your user file, and specialized instructions where they apply. Do not make every session carry a procedure that matters only for one kind of task.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

How to organize the project file

Anthropic recommends targeting fewer than 200 lines in each CLAUDE.md. Treat that as a practical size target from the documentation, not as a proven threshold at which quality or performance changes. A compact file is easier to review and leaves more context available for the task.

A practical order for a project file is:

  1. Purpose and scope: Say whether the guidance applies across the repository, to a team workflow, or to a particular area.
  2. Project map: Point out architecture, important directories, or ownership boundaries that are not easy to infer.
  3. Common commands: Give the exact build, test, lint, or development commands the team regularly uses.
  4. Conventions: State actionable naming, formatting, API, or review rules.
  5. Boundaries and exceptions: Explain important constraints and direct specialized cases to scoped rules.
  6. Maintenance: Remove guidance when commands, conventions, or workflows change.

This is a useful drafting pattern, not a required Anthropic template. Include only what helps Claude work in the repository.

How imports affect length and context

A CLAUDE.md can import supporting files with syntax such as @path/to/import. Relative paths are resolved from the file containing the import; relative and absolute paths are supported. Imports are expanded into context at launch, and recursive imports can extend up to four hops.

Imports can make a set of instructions easier to organize, but they do not make that guidance free: imported text still consumes context. A project-level import from outside the working directory can also prompt for approval. Use imports for logical organization, not to hide an instruction set that has grown too large.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

When to use rules, skills, settings, or hooks instead

Claude Code’s documentation makes an important distinction: “Claude treats CLAUDE.md files as context, not enforced configuration.” A file can guide Claude, but it is not a security boundary and cannot guarantee that a direction will always be followed.

  • Use .claude/rules/ for modular or path-specific guidance.
  • Use skills for multi-step procedures that should be available only when relevant.
  • Use settings or hooks for controls that must hold regardless of Claude’s choices.

Choose the mechanism according to the requirement: instructions explain how to work, while enforcement belongs in configuration or automation designed to enforce it.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Review the file for conflicts and outdated guidance

Instructions can become inconsistent as a repository changes. Review the main file alongside nested files and rules; remove stale commands, reconcile conflicting directions, and move subsystem-specific guidance to the appropriate scope.

The current Claude Code documentation describes /doctor prompt-audit as a way to identify outdated references and conflicts, and states that it requires Claude Code v2.1.283 or later. Check the installed release and the current documentation before relying on that command, since version requirements can change.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A focused checklist before you finish

  • Does each instruction address a recurring need or a real project-specific detail?
  • Can Claude act on it because it names a convention, command, location, or boundary?
  • Is the guidance in the narrowest scope that still reaches everyone who needs it?
  • Does the always-loaded project file stay focused, with specialized directions moved to rules or skills where appropriate?
  • Are commands and constraints current, and do the main, nested, and rule files agree?
  • Is a supposedly mandatory control actually implemented through settings or hooks rather than relying only on wording?

For the full current details on file locations, loading, imports, rules, and auditing, consult Anthropic’s Claude Code documentation on project memory.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.