NachschlagenQuellenregister

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 /goal und einen Stop-Hook bis zum Prüfer, der den Code nicht geschrieben hat. Dazu kommen Abschnitte über Kosten, Subagenten und Läufe ohne Zuschauer und eine Tabelle mit Ratschlägen, die heutige Modelle überflüssig gemacht haben.

geprüft 22.11.2026

Worauf sich diese Seite beruft, wörtlich, abgerufen am 12.10.2026:

  • Claude stops when the work looks done.bestätigt 22.11.2026
  • It keeps asking until the answers add up to a spec.bestätigt 22.11.2026
  • start a fresh session to build from it, so the build begins with a clean context and a written definition of donebestätigt 22.11.2026
  • per-user versus per-key limits, what happens to requests over the limit, what's out of scopebestätigt 22.11.2026
  • It's also the file you'll point the reviewer at laterbestätigt 22.11.2026
  • Claude starts every task by reading your codebestätigt 22.11.2026
  • They’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 22.11.2026
  • What it can’t find is the information that was never in the repobestätigt 22.11.2026
  • A decision your team made in a meetingbestätigt 22.11.2026
  • A deploy process that lives in one person’s headbestätigt 22.11.2026
  • The environment variable your integration tests needbestätigt 22.11.2026
  • There’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 22.11.2026
  • the file works best when it only holds what Claude couldn’t work out from the code itselfbestätigt 22.11.2026
  • With a 1M-token window on most current models and compaction near the top of it, you’ll rarely run out of context.bestätigt 22.11.2026
  • Every request sends the whole conversationbestätigt 22.11.2026
  • discounted while the cache is warm and full price once it expiresbestätigt 22.11.2026
  • Keeping 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 sessionbestätigt 22.11.2026
  • every subagent sends its own requests and they count against the same usage as your main conversationbestätigt 22.11.2026
  • answers a quick question without adding anything to the historybestätigt 22.11.2026
  • ask Claude for evidence: the command it ran and its output, or the screenshotbestätigt 22.11.2026
  • If it has nothing to run that tells it whether the work actually is donebestätigt 22.11.2026
  • in most cases, your first plain prompt in a fresh session already does the right thing, without any setup on your partbestätigt 22.11.2026
  • That usually happens when your project has knowledge, rules, or constraints that Claude can’t see from the code alonebestätigt 22.11.2026
  • If that system has a CLI, that’s usually the easiest way in.bestätigt 22.11.2026
  • With gh installed and signed in, for example, Claude will open pull requests and read review comments without any explanation from you.bestätigt 22.11.2026
  • Ask Claude to interview you insteadbestätigt 22.11.2026
  • Claude built something different from what you had in mindbestätigt 22.11.2026
  • Give Claude something it can run that comes back pass or fail.bestätigt 22.11.2026
  • If you'd rather have the review check the work against your plan than hunt for bugs in general, write the review prompt yourselfbestätigt 22.11.2026
  • In practice that makes you the test suite, and every mistake sits there until you happen to notice it.bestätigt 22.11.2026
  • Interview me until you could write the spec, then write it to SPEC.md.bestätigt 22.11.2026
  • It's missing information it can't get from reading the repo.bestätigt 22.11.2026
  • That makes it low-risk to try the bolder approach first and rewind if it doesn't work out.bestätigt 22.11.2026
  • The check can be almost anything, as long as Claude can read the resultbestätigt 22.11.2026
  • When you don't know exactly what you want yet, you don't have to work it all out before you prompt.bestätigt 22.11.2026
  • in most cases, your first plain prompt in a fresh session already does the right thingbestätigt 22.11.2026
  • /code-review reviews the diff in a fresh subagent that never saw your conversationbestätigt 22.11.2026
  • A fresh reviewer does help, because it hasn’t seen your reasoningbestätigt 22.11.2026
  • A reviewer that’s asked to find problems will always find something.bestätigt 22.11.2026
  • A script that diffs output against a fixturebestätigt 22.11.2026
  • A second session is also the easiest independent reviewer you can get.bestätigt 22.11.2026
  • Before 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 22.11.2026
  • Claude said it was done and it wasn’t quite, usually because it had no way to check its own work.bestätigt 22.11.2026
  • Give a custom subagent in .claude/agents/ only tools: Read, Grep, Glob.bestätigt 22.11.2026
  • If you fix every finding, you end up with extra abstraction layers and tests for cases that can’t happen.bestätigt 22.11.2026
  • If you’d rather have the review check the work against your plan than hunt for bugs in general, write the review prompt yourselfbestätigt 22.11.2026
  • It isn’t swayed by the reasoning that produced the code.bestätigt 22.11.2026
  • Same idea as /code-review, with you carrying the messages.bestätigt 22.11.2026
  • it can keep going on its own and you don’t have to watchbestätigt 22.11.2026
  • reading 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 22.11.2026
  • report gaps that affect correctness and skip stylebestätigt 22.11.2026
  • the gaps come back into your session, where Claude can fix thembestätigt 22.11.2026
  • If you give it something that comes back pass or fail, Claude can close that loop itself.bestätigt 22.11.2026
  • write a failing test that reproduces it, then fix itbestätigt 22.11.2026
  • run the auth tests after, and keep going until they passbestätigt 22.11.2026
  • Claude decides for itself when it’s satisfied.bestätigt 22.11.2026
  • When you don’t know exactly what you want yetbestätigt 22.11.2026
  • Claude comes back with multiple-choice questions about the parts you haven’t pinned downbestätigt 22.11.2026
  • Once Claude says it’s done, you can also run /verify in the sessionbestätigt 22.11.2026
  • That catches the kind of problem that tests and typechecks miss.bestätigt 22.11.2026
  • A browser screenshot next to the mockupbestätigt 22.11.2026
  • Don’t drop the skip style part of that prompt.bestätigt 22.11.2026
  • How strict you make the check is up to you.bestätigt 22.11.2026
  • The options go from Claude deciding for itself all the way to Claude Code enforcing itbestätigt 22.11.2026
  • It 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 22.11.2026
  • This 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 22.11.2026
  • for runs nobody’s watching, /goal or a Stop hook enforces itbestätigt 22.11.2026
  • runs once and exits, which is how Claude Code ends up in CI jobs, git hooks, and shell loops.bestätigt 22.11.2026
  • Try it on three files first, see what goes wrong, fix the prompt, then run the rest.bestätigt 22.11.2026
  • --allowedTools pre-approves its tools, and --permission-mode dontAsk refuses anything else that would have prompted.bestätigt 22.11.2026
  • check every requirement is implemented and the listed edge cases have tests, report gaps that affect correctness and skip stylebestätigt 22.11.2026
  • A reviewer that’s asked to find problems will always findbestätigt 22.11.2026
  • Command output: pipe it in from your shell with cat error.log | claude -pbestätigt 22.11.2026
  • Manual mode: you approve every edit and every command that isn’t read-only yourself.bestätigt 22.11.2026
  • The model then decides what to do with this information.bestätigt 22.11.2026
  • Claude Code applies this every time, no matter what the model decided to do.bestätigt 22.11.2026
  • If 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 22.11.2026
  • if you have hooks for things that are only preferences, delete them and let Claude decide.bestätigt 22.11.2026
  • it sees the name and description in every session, but only reads the full file when the task calls for itbestätigt 22.11.2026
  • How to confirm work in this repo: the exact test, typecheck, and lint commands, and how to run a single test filebestätigt 22.11.2026
  • whether Claude follows that line on a given turn is still Claude’s call.bestätigt 22.11.2026
  • without having watched it being writtenbestätigt 22.11.2026
  • ask Claude for evidence: the command it ran and its output, or the screenshot.bestätigt 22.11.2026
  • For a session you weren’t watching, it’s also the only evidence you have.bestätigt 22.11.2026
  • Broad codebase searches go to the built-in Explore agent.bestätigt 22.11.2026
  • Running 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 22.11.2026
  • Giving a task fewer tools than the main session has, like a reviewer that can read but not editbestätigt 22.11.2026
  • What 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 22.11.2026
  • so it can end up slower than doing the task where you arebestätigt 22.11.2026
  • You get parallelism or a fresh pair of eyes out of it, but not a smarter answer.bestätigt 22.11.2026
  • if its work is simple, like collecting the files that import a module or checking links in the docsbestätigt 22.11.2026
  • to see what share of your usage each subagent type takesbestätigt 22.11.2026
  • and you paste the findings back into the firstbestätigt 22.11.2026
  • Exit code 2 is what blocks the stop.bestätigt 22.11.2026
  • A prompt or agent hook asks another model to decide, so it isn’t deterministic either.bestätigt 22.11.2026
  • For real enforcement, use a command, http, or mcp_tool hookbestätigt 22.11.2026
  • To see it work, ask Claude for a change that breaks a typebestätigt 22.11.2026
  • Side tasks get forked while fork mode is on (the default).bestätigt 22.11.2026
  • that limit is enforced by Claude Code rather than requested in a promptbestätigt 22.11.2026
  • Checkpoints 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 22.11.2026
  • --bare skips your hooks, skills, plugins, MCP servers, and CLAUDE.md files from the repo and your home directory.bestätigt 22.11.2026
  • It also doesn’t use 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 22.11.2026
  • --append-system-prompt, --mcp-config, and --settings explicitly pass in what the run does need.bestätigt 22.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

Alle Quellen

↑↓ auswählenEnter öffnenDie Suche läuft im Browser. Nichts wird übertragen.