Skip to main content

CLAUDE.md Best Practices

Keep CLAUDE.md under 150 lines for reliable adherence. HumanLayer uses 60 lines as their guideline, though this isn’t 100% guaranteed.

Multiple CLAUDE.md for Monorepos

For large monorepo projects, use multiple CLAUDE.md files with ancestor + descendant loading.
See Memory Best Practices for detailed guidance on CLAUDE.md loading behavior in monorepos.

Commands vs Agents

Use commands for your workflows instead of agents. Commands provide better entry points for workflows.
Create feature-specific subagents with skills (progressive disclosure) instead of general-purpose agents like “qa” or “backend engineer.”

Context Management

Manual Compacting

Avoid the “agent dumb zone” — perform manual /compact at around 50% context usage for best results.

Memory and Rules Limitations

/memory, /rules, and constitution.md do not guarantee anything. These are guidance mechanisms, not strict enforcement.

Planning and Execution

Always Start with Plan Mode

Always start complex tasks with plan mode for better task breakdown and execution.

Task Size Guidelines

  • Vanilla Claude Code is better than complex workflows for smaller tasks
  • Break subtasks small enough to complete in under 50% context usage
  • Use human-gated task list workflow for multi-step tasks

Advanced Workflows

Parallel Development

Use agent teams and git worktrees for parallel development across isolated branches.

Long-Running Tasks

Use the Ralph Wiggum plugin for long-running autonomous tasks that iterate until completion.

Daily and Hourly Habits

Daily Updates

Update Claude Code daily and start your day by reading the changelog.

Commit Often

Commit often — as soon as a task is completed, commit. This creates better checkpoints for rewinding and helps with context management.

Build docs developers (and LLMs) love