Skip to content AI News: Nano Banana 2.1 is out: better edits and text, half the API price per image →
Drawer A · by model · 14 on this page

Claude Code Prompts

Claude Code works inside your repository, so a prompt for it names files, commands and the definition of done. Each block below is one job: plan a change, add tests, review a diff, fix CI, write the project's CLAUDE.md.

Prompts

dashed = you fill it in
PH-0992Coding

Long Run Task Brief

Hand Claude Code a whole task with a clear finish line and one condition to stop and ask.

You fill in the whole job in one sentencefor example, every endpoint…one condition

Claude Code
PH-0999Coding

Setup Doc Safety Check

Before a coding agent follows someone else's setup document, have a model read it and every script it pulls.

You fill in paste the link or the documentWindows 11 / Ubuntu / macOS

Claude Code
PH-0708Coding

Bug Reproduction Test

Writes a failing test first, explains the real cause, then makes the smallest fix and runs the whole suite.

You fill in describe the bug, how to…

Claude Code
PH-0719Coding

CI Failure Fixer

Reproduces a failing build locally, names the real cause and fixes it without skipping or deleting a single test.

You fill in paste the failing log herebranch name

Claude Code
PH-0725Coding

CLAUDE.md Writer

Reads your repository and writes its CLAUDE.md: verified commands, the layout and the conventions the code follows.

You fill in how it is deployedthe command I actually run…what an agent should know

Claude Code
PH-0727Coding

CLI Command Builder

Adds a command to your CLI in the existing pattern, with flags, help text, error handling and tests that run.

You fill in what it doesthe exact command line

Claude Code
PH-0729Coding

Codebase Tour Guide

Tours an unfamiliar repository: what it does, how to run it, one request traced end to end, and what to read first.

You fill in what you have been asked to do

Claude Code
PH-0749Data & Analytics

Database Migration Writer

Writes a reversible migration in your repo style, split into safe steps for a large table, with the tests run.

You fill in describe the schema changerow count

Claude Code
PH-0756Coding

Dependency Migration Plan

Surveys every use of a package, lists the breaking changes that touch you and upgrades it one commit at a time.

You fill in packagecurrent versiontarget version

Claude Code
PH-0861Coding

Performance Profiler

Measures before it optimises: a baseline, a profile, one fix, and the before and after numbers side by side.

You fill in what is slowtarget

Claude Code
PH-0882Coding

Pull Request Reviewer

Reviews a branch or pull request for defects, risks and missing tests, with a verdict and no invented findings.

You fill in branch name, pull request…

Claude Code
PH-0894Coding

Repo Feature Planner

Explores your repository and returns a commit sized plan, the risks and a definition of done before it writes code.

You fill in describe the feature you want…

Claude Code
PH-0908Coding

Safe Refactor Pass

Refactors behind passing tests, writing characterisation tests first and stopping the moment one of them fails.

You fill in file or modulethe reason

Claude Code
PH-0916Coding

Security Review Pass

Traces untrusted input through a diff and reports real security findings with the attack path, impact and fix.

You fill in branch, pull request number…

Claude Code

What a Claude Code request needs

Claude Code reads your repository, edits files and runs commands, and it keeps going until the work looks finished to it. That's the catch: without a check it can run, «looks finished» is the only signal it has, and you become the person who finds every mistake. A request that works carries five things.

  1. The goal, as behavior. «Exports show the right date for users west of UTC» beats «fix the export». Describe the symptom and what fixed looks like.
  2. Where to look. Name the folder or file, or type @ and pick it. If the codebase already has a pattern for this change, point at one file that follows it.
  3. The constraints. What it mustn't touch: the public interface, the column order, the lock file, other packages. No new dependencies unless you say so.
  4. How to verify. The exact test or build command, and what passing looks like. This line lets Claude check its own work and fix what fails.
  5. Where to stop. What done means, and what to show you at the end: the diff, the commands it ran and their output. Evidence is faster to review than a claim that everything works.

Put together, a request you can type from memory:

[What is wrong, or what should exist], in [folder or file].
Follow the pattern in [an existing file that does this well].
Don't change [what must stay the same]. No new dependencies.
Verify with [test or build command] and fix anything that fails.
Done means [the condition]. Show me the diff and the test output.

