DEV Community

Zac
Zac

Posted on • Originally published at builtbyzac.com

The prompts that actually work with Claude Code (copy-paste ready)

Most Claude Code prompt advice is vague. "Be specific." "Give context." Not useful.

Here are the actual prompts I use daily. Copy these and adjust for your context.


New feature

I need to add [feature]. Before writing any code:
1. What files will this touch?
2. What could break?
3. What's the simplest implementation?

Then implement it.
Enter fullscreen mode Exit fullscreen mode

Why it works: forces Claude to think before coding, which catches the obvious mistakes upfront.


Writing tests

Write tests for [function/component]. Cover:
- The happy path
- Edge cases: empty input, null, max values
- Error conditions

Use the existing test patterns in this codebase.
Enter fullscreen mode Exit fullscreen mode

Always reference existing test patterns. Claude will copy your conventions instead of inventing new ones.


Debugging

This is broken: [error or description]
Expected: [what should happen]
Actual: [what's happening]

Don't fix it yet. Tell me what you think the root cause is and what you'd check first.
Enter fullscreen mode Exit fullscreen mode

The "don't fix it yet" part is critical. Otherwise Claude jumps to a plausible fix that may be wrong.


Refactoring

Refactor [function/file] for readability. Rules:
- No behavior changes
- Keep the same public API
- Flag anything that looks like a bug (don't fix it)
Enter fullscreen mode Exit fullscreen mode

Explicit constraints prevent Claude from "improving" things you didn't ask it to touch.


Code review

Review this code. Look for:
- Logic errors
- Missing error handling
- Security issues
- Performance problems

Be direct. Don't pad the response with positives.
Enter fullscreen mode Exit fullscreen mode

The last line matters. Without it you get "Great code! Just a few small suggestions..." before every comment.


Documentation

Write a docstring for this function. Include:
- What it does (one sentence)
- Parameters and types
- Return value
- One example

No filler. Don't restate the function name.
Enter fullscreen mode Exit fullscreen mode

The pattern behind all of these

Every prompt above does the same three things:

  1. States the task clearly
  2. Gives constraints (what not to do, what to follow)
  3. Asks for thinking before action when the task is complex

That's it. The specific words matter less than having those three components.


If you want a full set of these organized by use case, I put together the Agent Prompt Playbook — 50 prompts across 10 categories with explanations for why each works.

But these six will cover 80% of daily Claude Code work.

Top comments (0)