/refine — Prompt Optimizer
Transform any brief, draft, or one-liner into a production-ready structured prompt.When to Use
- User wants to improve a prompt or brief
- User references
/refinewith text or a file path - An agent needs to optimize a prompt before dispatching it
Modes
File Mode
Text Mode
/tmp/prompts/<slug>.md.
Flow
- Detect mode — argument starts with
@→ file mode; otherwise → text mode. - Read input — file mode reads the target file; text mode uses the raw argument.
- Spawn refiner subagent — system prompt = the Prompt Optimizer, input = user text.
- Receive output — the subagent returns the optimized prompt body only.
- Write output — file mode overwrites source; text mode writes to
/tmp/prompts/. - Report — print the path of the written file.
Prompt Type Detection
The optimizer classifies prompts and applies type-specific patterns:Core Patterns
The optimizer applies these structural patterns:- D/I/V (Discovery / Implementation / Verification) — task decomposition with rollback points
- Success/Failure Boundaries — concrete criteria with pass/fail markers
- Concrete Examples — code samples over descriptions
- Scope Controls — explicit boundaries to prevent scope creep
Rules
- Never add wrapper text or commentary to the output file
- Never execute the prompt — only rewrite it
- Single-turn execution only — no clarification loops
- File mode overwrites in place
- Text mode always writes to
/tmp/prompts/