Every prompt on this page is that pattern worked out for one job. The Bug Reproduction Test adds a failing test before any fix; the Safe Refactor Pass runs the tests after every small step and stops at the first red one.

Which prompt for which job

You want toUseWhat you get back
Understand a repo you've never seenCodebase Tour GuideOne request traced end to end, and the five files to read first
Plan a feature before any codeRepo Feature PlannerCommit-sized steps, each with its test, and a definition of done
Hand over a whole taskLong Run Task BriefA TASKS.md checklist kept current, and one stop condition
Fix a bug properlyBug Reproduction TestA failing test, the cause, the smallest fix
Clean up code without changing itSafe Refactor PassSmall steps with a test run after each
Get a red build greenCI Failure FixerThe failure classified and reproduced, then fixed
Review a branch or PRPull Request ReviewerDefects, risks and cleanups by severity, and a verdict
Check a change for security holesSecurity Review PassAttack paths with file and line, ordered by what to fix first
Upgrade a major dependencyDependency Migration PlanBreaking changes that touch your code, then one commit at a time
Change a database schemaDatabase Migration WriterUp and down steps, split safely for large tables
Make something fasterPerformance ProfilerA baseline, a profile, one fix, before and after numbers
Add a command to your CLICLI Command BuilderA command modeled on two existing ones, with tests
Give the repo standing instructionsCLAUDE.md WriterA CLAUDE.md built from verified commands and real conventions
Vet a setup guide before an agent runs itSetup Doc Safety CheckEvery command and download, risks quoted, and a verdict

One request, before and after

We wrote this pair ourselves to show the difference. The first is what gets typed at the end of a long day:

the export is broken, fix it

Claude will fix something, but you can't tell whether it's what you meant. Here's the same request with the five parts in it:

CSV exports from the reports page show dates one day early for users
west of UTC. The export code is in src/reports/export/. Write a failing
test that reproduces it for a user in America/Los_Angeles, run it and
show me the failure. Then fix the cause, not the formatting of the output.
Don't change the column order or add a dependency.
Run npm test -- reports and show the output.
Done means the new test and the existing reports tests pass.

Each line removes a guess. The time zone says which bug. The folder keeps it from wandering the repo. The failing test proves the bug exists before anything changes, and the test command gives it a pass or fail it can read. The column order is what a downstream spreadsheet depends on and a tidy fix might «improve».

Plan first, then small steps

For a change that spans several files, or code you don't know well, separate exploring from editing. Plan mode does this: Claude reads files and writes a plan, but doesn't edit your source. Press Shift+Tab until the status bar shows plan mode, start the request with /plan, or launch with claude --permission-mode plan. Ctrl+G opens the plan in your text editor so you can correct it before approving. Anthropic's own guidance is to skip the plan when you could describe the diff in one sentence.

The Repo Feature Planner is written for that first step. Once you approve, ask for one step at a time with the tests run after each, and commit as you go. Small diffs are ones you'll actually read.

CLAUDE.md: say it once

Claude reads CLAUDE.md at the start of every session, so it's where things you'd otherwise repeat belong: commands it can't guess, style rules that differ from the defaults, branch and PR conventions, a required environment variable. Leave out what it can learn from the code. As of October 2026, Anthropic's docs suggest keeping each file under 200 lines, because longer files cost context and get followed less. Running /init drafts a starter file, and on a repo that already has one it suggests improvements. The CLAUDE.md Writer goes further and records only commands it has run.

One limit worth knowing: Claude treats CLAUDE.md as context, not as enforced rules. If something must never happen, such as writes to a migrations folder, that's a job for a hook.

Follow-up lines that fix a weak result

You rarely need a new prompt. One line in the same session usually repairs it.

The resultReply with
Says it's done, shows nothingRun the tests and paste the output. Show me the commands you ran.
Touched files you didn't ask aboutRevert every change outside [folder]. List what you reverted.
Fixed the symptomExplain why the bug happened in two sentences. If the fix doesn't address that, redo it.
Invented its own patternRedo this following [existing file] exactly. Same structure, same naming.
One huge diffSplit this into commits that each pass the tests on their own.
Added a libraryRemove the new dependency and use what the project already has.
Went in the wrong directionPress Esc twice or run /rewind, then send a narrower request.

