How to Prompt Claude Code (The 3-Part Prompt I Use)

David IyaDavid Iya July 20, 2026 8 min read
A calm, bright modern desk with an open laptop and a notebook of prompt notes, branded Claude Code Club hero for how to prompt Claude Code
Original image, Claude Code Club

How to Prompt Claude Code

Here is the whole thing up front: a prompt that works has three parts - the goal, the context, and the constraints. The goal is what done actually looks like, in behavior, not vibes. The context is the information Claude cannot see on its own - which files matter, what the project is, what you already tried. The constraints are the guardrails - what to leave alone, which patterns to follow, what not to install. Give it all three and Claude gets it right on the first pass. Leave one out and it fills the gap with a guess, and the guess is where your afternoon goes. Everything below is how I write each part on real work.

Part 1: State the Goal, Not the Task

Most weak prompts name a task instead of an outcome. 'Fix the login' is a task. 'Make login reject an unverified email with an inline error and keep the user on the page' is an outcome. The difference is that an outcome tells Claude how to know it succeeded, so it can check its own work instead of handing you something that technically ran. Describe the finished behavior you want to see - what happens, on which screen, in response to what. If you would struggle to tell whether the result is right by looking at it, your goal is too vague and Claude will feel the same ambiguity you do.

Part 2: Give It the Context It Cannot See

Claude Code can read your project, but it does not know which parts matter unless you point at them. This is the part people skip, and it is the biggest single upgrade to your prompts. Name the file or the feature. Say what the project is in one line. Mention what you already tried and what happened. If there is a pattern the codebase already uses, say 'follow the way we do it in X'. You are not writing a novel - you are handing Claude the three or four facts that would take it ten tool calls to discover on its own. That is where the speed comes from.

  • Which files or feature the change lives in, so Claude does not have to hunt.
  • One line on what the project is, so its choices fit your stack instead of a generic one.
  • What you already tried and the exact error or wrong behavior you saw.

Part 3: Set the Constraints Up Front

Constraints are the cheapest way to prevent the outcomes you would have rejected anyway. If you do not want a new dependency, say so. If a file is off-limits, name it. If you want the smallest change that works rather than a refactor, ask for exactly that. Claude is agreeable by default - it will happily rewrite three files to solve a one-line problem if you did not tell it not to. Stating the guardrails before it starts is far cheaper than catching them in review, because by review the work is already done and you are unwinding it. Two or three constraints handle almost every case.

The CCC Three-Part Prompt in One Template

Put the three parts together and you get a template I reuse on almost every task. I call it the CCC three-part prompt, and it reads like a short brief rather than a wish. It is not longer than a bad prompt - it is just aimed. You will find you write it in under a minute once it is a habit, and it saves you the three rounds of correction that a one-liner costs you.

  1. Goal: 'I want <finished behavior> on <where>, so that <how I will know it worked>.'
  2. Context: 'This lives in <files/feature>. The project is <one line>. I already tried <X> and got <result>.'
  3. Constraints: 'Follow <existing pattern>. Do not touch <off-limits>. Keep the change as small as possible.'

The Mistake That Wastes Your First Prompt

The most common mistake is treating the first prompt as a throwaway - firing off one vague line to 'see what it does', then correcting from there. It feels faster because you sent something quickly, but you have just handed Claude permission to guess, and now every follow-up is you cleaning up a direction you never chose. The first prompt is the cheapest place to be specific. Spend the extra thirty seconds there and you skip the three rounds of 'no, not like that' that a lazy opener guarantees. Aim the first shot; do not spray and adjust.

Where This Goes Next

Prompting well is the skill that makes every other Claude Code feature worth having - plan mode, subagents, custom skills, all of it lands harder when the prompt underneath is aimed. Get the three parts habitual and your hit rate climbs without touching your setup or your model. Inside the Claude Code Club we keep a shared library of the exact prompts our members use on real client builds - the openers that get it right the first time on the tasks that usually go sideways. Come grab them and bring the request you always end up correcting three times.

Free Claude Code drops, straight to your inbox

Short, practical drops on skills, MCP, agents, prompts, and more. No spam, unsubscribe anytime.

Frequently asked questions

How do I write a good prompt for Claude Code?

Include three parts: the goal (the finished behavior you want and how you will know it worked), the context Claude cannot see (which files matter, what the project is, what you already tried), and the constraints (what to leave alone and which patterns to follow). Missing any one of the three forces Claude to guess, which is where most wasted rounds come from.

Why does Claude Code do the wrong thing?

Usually because the prompt named a task instead of an outcome, or left out context it could not infer. 'Fix the form' gives Claude no way to know what right looks like, so it picks one. Tell it the exact behavior you want, point it at the relevant files, and say what not to change, and the wrong-guess problem mostly disappears.

Should I write long or short prompts for Claude Code?

Aimed beats long. A short prompt that states the goal, the key context, and one or two constraints outperforms a long one that rambles without deciding anything. Length is not the point - specificity is. If a sentence does not help Claude decide, cut it.

How do I stop Claude Code from changing files I did not ask about?

Say so in the prompt. Add a constraint like 'do not touch anything I did not ask about' or name the specific files that are off-limits. Claude is agreeable by default and will clean up nearby code unless you tell it to keep the change minimal, so state that guardrail before it starts.

Does the way I prompt matter more than the model I use?

In my experience the prompt moves results more than a model upgrade does for everyday building. A sharp prompt on a good model beats a lazy prompt on the best model, because the lazy prompt leaves the important decisions to a guess. Fix the prompt first, then worry about the model.

What is the CCC three-part prompt?

It is a simple template - goal, context, constraints - that we use inside the Claude Code Club to get the right result on the first try. Goal is the finished behavior, context is what Claude cannot see on its own, and constraints are the guardrails. It reads like a short brief and takes under a minute once it is a habit.

Last reviewed by David Iya on July 20, 2026

David Iya

Written by

David Iya

Forbes 30 Under 30 · Y Combinator

Keep reading

WorkflowsBuilding

Claude Code Plan Mode: How I Ship Client Work Without Rework

Plan Mode is Claude Code's read-only research mode - it reads your codebase and writes a step-by-step plan for your approval before it touches a single file. Here's the exact loop I run on every client build to catch the wrong approach in a plan I can edit in seconds, instead of in code I'd have to rip out an hour later.

David Iya 9 min
Read article
Claude CodeWorkflow

How I Review Claude Code's Output Before I Ship It

Claude Code can write a whole feature in one turn, but shipping it blind is how you burn a client. Here is the exact review pass I run on every build - what I read first, what I never trust, and how I keep it fast.

David Iya 8 min
Read article

Ready to build it yourself?

Join Claude Code Club, the #1 community for learning claude code, for $9/month.

← Back to the blog