Skip to content
All Posts

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.

Website

Claude 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.

  1. Explore: ask Claude to read the relevant files without editing.
  2. Plan: request a concrete file-by-file plan and acceptance checks.
  3. Implement: leave plan mode and code against that plan.
  4. 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.

  1. Confirm the change matches the plan and acceptance checks.
  2. Look for scope creep outside the requested files.
  3. Run the full relevant test suite one more time.
  4. Commit only after the evidence looks clean.

A practical Claude Code workflow

  1. Open the project and confirm CLAUDE.md still matches reality.
  2. State the goal, files, and verification command in one prompt.
  3. Use /plan for non-trivial work.
  4. Implement in small verified steps.
  5. Run /compact or /clear when context gets noisy.
  6. 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.

Interested? Get in touch

Newsletter

Regional startups, events, and global mentorship

Join 1,500+ subscribers for exclusive access to startups in the region, regional events, and mentorship sessions with experts from around the world — curated weekly.

  • Exclusive lens on startups in the region — signals, stories, and context worth knowing
  • Events in the region — invites and practical takeaways before and after they happen
  • Mentorship sessions with global experts — frameworks and operator insight

Read by people at

Bosch
Mercedes-Benz
Accenture
Fraunhofer
Lenovo
SAP
Spaitial
Y Combinator
Bosch
Mercedes-Benz
Accenture
Fraunhofer
Lenovo
SAP
Spaitial
Y Combinator

Newsletter

Weekly: access to regional startups and events, mentorship from experts worldwide — curated in Stuttgart.