Turns rough intent or a weak prompt into a reliable one — diagnosing why output is inconsistent, restructuring the instruction, and adapting it across models. Use this when a prompt is not producing what was wanted, when output varies run to run, when writing a prompt for a repeated task, when moving a prompt between models, or when someone describes what they want an AI to do and needs it written properly.
npx skills add https://github.com/cbrock84/headcount --skill prompt-optimizer
Bad output has a small number of causes, and the fix differs entirely by cause:
arbitrarily.
options.
nothing.
context.
Say so rather than iterating.
Read the actual bad output before rewriting. The failure mode names the cause.
often summon the thing named.
an example rather than describing it.
per token than description does, and one good one beats three mediocre.
the output more than most adjectives.
stated first is defended rather than derived.
Politeness, threats, incentives, insisting on importance, and stacked superlatives. These consume
tokens and change little. So does repeating an instruction in three phrasings — it usually signals
the instruction is unclear rather than reinforcing it.
Put the task first, context second, and any output format last where it will be closest to
generation. Long context between instruction and output is where instructions get lost.
For repeated prompts, separate the fixed instruction from the variable input explicitly, so the
model can tell which is which.
A prompt is not done because one run looked good. Run it three to five times on the same input and
look at the variance — that is the actual quality. Then run it on the awkward inputs: empty, far too
long, ambiguous, adversarial.
Fix the worst case, not the average. The average is what you see in testing; the worst case is what
your users see.
When a prompt matters enough to optimize, produce genuinely different versions rather than variants
of one phrasing:
Test all four on the same inputs. Which wins is genuinely hard to predict, and the intuition that a
longer prompt is better is wrong about as often as it is right.
Judge against criteria written before seeing results, or you will rationalize whatever came back.
For most tasks: did it do the task, is it correct, is it the right shape and length, is it usable
without editing. Score each run rather than forming an overall impression — impressions are
dominated by the best run, and the worst run is what matters.
Do not assume a prompt transfers. Models differ in how they weight system versus user instruction,
how they handle long context, and how they respond to formatting. Re-test on the target model, and
be especially suspicious of prompts tuned through many small iterations — those are often fitted to
one model's quirks.
Take cbrock84/prompt-optimizer from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.