System Prompts and Instructions
Layers of instruction (design guidance)
| Layer | Owner | Content |
|---|---|---|
| Platform or organisation | Platform team | Non-negotiable policy, safety, tone, data handling |
| Product or application | Product team | Role, domain knowledge, output contract, tool-use rules |
| Task or request | Feature code | The specific job, inputs, format |
| User | End user | The request itself (untrusted) |
Keep each layer short and specific. Put enforcement-critical rules in code, hooks or permissions, not only in prose (see workflow enforcement and handoff).
Writing principles (verified, from Anthropic's prompting guide)
- Be clear and direct; explicit beats implied. Show the prompt to a colleague with no context: if they would be confused, Claude will be.
- Give context and the reason behind a rule so Claude can generalise.
- Use numbered steps when order matters.
- Structure with XML tags (
<instructions>,<context>,<input>) with consistent names. - A role in the system prompt is supported, but specifics matter more than a persona.
- For long inputs, put documents first, query last.
Instructions in Claude Code
CLAUDE.md files, .claude/rules/ and skills are the instruction layers for coding agents; they are context, not enforcement, and concise files (under about 200 lines) are followed more reliably. Contradictory instructions across files can lead Claude to pick one arbitrarily. See claude md hierarchy.
Maintenance at scale (design guidance)
- Version control prompts with the code that uses them; tag releases.
- Own each prompt (a named owner and a change log).
- Regression-test every change on an evaluation set (D4.1).
- Re-tune on model change: Anthropic provides model-specific guidance and migration notes because the same prompt can behave differently across models (verified: the prompting guide has model-specific sections and a migration section).
- Remove dead rules; audit for contradictions.
- Reduce prompt leakage risk where it matters: Anthropic has a guide on reducing prompt leaks (verified to exist); do not put secrets in prompts.
Prefill is gone on newer models
Prefilled assistant turns are not supported from Claude 4.6 models onward (400 error). Use direct instructions, XML-tagged output, structured outputs or tool calling instead.
Exam traps
- One giant prompt mixing policy, product rules and task text.
- Critical safety rules only in the system prompt.
- No owner, version or tests for prompts.
- Copying a prompt to a new model unchanged.
- Secrets inside the system prompt.
References
- Prompting best practices — checked Oct 16, 2026
- How Claude remembers your project — checked Oct 16, 2026
Check your understanding
A rule must never be violated. Prompt or enforcement?Show answerHide answer
Answer
Enforcement in code, hooks or permissions; the prompt reinforces.Why include the reason behind an instruction?Show answerHide answer
Answer
It lets Claude generalise to unlisted cases.What do you do when upgrading models?Show answerHide answer
Answer
Re-run the evaluation suite and re-tune using the model-specific guidance.