Tips

6 effective Claude Code prompt patterns from Anthropic's Prompt library

TL;DR

Good Claude Code prompts state the outcome rather than steps, give a way to self-check, point at a reference, set a measurable target, include the original artefact and say how the answer should look. Save prompts that work repeatedly as skills.

With the same Claude Code, one person gets a good result on the first turn while another has to correct it five times. The difference is usually how the prompt is written. Anthropic has a Prompt library for Claude Code: copy-paste prompts tagged by task and role, each with a "why this works" note. The most valuable part isn't any single prompt but the six patterns behind them.

Six patterns that make prompts work

PatternExample
Describe the outcome, not the steps"add rate limiting to the public API and make sure existing tests still pass"
Give it a way to check its work"write the migration, run it against the dev database, and confirm the schema matches"
Point at a reference"add a settings page that follows the same layout as the profile page"
State the measurable target"get the bundle size under 200KB and show me what you removed"
Give it the artefact"why is the build failing? @build.log" (paste logs, screenshots, errors instead of describing them)
Say how you want the answer"explain the payment retry logic as an HTML page with a diagram, then open it in my browser"

Why each pattern works

  • Outcome over steps: Claude finds the files itself instead of following the path you guessed.
  • Self-checking: with a command, test or comparison in the prompt, Claude iterates until it passes rather than stopping after one attempt. To check against the running app, there's /verify.
  • A reference: new code stays consistent with existing code, with fewer style fixes.
  • Measurable: "done" becomes unambiguous rather than a debate.
  • The original artefact: Claude reads the source rather than your description of it, so less is misunderstood.
  • Answer format: the answer fits how you'll use it; for a lasting default, set an output style.

One prompt combining all six

The /checkout page is slow (@lighthouse.json). Get LCP under 2.5 seconds,
following the image optimisation already used on /product. Rerun Lighthouse to
confirm, and don't change the UI. Finally, summarise the changes as a
"file / change / impact" table.

From a good prompt to a repeatable workflow

  1. A prompt that works repeatedly → save it as a skill so the team can run it as /command.
  2. Conventions Claude learns along the way → record them in CLAUDE.md so later sessions don't relearn them.
  3. Large or risky changes → use plan mode to see the file list before any edits.

Caveats

  • Library prompts are starting points, not scripts: adapt them to your project.
  • Don't dictate steps unnecessarily: detailed procedures make it harder for Claude to find a better way.
  • Artefacts can contain secrets: scrub tokens and passwords from logs before pasting.

How to apply it

  • Dev: Before sending a prompt, ask: is there a way to check, and did I point at an existing example?
  • Tech Lead: Browse the Prompt library, pick 5–10 prompts that fit your team and turn them into internal skills.
  • PM: Write requests as "outcome + measurable criteria + report format"; that's also a good prompt for Claude.

Sources & references

  1. Prompt library — Claude Code Docs