Back to blog
Prompting
Claude Code

The System Prompt Your Coding Agent Actually Needs

Thang Doan
Thang Doan

A coding agent without a system prompt is a chatbot that happens to write code. It will produce plausible-looking output that misses the actual job. The system prompt is where you tell it what the job is.

Most teams skip this. They let the tool vendor's default system prompt run the agent. Then they are surprised when the agent behaves like a generic assistant instead of an engineer on their team.

What a system prompt actually does

The system prompt is the highest-priority text in the context window. It is read before your message, before the project files, before the tool definitions. It tells the agent how to behave, not what to do in this specific task.

A good system prompt answers three questions about the agent's behavior.

How should it think before acting? Plan first, or jump straight to code? Consider multiple approaches, or take the first one that works?

How should it handle problems? Persist through transient errors, or escalate quickly? Treat all actions the same, or distinguish safe reads from risky writes?

How should it communicate with you? Explain every step, or work silently? Solve edge cases with exact numbers, or accept ballpark estimates?

Default prompts answer these generically. Your team needs specific answers.

A template that actually works

This is not the only system prompt structure. It is one that earns its keep for engineering agents.

You are a senior engineer on the [team name] team working in the [codebase name] codebase.

## How you work

Plan before acting. Read the relevant code before proposing changes. Verify your understanding by running commands, not by reading logs and guessing.

Distinguish safe from risky. Read operations (cat, ls, grep, git status) are safe; run them freely. Write operations (file edits, git push, npm install, database changes) require explicit human approval.

When you encounter an error, read the full error message before proposing a fix. Most errors contain the solution. If you cannot fix it in two attempts, stop and report what you tried.

## What you do not do

You do not add dependencies without asking.
You do not refactor code outside the scope of the current task.
You do not write tests after the implementation.
You do not claim work is complete without running the verification command and pasting the output.

## How you communicate

When you report completion, include the exact command you ran and its actual output. Not a summary. The output.

When you are uncertain, say so. "I am not sure whether X" is more useful than a confident wrong answer.

Adapt the specifics. Keep the structure.

The pieces that matter most

The "what you do not do" section is the part teams skip and regret skipping. Agents reach for abstractions, dependencies, and refactors because that is what training data rewarded. Telling them not to, explicitly, in the system prompt, changes the output.

The verification rule is the other piece that earns its keep. Without it, the agent will report success based on "the test command should have passed". With it, the agent pastes the actual output. The difference shows up immediately in review quality.

The "two attempts then stop" rule prevents the failure mode where the agent tries six variations of a fix, each one slightly worse, until the context window is full of dead attempts.

When the system prompt is not enough

A system prompt does not replace an AGENTS.md file. The system prompt is about agent behavior. AGENTS.md is about project rules. You need both.

A system prompt also does not replace clear task descriptions. If the task itself is vague, the agent will produce vague output regardless of the prompt.

And no system prompt fixes a model that is not capable enough for the task. The prompt steers capability. It does not create it.

The smallest test

Take the template above. Customize the team name, codebase name, and the three "do not" rules that match your team's most common review comments. Save it as your agent's system prompt. Run the same task you ran last week.

If the output is closer to what you wanted, the problem was never the model. It was that you were running the vendor's default prompt instead of yours.

Recommended for you

Enjoyed this article?

Subscribe for new articles. No spam. Unsubscribe anytime.

By subscribing you agree to receive the newsletter. See the Privacy page.