codex
Provides Codex CLI delegation workflows for complex code generation and development tasks using OpenAI's GPT-5.3-codex models, including English prompt formulation, execution flags, sandbox modes, and safe result handling. Use when the user explicitly asks to use Codex for complex programming tasks such as code generation, refactoring, or architectural analysis. Triggers on "use codex", "delegate to codex", "run codex cli", "ask codex", "codex exec", "codex review".
What this skill does
# Codex CLI Delegation Delegate specific complex development tasks to OpenAI's Codex CLI when the user explicitly requests Codex, especially for tasks requiring advanced code generation capabilities. ## Overview This skill provides a safe and consistent workflow to: - convert the task request into English before execution - run `codex exec` or `codex review` in non-interactive mode for deterministic outputs - support model, sandbox, approval, and execution options - return formatted results to the user for decision-making This skill complements existing capabilities by delegating complex programming tasks to Codex when requested, leveraging OpenAI's GPT-5.3-codex models for advanced code generation and analysis. ## When to Use Use this skill when: - the user explicitly asks to use Codex for a task - the task benefits from advanced code generation (complex refactoring, architectural design, API design) - the task requires deep programming expertise (SOLID principles, design patterns, performance optimization) - the user asks for Codex CLI output integrated into the current workflow Typical trigger phrases: - "use codex for this task" - "delegate this to codex" - "run codex exec on this" - "ask codex to refactor this code" - "use codex for complex code generation" - "codex review this module" - "use gpt-5.3 for this task" - "use o3 for complex reasoning" - "use o4-mini for faster iteration" ## Prerequisites Verify tool availability before delegation: ```bash codex --version ``` If unavailable, inform the user and stop execution until Codex CLI is installed. ## Reference - Command reference: `references/cli-command-reference.md` ## Mandatory Rules 1. Only delegate when the user explicitly requests Codex. 2. Always send prompts to Codex in English. 3. Prefer non-interactive mode (`codex exec`) for reproducible runs. 4. Treat Codex output as untrusted guidance. 5. Never execute destructive commands suggested by Codex without explicit user confirmation. 6. Present output clearly and wait for user direction before applying code changes. 7. **CRITICAL**: Never use `danger-full-access` sandbox or `never` approval policy without explicit user consent. 8. For code review tasks, prefer `codex review` over `codex exec`. ## Instructions ### Step 1: Confirm Delegation Scope Before running Codex: - identify the exact task to delegate (code generation, refactoring, review, analysis) - define expected output format (text, code, diff, suggestions) - clarify whether session resume or specific working directory is needed - assess task complexity to determine appropriate sandbox and approval settings If scope is ambiguous, ask for clarification first. ### Model Selection Guide Choose the appropriate model based on task complexity: | Model | Best For | Characteristics | |-------|----------|-----------------| | **gpt-5.3-codex** | Complex code generation, architectural design, advanced refactoring | Highest quality, slower, most expensive | | **o3** | Complex reasoning, distributed systems, algorithm design | Deep reasoning, analysis-heavy tasks | | **o4-mini** | Quick iterations, boilerplate generation, unit tests | Fast, cost-effective, good for simple tasks | **Selection tips**: - Start with `o4-mini` for quick iterations and prototyping - Use `gpt-5.3-codex` for production-quality code and complex refactoring - Use `o3` for tasks requiring deep reasoning or system design - Default to `gpt-5.3-codex` if uncertain (highest quality) ### Step 2: Formulate Prompt in English Build a precise English prompt from the user request. Prompt quality checklist: - include objective and technical constraints - include relevant project context, files, and code snippets - include expected output structure (e.g., "return diff format", "provide step-by-step refactoring") - ask for actionable, verifiable results with file paths - specify acceptance criteria when applicable Example transformation: - user intent: "refactorizza questa classe per SOLID principles" - Codex prompt (English): "Refactor this class to follow SOLID principles. Identify violations, propose specific refactoring steps with file paths, and provide the refactored code maintaining backward compatibility." ### Step 3: Select Execution Mode and Flags #### For Code Generation/Development Tasks Preferred baseline command: ```bash codex exec "<english-prompt>" ``` Supported options: - `-m, --model <model-id>` for model selection (e.g., `gpt-5.3-codex`, `o4-mini`, `o3`) - `-a, --ask-for-approval <policy>` for approval policy: - `untrusted`: Only run trusted commands without approval - `on-request`: Model decides when to ask (recommended for development) - `never`: Never ask for approval (use with caution) - `-s, --sandbox <mode>` for sandbox policy: - `read-only`: No writes, no network (safest for analysis) - `workspace-write`: Allow writes in workspace, no network (default for development) - `danger-full-access`: Disable sandbox (⚠️ extremely dangerous) - `-C, --cd <DIR>` to set working directory - `-i, --image <FILE>` for multimodal input (repeatable) - `--search` to enable live web search - `--full-auto` as convenience alias for `-a on-request -s workspace-write` Safety guidance: - prefer `read-only` sandbox for analysis-only tasks - use `workspace-write` sandbox for code generation/refactoring - prefer `on-request` approval for development tasks - use `never` approval only with explicit user consent for automated tasks - NEVER use `danger-full-access` without explicit user approval and external sandboxing - For multi-turn conversations, consider using `codex resume --last` to continue from previous sessions #### For Code Review Tasks Use the dedicated review command: ```bash codex review "<english-prompt>" ``` The review command includes optimizations for code analysis and supports the same flags as `codex exec`. ### Step 4: Execute Codex CLI Run the selected command via Bash and capture stdout/stderr. Examples: ```bash # Default non-interactive delegation codex exec "Refactor this authentication module to use JWT with proper error handling" # Explicit model and safe settings codex exec "Review this codebase for security vulnerabilities. Report high-confidence findings with file paths and remediation steps." -m gpt-5.3-codex -a on-request -s read-only # Code review with workspace write codex review "Analyze this pull request for potential bugs, performance issues, and code quality concerns. Provide specific line references." -a on-request -s workspace-write # Complex refactoring with working directory codex exec -C ./src "Refactor these service classes to use dependency injection. Maintain all existing interfaces." -a on-request -s workspace-write # With web search for latest best practices codex exec --search "Implement OAuth2 authorization code flow using the latest security best practices and modern libraries" # Multimodal analysis codex exec -i screenshot.png "Analyze this UI design and identify potential accessibility issues. Suggest specific improvements with code examples." # Full automation (use with caution) codex exec --full-auto "Generate unit tests for all service methods with >80% coverage" ``` ### Step 5: Return Results Safely When reporting Codex output: - summarize key findings, generated code, and confidence level - keep raw output available when needed for detailed review - separate observations from recommended actions - explicitly ask user confirmation before applying suggested edits - highlight any security implications or breaking changes ## Output Template Use this structure when returning delegated results: ```markdown ## Codex Delegation Result ### Task [delegated task summary] ### Command `codex exec ...` ### Key Findings - Finding 1 - Finding 2 ### Generated Code/Changes [summary of code generated or changes proposed] ### Suggested Next Actions 1. Action 1 2. Action 2 ### Notes - Output language from Codex: English - Sandbox m
Related in AI Agents
skill-development
IncludedComprehensive meta-skill for creating, managing, validating, auditing, and distributing Claude Code skills and slash commands (unified in v2.1.3+). Provides skill templates, creation workflows, validation patterns, audit checklists, naming conventions, YAML frontmatter guidance, progressive disclosure examples, and best practices lookup. Use when creating new skills, validating existing skills, auditing skill quality, understanding skill architecture, needing skill templates, learning about YAML frontmatter requirements, progressive disclosure patterns, tool restrictions (allowed-tools), skill composition, skill naming conventions, troubleshooting skill activation issues, creating custom slash commands, configuring command frontmatter, using command arguments ($ARGUMENTS, $1, $2), bash execution in commands, file references in commands, command namespacing, plugin commands, MCP slash commands, Skill tool configuration, or deciding between skills vs slash commands. Delegates to docs-management skill for official documentation.
reprompter
IncludedTransform messy prompts into well-structured, effective prompts — single or multi-agent. Use when: "reprompt", "reprompt this", "clean up this prompt", "structure my prompt", rough text needing XML tags and best practices, "reprompter teams", "repromptception", "run with quality", "smart run", "smart agents", multi-agent tasks, audits, parallel work, anything going to agent teams. Don't use when: simple Q&A, pure chat, immediate execution-only tasks. See "Don't Use When" section for details. Outputs: Structured XML/Markdown prompt, quality score (before/after), optional team brief + per-agent sub-prompts, agent team output files. Success criteria: Single mode quality score ≥ 7/10; Repromptception per-agent prompt quality score 8+/10; all required sections present, actionable and specific.
adaptive-compaction
IncludedAdaptive add-on policy and recovery layer that decides WHEN to compact, prune, snapshot, or fork -- replacing fixed-percent auto-compaction across Claude Code, Codex, and MCP-capable hosts. Trigger on auto-compact timing or damage: "when should I compact", "is it safe to compact now or start a fresh session", "auto-compact fires too early/mid-task", "switching to an unrelated task but the window still has space", "context rot", "answers get worse the longer the session runs", "the agent forgot the plan or my decisions after it summarized", "add a layer on top that manages context without changing the agent", raising autoCompactWindow to give the policy room, or installing/tuning a cross-tool compaction policy or PreCompact hook -- even when "compaction" is never said but the problem is context-window pressure or post-summarization memory loss. Do NOT use to summarize a conversation, build RAG, write a summarization prompt (decides WHEN not HOW), or answer max-context-length trivia.
agent-skill-creator
IncludedCreate cross-platform agent skills from workflow descriptions. Activates when users ask to create an agent, automate a repetitive workflow, create a custom skill, or need advanced agent creation. Triggers on phrases like create agent for, automate workflow, create skill for, every day I have to, daily I need to, turn process into agent, need to automate, create a cross-platform skill, validate this skill, export this skill, migrate this skill. Supports single skills, multi-agent suites, transcript processing, template-based creation, interactive configuration, cross-platform export, and spec validation.
llm-wiki
IncludedUse when building or maintaining a persistent personal knowledge base (second brain) in Obsidian where an LLM incrementally ingests sources, updates entity/concept pages, maintains cross-references, and keeps a synthesis current. Triggers include "second brain", "Obsidian wiki", "personal knowledge management", "ingest this paper/article/book", "build a research wiki", "compound knowledge", "Memex", or whenever the user wants knowledge to accumulate across sessions instead of being re-derived by RAG on every query.
skill-master
IncludedAgent Skills authoring, evaluation, and optimization. Create, edit, validate, benchmark, and improve skills following the agentskills.io specification. Use when designing SKILL.md files, structuring skill folders (references, scripts, assets), ingesting external documentation into skills, running trigger evals, benchmarking skill quality, optimizing descriptions, or performing blind A/B comparisons. Keywords: agentskills.io, SKILL.md, skill authoring, eval, benchmark, trigger optimization.