prompt-optimizer: Selective Domain-Term Rewriter Skill
Rewrites vague multi-step requests into one dense, verifiable prompt in your own language—translating layperson wording into accurate domain terms while silently skipping confirmations, venting, and already-clear edits.
Requirements
- Any Skill-compatible coding agent (Claude Code, Codex, Antigravity, Cursor, Pi, or Grok)
- Optional automatic pre-routing hooks require Node.js 18+
Quick start
1. Install the Skill
git clone https://github.com/TinkCarlos/prompt-optimizer.git
cd prompt-optimizer
for d in ~/.claude/skills ~/.codex/skills ~/.cursor/skills ~/.grok/skills \
~/.gemini/config/skills ~/.agents/skills; do
[ -d "$d" ] && mkdir -p "$d/prompt-optimizer" && cp SKILL.md "$d/prompt-optimizer/"
doneManual trigger in any agent: /prompt-optimizer make a deck introducing the new product (or /skill:prompt-optimizer ... in Pi).
2. Optional automatic hooks (Node.js 18+)
The bundled hooks/ directory includes automatic pre-routing scripts for Antigravity (prompt-optimizer-agy.js), Claude Code & Codex (prompt-optimizer-hook.js), and Pi (pi install git:github.com/TinkCarlos/prompt-optimizer).
What it does
Before executing a vague request, prompt-optimizer silently runs a REWRITE vs SKIP gate:
- Skips silently on venting (
ugh, it broke again), confirmations/nudges (yes,continue,you decide), feedback (too long, shorten it), and already-clear single-step edits (Change the primary submit button color in src/App.tsx to #2563eb). - Rewrites only when helpful into one natural paragraph (1–4 sentences) plus a single confirmation line (
Use this prompt? (approve / edit / use original)) in the user's original language.
Design principles
- 100% fidelity: Preserves intent, scope, numbers, and constraints; flags missing facts instead of inventing them.
- Layperson wording to domain terms without over-specifying: Translates everyday phrasing like "wait after typing before searching" into
input debounceor "looks like glass" intoglassmorphism, while refusing to guess unverified root causes or lock in unmentioned frameworks. - External verification: Asks for first-hand code, DevTools profiling, execution plans, or real sample checks instead of self-grading.
Current validation status
Honest status: there is no end-to-end execution benchmark yet. Hook routing, confirmation tracking, toggles, and long-session filtering have automated test coverage, and first-round black-box tests across Chinese, English, Japanese, and Spanish scored 12/12 on routing and prompt quality (11 rewritten as expected, 1 explicit color-hex instruction silently skipped).
--- name: prompt-optimizer description: >- Works in any language. Before acting on a user message, decide from the conversation context whether it is worth rewriting (REWRITE or SKIP). Venting, confirmations, single-step tweaks and already-clear messages are skipped silently. When a rewrite is worth it, translate layperson descriptions into accurate domain terms and restate the request as one short, high-signal prompt in the user's own language, preserving intent, scope and constraints 100%, and ask the user to confirm before executing. Use for automatic pre-routing, or when the user asks to "optimize my prompt", "polish this prompt" or runs /prompt-optimizer. --- # Prompt Optimizer First decide whether a rewrite is worth it. If it is, turn the user's words into one dense, ready-to-run prompt and wait for confirmation. Always write in the language the user wrote in. ## 1. Step one: decide REWRITE or SKIP from context - **How to answer** - Called as a standalone router (asked for the verdict only): reply with exactly `REWRITE` or `SKIP`, nothing else. - Running inline before a normal reply: on **SKIP**, stay completely silent about it. Do not mention routing or rewriting, do not load the rest of this skill, just answer or act. On **REWRITE**, continue to section 2. - The user names this skill explicitly (`/prompt-optimizer <text>`, "optimize this prompt"): skip the decision and go to section 2.
prompt-optimizer/README.md prompt-optimizer/README.zh-CN.md prompt-optimizer/SKILL.md prompt-optimizer/hooks/claude-settings.example.json prompt-optimizer/hooks/codex-hooks.example.json prompt-optimizer/hooks/hooks.json.example prompt-optimizer/hooks/prompt-optimizer-agy.js prompt-optimizer/hooks/prompt-optimizer-hook.js …