SKILL.md
Prompt Optimizer Skill
A weak prompt fails in patterned ways — vague task, no output contract, buried instructions, no examples, or asking for judgement with nothing to ground it. This skill diagnoses which failure mode is in play and rewrites the prompt to fix it, then hands you a way to check the fix held — so "it's flaky" becomes a specific, testable change rather than another round of fiddling.
Working from a brief
You'll often get just the prompt and a vague "it's not working". Always deliver a full rewrite anyway — infer the intended task and output from the prompt's wording, state your assumptions, and rewrite. If the failing behaviour wasn't described, infer the most likely failure mode from the prompt's structure and say so. Never hand back only a critique with no rewritten prompt.
Required Inputs
Ask for these only if they aren't already provided (else infer and label):
- The current prompt — the exact text being used.
- What's going wrong — wrong answers, inconsistent format, refusals, too long/short, hallucinated facts.
- The desired output — what a perfect response looks like (a sample is ideal).
- Context — the model/runtime, whether it's one-shot or part of a chain, and any hard constraints (length, JSON, latency).
Output Format
Prompt Diagnosis & Rewrite
1. Diagnosis — the specific failure mode(s), each tied to the line that causes it:
| Symptom | Likely cause | Fix applied |
|---|---|---|
| Inconsistent format | no explicit output contract | added a schema + example |
| Hallucinated details | asked to answer without grounding | added "use only the provided context; say what's unknown" |
| Ignores an instruction | buried mid-paragraph | moved to a numbered rule near the top |
2. Rewritten prompt — the full new prompt in a fenced block, ready to paste. Apply the levers that fit: role + task in the first lines, an explicit (structure/schema + a short example), grounding rules ("answer only from X; if unknown, say so"), constraints stated as rules not prose, and 1–3 few-shot examples when the task needs a demonstrated pattern.
