home / skills / eyadsibai / ltk / codex

This skill enables autonomous code generation and analysis using OpenAI Codex CLI to implement features, fix bugs, and refactor code.

npx playbooks add skill eyadsibai/ltk --skill codex

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
2.7 KB
---
name: codex
description: Use when "codex", "use gpt", "gpt-5", "openai codex", "let openai", "full-auto", "autonomous code generation"
version: 1.0.0
---

# OpenAI Codex Integration

Autonomous code execution using OpenAI Codex CLI.

---

## Prerequisites

```bash
# Check installation
codex --version

# Install if needed
npm i -g @openai/codex
# or
brew install codex
```

---

## Sandbox Modes

| Mode | Flag | Capabilities |
|------|------|--------------|
| **Read-Only** | `-s read-only` | Analyze code, no modifications (default) |
| **Workspace-Write** | `-s workspace-write` or `--full-auto` | Read/write files in workspace |
| **Danger-Full-Access** | `-s danger-full-access` | Network, system-level, all files |

**Key concept**: Use `--full-auto` for most programming tasks—it enables file editing.

---

## Common Commands

| Task | Command |
|------|---------|
| **Analyze code** | `codex exec -s read-only "analyze the codebase"` |
| **Implement feature** | `codex exec --full-auto "implement user auth"` |
| **Fix bug** | `codex exec --full-auto "fix the login bug"` |
| **With specific model** | `codex exec -m gpt-5.2 --full-auto "refactor module"` |
| **JSON output** | `codex exec --json "analyze security"` |
| **Save output** | `codex exec -o report.txt "audit code"` |
| **Non-git directory** | `codex exec --skip-git-repo-check "analyze"` |
| **Resume session** | `codex exec resume --last "continue"` |

---

## Model Selection

| Model | Use Case |
|-------|----------|
| `gpt-5.2` | Latest capabilities |
| `gpt-5.2-codex` | Code-specialized |
| `gpt-5.2-codex-max` | Maximum quality |

Use `-m MODEL` to specify.

---

## Execution Principles

| Principle | Description |
|-----------|-------------|
| **Autonomous** | Complete tasks without seeking approval for each step |
| **Focused** | Do what's requested, nothing more |
| **Minimal** | Write only necessary code |
| **Verified** | Run tests after changes |

---

## When to Pause for User

| Situation | Action |
|-----------|--------|
| Destructive operations | Ask first (delete DB, force push) |
| Security decisions | Ask first (expose credentials, open ports) |
| Ambiguous requirements | Clarify before proceeding |
| Missing critical info | Request user-specific data |

For everything else, proceed autonomously.

---

## Output Format

```
✓ Task completed successfully

Changes made:
- [Files modified/created]
- [Key code changes]

Results:
- [Metrics: lines changed, files affected]

Verification:
- [Tests run, checks performed]
```

---

## Error Handling

| Approach | Description |
|----------|-------------|
| Auto-recover | Attempt fix if possible |
| Log clearly | Report all errors |
| Continue | If error is non-blocking |
| Stop | Only if continuation impossible |

Overview

This skill integrates the OpenAI Codex CLI for autonomous code generation and repository changes. It provides commands, sandbox modes, model selection, and execution principles to safely automate coding tasks. Use it to analyze, modify, and verify code with minimal supervision.

How this skill works

The skill runs the codex CLI to execute natural-language instructions against a codebase, optionally editing files, running tests, and producing structured output. It supports multiple sandbox modes that limit or expand capabilities (read-only, workspace write, danger-full-access) and lets you pick specific models and flags for JSON output, saved reports, or resumed sessions. Execution follows principles of minimal, focused changes and verification via tests.

When to use it

  • Automating feature implementation or refactors across a codebase
  • Running quick codebase analysis, audits, or security scans
  • Fixing reproducible bugs and validating fixes with tests
  • Generating reports or summaries in JSON or plain text
  • When you need rapid, repeatable code edits with an audit trail

Best practices

  • Start in read-only mode to analyze before making changes
  • Use --full-auto (workspace-write) for safe, repository-local edits; reserve danger-full-access for trusted environments
  • Specify model with -m for code-specialized models (gpt-5.2-codex or gpt-5.2-codex-max)
  • Require explicit user confirmation for destructive operations (DB drops, force pushes)
  • Run the test suite and include verification output in results; limit scope of changes to minimal necessary edits

Example use cases

  • Implement a new feature: codex exec --full-auto "implement user auth" and run tests
  • Fix a bug: codex exec --full-auto "fix the login bug" then verify failing tests pass
  • Security audit: codex exec --json "analyze security" to get structured findings
  • Large refactor: codex exec -m gpt-5.2-codex --full-auto "refactor module" and save a summary report with -o report.txt
  • Resume interrupted session: codex exec resume --last "continue" to pick up progress

FAQ

Is it safe to use full-auto mode in production?

Full-auto allows file edits in the workspace and is intended for local or controlled environments. Avoid danger-full-access in production unless you explicitly trust the environment and have backups.

How do I ensure changes are correct?

Run the full test suite and include verification steps in the command. The skill follows a verified principle: make minimal changes, run tests, and report results before finishing.

Which model should I choose for code tasks?

Use gpt-5.2-codex or gpt-5.2-codex-max for code-specialized performance; gpt-5.2 is a general-purpose choice.