跳到主要内容
知仓学习社ZHICANG

prompt-optimizer

Diagnose and rewrite an underperforming LLM prompt so it produces reliable, well-structured output. Use when asked to improve a prompt, fix a prompt…

不碰外部(只输出文字)无严重或高危命中mohitagw15856/pm-claude-skills

它会碰到什么

扫了多少1 个文本文件,4 KB
它会碰到什么不碰外部(只输出文字)
命中总数0 处
命中统计严重 0 · 高 0 · 中 0 · 低 0

这一栏是扫描器报的事实,不是结论。命中多不等于有毒(安全工具、规则库、示例脚本本来就会包含危险写法),命中少也不等于干净。它和你手上的凭据、文件、网络有什么关系,需要你自己看。

技能内容

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 output contract (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.

3. What changed and why — a short bullet list mapping each edit to the symptom it addresses.

4. Test set — 3–5 concrete inputs (incl. an edge case and a "should refuse / say unknown" case) and the

expected output for each, so the user can confirm the rewrite behaves before shipping.

Quality Checks

  • [ ] The rewrite has an explicit output contract (format/schema), not just a description of the task
  • [ ] Each change is tied to a specific symptom — no cosmetic edits presented as fixes
  • [ ] Grounding/uncertainty is handled (the model is allowed to say "I don't know")
  • [ ] Few-shot examples are included only where a pattern must be demonstrated, not by default
  • [ ] A test set with at least one edge case and one negative case is provided
  • [ ] The prompt is ready to paste — no placeholders left unfilled

Anti-Patterns

  • [ ] Do not return a critique without the rewritten prompt — the rewrite is the deliverable
  • [ ] Do not pile on every technique at once — apply the levers that match the diagnosed failure, and say why
  • [ ] Do not add examples that contradict the instructions — the model copies the example over the rule
  • [ ] Do not make the prompt longer when the fix is to make instructions clearer and earlier
  • [ ] Do not claim a fix works without a way to test it — ship the test set

Based On

Prompt-engineering practice — explicit output contracts, grounding/uncertainty handling, structured instructions, and example-driven demonstration.

想直接用这个技能?

本站把开放许可(MIT / Apache 等)的技能按仓库打包整理到网盘,点一下转存到你自己的网盘,不用一个个从 GitHub 拉。许可未声明的技能只给原始仓库链接,不打包。

同名技能的其他版本

有 3 个不同仓库或目录里都有叫 prompt-optimizer 的技能。它们内容并不相同,别混用: