AI Engineering · 6 MIN
Claude Code best practices: CLAUDE.md, skills, hooks and plan mode
The Claude Code practices that matter most for teams: a lean CLAUDE.md, explore-plan-code, context hygiene, checks to run, skills, hooks and subagents.
The Claude Code best practices that matter most are simple: keep a short project CLAUDE.md of facts every session needs, explore and plan before coding on anything non-trivial, clear the context between unrelated tasks, give the agent a check it can run, turn repeated workflows into skills, and enforce hard rules with hooks rather than polite instructions. Most of these come straight from Anthropic's documentation. The rest are what we have learned running our own company's work through coding agents.
- The context window is the scarce resource. Anthropic's docs say performance degrades as it fills, so clear it between unrelated tasks.
- Use plan mode to explore and plan before coding, and skip the plan when the change fits in one sentence.
- Give the agent a way to verify its work: tests, a build, or a screenshot to compare.
- A skill is a
SKILL.mdfile with instructions for a repeated workflow. It turns tribal knowledge into a command. - Hooks run automatically at points in the agent's lifecycle, such as before a tool call, so they can block actions instructions cannot.
- Nactore is a technology and growth company that sets up these practices for engineering teams and uses them daily.
Why do practices matter more than prompts?
Two developers with the same tool can get very different results. The difference is rarely a clever prompt. It is whether the agent has the right context, a way to check itself, and limits that stop it from doing damage. Those are set up once, in files your team commits, which is why they matter more than any one person's prompting style.
Eight practices that matter most
1. Keep CLAUDE.md short and factual
CLAUDE.md loads at the start of every session, so every line costs context on every task. The memory docs suggest adding to it when the agent makes the same mistake a second time, when a code review catches something it should have known, or when a new teammate would need the same context.
| Put in CLAUDE.md | Leave out |
|---|---|
| Build, test and lint commands | General coding advice the model already knows |
| Project layout and naming rules | Long explanations of history |
| "Never do X" rules with the reason | Personal preferences (use CLAUDE.local.md) |
| Where the tricky parts live | Anything that changes weekly |
2. Explore, plan, then code
Anthropic's best practices recommend four phases: explore, plan, implement, commit. In plan mode the agent reads the code and proposes an approach without editing anything. You correct the plan, then let it implement.
The same page gives a useful rule for when to skip it: if you could describe the diff in one sentence, skip the plan. Planning is overhead that pays off on changes touching several files or an unfamiliar part of the codebase.
3. Manage the context window
The docs are direct about it: the context window holds the whole conversation, every file read and every command output, it fills fast, and performance degrades as it fills. In practice:
- Run
/clearbetween unrelated tasks. A fresh start beats a long session carrying stale details. - Restart after repeated corrections. If you have corrected the same thing twice, clear and start again with a better prompt that includes what you learned.
- Use subagents for investigation. Subagents run in their own context and report back a summary, which keeps the main session clean for the actual change.
4. Give it a check it can run
"Give Claude a check it can run: tests, a build, a screenshot to compare" is one of the most useful lines in Anthropic's guide. An agent that can run the tests sees its own mistakes and fixes them before you review. An agent without a check hands you work that looks right.
For teams this means the test and build commands belong in CLAUDE.md, and the permission rules should allow them without asking.
5. Turn repeated workflows into skills
A skill is a folder with a SKILL.md file: a short frontmatter block that says when to use it, then the instructions. The skills docs show that a skill at .claude/skills/deploy/SKILL.md creates a /deploy command for the project.
Good candidates for skills:
- Releasing a version (changelog, tag, deploy, smoke test).
- Adding a new API endpoint the way your codebase expects.
- Writing a migration with your naming and rollback rules.
- Reviewing a pull request against your team's checklist.
Commit project skills to the repository so every developer, and every agent session, follows the same steps.
6. Enforce hard rules with hooks
Instructions are requests. Hooks are enforcement. The hooks docs describe user-defined shell commands, HTTP endpoints and other handlers that run automatically at specific points in the agent's lifecycle. A PreToolUse hook runs before a tool call and can block it.
Typical team hooks:
| Hook | What it does |
|---|---|
| Before a shell command | Block destructive commands or anything aimed at production |
| After a file edit | Run the formatter and linter on the changed file |
| At session start | Load the current branch, open issue or environment notes |
| When the agent stops | Run the test suite and report failures |
Keep hooks fast and predictable. A slow hook on every tool call makes the whole team's experience worse.
7. Write specific prompts
The docs put it simply: the more precise your instructions, the fewer corrections you need. "Fix the login bug" is weak. "Users with a + in their email cannot log in, the check is in auth/validate.ts, add a test for that case first" gets a correct fix in one pass.
8. Use it outside the terminal too
- Non-interactive mode.
claude -p "prompt"runs it in CI, pre-commit hooks or scripts. - GitHub. With the GitHub Actions integration, mentioning
@claudein a pull request or issue comment lets it analyze code, implement changes and push commits.
Start these after the interactive setup works well. Automation repeats whatever your setup gets wrong.
Frequently asked questions
How long should CLAUDE.md be?
As short as it can be while covering commands, layout and hard rules. If a line does not change the agent's behavior, remove it.
What is the difference between a skill and CLAUDE.md?
CLAUDE.md is context for every session. A skill is a workflow loaded when it is relevant or called by name, so detailed steps live there instead of in every session's context.
Are hooks safe to share with the team?
Hooks run commands on each developer's machine, so review them like any other code before committing them.
Do these practices apply to other coding agents?
The ideas do: short shared context, planning, checks, reusable workflows and enforced limits. The file names and features differ by tool.
Make the setup part of the codebase
The teams that get the most from coding agents treat the setup as code: reviewed, versioned and improved every time something goes wrong. Nactore sets up AI-native engineering for teams, from the first CLAUDE.md to skills, hooks and MCP servers. For the rollout side, read Claude Code for teams.
Want this set up for your codebase? Book a free 30-minute call.
Want to apply this to your business?
Book a free 30-minute call. We will tell you what we would do first.