Where Claude Code sessions go wrong

The failures are predictable, which makes them cheap to avoid.

  • The session gets crowded. Every file read and command output stays in context, and quality drops as it fills. Run /clear between unrelated tasks.
  • You correct it again and again. After two failed corrections the context is full of wrong attempts. Clear it and write one better request that includes what you learned.
  • «Investigate» has no edges. An unscoped question can send it through hundreds of files. Name the folder, or say «use subagents to investigate X» so the reading happens in a separate context and only the summary comes back.
  • Rewind isn't version control. Checkpoints restore edits made through Claude's file tools, not changes made by shell commands. Commit before anything risky.

Ask for a picture before an edit

For an unfamiliar module or a big pull request, a diagram reads faster than three screens of terminal text. Claude Code can publish an artifact: one interactive web page on claude.ai, built from what the session can see and updated as it continues. Anthropic's own examples include a PR walkthrough with the diff annotated inline. Ask for the explanation before any edit:

Don't change any code yet. Make an artifact that explains how
[module or feature] works: a diagram of the main parts and how one
request moves through them, with the file path on every box.
Then list the three places a change to [what I want] would touch.

As of October 2026, artifacts need a Pro, Max, Team or Enterprise plan and a session signed in with /login; API-key and cloud-provider sessions can't publish them. Without that, ask for the diagram as an HTML file in a folder you name. For reasoning in the terminal as it works, the Explanatory output style (/output-style explanatory) adds short Insight blocks explaining its choices.

Commands and features that change the result

As listed in Anthropic's Claude Code docs, October 2026. Type / in a session to see what your version has; our Claude Code cheat sheet has the rest.

  • /code-review reviews the current diff for bugs in a fresh subagent, so the reviewer isn't grading its own work. Our /code-review page covers the options. /security-review checks your branch's changes against origin's default branch.
  • /goal sets a condition that a separate model checks after every turn; Claude keeps going until it holds. Make it verifiable, like a passing test command.
  • Skills are SKILL.md files in .claude/skills/ that Claude loads when relevant, or you call by name; see Claude skills.
  • Subagents run in their own context with their own tools, which keeps heavy reading out of your main session.
  • Hooks run your scripts at set points, such as after every edit. Unlike CLAUDE.md, they always run.

Claude Code comes with Claude's Pro and Max plans, and usage there is shared between the Claude apps and Claude Code. Our Claude Code review has the plan details, and the parent Claude prompts page covers the chat app.

Claude Code Prompts: questions people ask

Do I paste these in the terminal or into the Claude app?

In the terminal, with Claude Code started in the repository root, because every block assumes it can read files, run your tests and report real paths. Codebase Tour Guide means nothing without that access. The chat app can still help with a single file you attach, but drop the lines about exploring first and naming what it read.

How do I stop it editing files before I have agreed the plan?

Repo Feature Planner tells it to explore, list the files it read and write nothing during that step, then return commit sized pieces each with the test that proves it. Read the plan, correct whatever is wrong about your codebase, and only then say go. Planning in one session and implementing in the next makes that boundary harder to cross by accident.

What stops it turning a red build green by deleting the failing test?

CI Failure Fixer forbids it outright and makes it classify the failure first: a genuine defect, a flaky test, an environment or dependency problem, or broken pipeline configuration. It also has to quote the first real error rather than the last line printed, and reproduce the failure locally before touching code. If everything passes locally, the gap between environments is the bug.

Do I need a CLAUDE.md in the repo before any of this works?

No, although later runs go better with one. CLAUDE.md Writer reads your build files, scripts, test configuration, CI workflows and recent commits, then records what the project is, the commands it verified, the directory layout and the conventions the code genuinely follows. Where such a file already exists, it keeps whatever still holds instead of starting over.

More prompt collections

Claude Prompts

Weekly

New prompts in your inbox

One email a week: the best new prompts and one short guide. Unsubscribe any time. Privacy policy