Claude Code best practices for reliable agentic workflows
Michael Aechtler
AI keynote speaker based in Stuttgart; on stage since 2005. He builds with AI agents and tools every day, not slide-only talks. Co-founder of the CREATORS ScaleUp Campus.
WebsiteClaude Code best practices are the workflows that keep an agentic coding session accurate as context fills. The core pattern is simple: give Claude a way to verify work, explore before big edits, write focused prompts, keep CLAUDE.md short, manage context, and review the final diff.
This guide assumes Claude Code is already installed. If not, start with the Claude Code setup guide. For the command list, use the Claude Code cheat sheet. Patterns below follow Anthropic's official best practices, updated July 2026.
Give Claude a way to verify its work
Claude stops when the work looks done. Without a check it can run, you become the verification loop. Give it tests, a build, a linter, a screenshot comparison, or a script that returns pass or fail.
- Bad: "implement email validation."
- Better: "write validateEmail with these cases: user@example.com true, invalid false, user@.com false. Run the tests and fix failures."
Ask Claude to show evidence: command output, test results, or a screenshot. Reviewing evidence is faster than re-running every check yourself.
Explore, plan, then code
For multi-file or unfamiliar work, separate research from implementation. Enter plan mode with /plan, let Claude inspect the codebase, edit the plan if needed, then implement.
- Explore: ask Claude to read the relevant files without editing.
- Plan: request a concrete file-by-file plan and acceptance checks.
- Implement: leave plan mode and code against that plan.
- Commit: review the diff, then commit with a clear message.
Skip the plan for tiny, obvious changes like a typo or a one-line rename. Plan when the approach is unclear or the blast radius is large.
Write focused prompts
Name the files, the scenario, constraints, and what done looks like. Point Claude at existing patterns with @file references instead of describing the codebase from memory.
- Scope the task to one outcome per turn when possible.
- Point to sources: git history, docs URLs, or a reference implementation.
- Describe the symptom and the fix criteria for bugs.
- Paste errors and screenshots instead of paraphrasing them.
Keep CLAUDE.md concise
CLAUDE.md is loaded into context every session. Long policy dumps crowd out the task. Prefer short, actionable rules:
- Exact commands for install, test, lint, and typecheck
- Repo conventions Claude cannot infer from code alone
- Hard constraints and directories to avoid
- Links to deeper docs instead of pasting whole guides
Manage context deliberately
Context is the scarce resource. Performance drops as the window fills. Watch usage with /context, clear finished threads with /clear, and summarize long history with /compact.
- Start a fresh session for a new feature or incident.
- Use /btw for side questions that should not pollute history.
- Avoid dumping huge logs unless Claude needs them.
- Split unrelated work into parallel sessions or worktrees.
Use tests, subagents, and worktrees
Tests close the loop. Subagents and worktrees help when work can run in parallel without fighting over the same files.
- Write or update tests before or with the implementation.
- Use subagents for review, research, or verification with a fresh context.
- Use worktrees or /batch when changes are independent.
- Keep one owner for shared files to avoid merge thrash.
Permissions, hooks, and MCP restraint
Loose permissions feel fast until a bad command lands. Tighten defaults, then automate the checks you already trust.
- Allow safe reads and frequent test commands.
- Ask before destructive shell actions.
- Add a Stop hook for the one check that must pass before a turn ends.
- Add MCP servers only when Claude needs that tool on most tasks.
Review the final diff before you ship
Even strong sessions need a human pass on the change set. Use /diff or /code-review, then read the patch yourself.
- Confirm the change matches the plan and acceptance checks.
- Look for scope creep outside the requested files.
- Run the full relevant test suite one more time.
- Commit only after the evidence looks clean.
A practical Claude Code workflow
- Open the project and confirm CLAUDE.md still matches reality.
- State the goal, files, and verification command in one prompt.
- Use /plan for non-trivial work.
- Implement in small verified steps.
- Run /compact or /clear when context gets noisy.
- Review with /diff or /code-review, then commit.
Need install steps? Read the Claude Code setup guide. Need the printable command poster? Unlock the Claude Code cheat sheet.







