System Prompts — How to Write Effective AI Instructions
## what it does
What Is a System Prompt?
A system prompt is a set of instructions given to an AI model before any user interaction. It defines the model’s persona, capabilities, constraints, and output format. System prompts are layer 1 of context engineering — the foundation everything else sits on.
Anatomy of a Good System Prompt
Anthropic’s effective context engineering post frames the goal: find the smallest possible set of high-signal tokens that maximizes the chance of your desired outcome. The “right altitude” sits between brittle if-else logic and vague vibes — specific enough to guide behavior, flexible enough for the model to apply judgment.
# Role
You are a senior financial analyst specializing in SaaS metrics.
# Capabilities
- Analyze MRR, ARR, churn, and LTV
- Create executive summaries from raw data
- Generate actionable recommendations
# Constraints
- Never fabricate numbers — say "I need more data" if uncertain
- Always cite which data points support your conclusions
- Use the company's terminology (MRR not "monthly revenue")
# Output Format
- Start with a 2-sentence executive summary
- Use tables for metrics comparisons
- End with 3 prioritized action items
# Tone
Professional but accessible. Avoid jargon unless the audience is technical.
Patterns That Work
1. Role + Expertise
You are a [role] with [N] years of experience in [domain].
You specialize in [specific area].
2. Negative Constraints
Tell the model what NOT to do — often more effective than positive instructions:
- Never use placeholder data
- Never apologize unnecessarily
- Never start responses with "Sure!" or "Of course!"
- Never add caveats that weaken your analysis
3. Output Scaffolding
Define the exact structure of expected output:
Always respond using this structure:
## Summary (2 sentences)
## Analysis (detailed findings)
## Recommendations (numbered list)
4. Examples (Few-Shot)
Curate a small set of canonical examples — “pictures worth a thousand words.” Don’t paste a laundry list of edge cases; pick diverse, representative ones. The same advice applies to any rule set the model reads.
5. Sections with XML or Markdown Tags
For longer system prompts, organize into named sections (<background_information>, <instructions>, ## Tool guidance, ## Output description). Models parse these reliably; XML tagging becomes optional as models get more capable.
Platform-Specific Tips
| Platform | System Prompt Location | Notes |
|---|---|---|
| Claude | Projects → Custom Instructions, or system in the API | Persistent per project on the web, full control via API |
| Claude Code | CLAUDE.md at project root + /memory | Auto-loaded every session; supports nested files and auto memory |
| ChatGPT | Custom Instructions or GPT builder | Per-conversation or per-GPT |
| Gemini | Gems or API system message | Gems for reusable personas |
| Cursor | .cursor/rules/*.mdc or AGENTS.md | Modular rules with description, globs, alwaysApply frontmatter |
Browse this shelf (named packs, not leaked dumps)
The /prompts shelf is types and packs you can steal. It is not 40 more MCP stubs and not a dump of every leaked assistant prompt.
| Pack | Type | On this site |
|---|---|---|
| Code review | system | Severity taxonomy + no scope creep |
| Design-system checklist | pack | UI audit instructions |
| Agent UI source router | pack | Where an agent should look |
| Cursor React/TS rules-as-prompt | pack | Overlaps the rules shelf |
| Claude system prompt (reverse-engineered) | leaked/historical | Treat as dated; do not ship as official |
| Cursor system prompt | leaked/historical | Same — dated, not a vendor doc |
Official craft: Anthropic’s prompt engineering overview (fetched this session) says define success criteria and evals before rewriting the prompt, and that not every failure is a prompting problem (sometimes pick another model). Living techniques: prompting best practices.
Related
## embed this badge
