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-eccinstead) - User wants a skill inventory (use
skill-stocktakeinstead) - 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.mdexists in the working directory — read it for project conventions - Detect tech stack from project files:
package.json→ Node.js / TypeScript / React / Next.jsgo.mod→ Gopyproject.toml/requirements.txt→ PythonCargo.toml→ Rustbuild.gradle/pom.xml→ Java / Kotlin (then check forquarkusin build file → Quarkus, orspring-boot→ Spring Boot)Package.swift→ SwiftGemfile→ Rubycomposer.json→ PHP*.csproj/*.sln→ .NETMakefile/CMakeLists.txt→ C / C++cpanfile/Makefile.PL→ Perl
- 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 1: Intent Detection
Classify the user's task into one or more categories:
Phase 2: Scope Assessment
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.
Phase 3: ECC Component Matching
Map intent + scope + tech stack (from Phase 0) to specific ECC components.
By Intent Type
By Tech Stack
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?
- Security requirements — Auth, input validation, secrets?
- Testing expectations — Unit, integration, E2E?
- Performance constraints — Load, latency, resource limits?
- UI/UX requirements — Design specs, responsive, a11y? (if frontend)
- 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:
For MEDIUM+ tasks, always start with /plan. For EPIC tasks, use blueprint skill.
Model recommendation (include in output):
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
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:
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
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. Include:
- Clear task description with context
- Tech stack (detected or specified)
- /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).
Section 4: Optimized Prompt — Quick Version
A compact version for experienced ECC users. Vary by intent type:
Section 5: Enhancement Rationale
Footer
Not what you need? Tell me what to adjust, or make a normal task request if you want execution instead of prompt optimization.
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
Optimized Prompt (Full):
Example 2: Moderate English Prompt
User input:
Phase 0 detects: go.mod with Go 1.22, Chi router
Optimized Prompt (Full):
Example 3: EPIC Project
User input:
Optimized Prompt (Full):

