Dokumentationerreichbar
Anthropic, Best practices for Claude Code
code.claude.com (externe Seite)
Anthropics Leitfaden für die Fälle, in denen die Voreinstellungen von Claude Code nicht reichen. Er ordnet jede Anweisung einer von zwei Arten zu: Prompt, CLAUDE.md und Skill liest das Modell und entscheidet selbst, Hooks, Rechteregeln und verwaltete Einstellungen setzt das Programm jedes Mal durch. Im Mittelpunkt steht eine Prüfung, die Claude selbst fahren kann; ohne sie wird der Mensch zur Testsuite. Die Seite nennt vier Wege, eine Prüfung durchzusetzen, vom Satz im Auftrag über /
geprüft 10.11.2026
Worauf sich diese Seite beruft, wörtlich, abgerufen am 12.10.2026:
Claude stops when the work looks done.
bestätigt 10.11.2026It keeps asking until the answers add up to a spec.
bestätigt 10.11.2026start a fresh session to build from it, so the build begins with a clean context and a written definition of done
bestätigt 10.11.2026per-user versus per-key limits, what happens to requests over the limit, what's out of scope
bestätigt 10.11.2026It's also the file you'll point the reviewer at later
bestätigt 10.11.2026Claude starts every task by reading your code
bestätigt 10.11.2026They’ll find your file layout, your conventions, your test framework, and how existing components are built, usually faster than you could explain them.
bestätigt 10.11.2026What it can’t find is the information that was never in the repo
bestätigt 10.11.2026A decision your team made in a meeting
bestätigt 10.11.2026A deploy process that lives in one person’s head
bestätigt 10.11.2026The environment variable your integration tests need
bestätigt 10.11.2026There’s also information that is in the repo but takes a few minutes of digging to find, and Claude has to redo that digging at the start of every session.
bestätigt 10.11.2026the file works best when it only holds what Claude couldn’t work out from the code itself
bestätigt 10.11.2026With a 1M-token window on most current models and compaction near the top of it, you’ll rarely run out of context.
bestätigt 10.11.2026Every request sends the whole conversation
bestätigt 10.11.2026discounted while the cache is warm and full price once it expires
bestätigt 10.11.2026Keeping long output, like a full test run or a wide search, out of your main conversation, where it would otherwise ride along for the rest of the session
bestätigt 10.11.2026every subagent sends its own requests and they count against the same usage as your main conversation
bestätigt 10.11.2026answers a quick question without adding anything to the history
bestätigt 10.11.2026ask Claude for evidence: the command it ran and its output, or the screenshot
bestätigt 10.11.2026If it has nothing to run that tells it whether the work actually is done
bestätigt 10.11.2026in most cases, your first plain prompt in a fresh session already does the right thing, without any setup on your part
bestätigt 10.11.2026That usually happens when your project has knowledge, rules, or constraints that Claude can’t see from the code alone
bestätigt 10.11.2026If that system has a CLI, that’s usually the easiest way in.
bestätigt 10.11.2026With gh installed and signed in, for example, Claude will open pull requests and read review comments without any explanation from you.
bestätigt 10.11.2026Ask Claude to interview you instead
bestätigt 10.11.2026Claude built something different from what you had in mind
bestätigt 10.11.2026Give Claude something it can run that comes back pass or fail.
bestätigt 10.11.2026If you'd rather have the review check the work against your plan than hunt for bugs in general, write the review prompt yourself
bestätigt 10.11.2026In practice that makes you the test suite, and every mistake sits there until you happen to notice it.
bestätigt 10.11.2026Interview me until you could write the spec, then write it to SPEC.md.
bestätigt 10.11.2026It's missing information it can't get from reading the repo.
bestätigt 10.11.2026That makes it low-risk to try the bolder approach first and rewind if it doesn't work out.
bestätigt 10.11.2026The check can be almost anything, as long as Claude can read the result
bestätigt 10.11.2026When you don't know exactly what you want yet, you don't have to work it all out before you prompt.
bestätigt 10.11.2026in most cases, your first plain prompt in a fresh session already does the right thing
bestätigt 10.11.2026/
bestätigt 10.11.2026code-review reviews the diff in a fresh subagent that never saw your conversation A fresh reviewer does help, because it hasn’t seen your reasoning
bestätigt 10.11.2026A reviewer that’s asked to find problems will always find something.
bestätigt 10.11.2026A script that diffs output against a fixture
bestätigt 10.11.2026A second session is also the easiest independent reviewer you can get.
bestätigt 10.11.2026Before a run goes unattended, make sure it knows what done looks like, can check its own work, and can only touch what it should.
bestätigt 10.11.2026Claude said it was done and it wasn’t quite, usually because it had no way to check its own work.
bestätigt 10.11.2026Give a custom subagent in .claude/
bestätigt 10.11.2026agents/ only tools: Read, Grep, Glob. If you fix every finding, you end up with extra abstraction layers and tests for cases that can’t happen.
bestätigt 10.11.2026If you’d rather have the review check the work against your plan than hunt for bugs in general, write the review prompt yourself
bestätigt 10.11.2026It isn’t swayed by the reasoning that produced the code.
bestätigt 10.11.2026Same idea as /
bestätigt 10.11.2026code-review, with you carrying the messages. it can keep going on its own and you don’t have to watch
bestätigt 10.11.2026reading the output is faster than rerunning the check yourself. For a session you weren’t watching, it’s also the only evidence you have.
bestätigt 10.11.2026report gaps that affect correctness and skip style
bestätigt 10.11.2026the gaps come back into your session, where Claude can fix them
bestätigt 10.11.2026If you give it something that comes back pass or fail, Claude can close that loop itself.
bestätigt 10.11.2026write a failing test that reproduces it, then fix it
bestätigt 10.11.2026run the auth tests after, and keep going until they pass
bestätigt 10.11.2026Claude decides for itself when it’s satisfied.
bestätigt 10.11.2026When you don’t know exactly what you want yet
bestätigt 10.11.2026Claude comes back with multiple-choice questions about the parts you haven’t pinned down
bestätigt 10.11.2026Once Claude says it’s done, you can also run /
bestätigt 10.11.2026verify in the session That catches the kind of problem that tests and typechecks miss.
bestätigt 10.11.2026A browser screenshot next to the mockup
bestätigt 10.11.2026Don’t drop the skip style part of that prompt.
bestätigt 10.11.2026How strict you make the check is up to you.
bestätigt 10.11.2026The options go from Claude deciding for itself all the way to Claude Code enforcing it
bestätigt 10.11.2026It matters for long background runs, where Claude sometimes ends a turn with a progress summary while items are still open, and the goal sends it back.
bestätigt 10.11.2026This one is enforced by Claude Code (the harness), so the turn doesn’t end until the typecheck passes or the block limit is reached.
bestätigt 10.11.2026for runs nobody’s watching, /
bestätigt 10.11.2026goal or a Stop hook enforces it runs once and exits, which is how Claude Code ends up in CI jobs, git hooks, and shell loops.
bestätigt 10.11.2026Try it on three files first, see what goes wrong, fix the prompt, then run the rest.
bestätigt 10.11.2026--allowed
bestätigt 10.11.2026Tools pre-approves its tools, and --permission-mode dont Ask refuses anything else that would have prompted. check every requirement is implemented and the listed edge cases have tests, report gaps that affect correctness and skip style
bestätigt 10.11.2026A reviewer that’s asked to find problems will always find
bestätigt 10.11.2026Command output: pipe it in from your shell with cat error.log | claude -p
bestätigt 10.11.2026Manual mode: you approve every edit and every command that isn’t read-only yourself.
bestätigt 10.11.2026The model then decides what to do with this information.
bestätigt 10.11.2026Claude Code applies this every time, no matter what the model decided to do.
bestätigt 10.11.2026If you keep adding emphasis to a CLAUDE.md line and Claude still misses it, that’s a sign the line belongs in a hook.
bestätigt 10.11.2026if you have hooks for things that are only preferences, delete them and let Claude decide.
bestätigt 10.11.2026it sees the name and description in every session, but only reads the full file when the task calls for it
bestätigt 10.11.2026How to confirm work in this repo: the exact test, typecheck, and lint commands, and how to run a single test file
bestätigt 10.11.2026whether Claude follows that line on a given turn is still Claude’s call.
bestätigt 10.11.2026without having watched it being written
bestätigt 10.11.2026ask Claude for evidence: the command it ran and its output, or the screenshot.
bestätigt 10.11.2026For a session you weren’t watching, it’s also the only evidence you have.
bestätigt 10.11.2026Broad codebase searches go to the built-in Explore agent.
bestätigt 10.11.2026Running out of context is rarely the problem anymore. Subagents are still great for parallel work, keeping noisy output out of your way, and independent review, but each of those costs extra tokens.
bestätigt 10.11.2026Giving a task fewer tools than the main session has, like a reviewer that can read but not edit
bestätigt 10.11.2026What they cost you is mostly tokens, since every subagent sends its own requests and they count against the same usage as your main conversation.
bestätigt 10.11.2026so it can end up slower than doing the task where you are
bestätigt 10.11.2026You get parallelism or a fresh pair of eyes out of it, but not a smarter answer.
bestätigt 10.11.2026if its work is simple, like collecting the files that import a module or checking links in the docs
bestätigt 10.11.2026to see what share of your usage each subagent type takes
bestätigt 10.11.2026and you paste the findings back into the first
bestätigt 10.11.2026Exit code 2 is what blocks the stop.
bestätigt 10.11.2026A prompt or agent hook asks another model to decide, so it isn’t deterministic either.
bestätigt 10.11.2026For real enforcement, use a command or http hook
bestätigt 10.11.2026To see it work, ask Claude for a change that breaks a type
bestätigt 10.11.2026Side tasks get forked while fork mode is on (the default).
bestätigt 10.11.2026that limit is enforced by Claude Code rather than requested in a prompt
bestätigt 10.11.2026Checkpoints cover the files Claude edited with its own file tools in your main conversation, so a file that only a Bash command touched isn’t restored.
bestätigt 10.11.2026--bare skips hooks, skills, plugins, MCP servers, and CLAUDE.md files, the repo’s as well as the machine’s, so the run does the same thing wherever it runs.
bestätigt 10.11.2026It also never touches your claude.ai login: auth comes from ANTHROPIC_API_KEY, an apiKeyHelper in the file you pass with --settings, or your cloud provider’s credentials.
bestätigt 10.11.2026--append-system-prompt, --mcp-config, and --settings explicitly pass in what the run does need.
bestätigt 10.11.2026
ADR und Spezifikation: wie viel Papier ein Agent brauchtErst der rote Test02 Die erste Sitzung07 Prüfen statt glauben08 Vom Prototyp zum Produkt09 Bestehenden Code verstehen10 Texte und Dateien in Ordnern12 Hooks und Skills12 Rechner und Netz pflegen13 Subagenten und Schleifen23 Plan vor Code24 Test und Spezifikation zuerst25 Prüfen und Review26 Git und Forges27 Übergabe zwischen Sitzungen