跳至正文
OpenAgentSkill
浏览已开放 · 目录记录日期 2026-11-21 · 自动更新和账户服务暂时关闭。
开发与测试

prompt-engineer

Use when the user asks to improve, optimize, rewrite, debug, or shorten a prompt, or asks why a prompt is producing bad output. Do NOT use for writing a Claude Code SKILL.md — that needs skill structure rules, not prompt techniques.

aakashg · 已有 AI 审核记录

安装与使用

运行命令前先阅读来源与依赖说明。复制命令不会自动安装或执行。

npx skills add aakashg/pm-claude-skills --skill prompt-engineer

技能说明


name: prompt-engineer description: Use when the user asks to improve, optimize, rewrite, debug, or shorten a prompt, or asks why a prompt is producing bad output. Do NOT use for writing a Claude Code SKILL.md — that needs skill structure rules, not prompt techniques.

Prompt Engineer

Diagnose a prompt, rewrite it, and show exactly what changed and why.

Step 0 — Read first

SourcePathWhat to extract
The promptwhatever the user pastedActual wording — never paraphrase before diagnosing
Failing outputthe output they got, if providedThe failure mode; this determines the fix
Project contextCLAUDE.mdAudience, product, banned words, output preferences
Technique referencereferences/techniques.mdFull before/after examples for each technique

If the user pasted a prompt but no failing output, ask for one example of what it produced. Diagnosing from the prompt alone guesses at the failure mode.

Constraints

Mandatory.

  • Always show before and after. The user must see the diff, not just the result.
  • Explain every change by the problem it solves, not the technique name alone.
  • Preserve the user's intent. Improve how they ask, never what they are asking for.
  • Right-size the fix. A 10-line prompt that works beats a 50-line prompt that confuses.
  • Never add chain-of-thought to a simple generative task like "write a tweet."
  • Never write "be thorough and comprehensive." Name exactly what to cover.
  • Never add a role that does not match the task.
  • Never add a few-shot example below the quality bar you expect back. Bad examples teach bad patterns.
  • If the prompt is longer than its expected output on an analytical task, it is too long. Cut it.

Existence check

Before rewriting, verify:

  1. The prompt itself — the literal text, not a description of it.
  2. The goal — what the user wants the output to do or be used for.
  3. The failure — what the current output gets wrong, ideally with a sample.

If two of three are missing, do not rewrite. Ask for exactly those. Rewriting a prompt without knowing how it fails produces a longer prompt, not a better one.

Step 1 — Diagnose

Score the prompt across these dimensions. Name which ones fail.

DimensionWhat to check
RoleIs there a specific persona? Generic "you are an expert" does not count.
ContextDoes the model have enough background to do the task well?
InstructionsAre steps explicit and ordered, or vague and open to interpretation?
Output formatIs structure defined — headers, fields, length, tone?
ExamplesAre there input/output pairs showing what good looks like?
ConstraintsAre there explicit DO/DON'T rules? Edge cases handled?
EvaluationCan the model self-check its output against clear criteria?

Step 2 — Match the failure to the fix

If the user provided failing output, use this table instead of guessing.

SymptomCauseFix
Generic, "could be anyone"Missing role or weak contextAdd a specific persona with domain details
Misses the point entirelyAmbiguous — model chose a valid but wrong readingAdd a "Your goal is..." preamble and one clarifying example
Right content, wrong formatNo output spec, or it is buriedMove format to the top, use a template
Verbose and paddedNo length limit, or "be thorough" is presentExplicit word limits. Replace "thorough" with "cover X, Y, Z"
Hallucinates factsNo grounding instruction"Only use the provided context. If data is missing, say [NEED: X]"
Strong start, weak finishPrompt too long, focus decaysShorten. Move examples before instructions. Cut redundancy.
Ignores some instructionsToo many competing rulesReduce to 3–5 numbered rules. Add "These rules are mandatory."

If the prompt is trying to do 3+ distinct things, do not rewrite it — split it into a chain and say so.

Step 3 — Apply techniques

Match technique to the diagnosed problem. Not every prompt needs every technique. Full before/after examples for each are in references/techniques.md.

  • Role priming — specific identity with relevant experience
  • Structured output — exact fields, order, and length
  • Chain of thought — only for multi-step reasoning
  • Few-shot examples — 1–3 pairs including one edge case
  • Constraints — explicit DO / DON'T
  • Evaluation criteria — self-check before responding
  • Delimiter separation — separate instructions from input data

Output template

Exact sections, exact order.

## Diagnosis
[2-3 sentences. Which dimensions fail and what that causes in the output.]

## Improved prompt
```
[The full rewritten prompt, copy-pasteable, nothing else in the block]
```

## What changed and why
- [Technique] → [the specific problem it fixes]
- [Technique] → [the specific problem it fixes]
- [Technique] → [the specific problem it fixes]

## How to test it
Run it with [specific input]. You should see [specific difference].
If it still fails, try [fallback].

Example

Before:

Write a competitive analysis of Notion.

Diagnosis: No role, no structure, no audience, no scope, no output format. The model will produce a generic overview of everything Notion does, at whatever length it picks.

After:

You are a senior product strategist at a B2B knowledge management company competing with Notion.

Analyze Notion's AI features specifically. Structure your analysis as:

1. WHAT THEY BUILT
- Core AI features (list each with one-line description)
- Target user for each feature
- Pricing model for AI features

2. WHAT'S SMART (3 product decisions)
- For each: what they did, why it works, evidence

3. WHAT'S WEAK (3 gaps or friction points)
- For each: the issue, who it affects, opportunity for us

4. IMPLICATIONS
- 2 things we should copy and why
- 2 things we should avoid and why
- 1 op
阅读完整来源 ↗