[NTTP]
Developers

How to write a good Claude Code prompt

July 12, 2026 · 4 min read

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

Example

Vague: “make the login better” Better: “In src/app/login/page.tsx, add inline validation to the email and password fields. Show the error below each field on blur, not on every keystroke. Keep the existing Tailwind styles and the server action. Do not change the layout.”

Common mistakes

← All guides