Guides building, reviewing, and optimizing system prompts and prompt templates for LLMs. Use when creating system prompts, writing prompt templates, optimizing prompt structure, reducing prompt token usage, compressing prompts, improving prompt clarity, reviewing prompts for safety and bias, or making prompts more token-efficient. Also use when the user says "write a prompt," "optimize this prompt," "system prompt," "prompt engineering," "make this prompt better," "reduce tokens," or "compress this prompt."
Build effective, safe, and token-efficient system prompts for LLMs.
Pick the workflow that matches the task, then follow it end-to-end:
| Task | Workflow | Reference |
|---|---|---|
| Write a new prompt from scratch | Create workflow | references/workflows.md → Workflow 1 |
| Review/audit an existing prompt | Review workflow | references/workflows.md → Workflow 2 |
| Reduce token count of a working prompt | Optimize workflow | references/workflows.md → Workflow 3 |
Each workflow references the specific detail pages below as needed. Do not read all references upfront — load them when the workflow step calls for them.
1. Identity / Role — Who the model is (1–2 sentences)
2. Core behavior rules — Non-negotiable constraints (safety, tone)
3. Task instructions — What to do and how
4. Context / Knowledge — Domain data, schemas, reference docs
5. Output format — Structure, length, style requirements
6. Examples (few-shot) — 2–3 input/output pairs in <example> tags
7. Dynamic input — User content (always last, always delimited)
<user_input>; never interpolate rawLoad these when a workflow step calls for them:
| Reference | Contents |
|---|---|
references/workflows.md | End-to-end workflows for create, review, and optimize tasks |
references/clarity-and-structure.md | XML tags, delimiters, role prompting, long-context patterns |
references/output-control.md | Format steering, verbosity control, few-shot examples |
references/safety-and-security.md | Injection prevention, bias mitigation, data leakage, red-teaming |
references/compression-techniques.md | High-density writing, token pruning, compression methods, density test |
references/agentic-prompts.md | Tool use, thinking/reasoning, state tracking, subagent orchestration |
references/anti-patterns-and-checklist.md | 8 anti-patterns, design checklist, evaluation metrics |