agentleFS
stephen-tataristephen-tatari/claude-skills/codex/SKILL.md

codex

Skill0 starsChanged 10 months agoMITView on GitHub

Executes OpenAI Codex CLI for code analysis, refactoring, and automated editing. Activates when users mention codex commands, code review requests, or automated code transformations requiring advanced reasoning models.

156 other projects use a version of this, 1 of them edited.

Adopted by

Most recently taken up by

Used with

Projects with it also use ios-sync, audit-decisions and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • Saqlain-811Skill

    ios-sync

    Regenerate the iOS debug bridge against the latest upstream gstack templates. (gstack)

    Also in 7 projects that use this

  • dzhngSkill

    audit-decisions

    Audit the decisions an implementing agent made, not its diff — a pure audit that traces the session's history into a decisions ledger, changes no code, and never blocks an unsupervised run. Working code still embeds architecture the user never chose; surface it because future work inherits it. Use when the user wants to review the decisions the AI made on their behalf, before merging or committing AI-implemented work, when integrating a delegated subagent's pass, or when a fix "works" but might be a point fix.

    Also in 4 projects that use this

  • dzhngSkill

    implement-spec-with-codex

    Run [implement-spec](../implement-spec/SKILL.md) with Codex doing the implementation passes while you orchestrate, integrate, and review. Use when the user asks to implement a spec with Codex, or to run implement-spec with Codex as the implementer.

    Also in 4 projects that use this

  • math-incSkill

    minecraft-modpack-server

    Set up a modded Minecraft server from a CurseForge/Modrinth server pack zip. Covers NeoForge/Forge install, Java version, JVM tuning, firewall, LAN config, backups, and launch scripts.

    Also in 6 projects that use this

  • math-incSkill

    pokemon-player

    Play Pokemon games autonomously via headless emulation. Starts a game server, reads structured game state from RAM, makes strategic decisions, and sends button inputs — all from the terminal.

    Also in 6 projects that use this

  • ayudaySkill

    setup-deploy

    Configure deployment settings for /land-and-deploy. Detects your deploy platform (Fly.io, Render, Vercel, Netlify, Heroku, GitHub Actions, custom), production URL, health check endpoints, and deploy status commands. Writes the configuration to CLAUDE.md so all future deploys are automatic. Use when: "setup deploy", "configure deployment", "set up land-and-deploy", "how do I deploy with gstack", "add deploy config".

    Also in 22 projects that use this

  • +1 more from math-inc

The file

Show its rules and text

We split this skill into the rules it gives an agent

28 rules. 0 are common, 12 are distinctive, and 16 are very specific to this project.

  • 0

    Common

    Most of the 132 edited versions we read keep these.

  • 12

    Distinctive

    This author's own choices. Worth a look.

  • 16

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Verify availability: codex --version on first use per session

    line 14
  2. Very specific:

    Default to 2>&1 so errors are visible in output

    line 44
  3. Very specific:

    Only use 2>/dev/null when user explicitly requests clean output or after confirming the command works

    line 45
  4. Distinctive:

    Check exit code (0 = success)

    line 48
  5. Very specific:

    Use @path syntax to include file contents in prompts:

    line 66
  6. Very specific:

    Use absolute paths with --skip-git-repo-check: @/full/path/to/file.py

    line 75
  7. Distinctive:

    Check exit code (non-zero = failure)

    line 222
  8. Very specific:

    Ask user for direction via AskUserQuestion

    line 224
  9. Very specific:

    Before using high-impact flags, request user approval via AskUserQuestion:

    line 230
  10. Distinctive:

    When output contains warnings:

    line 238
  11. Very specific:

    Use AskUserQuestion to determine next steps

    line 242
  12. Very specific:

    Verify stderr is captured with 2>&1 (not suppressed with 2>/dev/null)

    line 283
  13. Very specific:

    Test minimal command: codex exec -m gpt-5.2 "hello world"

    line 286
  14. Very specific:

    Verify model access: codex exec --model gpt-5.2 "test"

    line 287
  15. Very specific:

    Check configured model: grep model ~/.codex/config.toml

    line 295
  16. Distinctive:

    Verify API access: Ensure valid credentials

    line 296
  17. Very specific:

    Use OSS fallback: --oss (requires Ollama)

    line 298
  18. Very specific:

    Use codex resume to open the session picker

    line 306
  19. Distinctive:

    Check if session expired or was cleaned up

    line 308
  20. Distinctive:

    read-only: Default for any analysis or review

    line 322
  21. Distinctive:

    Create profiles for common workflows:

    line 335
  22. Very specific:

    Use @path syntax for all file input: "analyze @src/main.py and @src/utils.py"

    line 344
  23. Very specific:

    Prefer multiple @path references over separate commands

    line 346
  24. Distinctive:

    If errors persist after troubleshooting:

    line 395
  25. Distinctive:

    Ask user: model + reasoning effort

    line 437
  26. Distinctive:

    If changes needed: resume with workspace-write

    line 440
  27. Distinctive:

    Use high reasoning effort

    line 456
  28. Distinctive:

    Run comprehensive analysis (read-only)

    line 457

