Agent Skillsmohitagw15856/pm-claude-skills › prompt-optimizer

prompt-optimizer

GitHub

诊断并优化低效LLM提示词,针对格式混乱、幻觉或拒绝等问题提供修复方案。通过结构分析输出重写后的提示词、变更理由及测试用例,确保生成稳定、结构化的结果。

skills/prompt-optimizer/SKILL.md mohitagw15856/pm-claude-skills

Trigger Scenarios

用户要求改进提示词 提示词导致不一致或错误结果 需要减少模型幻觉或拒绝行为 要求输出遵循特定格式

Install

npx skills add mohitagw15856/pm-claude-skills --skill prompt-optimizer -g -y
More Options

Use without installing

npx skills use mohitagw15856/pm-claude-skills@prompt-optimizer

指定 Agent (Claude Code)

npx skills add mohitagw15856/pm-claude-skills --skill prompt-optimizer -a claude-code -g -y

安装 repo 全部 skill

npx skills add mohitagw15856/pm-claude-skills --all -g -y

预览 repo 内 skill

npx skills add mohitagw15856/pm-claude-skills --list

SKILL.md

Frontmatter
{
    "name": "prompt-optimizer",
    "description": "Diagnose and rewrite an underperforming LLM prompt so it produces reliable, well-structured output. Use when asked to improve a prompt, fix a prompt that gives inconsistent or wrong results, reduce hallucination\/refusals, or make output follow a format. Produces a rewritten prompt with a diagnosis of what was failing, the specific changes and why, and a small test set to verify the fix."
}

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.

Version History

  • a38bc30 Current 2026-07-05 11:41

Same Skill Collection

exports/openclaw/360-feedback-template/SKILL.md
exports/openclaw/401k-plan-decoder/SKILL.md
exports/openclaw/ab-test-planner/SKILL.md
exports/openclaw/ab-test-readout/SKILL.md
exports/openclaw/accessibility-audit/SKILL.md
exports/openclaw/account-plan/SKILL.md
exports/openclaw/acquirer-red-team/SKILL.md
exports/openclaw/ad-copy/SKILL.md
exports/openclaw/aeo-optimizer/SKILL.md
exports/openclaw/agenda-or-cancel/SKILL.md
exports/openclaw/agent-design-review/SKILL.md
exports/openclaw/agent-observability-spec/SKILL.md
exports/openclaw/agent-spec/SKILL.md
exports/openclaw/ai-ethics-review/SKILL.md
exports/openclaw/ai-eval-plan/SKILL.md
exports/openclaw/ai-feature-prd/SKILL.md
exports/openclaw/ai-product-canvas/SKILL.md
exports/openclaw/air-quality/SKILL.md
exports/openclaw/altitude-shifter/SKILL.md
exports/openclaw/ambiguity-resolver/SKILL.md
exports/openclaw/analyst-relations-brief/SKILL.md
exports/openclaw/announcement-card/SKILL.md
exports/openclaw/api-docs-writer/SKILL.md
exports/openclaw/api-test-plan/SKILL.md
exports/openclaw/api-versioning-strategy/SKILL.md
exports/openclaw/apology-letter/SKILL.md
exports/openclaw/architecture-decision-record/SKILL.md
exports/openclaw/architecture-diagram/SKILL.md
exports/openclaw/archive-strategy/SKILL.md
exports/openclaw/assumption-bounty/SKILL.md
exports/openclaw/assumption-mapper/SKILL.md
exports/openclaw/async-update-format/SKILL.md
exports/openclaw/auto-repair-estimate-decoder/SKILL.md
exports/openclaw/autopilot-charter/SKILL.md
exports/openclaw/benefits-decoder/SKILL.md
exports/openclaw/bid-tender-review/SKILL.md
exports/openclaw/board-deck-narrative/SKILL.md
exports/openclaw/board-minutes/SKILL.md
exports/openclaw/board-pre-read/SKILL.md
exports/openclaw/bom-cost-review/SKILL.md
exports/openclaw/bookkeeping-categorization/SKILL.md
exports/openclaw/boolean-search-builder/SKILL.md
exports/openclaw/brag-doc/SKILL.md
exports/openclaw/brainstorming/SKILL.md
exports/openclaw/brief-builder/SKILL.md
exports/openclaw/briefing-note/SKILL.md
exports/openclaw/budget-builder/SKILL.md
exports/openclaw/budget-variance-analysis/SKILL.md
exports/openclaw/bug-diagnosis/SKILL.md
exports/openclaw/bug-report/SKILL.md

Metadata

Files
0
Version
471c606
Hash
5ee639d6
Indexed
2026-07-05 11:41

- 위키
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-07-30 19:26
浙ICP备14020137号-1 $방문자$