$npx -y skills add jackspace/ClaudeSkillz --skill codexExecutes 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.
| 1 | # Codex Execution Skill |
| 2 | |
| 3 | ## Prerequisites |
| 4 | - Codex CLI installed and configured (`~/.codex/config.toml`) |
| 5 | - Verify availability: `codex --version` on first use per session |
| 6 | |
| 7 | ## Workflow Checklist |
| 8 | |
| 9 | **For every Codex task, follow this sequence**: |
| 10 | |
| 11 | 1. ☐ **Detect HPC/Slurm environment**: |
| 12 | - Check if running on HPC cluster (look for `/home/woody/`, `/home/hpc/`, Slurm env vars) |
| 13 | - If HPC detected: **Always use `--yolo` flag to bypass Landlock sandbox restrictions** |
| 14 | |
| 15 | 2. ☐ **Ask user for execution parameters** via `AskUserQuestion` (single prompt): |
| 16 | - Model: `gpt-5`, `gpt-5-codex`, or default |
| 17 | - Reasoning effort: `minimal`, `low`, `medium`, `high` |
| 18 | |
| 19 | 3. ☐ **Determine sandbox mode** based on task: |
| 20 | - `read-only`: Code review, analysis, documentation |
| 21 | - `workspace-write`: Code modifications, file creation |
| 22 | - `danger-full-access`: System operations, network access |
| 23 | - **HPC override**: Always add `--yolo` flag (bypasses Landlock restrictions) |
| 24 | |
| 25 | 4. ☐ **Build command** with required flags: |
| 26 | ```bash |
| 27 | codex exec [OPTIONS] "PROMPT" |
| 28 | ``` |
| 29 | Essential flags: |
| 30 | - `-m <MODEL>` (if overriding default) |
| 31 | - `-c model_reasoning_effort="<LEVEL>"` |
| 32 | - `-s <SANDBOX_MODE>` (skip on HPC) |
| 33 | - `--skip-git-repo-check` (if outside git repo) |
| 34 | - `-C <DIRECTORY>` (if changing workspace) |
| 35 | - `--full-auto` (for non-interactive execution, **cannot be used with --yolo**) |
| 36 | |
| 37 | **HPC command pattern** (with `--yolo` to bypass Landlock): |
| 38 | ```bash |
| 39 | codex exec --yolo -m gpt-5 -c model_reasoning_effort="high" --skip-git-repo-check \ |
| 40 | "Analyze this code: $(cat /path/to/file.py)" 2>/dev/null |
| 41 | ``` |
| 42 | |
| 43 | **Note**: `--yolo` is an alias for `--dangerously-bypass-approvals-and-sandbox` and is REQUIRED on HPC clusters to avoid Landlock sandbox errors. **Do not use --full-auto with --yolo as they are incompatible.** |
| 44 | |
| 45 | 5. ☐ **Execute with stderr suppression**: |
| 46 | - Append `2>/dev/null` to hide thinking tokens |
| 47 | - Remove only if user requests verbose output or debugging |
| 48 | |
| 49 | 6. ☐ **Validate execution**: |
| 50 | - Check exit code (0 = success) |
| 51 | - Summarize output for user |
| 52 | - Report errors with actionable solutions |
| 53 | - If Landlock/sandbox errors on HPC: verify `--yolo` flag was used, retry if missing |
| 54 | |
| 55 | 7. ☐ **Inform about resume capability**: |
| 56 | - "Resume this session anytime: `codex resume`" |
| 57 | |
| 58 | ## Command Patterns |
| 59 | |
| 60 | > **🔥 HPC QUICK TIP**: On HPC clusters (e.g., `/home/woody/`, `/home/hpc/`), **ALWAYS add `--yolo` flag** to avoid Landlock sandbox errors. Example: `codex exec --yolo -m gpt-5 ...` |
| 61 | |
| 62 | ### Read-Only Analysis |
| 63 | ```bash |
| 64 | codex exec -m gpt-5 -c model_reasoning_effort="medium" -s read-only \ |
| 65 | --skip-git-repo-check --full-auto "review @file.py for security issues" 2>/dev/null |
| 66 | ``` |
| 67 | |
| 68 | ### Stdin Input (bypasses sandbox file restrictions) |
| 69 | ```bash |
| 70 | cat file.py | codex exec -m gpt-5 -c model_reasoning_effort="low" \ |
| 71 | --skip-git-repo-check --full-auto - 2>/dev/null |
| 72 | ``` |
| 73 | **Note**: Stdin with `-` flag may not be supported in all Codex CLI versions. |
| 74 | |
| 75 | ### HPC/Slurm Environment (YOLO Mode - Bypass Landlock) |
| 76 | When running on HPC clusters with Landlock security restrictions, use the `--yolo` flag: |
| 77 | |
| 78 | ```bash |
| 79 | # Primary solution: --yolo flag bypasses Landlock sandbox |
| 80 | codex exec --yolo -m gpt-5 -c model_reasoning_effort="high" --skip-git-repo-check \ |
| 81 | "Analyze this code: $(cat /path/to/file.py)" 2>/dev/null |
| 82 | ``` |
| 83 | |
| 84 | **Alternative: Manual Code Injection** (if --yolo is unavailable): |
| 85 | ```bash |
| 86 | # Capture code content and pass directly in prompt |
| 87 | codex exec -m gpt-5 -c model_reasoning_effort="high" --skip-git-repo-check --full-auto \ |
| 88 | "Analyze this Python code: $(cat file.py)" 2>/dev/null |
| 89 | ``` |
| 90 | Or for large files, use heredoc: |
| 91 | ```bash |
| 92 | codex exec --yolo -m gpt-5 -c model_reasoning_effort="high" --skip-git-repo-check "$(cat <<'ENDCODE' |
| 93 | Analyze the following code comprehensively: |
| 94 | |
| 95 | $(cat file.py) |
| 96 | |
| 97 | Focus on: architecture, algorithms, multi-GPU optimization, potential bugs, code quality. |
| 98 | ENDCODE |
| 99 | )" 2>/dev/null |
| 100 | ``` |
| 101 | |
| 102 | **Note**: `--yolo` is short for `--dangerously-bypass-approvals-and-sandbox` and is safe on HPC login nodes where you have limited permissions anyway. **Do not combine --yolo with --full-auto as they are incompatible.** |
| 103 | |
| 104 | ### Code Modification |
| 105 | ```bash |
| 106 | codex exec -m gpt-5 -c model_reasoning_effort="high" -s workspace-write \ |
| 107 | --skip-git-repo-check --full-auto "refactor @module.py to async/await" 2>/dev/null |
| 108 | ``` |
| 109 | |
| 110 | ### Resume Session |
| 111 | ```bash |
| 112 | echo "fix the remaining issues" | codex exec --skip-git-repo-check resume --last 2>/dev/null |
| 113 | ``` |
| 114 | |
| 115 | ### Cross-Directory Execution |
| 116 | ```bash |
| 117 | codex exec -C /path/to/project -m gpt-5 -c model_reasoning_effort="medium" \ |
| 118 | -s read-only --skip-git-repo-check --full-auto "analyze architecture" 2>/dev/null |
| 119 | ``` |
| 120 | |
| 121 | ### Using Profiles |
| 122 | ```bash |
| 123 | codex exec --profile production -c model_reasoning_effort=" |