Every rule is concrete and verifiable. The agent cannot misinterpret "clean".
</Good>
## Anti-Pattern Catalog
Common prompt weaknesses and their fixes. See `reference/anti-patterns.md` for the full catalog with extended examples.
| Anti-Pattern | Example | Fix |
|-------------|---------|-----|
| **The Fog** | "Make this better" | State what "better" means: faster, more readable, fewer dependencies |
| **The Novel** | 2000-word prompt for a 5-line change | Strip to proportional level. Three lines for a three-line task. |
| **The Parrot** | Copy-pasted template with unfilled placeholders | Fill every placeholder or delete the block entirely |
| **The Hedge** | "Maybe consider possibly looking at..." | Direct language: "Read X. Change Y. Verify Z." |
| **The Wish** | "It would be nice if the code was faster" | Measurable goal: "Reduce p95 latency from 200ms to under 50ms" |
| **The Shotgun** | 15 unrelated instructions in one prompt | Split into separate prompts, one objective each |
| **The Cage** | Over-constrained: every line of code dictated | Specify WHAT and WHY, let the agent decide HOW |
| **The Ghost** | References "the file" or "that function" without names | Use explicit paths: `src/utils/parse.ts`, function `parseConfig` |
## Provider References
Reference files support prompt construction for specific agent environments:
- `reference/framework.md` -- vendor-neutral framework blocks. Always loaded.
- `reference/claude-code.md` -- Claude Code and generic Claude patterns.
- `reference/openai-gpt.md` -- GPT and OpenAI reasoning model patterns.
- `reference/amp-codex.md` -- Amp, Codex CLI, and other coding agent patterns.
- `reference/anti-patterns.md` -- Extended anti-pattern catalog with examples.
### Detection: Which Reference to Load
**Claude Code / Claude** --> load `claude-code.md`
Keywords: "Claude", "Claude Code", "Anthropic", "Sonnet", "Opus", "Haiku"
Model IDs: `claude-opus-4-6`, `claude-sonnet-4-6`, `claude-haiku-4-5`, or any `claude-*` string
Prompt signals: XML tags, CLAUDE.md references, `<thinking>` blocks, tool rules in XML
**OpenAI / GPT** --> load `openai-gpt.md`
Keywords: "GPT", "OpenAI", "ChatGPT"
Model IDs: `gpt-5.4`, `gpt-5.3`, `gpt-5`, `gpt-4.1`, `gpt-4o`, or any `gpt-*` string
Reasoning models: "o1", "o3", "o4-mini", or any `o[0-9]*` pattern
Prompt signals: `<output_contract>`, `reasoning_effort`, Responses API references
**Amp / Codex / Other coding agents** --> load `amp-codex.md`
Keywords: "Amp", "Codex", "Cursor", "Windsurf", "Copilot"
Prompt signals: AGENTS.md, rules files, sandbox execution, `.cursorrules`
**Unspecified** --> `framework.md` only
When no provider is detected, the vendor-neutral framework produces strong prompts for any model. Load at most one vendor file.
## Output Modes
Choose one mode based on the user request.
- **Inline upgrade**: provide the upgraded prompt only.
- **Upgrade + rationale**: provide the prompt plus a brief list of improvements.
- **Template extraction**: convert the prompt into a reusable fill-in-the-blank template.
- **Hook spec**: explain how to apply the framework automatically before execution.
## Hook Pattern
When the user asks for a hook, model it as a pre-processing layer:
1. Accept the current prompt.
2. Classify the task type and complexity level.
3. Select proportionality level from the table above.
4. Expand the prompt using only the framework blocks appropriate for that level.
5. Return the upgraded prompt for execution.
6. Optionally keep a diff or summary of injected structure.
## Red Flags -- The Upgraded Prompt Went Wrong
Stop and re-evaluate if you see any of these:
- Upgraded prompt is 3x longer than the raw prompt for a simple task
- Framework blocks contain placeholder text ("describe your context here")
- Multiple blocks repeat the same instruction in different words
- The agent's actual job is buried under ceremony
- Constraints conflict with each other
- You added verification steps for a task with no side effects
- The prompt reads like documentation instead of an instruction
**All of these mean: strip back. Simpler is stronger.**
## Quality Bar
Before finalizing, check the upgraded prompt:
- [ ] Still matches the original intent (do not drift)
- [ ] Every block materially improves execution (remove those that do not)
- [ ] Proportional to task complexity (no over-engineering)
- [ ] Includes verification appropriate to the risk level
- [ ] Gives the agent a clear definition of done
- [ ] Uses direct language (no hedging, no "maybe", no "consider")
- [ ] File paths and function names are explicit, not vague references
If the prompt is already strong, say so and make only minimal edits. The best upgrade is sometimes "this prompt is fine as-is."
## When Stuck
| Problem | Solution |
|---------|----------|
| Do not know what the user really wants | Ask one clarifying question with a recommended default |
| Task seems too big for one prompt | Split into multiple prompts, each with one objective |
| Cannot determine the target agent | Use framework.md only -- it works for any model |
| Upgraded prompt feels bloated | Remove blocks one at a time. If removing it does not hurt, it was noise. |
| User says "just make it work" | Add objective + done criteria. Skip everything else. |