A coding agent like Claude Code is only as good as the prompt you hand it. A vague request gets a vague change; a specific one gets the thing you actually wanted. A good Claude Code prompt does four things: states one clear task, gives the context the agent cannot see, names files and constraints exactly, and defines what done looks like. None of that is talent; it is habit.
Lead with one clear task
Open with a single, plain statement of what you want done. If your prompt contains three unrelated jobs, it is three prompts. Splitting them gives the agent a clean target and gives you a change you can actually review.
Give it the context it cannot see
The agent does not know your stack, your conventions, or which file you mean unless you say so. A sentence of context (the framework, the file, the constraint that matters) removes most of the guessing that leads to a wrong answer.
Be specific, and say what not to touch
- Name the file, the function, and the library, exactly.
- Use the imperative: Add, Fix, Refactor. Not “I need you to”.
- State the constraints: keep the existing styles, do not change the API.
- Say what done looks like, so the agent knows when to stop.
Example
Common mistakes
- Five jobs in one prompt. Split them; review them separately.
- No context, so the agent guesses your stack and gets it wrong.
- “Fix everything” with no definition of done. Bound the task.