Prompt optimizer

From event4u-app/agent-config · View interactive version

Prompt optimizer is an AI agent skill from the GitHub repository event4u-app/agent-config. When the user wants a prompt optimized for ChatGPT, Claude, Gemini, or another AI — 'make this prompt better', 'optimize for ChatGPT', 'rewrite my prompt' — even without saying 'optimize'.

How to use this skill

Skill file

prompt-optimizer

Mission: turn a raw user prompt into a precision-crafted prompt that lands well on the user's chosen external AI (ChatGPT, Claude, Gemini, Perplexity, …). Sibling of CODE0 which is engine-inbound; this skill is engine-outbound (the polished prompt is text the user will paste elsewhere).

When to use

When NOT to use (near-misses)

| Phrasing | Route to |

|---|---|

| "refine this ticket / prompt for the engine" | CODE0 |

| "make this skill description pushier" | CODE0 |

| "write the marketing email itself" | direct execution — the user wants the artifact, not a prompt |

| "review my code / commit" | CODE0 and friends |

The 4-D Methodology

  1. Deconstruct — extract core intent, key entities, output shape, constraints; map what's provided vs missing.
  2. Diagnose — audit clarity gaps, ambiguity, missing specificity, missing structure; flag unstated assumptions.
  3. Develop — pick technique + template by request type:
  1. Deliver — output the optimized prompt + a short "what changed" + (DETAIL only) techniques applied + one pro-tip.

Setting awareness

The skill reads prompt_optimization.outbound (or .default when no

outbound override is set) from .agent-project-settings.yml:

| Mode | Behaviour |

|---|---|

| off | The skill refuses; the dispatcher echoes the user's prompt verbatim with a one-line note. |

| mini | BASIC path only — safe defaults, no clarifying questions, no template selection (use the user's structure as-is). Hard cap: 1 turn. |

| max (default) | Full 4-D + template selection. DETAIL mode auto-detects per the table below. |

Any prompt starting with the configured prompt_optimization.bypass_prefix

(default /raw) is echoed verbatim, no shaping, no template.

Modes — BASIC vs DETAIL

Auto-detect on first turn:

| Signal | Mode |

|---|---|

| User wrote "BASIC" or "DETAIL" verbatim | honor it |

| One-line ask, common task (resume help, casual email, summary) | BASIC |

| Multi-paragraph context, professional/technical scope, named audience, named tone | DETAIL |

| Target AI not named AND request implies platform-sensitive output | DETAIL |

| Tiebreaker — both BASIC and DETAIL signals fire | DETAIL (safer default) |

BASIC — apply core 4-D fixes silently, return optimized prompt + 3-bullet "what changed". No questions.

DETAIL — gather missing context one question per turn (Iron Law from ask-when-uncertain). Stop asking once Deconstruct + Diagnose are clean. Then deliver.

Always inform mode + override: first reply names the chosen mode and offers the other in one numbered-options block. Re-pick is silent on subsequent turns.

Procedure

1. Receive input

Capture: (a) the rough prompt, (b) target AI if named, (c) explicit BASIC/DETAIL marker if present. If the user pasted only a topic ("marketing email"), treat it as the prompt seed.

2. Auto-detect mode + announce

Apply the table above. State: "Running in BASIC — say DETAIL to switch." (or vice-versa). Use a single numbered-options block only if the user has not signalled a mode and the heuristic is genuinely 50/50.

3. Inspect + Diagnose (Deconstruct)

Identify each slot in the rough prompt: intent · entities · output shape · constraints · target AI · tone · audience. List every missing slot. Check for ambiguity, unstated assumptions, and contradictory requirements.

3b. De-inflate before you sharpen

Diagnose asks what is missing. The de-inflation pass asks what must go — because sharpening a premise the target model will confabulate around makes the output worse, not better. Strip exactly these four, and nothing else:

| Pattern | What it looks like | What it costs |

|---|---|---|

| Grandiose persona | "You are the world's foremost / legendary / 10× expert in X" | Tokens without behaviour change — a superlative is not a constraint, and the model cannot act on it |

| Presupposed canon | "Apply the 7 laws of X", "use the standard X framework" for a body of knowledge that may not exist | The model invents a canon to satisfy the presupposition, and the confabulation reads as authority |

| Scope stuffing | One prompt demanding analysis and strategy and copy and a checklist | An answer to a question nobody asked, at the cost of the one that was |

| Bare role | "You are a senior X" with no method, source or check attached | Vocabulary changes, method does not |

Strip only these four. Anything else the author wrote is a requirement, not inflation — see § Gotcha for the failure mode on both sides. A stripped persona or role is replaced by the methods and the check it stood in for ("profile it, compare p95" over "you are a senior performance engineer"). A presupposed canon becomes a question in DETAIL mode or a stated assumption in BASIC. This is own analysis, not adopted material — the four patterns are named here rather than cited from an external collection.

4a. BASIC path

Fill missing slots with safe defaults (general audience, neutral tone, the named AI or "any modern LLM"). Skip to step 5.

4b. DETAIL path

Ask one question for the highest-leverage missing slot. Order: target AI → output shape → audience → tone → constraints. Stop asking once the prompt would land cleanly. Never batch. Hard cap: 3 question turns; after that, fill remaining slots with safe defaults and deliver — note the assumptions in § What changed.

5. Develop

Pick techniques per request type (see § 4-D step 3). Name the methods and instruments the task needs — a role label only alongside them, never instead of them — layer context, add structure (numbered steps, bullet headers, output format spec, length cap), and inject specificity (concrete numbers, named formats, explicit success criteria — replace "good", "professional", "high-quality" with measurable criteria).

6. Deliver

Format per § Output format. Do not execute the optimized prompt yourself unless the user explicitly says "and run it" — this skill produces a prompt, not the answer to it.

Output format

  1. Optimized prompt — fenced code block, ready to copy. Top line names the target AI if known.
  2. What changed — 3-5 bullets, each ≤ 12 words.
  3. Techniques applied (DETAIL only) — bullet list naming the techniques (e.g. "few-shot", "chain-of-thought", "method naming").
  4. Pro tip — one sentence, platform-specific when target AI is known (e.g. "Claude responds well to XML tags"; "ChatGPT honors length caps in the system message").

Gotcha

Do NOT

See also

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.