Analyze raw prompts, identify intent and gaps, match ECC components (skills/commands/agents/hooks), and output a ready-to-paste optimized prompt. Advisory role only — never executes the task itself. TRIGGER when: user says "optimize prompt", "improve my prompt", "how to write a prompt for", "help me prompt", "rewrite this prompt", or explicitly asks to enhance prompt quality. Also triggers on Chinese equivalents: "优化prompt", "改进prompt", "怎么写prompt", "帮我优化这个指令". Specially handles short Chinese bug reports (the dominant real-world use case): runs Bug Report Triage to extract repro/expected/actual/environment, asks up to 3 clarifying questions if ≤ 2 fields are present, and inserts systematic-debugging as a hard prerequisite before any code change. DO NOT TRIGGER when: user wants the task executed directly, or says "just do it" / "直接做". DO NOT TRIGGER when user says "优化代码", "优化性能", "optimize performance", "optimize this code" — those are refactoring/performance tasks, not prompt optimization (unless the user exp
Installation
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Analyze raw prompts, identify intent and gaps, match ECC components (skills/commands/agents/hooks), and output a ready-to-paste optimized prompt. Advisory role only — never executes the task itself. TRIGGER when: user says "optimize prompt", "improve my prompt", "how to write a prompt for", "help me prompt", "rewrite this prompt", or explicitly asks to enhance prompt quality. Also triggers on Chinese equivalents: "优化prompt", "改进prompt", "怎么写prompt", "帮我优化这个指令". Specially handles short Chinese bug reports (the dominant real-world use case): runs Bug Report Triage to extract repro/expected/actual/environment, asks up to 3 clarifying questions if ≤ 2 fields are present, and inserts systematic-debugging as a hard prerequisite before any code change. DO NOT TRIGGER when: user wants the task executed directly, or says "just do it" / "直接做". DO NOT TRIGGER when user says "优化代码", "优化性能", "optimize performance", "optimize this code" — those are refactoring/performance tasks, not prompt optimization (unless the user explicitly invokes /prompt-optimize, in which case treat them as Bug Fix + Refactor combined).
origin
community
metadata
{"author":"YannJY02","version":"1.3.0","changelog":"1.3.0 — Phase 0.7 Project Context Probe. The skill now reads the actual\n repo (stack manifest, git state, README/CLAUDE.md/AGENTS.md)\n before producing the optimized prompt, so recommendations cite\n real file paths, branch names, and declared versions instead of\n generic templates. Hard rules R1-R6.5 prevent the probe from\n misleading downstream agents:\n • R1 — 3-section Facts / Inferences (UNVERIFIED) / Unknown block\n • R2 — never reference code symbols the probe did not actually Read\n (commit subjects and branch names are not code verification)\n • R3 — branch names do not determine intent; skill selection uses\n user prompt + Facts.stack only\n • R4 — declared manifest version ≠ installed version; lockfile\n must be checked when exact runtime version matters\n • R5 — README/CLAUDE.md/AGENTS.md content gets 1 line + source +\n last-modified date; declared-vs-detected conflicts get\n an explicit ⚠️ flag\n • R6 — mandatory \"Re-verify before mutating\" footer in every block\n • R6.5 — probe failures are explicit (\"PROBE FAILED: <reason>\"),\n never silently empty\n Section 3 (Optimized Prompt — Full) now MUST start with the verbatim\n Context Block and cite ≥ 2 Facts. Self-check gate added before\n publishing output. New Example 5 demonstrates the full probe →\n 3-section block → safe \"starting points to verify\" output pattern\n on a real SwiftUI iOS scenario. Budget: ≤ 6 read-only tool calls.\n Graceful degradation: works in non-git dirs, unknown stacks, and\n repos without self-description docs.\n1.2.1 — Fix phantom `/tdd` references (13 occurrences across Phase 1.5\n template, Phase 3 By-Intent table, Section 4 Quick Patterns,\n and all four examples). No `tdd` skill or command actually\n exists; the canonical name is `test-driven-development`\n (superpowers) — already mapped in the Phase 0.5 alias table\n but not applied to our own templates. This release closes that\n self-inconsistency. Added explicit `/tdd → /test-driven-development`\n row in the alias table to prevent regression.\n1.2.0 — Skill Existence & Alias Resolution (Phase 0.5) so we stop\n recommending phantom skills (`tdd-workflow`, `search-first`,\n `blueprint`, `tdd-guide` agent, etc. that don't exist on most\n installs). Multi-Intent Detection in Phase 1 with structured\n patterns and scope-bump rule. Conductor scope-gating column\n in Phase 2 (TRIVIAL/LOW skip, MEDIUM optional, HIGH default,\n EPIC required) — prevents over-ceremonialized small tasks.\n Best-Practices Skill Chains subsection in Phase 3 documenting\n the superpowers pipeline per intent (New Feature, Bug Fix,\n Performance, Research-then-Build, Multi-Intent, Refactor).\n1.1.0 — Added Bug Report Triage (Phase 1.5), Compact Mode (Phase 6),\n Tauri/Electron tech stacks, Research-then-Build intent,\n Performance intent, conductor/systematic-debugging/trace/analyze\n in component matching, real-data Chinese bug example.\n Driven by 8 real /prompt-optimize invocations: 7/8 were Chinese\n bug reports, 1/8 was research-then-build.\n1.0.0 — Initial release.\n"}
Prompt Optimizer
Analyze a draft prompt, critique it, match it to ECC ecosystem components,
and output a complete optimized prompt the user can paste and run.
When to Use
User says "optimize this prompt", "improve my prompt", "rewrite this prompt"
User says "help me write a better prompt for..."
User says "what's the best way to ask Claude Code to..."
User says "优化prompt", "改进prompt", "怎么写prompt", "帮我优化这个指令"
User pastes a draft prompt and asks for feedback or enhancement
User says "I don't know how to prompt for this"
User says "how should I use ECC for..."
User explicitly invokes /prompt-optimize
Do Not Use When
User wants the task done directly (just execute it)
User says "优化代码", "优化性能", "optimize this code", "optimize performance" — these are refactoring tasks, not prompt optimization
User is asking about ECC configuration (use configure-ecc instead)
User wants a skill inventory (use skill-stocktake instead)
User says "just do it" or "直接做"
How It Works
Advisory only — do not execute the user's task.
Do NOT write code, create files, run commands, or take any implementation
action. Your ONLY output is an analysis plus an optimized prompt.
If the user says "just do it", "直接做", or "don't optimize, just execute",
do not switch into implementation mode inside this skill. Tell the user this
skill only produces optimized prompts, and instruct them to make a normal
task request if they want execution instead.
Run this 6-phase pipeline sequentially. Present results using the Output Format below.
Analysis Pipeline
Phase 0: Project Detection
Before analyzing the prompt, detect the current project context:
Check if a CLAUDE.md exists in the working directory — read it for project conventions
electron.json / electron-builder.json / electron in package.json deps → Electron
expo.json / app.json with Expo SDK → React Native (Expo)
build.gradle / pom.xml → Java / Kotlin / Spring Boot
Package.swift → Swift
Gemfile → Ruby
composer.json → PHP
*.csproj / *.sln → .NET
Makefile / CMakeLists.txt → C / C++
cpanfile / Makefile.PL → Perl
Git context auto-pull — if the user's prompt mentions 当前分支 / current branch / this PR / 本次改动, run these read-only commands and inject results into Phase 4 context:
git status --short (uncommitted changes)
git log -5 --oneline (recent commits)
git diff --stat HEAD~1 (latest commit's surface area)
This converts vague references into concrete file lists.
Note detected tech stack for use in Phase 3 and Phase 4
If no project files are found (e.g., the prompt is abstract or for a new project),
skip detection and flag "tech stack unknown" in Phase 4.
Phase 0.5: Skill Existence & Alias Resolution
The component tables below were authored against a generic ECC distribution.
Many users run OMC, superpowers, or their own custom installs where the same
capability lives under a different skill name. Recommending a phantom skill
wastes the user's time.
Preferred check (live index): before listing a skill in Section 2 / Section 3,
read the auto-generated catalog:
cat ~/.claude/skills/_index.md
This file is regenerated by omc-manage setup (or manually via
omc-manage skill index) and contains one row per installed skill with its
name | description. Grep it for keywords from the user's intent:
If a recommended skill does not appear in _index.md, replace it with a
matching installed skill or fall back to the alias table below.
Fallback rule (when index is missing or empty): mentally check
"Is this skill likely installed locally?" If unsure, follow the alias table
or add a verification note.
Common alias map (generic ECC name → likely real names):
Generic ECC name
superpowers / OMC actual
Verification
tdd-workflow (skill)
test-driven-development (superpowers) OR tdd-generator (OMC)
ls ~/.claude/skills/test-driven-development
/tdd (slash) — no such command/skill
/test-driven-development (slash-invokes the superpowers skill)
ls ~/.claude/skills/test-driven-development
verification-loop (skill)
verification-before-completion (superpowers) OR verification-loop (OMC)
both common
search-first (skill)
external-context OR iterative-retrieval
check both
blueprint (skill)
conductor (preferred multi-session driver)
ls ~/.claude/skills/conductor
e2e-testing (skill)
e2e
—
tdd-guide (agent)
test-engineer (OMC)
—
build-error-resolver (agent)
debugger (OMC)
—
refactor-cleaner (agent)
code-simplifier (OMC)
—
doc-updater (agent)
writer (OMC)
—
python-reviewer / go-reviewer / etc.
usually just code-reviewer
—
Tech-stack-specific patterns (django-patterns, springboot-patterns,
frontend-patterns, etc., listed in the By Tech Stack table) are aspirational
on most installs — assume absent unless the user confirms otherwise. When
referencing them in Section 3, write:
If you don't have <skill-name> installed, recommend the universal coding-standards skill instead, or use the conventions in the project's CLAUDE.md.
Discovery shortcut for the user: if _index.md is missing entirely, suggest
they run omc-manage skill index --scope user (or just omc-manage setup,
which regenerates it as a side effect). For a quality audit, use
/oh-my-claudecode:skill-stocktake.
Goal: Ground the optimized prompt in what is actually true in this repo
right now, not in generic templates. Without this phase, the skill produces
plausible-sounding prompts that may reference nonexistent files, wrong
versions, or off-stack tooling — the user's actual complaint.
Budget: ≤ 6 read-only tool calls. Each step is independent — failures
degrade gracefully (see R6.5), never abort the whole phase.
One Glob with combined pattern: {package.json,Package.swift,Cargo.toml,go.mod,pyproject.toml,requirements.txt,*.csproj,Gemfile,pubspec.yaml,pom.xml,build.gradle*,mix.exs,composer.json}
The probe always emits this block, even when most fields are UNKNOWN.
It is appended to the top of Section 3: Optimized Prompt (see Output
Format) and must remain verbatim — no paraphrasing, no summarization.
## 🔍 Project Context (probed YYYY-MM-DD HH:MM — starting point, NOT ground truth)### Facts (directly observed in probe)- Stack: <name + declaredversion> ← from `<manifest>:<line>` (declared, installed version not verified)
- Repo: <basenameofcwd> @ branch `<branch>` (<Ncommitsaheadof <base>, or "no upstream tracking">)
- Uncommitted: <M/A/D files, or "clean working tree">- Recent commit subjects (commit messages only — NOT code verification):
-`<hash>` "<subject>"
-`<hash>` "<subject>"
- Recent diff scope (`git diff --stat HEAD~1`): <file>: +N -M (or "no diff since HEAD~1")
- Project self-description (`<source-file>:<line>`, last modified <date>): "<firstnon-emptyheading + openingline>"
### Inferences (UNVERIFIED — confirm before acting)-<e.g., "Likely SwiftUI iOS work based on Package.swift + branch name">-<e.g., "Stack manifest declares X but no lockfile read — installed version may differ">### Unknown / Not Probed- Whether <symbolmentionedincommitsubjects> actually exists in source — Read source before referencing it as if it does
- Runtime/installed versions (only declared manifest was read)
- Whether project self-description still matches current architecture (last modified <date>)
⚠️ Re-verify before mutating: run `git status`, `Read` actual files. This block
is probe-time context, not authoritative. If observation contradicts this
block, trust observation and ignore this block.
6 anti-misleading hard rules (binding on Phase 3 / Phase 4 outputs):
These rules prevent the probe from producing context that downstream agents
treat as truth when it is in fact inference, name-based guessing, or stale
data. Violation = regenerate the optimized prompt.
ID
Rule
Why
R1
Block MUST be 3-section: ### Facts / ### Inferences (UNVERIFIED) / ### Unknown / Not Probed. Never mix categories. A fact mis-labeled as fact-but-actually-inferred is the primary misleading vector.
Forces explicit epistemic status on every line.
R2
Do not reference code symbols the probe did not actually read. A symbol seen only in a commit subject or branch name is NOT verified to exist. It may appear in Inferences or Unknown, never as an imperative ("extend AuthService").
A commit titled "add AuthService stub" does not prove AuthService exists, is complete, or is at the path one might guess.
R3
Branch names do not determine intent. A branch named feat/auth is a weak signal at best; it goes only in Inferences. Phase 3 skill selection is driven only by user prompt + Facts.stack.
Branch names are user-authored labels with no semantic guarantee.
R4
Manifest version ≠ installed version. All version facts must be marked declared in <manifest>, installed not verified. Tasks that need exact runtime version must explicitly check lockfile (package-lock.json, Cargo.lock, Package.resolved, poetry.lock, etc.).
package.json says React 18, node_modules may have 17.
R5
README / CLAUDE.md / AGENTS.md content gets 1 line + source + last-modified date. If declared description contradicts detected stack, append ⚠️ Conflict: declared "<X>" but stack indicates <Y> — verify with user.
Self-description docs drift; stack manifests do not.
R6
Banner footer is mandatory. The ⚠️ Re-verify before mutating line MUST appear verbatim at the bottom of every Context Block.
Drives downstream agent to treat block as starting context, not ground truth.
R6.5
Probe failures are explicit, never silently empty. Any failed action writes PROBE FAILED: <reason> for that field. Downstream agents seeing PROBE FAILED know to re-probe themselves; they would misread an empty field as "no problem".
An empty uncommitted field looks like a clean working tree.
Classify the user's task into one or more categories:
Order matters: explicit "先 X 再 Y" is sequential; "X + Y" with no
ordering signal — recommend a default order based on dependency
(e.g., investigation before fix, fix before refactor, refactor before docs).
Stop conditions per intent: each track gets its own /verify gate; do
NOT proceed to track 2 until track 1's verify passes.
Note on Performance intent: The skill's "Do Not Use When" rule blocks 优化性能as a trigger — but if the user explicitly invoked /prompt-optimize with a performance task, treat it like Bug Fix + Refactor combined: investigate first (analyze/trace), then refactor with measurement gates.
Phase 1.5: Bug Report Triage (only if Intent = Bug Fix or Performance)
Bug reports are the highest-volume use case for this skill, and they fail in
predictable ways: vague repro, missing environment, no expected/actual.
For Bug Fix and Performance intents, you MUST score the prompt against this
checklist before generating the optimized prompt.
Field
What to extract
Default if missing
Repro steps
Concrete numbered steps to trigger the bug
Mark TODO: 用户补充复现步骤
Expected behavior
What should happen
Infer from prompt or mark TODO
Actual behavior
What does happen (error message, screenshot, log)
Mark TODO
Environment
OS (macOS/Windows/Linux), version, browser, device
Ask if absent and prompt mentions cross-platform symptoms
Reproducibility
100% / 偶现 (intermittent) / "first time"
Default 100% if not stated
Recent changes
Branch name, recent commits, suspected commit
Auto-fill via git log -5 (Phase 0)
Logs / stack trace
Error text, console output, network response
Mark TODO: 粘贴完整错误日志/截图
Scoring rule:
≥ 5 fields present → proceed to Phase 2 directly
3–4 fields present → fill TODO markers in optimized prompt; do NOT block
≤ 2 fields present → ask the user up to 3 clarifying questions BEFORE generating prompt. Prioritize: (1) repro, (2) environment if "偶现"/"intermittent"/cross-platform mentioned, (3) actual error/log
If Phase 0 detected a project, use codebase size as a signal. Otherwise, estimate
from the prompt description alone and mark the estimate as uncertain.
Scope
Heuristic
Orchestration
Conductor recommendation
TRIVIAL
Single file, < 50 lines
Direct execution
Skip — overkill
LOW
Single component or module
Single command or skill
Skip — single skill is enough
MEDIUM
Multiple components, same domain
Command chain + /verify
Optional — offer it but don't force; user choice
HIGH
Cross-domain, 5+ files
/plan first, then phased execution
Default ON — conductor track keeps phases coherent across reviews
EPIC
Multi-session, multi-PR, architectural shift
conductor (or blueprint) for multi-session plan
Required — single-session execution will lose context
Why the gating matters: Recommending conductor for a TRIVIAL task ("rename
this variable") creates .omc/conductor/<track>/spec.md etc. — pure ceremony
overhead. Conductor's value (durable spec/plan/review across sessions) only
pays off when the task itself is durable (HIGH+).
Multi-intent override: per Phase 1, multi-intent prompts bump scope by
one level. So a MEDIUM task with 2 intents → HIGH → conductor defaults ON.
Phase 3: ECC Component Matching
Map intent + scope + Phase 0.7 Facts.stack to specific ECC components.
HARD RULE (binding): Component selection MUST be driven by Project Context Block → Facts → Stack when present. When matching the By-Tech-Stack
table below, skip rows that do not match the detected stack — never list
React skills for a Swift project, never list Django skills for a Go project.
Inferences and Unknown fields are advisory only — they MAY surface a
"verify this assumption" note, but MUST NOT drive skill selection.
If Facts.stack is unknown (no manifest detected), fall back to the
language-agnostic intent-only recommendations and explicitly say so in
Section 5 rationale: "Stack unknown — recommendations are generic; user
should re-run after declaring stack."
The two tables above pick single skills; this subsection wires them into
ordered chains that match documented community best practices (primarily
the superpowers pipeline). Use these chains in Section 3 — don't just dump a
flat list of skills.
Chain notation:A → B → C means run A first, then B, then C, with each
step gated by its own success criterion. [X] = optional, include only if
scope/risk warrants it.
analyze (baseline measurement: profile / timing)
→ trace (locate hotspot with evidence)
→ writing-plans (which optimizations, in what order)
→ test-driven-development (regression test for behavior)
→ [implement] (one optimization at a time)
→ verification-before-completion (re-measure: did it actually improve?)
→ finishing-a-development-branch
Chain: Research-then-Build
external-context (study reference implementation)
→ produce comparison report (what to copy, what to skip, what to adapt)
→ brainstorming (apply learnings to our context)
→ conductor (init multi-phase track)
→ phase-1: minimal viable port
→ phase-2: project-specific adaptations
→ phase-3: integration + tests
→ finishing-a-development-branch
Chain: Multi-Intent Prompt
brainstorming (decompose into intents, prioritize)
→ conductor (multi-track init) (one track per intent)
→ for each track in dependency order:
→ use the appropriate single-intent chain above
→ /verify gate before next track starts
→ finishing-a-development-branch (one PR or split per track, user's call)
Chain: Refactor (no behavior change)
[code-review of current state] (understand existing intent)
→ writing-plans (refactor steps, each behavior-preserving)
→ test-driven-development (characterization tests if absent)
→ ai-slop-cleaner (only if cleaning AI-generated bloat)
→ verification-before-completion (behavior unchanged: tests still pass)
→ finishing-a-development-branch
When to deviate from these chains:
User explicitly says "skip TDD" → drop test-driven-development
Project's CLAUDE.md mandates a different workflow → follow it (CLAUDE.md > skill chains, per superpowers using-superpowers priority rule)
Time-boxed prototype / spike → can drop verification-before-completion + requesting-code-review (mark explicitly: "this is a spike, not production")
Phase 4: Missing Context Detection
Scan the prompt for missing critical information. Check each item and mark
whether Phase 0 auto-detected it or the user must supply it:
Tech stack — Detected in Phase 0, or must user specify?
Target scope — Files, directories, or modules mentioned?
Acceptance criteria — How to know the task is done?
Error handling — Edge cases and failure modes addressed?
Database changes — Schema, migrations, indexes? (if data layer)
Existing patterns — Reference files or conventions to follow?
Scope boundaries — What NOT to do?
If 3+ critical items are missing, ask the user up to 3 clarification
questions before generating the optimized prompt. Then incorporate the
answers into the optimized prompt.
Phase 5: Workflow & Model Recommendation
Determine where this prompt sits in the development lifecycle:
Research → Plan → Implement (TDD) → Review → Verify → Commit
For MEDIUM+ tasks, always start with /plan. For EPIC tasks, use blueprint skill.
Model recommendation (include in output):
Scope
Recommended Model
Rationale
TRIVIAL-LOW
Sonnet 4.6
Fast, cost-efficient for simple tasks
MEDIUM
Sonnet 4.6
Best coding model for standard work
HIGH
Sonnet 4.6 (main) + Opus 4.6 (planning)
Opus for architecture, Sonnet for implementation
EPIC
Opus 4.6 (blueprint) + Sonnet 4.6 (execution)
Deep reasoning for multi-session planning
Multi-prompt splitting (for HIGH/EPIC scope):
For tasks that exceed a single session, split into sequential prompts:
Prompt 1: Research + Plan (use search-first skill, then /plan)
Prompt 2-N: Implement one phase per prompt (each ends with /verify)
Final Prompt: Integration test + /code-review across all phases
Use /save-session and /resume-session to preserve context between sessions
For multi-session structured delivery, prefer the conductor skill (creates .omc/conductor/ tracks with Context → Spec → Plan → Implement artifacts that survive across sessions)
Phase 6: Compact Mode (output short-circuit)
When ALL of these are true, skip Section 1 (Diagnosis) and Section 5 (Rationale)
in the output — just deliver Section 2 (Components) + Section 3 (Full prompt) +
Section 4 (Quick) + Footer:
Original prompt is < 300 characters AND
Single, well-defined issue (no multi-part request) AND
Tech stack auto-detected in Phase 0 AND
Bug Triage scored ≥ 5/7 OR intent ≠ Bug Fix
Why: Real telemetry shows the majority of /prompt-optimize invocations
are short Chinese bug reports. Forcing them through full diagnosis adds reading
overhead with no signal. Diagnosis tables matter when prompts are ambiguous —
not when they're already concrete.
If Compact Mode triggers, prefix Section 2 with: > Compact mode (short single-issue prompt). Full diagnosis skipped — ask if you want it.
Output Format
Present your analysis in this exact structure. Respond in the same language
as the user's input.
Section 1: Prompt Diagnosis
Strengths: List what the original prompt does well.
Issues:
Issue
Impact
Suggested Fix
(problem)
(consequence)
(how to fix)
Needs Clarification: Numbered list of questions the user should answer.
If Phase 0 auto-detected the answer, state it instead of asking.
Section 2: Recommended ECC Components
Type
Component
Purpose
Command
/plan
Plan architecture before coding
Skill
tdd-workflow
TDD methodology guidance
Agent
code-reviewer
Post-implementation review
Model
Sonnet 4.6
Recommended for this scope
Section 3: Optimized Prompt — Full Version
Present the complete optimized prompt inside a single fenced code block.
The prompt must be self-contained and ready to copy-paste.
MANDATORY STRUCTURE (binding):
First, paste the Project Context Block from Phase 0.7 verbatim.
Do not summarize, do not paraphrase. The downstream agent needs the same
epistemic separation (Facts / Inferences / Unknown) the probe produced.
Then, a blank line.
Then, the task content, which MUST:
Cite at least 2 specific items from Facts by file path, branch
name, manifest line, or commit hash. Generic language like "use the
existing auth code" is a FAIL — replace with "Read
Sources/Auth/LoginView.swift (uncommitted change, see Facts)".
Phrase next-step references as starting points to verify, NOT as
imperatives. Good: "Read LoginView.swift first to see what's
already there." Bad: "Extend LoginView.swift."
Never reference a code symbol that appeared only in Inferences or
Unknown (R2 — see Phase 0.7). Such references must downgrade to
"search Grep for X before assuming it exists."
Other required content:
Clear task description (after Context Block)
/command invocations at the right workflow stages
Acceptance criteria
Verification steps
Scope boundaries (what NOT to do)
For items that reference blueprint, write: "Use the blueprint skill to..."
(not /blueprint, since blueprint is a skill, not a command).
Self-check gate (run before publishing Section 3 output):
Check
If FAIL
Does Section 3 start with the verbatim Project Context Block?
Regenerate; prepend the block
Does the task content cite ≥ 2 items from Facts by name/path?
Regenerate; replace generic references with specific Facts
Does any imperative reference a symbol that only appeared in Inferences or Unknown?
Regenerate; downgrade to "verify before extending"
Is the ⚠️ Re-verify before mutating footer present in the block?
Regenerate; add the footer
Section 4: Optimized Prompt — Quick Version
A compact version for experienced ECC users. Vary by intent type:
Intent
Quick Pattern
New Feature
/plan [feature]. /test-driven-development to implement. /code-review. /verify.
Bug Fix
Use systematic-debugging for [bug] — list 3 hypotheses, verify each. Then /test-driven-development: write failing test, fix to green. /verify.
Bug Fix (intermittent)
Use trace skill for [intermittent bug] — competing hypotheses with evidence. Build flaky-repro harness in /e2e. Fix only after 100% repro. /verify.
Bug Fix (cross-platform)
Use systematic-debugging for [bug]. Repro on both [platform A] and [platform B]. Fix. /verify on both platforms.
Performance
Use analyze for [slow path] — measure baseline first (timing/profile). Identify top 3 hotspots. Fix one at a time, re-measure after each. /verify regression.
Refactor
/refactor-clean [scope]. /code-review. /verify.
Research
Use external-context skill for [topic]. /plan based on findings.
Research-then-Build
Use external-context to study [reference X]. Produce comparison report. Then use conductor skill to track delivery: spec → plan → /test-driven-development per phase.
Testing
/test-driven-development [module]. /e2e for critical flows. /test-coverage.
Review
/code-review. Then use security-reviewer agent.
Docs
/update-docs. /update-codemaps.
EPIC
Use conductor skill (or blueprint) for "[objective]". Execute phases with /verify gates.
Section 5: Enhancement Rationale
Enhancement
Reason
(what was added)
(why it matters)
Footer
Not what you need? Tell me what to adjust, or make a normal task request
if you want execution instead of prompt optimization.
For bug reports: before pasting the optimized prompt into a new session,
attach any error logs, stack traces, or screenshots — they make the
investigation 10× faster than text descriptions alone.
Examples
Trigger Examples
"Optimize this prompt for ECC"
"Rewrite this prompt so Claude Code uses the right commands"
"帮我优化这个指令"
"How should I prompt ECC for this task?"
Example 1: Vague Chinese Prompt (Project Detected)
User input:
帮我写一个用户登录页面
Phase 0 detects:package.json with Next.js 15, TypeScript, Tailwind CSS
Add a REST API endpoint for user profile updates with validation
Phase 0 detects:go.mod with Go 1.22, Chi router
Optimized Prompt (Full):
Add a REST API endpoint for user profile updates (PATCH /api/users/:id).
Tech stack: Go 1.22 + Chi router (detected from project)
Requirements:
- PATCH /api/users/:id — partial update of user profile
- Input validation for fields: name, email, avatar_url, bio
- Auth: require valid token, users can only update own profile
- Return 200 with updated user on success
- Return 400 with validation errors on invalid input
- Return 401/403 for auth failures
- Follow existing API patterns in the codebase
Workflow:
1. /plan the endpoint structure, middleware chain, and validation logic
2. /test-driven-development — write table-driven tests for success, validation failure, auth failure, not-found
3. Implement following existing handler patterns
4. /go-review
5. /verify — run full test suite, confirm no regressions
Do not:
- Modify existing endpoints
- Change the database schema (use existing user table)
- Add new dependencies without checking existing ones first (use search-first skill)
Example 3: Chinese Bug Report (real-data pattern)
User input:
当前分支的分享 html 项目或者 md 文档的功能,存在一个问题,就是如果用户修改已经分享的文件,无法再次分享,这样链接始终不会发生改变
Use systematic-debugging for "分享 HTML/MD 后修改文件链接不更新" — list 3 hypotheses
(cache key, hash strategy, idempotent API), verify each. /test-driven-development write failing e2e.
Fix to green. /verify on macOS + Windows.
Example 4: EPIC Project
User input:
Migrate our monolith to microservices
Optimized Prompt (Full):
Use the blueprint skill to plan: "Migrate monolith to microservices architecture"
Before executing, answer these questions in the blueprint:
1. Which domain boundaries exist in the current monolith?
2. Which service should be extracted first (lowest coupling)?
3. Communication pattern: REST APIs, gRPC, or event-driven (Kafka/RabbitMQ)?
4. Database strategy: shared DB initially or database-per-service from start?
5. Deployment target: Kubernetes, Docker Compose, or serverless?
The blueprint should produce phases like:
- Phase 1: Identify service boundaries and create domain map
- Phase 2: Set up infrastructure (API gateway, service mesh, CI/CD per service)
- Phase 3: Extract first service (strangler fig pattern)
- Phase 4: Verify with integration tests, then extract next service
- Phase N: Decommission monolith
Each phase = 1 PR, with /verify gates between phases.
Use /save-session between phases. Use /resume-session to continue.
Use git worktrees for parallel service extraction when dependencies allow.
Recommended: Opus 4.6 for blueprint planning, Sonnet 4.6 for phase execution.
Example 5: Phase 0.7 — Project-Aware Recommendation (SwiftUI repo)
Demonstrates the v1.3.0 probe + 3-section Context Block + safe "starting
points to verify" output. Note how the optimized prompt avoids referencing
AuthService as if it exists (R2) and labels the branch signal as inference
only (R3).
## 🔍 Project Context (probed 2026-05-27 14:30 — starting point, NOT ground truth)
### Facts (directly observed in probe)
- Stack: Swift 6.0 + SwiftUI, target iOS 18 ← from `Package.swift:5` (declared, installed toolchain not verified)
- Repo: AcmeApp @ branch `feat/auth` (2 commits ahead of `main`)
- Uncommitted: M `Sources/Auth/LoginView.swift`
- Recent commit subjects (commit messages only — NOT code verification):
- `a1b2c3` "add AuthService stub"
- `d4e5f6` "wire keychain"
- `9f8e7d` "scaffold Auth module"
- Recent diff scope (`git diff --stat HEAD~1`): `Sources/Auth/LoginView.swift`: +45 -12
- Project self-description (`CLAUDE.md:1`, last modified 2026-04-30): "AcmeApp iOS companion (SwiftUI)"
### Inferences (UNVERIFIED — confirm before acting)
- Likely SwiftUI auth feature work in progress (branch name + recent commit subjects)
- A type named "AuthService" may exist (commit subject reference) — NOT verified by reading any file
### Unknown / Not Probed
- Whether `AuthService` actually exists as a Swift type — `Grep "AuthService" Sources/` before referencing
- Installed Swift toolchain version (only `Package.swift` declared version was read)
- Whether `LoginView.swift` is the intended host for login UI or just a scratch file
⚠️ Re-verify before mutating: run `git status`, `Read` actual files. This block
is probe-time context, not authoritative. If observation contradicts this
block, trust observation and ignore this block.
---
**Task**: Implement login functionality for AcmeApp.
**Required skills**: `swiftui-pro` (review/idiom), `test-driven-development` (write failing test first).
**Starting points to verify (NOT commands to obey blindly):**
1. `Sources/Auth/LoginView.swift` already has uncommitted changes (+45 -12 vs HEAD~1). **Read it first** to see what's already drafted before adding new code.
2. Commit log mentions "AuthService stub" — **before** importing or extending it, run `Grep "AuthService" Sources/` to confirm the type exists and is at a usable state. Treat the name as a lead, not a fact.
3. Branch is `feat/auth` with 2 commits ahead of `main` — verify this is the intended working branch. If unclear, ask the user.
4. `CLAUDE.md` declares SwiftUI iOS — use SwiftUI APIs (`@State`, `@Observable`, `NavigationStack`) and `iOS 18` features. Confirm by reading `Package.swift` platforms array before using iOS-26-only APIs.
**Workflow:**
1. `Read Sources/Auth/LoginView.swift` → understand existing scaffold.
2. `Grep` for `AuthService`, `Keychain` patterns → ground the implementation in what exists.
3. Use `test-driven-development`: write failing test for the login happy path first.
4. Implement minimum code to pass; let `swiftui-pro` review the View structure.
5. `/verify` — build, run tests, manually exercise the simulator flow.
**Acceptance criteria:**
- Login screen accepts email + password input, validates non-empty
- Successful auth navigates to main app screen
- Failed auth shows inline error
- Credentials persist via Keychain (extend existing wiring from `d4e5f6`, do NOT re-implement)
- Unit tests cover validation + success + failure paths
**Scope boundaries:**
- Do NOT redesign `AuthService` interface — extend it if it exists; flag for user if it doesn't
- Do NOT switch branch — work continues on `feat/auth`
- Do NOT introduce a new auth library (no Firebase / Auth0 / etc.) without asking
Why this output is safer than the v1.2.x style:
v1.2.x risk
v1.3.0 mitigation
Would have said "Use swiftui-pro to add login" without naming files