The prompt patterns that get clean, correct changes from Claude Code, with examples for every kind of task
Short answer
A free guide to prompting Claude Code in 2026: the anatomy of a good coding prompt, context with files and CLAUDE.md, plan first, constraints, definition of done, prompts for features, bug fixes, refactors, tests, reviews, and explanations, follow-up and correction prompts, effort levels, and common mistakes. For general tips, see our 20 Claude Code Tips guide.
Claude Code can read your project, edit files, and run commands. A clear prompt tells it what to change, what not to touch, and how to prove the change works. For setup and general habits, see our 20 Claude Code Tips guide.
Vague prompts get big, surprising diffs. Clear prompts get small, correct ones.
02
The anatomy of a good prompt
Task
What to build, fix, or change
Context
Relevant files with @, errors, and links
Constraints
Style, libraries, and what not to change
Done means
Tests pass, behavior works, output looks right
Process
Plan first, ask questions, or go ahead
03
Give the right context
Mention exact files with @
Paste the full error message
Share screenshots for UI work
Keep project rules in CLAUDE.md, so you do not repeat them
04
Plan before changing
Read @src/checkout and @tests/checkout. Propose a plan to add discount codes, listing files to change and risks. Do not edit anything yet.
Use plan mode for bigger changes, then approve the plan.
05
Feature prompts
Add a dark mode toggle to the settings page. Use the existing theme hook in @src/theme.ts, store the choice in local storage, and match the current toggle styles. Done means the toggle works, the choice persists after reload, and existing tests pass.
06
Bug fix prompts
Users see a blank page after login on Safari. Here is the console error: [error]. Find the root cause, explain it in two sentences, fix only that, and add a test that would have caught it.
07
Refactor prompts
Refactor @src/utils/date.ts into smaller functions without changing behavior. Keep the public API the same, and run the tests before and after.
08
Test prompts
Write tests for @src/cart.ts covering empty carts, discounts, and rounding. Follow the patterns in @tests/order.test.ts. Do not change the source code.
09
Review and explain prompts
“Review my changes for bugs, security issues, and missing tests.”
“Explain how authentication works in this project, with file references.”
“What could break if I upgrade this library?”
10
Correct course
Press Esc to stop as soon as it goes the wrong way
Say exactly what was wrong and what to do instead
Rewind to an earlier point when needed
Ask it to keep a change smaller
Undo the changes to the API layer. Only change the UI component, and keep the existing props.
11
Match effort to the task
Lower effort for simple edits and questions
Higher effort for tricky bugs and architecture
Start a fresh session with /clear for new tasks
12
Common mistakes
“Make it better” with no definition
Asking for many unrelated changes at once
No way to check the result
Letting it change files you did not mention
The golden rule
Do not tell Claude Code what to feel. Tell it what to change, what to leave alone, and how you will know it worked.
Task
Context
Constraints
Done means
Plan
Correct
Effort
Rewrite your next request with task, context, constraints, and done means, and compare the diff.
It has 12 sections, starting with “Why prompting matters”, “The anatomy of a good prompt”, “Give the right context” and “Plan before changing”, plus 8 more sections.
How long does it take to read?
About 2 minutes. Every section is a short, self-contained card, so you can jump straight to the part you need.
Is this guide free?
Yes. The full guide is free to read on this page, with no sign-up.
For research and ideas only. Results vary and nothing here is a promise of income. See our Disclaimer.
Weekly newsletter
Everything new, every Monday.
One short email every Monday with everything shipped that week: new free tools and websites, new guides, new free browser tools and what's new in my free Gumroad libraries, plus how the site is growing. Free, and you can unsubscribe anytime.
You sign up on Gumroad, which stores your email to send the newsletter. See our Privacy Policy.
Cookies and your choices
This site works without tracking you and loads no analytics scripts. Essential storage is always on so pages load and work correctly. You decide whether your browsing preferences are saved on your device. Read the Privacy Policy.