Analyze raw prompts, identify intent and gaps, inventory the current oh-my-codex skill catalog across local/upstream sources, choose the best-fit skill chain, and output a ready-to-paste optimized prompt for Codex. 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", "帮我优化这个指令". 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.
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.
A direct command skips the review prompt. Inspect the source before running it.
Analyze raw prompts, identify intent and gaps, inventory the current oh-my-codex skill catalog across local/upstream sources, choose the best-fit skill chain, and output a ready-to-paste optimized prompt for Codex. 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", "帮我优化这个指令". 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.
Analyze a draft prompt, critique it, match it to oh-my-codex installed skills,
and output a complete optimized prompt the user can paste and run in Codex.
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 Codex 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 explicitly invokes the prompt-optimize skill by name
Do Not Use When
User wants the task done directly (just execute it)
User says "优化代码", "优化性能", "optimize this code", "optimize performance"
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.
Run this pipeline sequentially. Present results using the Output Format below.
Phase 0: Project Detection
Before analyzing the prompt, detect the current project context:
Check if AGENTS.md or CLAUDE.md exists in the working directory — read it for conventions
build.gradle / pom.xml → Java / Kotlin / Spring Boot
Package.swift → Swift / iOS
Gemfile → Ruby
composer.json → PHP
*.csproj / *.sln → .NET
Makefile / CMakeLists.txt → C / C++
Note detected tech stack for Phase 3 and Phase 4
If no project files found, flag "tech stack unknown" in Phase 4.
Phase 0.5: Lightweight Skill Catalog Inventory
Before recommending any skill, build a lightweight view of the current
project skill catalog and resolve likely aliases. This phase is a routing index,
not a full skill-body review.
Token budget rule:
Prefer the runtime skill index cache at .omcodex/cache/skill-index.json.
If missing or stale, suggest running npm run catalog:skill-index or let
tooling fall back to catalog/frontmatter lookup.
Use catalog/manifest data such as src/catalog/manifest.json,
src/catalog/generated/public-catalog.json, or templates/catalog-manifest.json
to confirm source, intent, layer, and conflicts.
If catalog files are missing or stale, inspect only each SKILL.md
frontmatter block (name, description, intent, layer, origin,
version). Do not read every skill body.
Prefer .agent/skills/local/**/SKILL.md over upstream copies when duplicate
names exist.
Include upstream sources under .agent/skills/upstream/**/SKILL.md only as
candidates, using metadata/frontmatter first.
Group available skills by intent/layer instead of dumping a long flat list:
planning, execution, debugging, testing, review, verification, research,
documentation, frontend, backend, security, orchestration, skill-management.
Shortlist at most 2-5 candidate skills or chains, then read full skill bodies
only for the shortlisted skills if the prompt needs precise workflow details.
For short, clear prompts, skip full body reads entirely and use metadata plus
the best-practice chains below.
Recommend only skills that appear in the current project/runtime catalog. If a
well-known capability is absent, name the nearest installed substitute and
state the substitution.
This keeps prompt optimization fast: catalog/frontmatter lookup is cheap, while
full skill loading is reserved for ambiguous or high-risk choices.
"Change the workflow from direct execution to conductor"
If a prompt contains multiple intents, split them instead of flattening them
into one instruction. Preserve explicit order signals such as "先 X 再 Y".
Phase 2: Scope Assessment
Scope
Heuristic
Orchestration
Conductor Gate
TRIVIAL
Single file, < 50 lines
Direct execution
Skip
LOW
Single component or module
Single skill
Skip
MEDIUM
Multiple components, same domain
Skill chain + verify
Optional; suggest when future follow-up is likely
HIGH
Cross-domain, 5+ files, several phases, or several skills
conductor track + phased execution
Default
EPIC
Multi-session, multi-PR, architectural shift
conductor required; use ralplan only if conductor is unavailable
Required
For new requirements, prefer conductor when the work is HIGH/EPIC or when
the prompt asks for durable context, a track, spec/plan/review artifacts, or
multi-session continuity. Do not force conductor for TRIVIAL/LOW tasks; that
adds ceremony without improving execution.
When using grill-me or any other workflow, check whether it changes the
project's durable intent layer:
Requirements, scope, acceptance criteria, architecture, workflow rules, or
long-lived delivery plan changed -> include conductor refresh/new-track or
reconcile steps in the optimized prompt.
Pure implementation technique, debugging method, review pass, or verification
gate with no intent change -> use the workflow directly and do not add
conductor solely for formality.
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 up to 3 clarification questions before
generating the optimized prompt. Incorporate answers into the output.
Phase 5: Workflow & Model Recommendation
Lifecycle position:
Research → Plan → Implement (TDD) → Review → Verify → Commit
For MEDIUM tasks, start with plan unless the task explicitly needs durable
artifacts. For HIGH/EPIC tasks, start with conductor; use ralplan as a
blueprint helper only when conductor is unavailable or the user explicitly
requests it.
Model recommendation:
Scope
Model
Rationale
TRIVIAL-LOW
Sonnet 4.6
Fast, cost-efficient
MEDIUM
Sonnet 4.6
Best coding model for standard work
HIGH
Sonnet 4.6 (impl) + Opus 4.7 (planning)
Opus for architecture decisions
EPIC
Opus 4.7 (conductor/spec planning) + Sonnet 4.6 (execution)
Deep reasoning for multi-session planning
Multi-prompt splitting (for HIGH/EPIC scope):
Prompt 1: Research + Plan (research/deepsearch skill, then conductor for HIGH/EPIC or plan for MEDIUM)
Prompt 2–N: Implement one phase per prompt (each ends with verify skill)
Final Prompt: Integration test + code-review across all phases
Use project-session-manager skill to preserve context between sessions
Output Format
Present analysis in this exact structure. Respond in the same language as the user's input.
Section 1: Prompt Diagnosis
Strengths: What the original prompt does well.
Issues:
Issue
Impact
Suggested Fix
(problem)
(consequence)
(how to fix)
Needs Clarification: Numbered list of questions (omit if Phase 0 auto-detected the answer).
Section 2: Recommended oh-my-codex Skills
Start with a compact catalog summary based on catalog/frontmatter metadata, not
full-body reads:
Skill Group
Best Matches Found
Why Relevant
Orchestration
conductor
Durable track/spec/plan/review for HIGH+ new requirements
Then list only the selected skill chain. If full skill bodies were read, name
which ones and why; otherwise state "metadata-only routing was sufficient."
Type
Skill
Purpose
Planning
plan
Architecture before coding
Testing
tdd
Test-driven implementation
Review
code-review
Post-implementation review
Verification
verify
Confirm correctness
Model
Sonnet 4.6
Recommended for this scope
Only list skills that are actually useful for this task. Do not pad the table.
State when conductor was deliberately skipped because scope is TRIVIAL/LOW.
Section 3: Optimized Prompt — Full Version
Present the complete optimized prompt inside a single fenced code block.
Must be self-contained and ready to copy-paste into Codex. Include:
Clear task description with context
Tech stack (detected or specified)
Skill invocations at the right workflow stages (write as: "Use the plan skill to...")
Acceptance criteria
Verification steps
Scope boundaries (what NOT to do)
Do NOT use slash-command syntax — Codex activates skills via conversation, not
slash commands. Write skill references as natural language:
"Use the plan skill", "Run tdd skill", "Apply verify skill".
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 (name, email, avatar_url, bio)
- Input validation for all fields
- Auth: require valid token, users can only update own profile
- Return 200 with updated user on success; 400 for validation errors; 401/403 for auth
Workflow:
1. Use `plan` skill to design endpoint structure, middleware chain, and validation logic
2. Use `tdd` skill — write table-driven tests for success, validation failure, auth failure, not-found
3. Implement following existing handler patterns in the codebase
4. Use `code-review` skill + `security-review` skill
5. Use `verify` skill — run full test suite, confirm no regressions
Do not: modify existing endpoints, change database schema, add new dependencies without
first using `deepsearch` skill to check existing ones.
Example 3: EPIC Scope
User input:
Migrate our monolith to microservices
Optimized Prompt (Full):
Use the `conductor` skill to create a durable track for:
"Migrate monolith to microservices architecture"
Before executing, the track spec and plan must answer:
1. Which domain boundaries exist in the current monolith?
2. Which service to extract first (lowest coupling)?
3. Communication pattern: REST, gRPC, or event-driven?
4. Database strategy: shared DB initially or database-per-service?
5. Deployment target: Kubernetes, Docker Compose, or serverless?
Track phases:
- Phase 1: Identify service boundaries, create domain map
- Phase 2: Set up infrastructure (API gateway, CI/CD per service)
- Phase 3: Extract first service (strangler fig pattern)
- Phase 4: Verify with integration tests, extract next service
- Phase N: Decommission monolith
Each phase = 1 PR with `verify` skill gate.
Use `project-session-manager` skill between phases to preserve context.
Use `using-git-worktrees` skill for parallel service extraction.
Recommended: Opus 4.7 for conductor/spec planning, Sonnet 4.6 for phase execution.
Installed Skills Reference
Before using this reference, refresh it from .agent/skills/local and
.agent/skills/upstream and prefer local overrides. Key skill groups commonly
available in this oh-my-codex installation:
Planning & Architecture:plan, brainstorming, architect-planner, planning-methodology, planning-with-files, ralplan, ultrawork, ralph