“Common” is measured: kept by at least 6 in 10 of the 132 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md
<!-- Based on claude-skill-codex by Yipeng Sun (https://github.com/sypsyp97/claude-skill-codex) --><!-- Original work licensed under MIT License. Copyright (c) 2025 Yipeng Sun. -->

Codex Execution Skill

Prerequisites

  • Codex CLI installed and configured (~/.codex/config.toml)
  • Verify availability: codex --version on first use per session

Workflow Checklist

For every Codex task, follow this sequence:

  1. ☐ Ask user for execution parameters via AskUserQuestion (single prompt):
    • Model: gpt-5.2, gpt-5.2-pro, gpt-5.3-codex or default
    • Reasoning effort: none, low, medium, high, xhigh
  2. ☐ Determine sandbox mode based on task:
    • read-only: Code review, analysis, documentation
    • workspace-write: Code modifications, file creation
    • danger-full-access: System operations, network access
  3. ☐ Build command with required flags:

    codex exec [OPTIONS] "PROMPT"

    Essential flags:

    • -m <MODEL> (if overriding default)
    • -c model_reasoning_effort="<LEVEL>"
    • -s <SANDBOX_MODE>
    • --skip-git-repo-check (if outside git repo)
    • -C <DIRECTORY> (if changing workspace)
    • --full-auto (for non-interactive execution, cannot be used with --yolo)
  4. ☐ Execute with stderr capture:
    • Default to 2>&1 so errors are visible in output
    • Only use 2>/dev/null when user explicitly requests clean output or after confirming the command works
  5. ☐ Validate execution:
    • Check exit code (0 = success)
    • Summarize output for user
    • Report errors with actionable solutions
  6. ☐ Inform about resume capability:
    • "Resume this session anytime: codex resume"

Command Patterns

Read-Only Analysis

codex exec -m gpt-5.2 -c model_reasoning_effort="medium" -s read-only \
  --skip-git-repo-check --full-auto "review @file.py for security issues" 2>&1

File References

Use @path syntax to include file contents in prompts:

codex exec -m gpt-5.2 -c model_reasoning_effort="medium" -s read-only \
  --skip-git-repo-check --full-auto \
  "Review @/path/to/plan.md and @/path/to/config.md for issues" 2>&1
  • Relative paths work inside git repos: @src/module.py
  • Use absolute paths with --skip-git-repo-check: @/full/path/to/file.py
  • Multiple files: include several @path references in one prompt

Code Modification

codex exec -m gpt-5.3-codex -c model_reasoning_effort="xhigh" -s workspace-write \
  --skip-git-repo-check --full-auto "refactor @module.py to async/await" 2>&1

Resume Session

codex exec --skip-git-repo-check resume --last "fix the remaining issues" 2>&1

Cross-Directory Execution

codex exec -C /path/to/project -m gpt-5.2 -c model_reasoning_effort="medium" \
  -s read-only --skip-git-repo-check --full-auto "analyze architecture" 2>&1

Profiles

codex exec --profile production -c model_reasoning_effort="high" \
  --full-auto "optimize performance in @app.py" 2>&1

CLI Reference

Core Flags

FlagValuesWhen to Use
-m, --modelgpt-5.2, gpt-5.2-pro, gpt-5.3-codex, gpt-5-mini, gpt-5-nanoOverride default model
-c, --configkey=valueRuntime config override (repeatable)
-s, --sandboxread-only, workspace-write, danger-full-accessSet execution permissions
-a, --ask-for-approvaluntrusted, on-failure, on-request, neverDirect approval policy flag
--yoloflagBypasses all sandbox restrictions (alias for --dangerously-bypass-approvals-and-sandbox). Cannot be used with --full-auto
-C, --cdpathChange workspace directory
--skip-git-repo-checkflagAllow execution outside git repos
--full-autoflagNon-interactive mode (workspace-write + approvals on failure). Cannot be used with --yolo
--add-dir <DIR>pathAdditional writable directories
--searchflagEnable live web search tool
--enable/--disable<FEATURE>Feature flag toggles
-p, --profilestringLoad configuration profile from config.toml
--jsonflagJSON event output (CI/CD pipelines)
-o, --output-last-messagepathWrite final message to file
-i, --imagepath[,path...]Attach images (repeatable or comma-separated)
--ossflagUse local open-source model (requires Ollama)

Configuration Options

Model Reasoning Effort (-c model_reasoning_effort="<LEVEL>"):

  • none: Minimal reasoning for low-latency interactions
  • low: Standard operations, routine refactoring
  • medium: Complex analysis, architectural decisions (default)
  • high: Critical code, security audits, complex algorithms
  • xhigh: Extremely complex problems requiring maximum reasoning depth

Model Verbosity (-c model_verbosity="<LEVEL>"):

  • low: Minimal output
  • medium: Balanced detail (default)
  • high: Verbose explanations

Approval Prompts (-c approvals="<WHEN>"):

  • on-request: Before any tool use
  • on-failure: Only on errors (default for --full-auto)
  • untrusted: Minimal prompts
  • never: No interruptions (use with caution)

Configuration Management

Config File Location

~/.codex/config.toml

Runtime Overrides

# Override single setting
codex exec -c model="gpt-5.2" "task"

# Override multiple settings
codex exec -c model="gpt-5.2" -c model_reasoning_effort="high" "task"

Profile Definitions

Define in config.toml:

[profiles.research]
model = "gpt-5.2"
model_reasoning_effort = "high"
sandbox = "read-only"

[profiles.development]
model = "gpt-5.3-codex"
sandbox = "workspace-write"

Use with:

codex exec --profile research "analyze codebase"

Resume Behavior

Automatic inheritance:

  • Model selection
  • Reasoning effort
  • Sandbox mode
  • Configuration overrides

Resume syntax:

# Resume last session
codex exec resume --last

# Resume with new prompt
codex exec resume --last "continue with next steps"

# Resume specific session
codex exec resume <SESSION_ID> "follow-up task"

Flag injection (between exec and resume):

# Change reasoning effort for resumed session
codex exec -c model_reasoning_effort="high" resume --last

Error Handling

Validation Loop

  1. Execute command
  2. Check exit code (non-zero = failure)
  3. Report error with context
  4. Ask user for direction via AskUserQuestion
  5. Retry with adjustments or escalate
  6. Stop after 3 failed attempts — reassess approach before continuing

Permission Requests

Before using high-impact flags, request user approval via AskUserQuestion:

  • --full-auto: Automated execution
  • -s danger-full-access: System-wide access
  • --yolo / --dangerously-bypass-approvals-and-sandbox: Full system access

Partial Success Handling

When output contains warnings:

  1. Summarize successful operations
  2. Detail failures with context
  3. Use AskUserQuestion to determine next steps
  4. Propose specific adjustments

Troubleshooting

File Access Blocked

Symptom: "shell is blocked by the sandbox" or permission errors

Root cause: Sandbox read-only mode restricts file system

Solutions (priority order):

  1. File references (recommended):

    codex exec -m gpt-5.2 -c model_reasoning_effort="medium" -s read-only \
      --skip-git-repo-check --full-auto "review @target.py" 2>&1
  2. Explicit permissions:

    codex exec -m gpt-5.2 -s read-only \
      -c 'sandbox_permissions=["disk-full-read-access"]' \
      --skip-git-repo-check --full-auto "review @file.py" 2>&1
  3. Upgrade sandbox:

    codex exec -m gpt-5.2 -s workspace-write \
      --skip-git-repo-check --full-auto "review @file.py" 2>&1

Exit Code Failures

Symptom: Non-zero exit without clear message

Diagnostic steps:

  1. Verify stderr is captured with 2>&1 (not suppressed with 2>/dev/null)
  2. Verify installation: codex --version
  3. Check configuration: cat ~/.codex/config.toml
  4. Test minimal command: codex exec -m gpt-5.2 "hello world"
  5. Verify model access: codex exec --model gpt-5.2 "test"

Model Unavailable

Symptom: "model not found" or authentication errors

Solutions:

  1. Check configured model: grep model ~/.codex/config.toml
  2. Verify API access: Ensure valid credentials
  3. Try alternative model: -m gpt-5.2-pro or -m gpt-5-mini
  4. Use OSS fallback: --oss (requires Ollama)

Session Resume Fails

Symptom: Cannot resume previous session

Diagnostic steps:

  1. Use codex resume to open the session picker
  2. Try --last flag instead of specific ID
  3. Check if session expired or was cleaned up

Best Practices

Reasoning Effort Selection

  • none: Minimal reasoning for low-latency interactions, quick syntax fixes
  • low: Standard refactoring, basic analysis
  • medium: Complex refactoring, architecture review
  • high: Security audits, algorithm optimization, critical bugs
  • xhigh: Extremely complex problems requiring maximum reasoning depth

Sandbox Mode Selection

  • read-only: Default for any analysis or review
  • workspace-write: File modifications only
  • danger-full-access: Network operations, system commands (rare)

Stderr Handling

  • Default to 2>&1 to capture errors in output for visibility
  • Use 2>/dev/null only when:
    • User explicitly requests clean output without thinking tokens
    • Command is confirmed working and output noise is undesirable

Profile Usage

Create profiles for common workflows:

  • review: High reasoning, read-only
  • refactor: Medium reasoning, workspace-write
  • quick: Low reasoning, read-only
  • security: High reasoning, workspace-write

File Input

  • Use @path syntax for all file input: "analyze @src/main.py and @src/utils.py"
  • Relative paths inside git repos, absolute paths with --skip-git-repo-check
  • Prefer multiple @path references over separate commands

Safety Guidelines

Always verify before:

  • Using danger-full-access sandbox
  • Disabling approval prompts on production systems
  • Running with --yolo on machines with elevated privileges

Ask user approval for:

  • First-time workspace-write usage
  • System-wide access requests
  • Destructive operations (deletions, migrations)

Advanced Usage

CI/CD Integration

codex exec --json -o result.txt -m gpt-5.2 \
  -c model_reasoning_effort="medium" \
  --skip-git-repo-check --full-auto \
  "run security audit on changed files" 2>&1

Batch Processing

for file in *.py; do
  codex exec -m gpt-5.2 -c model_reasoning_effort="low" \
    --skip-git-repo-check --full-auto "lint and format @$file" 2>&1
done

Multi-Step Workflows

# Step 1: Analysis
codex exec -m gpt-5.2 -c model_reasoning_effort="high" -s read-only \
  --full-auto "analyze @codebase for architectural issues" 2>&1

# Step 2: Resume with changes
codex exec -s workspace-write resume --last "implement suggested refactoring" 2>&1

When to Escalate

If errors persist after troubleshooting:

  1. Check documentation:

    WebFetch https://developers.openai.com/codex/cli/reference
    WebFetch https://developers.openai.com/codex/local-config#cli
  2. Report to user:
    • Error message verbatim
    • Attempted solutions
    • Configuration details
    • Exit codes and stderr output
  3. Request guidance:
    • Alternative approaches
    • Configuration adjustments
    • Manual intervention points

Model Selection Guide

Task TypeRecommended ModelReasoning Effort
Quick syntax fixesgpt-5.3-codexnone
Simple refactoringgpt-5.3-codexlow
Code reviewgpt-5.2high
Complex refactoringgpt-5.3-codexhigh
Architecture analysisgpt-5.2xhigh
Security auditgpt-5.2high
Algorithm optimizationgpt-5.3-codexxhigh
Documentation generationgpt-5.2low
Tough algorithmic problemsgpt-5.2-proxhigh
High-throughput tasksgpt-5.2none

Common Workflows

Code Review Workflow

  1. Ask user: model + reasoning effort
  2. Run read-only analysis
  3. Present findings
  4. If changes needed: resume with workspace-write
  5. Validate changes
  6. Inform about resume capability

Refactoring Workflow

  1. Ask user: model + reasoning effort
  2. Analyze current code (read-only)
  3. Propose changes
  4. Get user approval
  5. Apply changes (workspace-write)
  6. Run validation/tests
  7. Report results

Security Audit Workflow

  1. Use high reasoning effort
  2. Run comprehensive analysis (read-only)
  3. Document findings
  4. Propose fixes
  5. Apply fixes if approved (workspace-write)
  6. Re-audit to verify
  7. Generate report

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.