codex-agent
Use when you want a second-opinion review via Codex CLI, cross-verification after another agent implements changes, debugging help, or alternative implementation proposals. Requires Codex CLI to be installed and authenticated.
What this skill does
# Codex Agent Collaboration Skill This skill enables Claude Code to collaborate with OpenAI's Codex CLI agent. ## Optional Codex Review Workflow Use this workflow when the user asks for Codex review, wants a second opinion, or needs cross-verification from a separate coding agent. ### Step 1: Call Codex for Review ```bash codex exec -C <project_path> -s read-only -o /tmp/codex-review.md \ "Review the code in <file_or_directory>. Check for: - Security vulnerabilities - Performance issues - Code quality and best practices - Potential bugs and edge cases - Naming and readability Provide specific, actionable feedback with file paths and line numbers." ``` ### Step 2: Read Codex Feedback ```bash cat /tmp/codex-review.md ``` ### Step 3: Apply Fixes Based on Codex Feedback For each issue identified by Codex: 1. Read the relevant file 2. Apply the fix using Edit tool 3. Verify the fix addresses Codex's concern ### Step 4: Re-verify with Codex (Optional) ```bash codex exec -C <project_path> -s read-only \ "Verify the fixes applied to <files>. Confirm issues are resolved." ``` ## Workflow Examples ### Example 1: Review and Fix a Single File ```bash # Step 1: Get Codex review codex exec -C /project -s read-only -o /tmp/codex-review.md \ "Review src/auth/login.ts for security vulnerabilities and code quality issues. Provide specific line numbers and fixes." # Step 2: Read the feedback cat /tmp/codex-review.md ``` Then the primary agent reads the feedback, applies fixes with Edit tool, and optionally re-verifies. ### Example 2: Review Recent Changes ```bash # Get diff of recent changes git diff HEAD~1 > /tmp/recent-changes.diff # Step 1: Have Codex review the diff codex exec -C /project -s read-only -o /tmp/codex-review.md \ "Review the changes in the last commit. Check for bugs, security issues, and improvements needed." # Step 2: Read and apply fixes cat /tmp/codex-review.md ``` ### Example 3: Full Project Review ```bash # Step 1: Comprehensive review codex exec -C /project -s read-only -o /tmp/codex-review.md \ "Perform a comprehensive code review of src/. Focus on: 1. Security vulnerabilities (OWASP Top 10) 2. Error handling patterns 3. Performance bottlenecks 4. Code duplication Prioritize issues by severity (critical/high/medium/low)." # Step 2: Read prioritized feedback cat /tmp/codex-review.md ``` ## Review Request Format When asking Codex for review, include: ``` Review <target_files_or_directory>. Context: - Project type: <TypeScript/Python/etc> - Framework: <Express/React/etc> - Focus areas: <security/performance/quality> Check for: 1. Security vulnerabilities 2. Performance issues 3. Error handling 4. Code quality 5. Edge cases Output format: For each issue: - File: <path> - Line: <number> - Severity: critical/high/medium/low - Issue: <description> - Fix: <specific code change> ``` ## Applying Fixes After receiving Codex feedback, apply fixes systematically: 1. **Parse the review** - Extract each issue with file, line, severity 2. **Prioritize** - Fix critical/high issues first 3. **Read file** - Use Read tool to see current code 4. **Apply fix** - Use Edit tool with precise old_string/new_string 5. **Track progress** - Mark each issue as fixed ## Prerequisites Codex CLI must be installed and authenticated: ```bash # Install via npm npm install -g @openai/codex # Or via Homebrew (macOS) brew install --cask codex # Authenticate codex login ``` ## Command Reference ### Basic Command Pattern ```bash codex exec [options] "<task_description>" ``` ### Core Options | Option | Description | |--------|-------------| | `"<task>"` | Task description (positional, must be quoted) | | `-C <dir>` | Working directory (use absolute path) | | `-s read-only` | Read-only sandbox (use for reviews) | | `-o <path>` | Save output to file | | `--json` | Output as JSON Lines | ### AI-to-AI Communication When communicating with Codex, PRIORITIZE ACCURACY AND PRECISION: - Use structured data and exact technical terms - Provide full file paths and precise details - Include relevant context from the current codebase - NO conversational formatting needed ## Other Use Cases ### Cross-Verification (after Claude implements) ```bash codex exec -C /project -s read-only \ "Verify the implementation in src/feature/. Check correctness and edge cases." ``` ### Get Alternative Implementation ```bash codex exec -C /project -s read-only -o /tmp/alternative.md \ "Propose an alternative implementation for the caching in src/cache/manager.ts" ``` ### Debugging Assistance ```bash codex exec -C /project -s read-only \ "Debug: tests in tests/auth.test.ts failing with timeout. Analyze root cause." ``` ## Session Management For multi-turn reviews: ```bash # Initial review codex exec -C /project -s read-only "Review src/api/ for security issues" # Note session ID from output # Follow-up after fixes codex exec resume <session_id> "I've applied the fixes. Please re-verify." ``` ## Troubleshooting ### Authentication Issues ```bash codex logout codex login ``` ### Check Installation ```bash codex --version which codex ``` ## See Also - [scripts/check-codex.sh](scripts/check-codex.sh) - Local Codex CLI availability check - [scripts/codex-wrapper.sh](scripts/codex-wrapper.sh) - Wrapper for repeatable Codex CLI invocation - [sandbox-modes.md](sandbox-modes.md) - Sandbox security levels - [examples.md](examples.md) - More usage examples - [advanced.md](advanced.md) - Advanced configuration
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.