Claude Code prompts for planning, coding and review
Strong Claude Code prompts make the task observable: the symptom, relevant files, what must stay unchanged and which check proves success. Use these examples to investigate a repository, plan a narrow change and review the diff before you accept it. Prompts guide the work; permissions and tests protect it.
Role
Context
Task
Format
Guardrails
Example prompts
Implement a scoped feature
Role
Context
Task
Format
Guardrails
Review a risky diff
Role
Context
Task
Format
Guardrails
A Claude Code prompt should define scope and verification
Describe a user-visible symptom and the smallest reproduction you have. Name relevant files only when you know them; otherwise ask the agent to locate the code before proposing a change. Supply the expected behavior and boundaries that the repository cannot explain, such as a billing rule or a required public URL. Tell the agent to inspect existing patterns rather than create a parallel implementation just because a new module looks cleaner.
For a risky change, request a short investigation and plan first. Ask which assumptions remain and what check will prove the result. Then authorize the scoped implementation. A useful completion report identifies changed files, tests actually run and any missing checks. Do not accept invented successful test output. For a small well-reproduced defect, keep planning proportionate instead of turning a two-line correction into an unrelated architecture project.
Include concrete acceptance cases. A list-ordering change needs two timestamps and expected order. An access-control change needs an owner and a different user. A file utility needs duplicate-name and permission-failure cases. Ask for error handling as well as the happy path. Review the diff yourself, especially when work touches user data, deletion, permissions or payments. Prompt boundaries guide behavior but do not replace restricted credentials and enforced policies.
Debug without losing the parts that work
When a test fails, supply the exact output and ask for a diagnosis grounded in the current source. Require a narrow fix that preserves unrelated behavior. If the tool cannot run a check, it should say so and provide a reproducible next step rather than claiming completion. Never paste tokens or private customer records into a debugging prompt. Use minimal sanitized examples and keep destructive commands subject to explicit review.
What makes a good Claude Code prompt
Supply a symptom and reproduction. “Fix the dashboard” is vague; a failed action with an expected result gives the agent a target.
Ask it to inspect before editing when the cause is unknown. Existing code often answers questions that a speculative rewrite would miss.
Define boundaries: access rules, public URLs, data shape and design. Explicitly preserve behavior that must survive the change.
Give a check that can fail. A regression test, real form submission or reproduced error is better evidence than a confident summary.
Require an honest completion report. Separate what changed, what ran and what remains unverified so you can decide whether to accept it.
Bad prompt vs What2Prompt prompt
Bad prompt
“fix my app”
What2Prompt prompt
Role
Context
Task
Format
Guardrails
This brief makes success measurable and limits the blast radius. The What2Prompt engine helps describe the task; your coding tool still needs appropriate repository access, permissions and review of the resulting diff.
Keep the conversation grounded in observations. If a patch fails, share the exact test output and ask for a diagnosis instead of repeating the original request more forcefully. Before accepting the result, read the diff and check the behavior a real user encounters. A report that admits a missing test is more useful than one claiming everything works without evidence.
Reference: Claude Code best practices ↗Questions about Claude Code prompts
Should I ask Claude Code to plan before coding?
For an unfamiliar area or a risky change, planning helps expose assumptions before files are edited. Small, well-specified repairs may not need an elaborate plan. Ask for enough investigation to identify the relevant code, the intended change and its verification, without turning every simple task into a long architecture exercise.
What should I put in a Claude Code prompt?
Include the user-visible goal, relevant reproduction or sample input, important constraints and a verification command or test. Explain facts the repository cannot reveal, such as an external process or business requirement. Avoid pasting secrets. Let the tool inspect code it can access rather than duplicating an entire repository in your message.
Does a detailed prompt make code safe automatically?
No. Prompts guide behavior but do not replace permissions, access policies or tests. Review changes that touch security, billing, destructive operations or user data. Claude Code’s documentation specifically distinguishes instructions from enforced rules: a boundary that must never be crossed needs a technical safeguard, not only a sentence asking for care.
Related prompts
Browse the complete AI Prompt Library · Create a prompt with your own idea
