codex
Codex Skill Guide
When to Use This Skill
Primary Use Cases:
- User explicitly requests
codexCLI execution (Mode 1: Direct CLI) - Complex debugging requiring GPT second opinion (Mode 2: GPT Delegation)
- Deep research on unfamiliar technologies (Mode 2: GPT Delegation)
- Algorithm optimization validation (Mode 2: GPT Delegation)
Do NOT use for:
- Simple code explanations
- Routine file operations
- Standard debugging that Claude can handle directly
Execution Modes
Mode 1: Direct CLI Execution
When: User explicitly asks to run codex CLI (codex exec, codex resume)
Workflow:
-
Utilise
AskUserQuestionto evaluate and extend the users query, providing at least 5 questions, each with multi-select options to determine the best model and reasoning effort. Let the first question include options for the following combinations: -
Execute:
codex exec --skip-git-repo-check -m <MODEL> --config model_reasoning_effort="<EFFORT>" --sandbox <MODE> --full-auto 2>/dev/null -
Inform user: "You can resume with 'codex resume' anytime"
Resuming:
echo "new prompt" | codex exec --skip-git-repo-check resume --last 2>/dev/null
Mode 2: GPT Delegation for Analysis
When: Complex problem needs second opinion (async race conditions, architecture decisions, algorithm validation)
Workflow:
- Analyze context and identify what GPT analysis would help
- Formulate comprehensive query with all relevant context:
- Problem statement
- Current findings
- Code snippets (if applicable)
- Error messages
- Attempted solutions
- Specific questions
- Keep context concise but complete (<10K tokens preferred)
- Execute:
codex -p "<DETAILED CONTEXT>" - Synthesize GPT response into actionable insights
- Report findings with:
- Clear summary of GPT's analysis
- Specific recommendations or solutions
- Additional considerations or caveats
- Next steps if applicable
Error Handling
- Verify codex binary exists before execution:
which codex - Stop immediately on non-zero exit codes and report to user
- Request direction before retrying failed commands
- See 'High-Impact Flags Confirmation' in AskUserQuestion Tool Usage section
before using:
--full-auto--sandbox danger-full-access--skip-git-repo-check(default, but mention to user)
Context Management
- Prioritize most relevant information when building queries
- Summarize background information if context is large
- Break complex problems into specific, answerable questions
- Avoid passing entire codebases - extract relevant snippets
AskUserQuestion Tool Usage
This skill uses the AskUserQuestion tool for all user interactions. Here are the standard invocation patterns:
Initial Configuration (Mode 1, Step 1)
At the start of Mode 1 execution, gather model, reasoning effort, and sandbox mode with a single question:
Invoke the tool like this:
Use AskUserQuestion with:
- Question: "Select codex configuration (model, reasoning effort, and sandbox)"
- Options:
1. "gpt-5.2-codex / high / read-only (Recommended)" - Balanced, analysis only
2. "gpt-5.2-codex / xhigh / read-only" - Max quality, analysis only
3. "gpt-5.2-codex / high / workspace-write" - Balanced, can edit files
4. "gpt-5.2-codex / xhigh / workspace-write" - Max quality, can edit files
5. "gpt-5.2 / medium / read-only" - Faster, general purpose
6. "gpt-5.2-codex / high / danger-full-access" - Network/broad access
7. "Custom" - User will specify model, effort, and sandbox separately
High-Impact Flags Confirmation
Before executing with --full-auto or dangerous flags:
Invoke the tool like this:
Use AskUserQuestion with:
- Question: "Ready to execute with these flags: [LIST FLAGS]. Proceed?"
- Show complete command preview
- Options:
1. "Execute now" - Run as configured
2. "Modify configuration" - Change settings
3. "Cancel" - Abort
Post-Execution Follow-up
After codex command completes:
Invoke the tool like this:
Use AskUserQuestion with:
- Question: "Codex completed. [SUMMARY]. Next steps?"
- Options:
1. "Resume with additional prompt" - Continue session
2. "Analyze results" - Review output
3. "Complete" - Finished
4. "Retry with different config" - Adjust settings
Error Recovery
When command fails or has warnings:
Invoke the tool like this:
Use AskUserQuestion with:
- Question: "Error: [SPECIFIC ERROR]. How to proceed?"
- Show what succeeded vs failed
- Options:
1. "Resume with adjustments" - Fix and continue
2. "Retry with different config" - Change model/effort/sandbox
3. "Accept partial results" - Use what worked
4. "Invoke heal-skill" - Fix outdated SKILL.md
Running a Task
- See 'Initial Configuration' in AskUserQuestion Tool Usage section to gather model, reasoning effort, and sandbox mode in one question
- Assemble the command with the appropriate options:
-m, --model <MODEL>--config model_reasoning_effort="<xhigh|high|medium|low>"--sandbox <read-only|workspace-write|danger-full-access>--full-auto-C, --cd <DIR>--skip-git-repo-check
- Always use --skip-git-repo-check.
- When continuing a previous session, use
codex exec --skip-git-repo-check resume --lastvia stdin. When resuming don't use any configuration flags unless explicitly requested by the user. Resume syntax:echo "your prompt here" | codex exec --skip-git-repo-check resume --last 2>/dev/null. All flags have to be inserted between exec and resume. - IMPORTANT: By default, append
2>/dev/nullto allcodex execcommands to suppress thinking tokens (stderr). Only show stderr if the user explicitly requests to see thinking tokens or if debugging is needed. - Run the command, capture stdout/stderr (filtered as appropriate), and summarize the outcome for the user.
- After Codex completes, inform the user: "You can resume this Codex session at any time by saying 'codex resume' or asking me to continue with additional analysis or changes."
Quick Reference
| Use case | Sandbox mode | Key flags |
|---|---|---|
| Read-only review or analysis | read-only |
--sandbox read-only 2>/dev/null |
| Apply local edits | workspace-write |
--sandbox workspace-write --full-auto 2>/dev/null |
| Permit network or broad access | danger-full-access |
--sandbox danger-full-access --full-auto 2>/dev/null |
| Resume recent session | Inherited from original | echo "prompt" | codex exec --skip-git-repo-check resume --last 2>/dev/null |
| Run from another directory | Match task needs | -C <DIR> plus other flags 2>/dev/null |
Following Up
- After every
codexcommand, see 'Post-Execution Follow-up' in AskUserQuestion Tool Usage section - When resuming, pipe the new prompt via stdin:
echo "new prompt" | codex exec resume --last 2>/dev/null. The resumed session automatically uses the same model, reasoning effort, and sandbox mode from the original session. - Restate the chosen model, reasoning effort, and sandbox mode when proposing follow-up actions.
Error Handling Guidelines
- Stop and report failures whenever
codex --versionor acodex execcommand exits non-zero; request direction before retrying. - See 'High-Impact Flags Confirmation' and 'Error Recovery' in AskUserQuestion Tool Usage section
- When output includes warnings or partial results, see 'Error Recovery' in AskUserQuestion Tool Usage section
Heal-Skill Integration
When codex CLI API changes are detected (command failures, unexpected output formats, or deprecated flags):
- Detection: Notice command failures or API mismatches during execution
- Trigger: Flag skill for healing via
/heal-skill codex - Analysis: Healing agent analyzes current CLI with
codex --helpandcodex features list - Update: Updates skill documentation to match current API
- Validation: Re-validates agent configuration for compatibility
- Model Verification: Ensures only gpt-5.2 and gpt-5.2-codex models are referenced
Common Changes to Monitor:
- New or deprecated command flags
- Changes to sandbox modes or reasoning effort options
- Model availability updates
- MCP integration changes
- Session management API modifications
More from zpankz/mcp-skillset
network-meta-analysis-appraisal
Systematically appraise network meta-analysis papers using integrated 200-point checklist (PRISMA-NMA, NICE DSU TSD 7, ISPOR-AMCP-NPC, CINeMA) with triple-validation methodology, automated PDF extraction, semantic evidence matching, and concordance analysis. Use when evaluating NMA quality for peer review, guideline development, HTA, or reimbursement decisions.
16software-architecture
Guide for quality focused software architecture. This skill should be used when users want to write code, design architecture, analyze code, in any case that relates to software development.
13cursor-skills
Cursor is an AI-powered code editor and development environment that combines intelligent coding assistance with enterprise-grade features and workflow automation. It extends beyond basic AI code comp...
13textbook-grounding
Orthogonally-integrated Hegelian syntopical analysis for SAQ/VIVA/concept grounding with systematic textbook citations. Implements thesis extraction → antithesis identification → abductive synthesis across multiple authoritative sources. Tensor-integrated with /m command: activates S×T×L synergies (textbook-grounding × pdf-search × qmd = 0.95). Triggers on requests for model SAQ responses, VIVA preparation, concept explanations requiring textbook evidence, or any PEX exam content needing systematic cross-reference validation.
12obsidian-process
This skill should be used when batch processing Obsidian markdown vaults. Handles wikilink extraction, tag normalization, frontmatter CRUD operations, and vault analysis. Use for vault-wide transformations, link auditing, tag standardization, metadata management, and migration workflows. Integrates with obsidian-markdown for syntax validation and obsidian-data-importer for structured imports.
12terminal-ui-design
Create distinctive, production-grade terminal user interfaces with high design quality. Use this skill when the user asks to build CLI tools, TUI applications, or terminal-based interfaces. Generates creative, polished code that avoids generic terminal aesthetics.
10