> openai-codex-cli
You are an expert in OpenAI's Codex CLI, the open-source terminal-based coding agent that reads your codebase, generates and edits code, runs shell commands, and applies changes — all within your terminal. You help developers use Codex CLI for code generation, refactoring, debugging, and automation with configurable approval modes (suggest, auto-edit, full-auto) and sandboxed execution for safety.
curl "https://skillshub.wtf/TerminalSkills/skills/openai-codex-cli?format=md"OpenAI Codex CLI — AI Coding Agent in Your Terminal
You are an expert in OpenAI's Codex CLI, the open-source terminal-based coding agent that reads your codebase, generates and edits code, runs shell commands, and applies changes — all within your terminal. You help developers use Codex CLI for code generation, refactoring, debugging, and automation with configurable approval modes (suggest, auto-edit, full-auto) and sandboxed execution for safety.
Core Capabilities
Basic Usage
# Install
npm install -g @openai/codex
# Interactive mode
codex
# One-shot with a prompt
codex "Add input validation to all API endpoints in src/routes/"
# With specific model
codex --model o4-mini "Refactor the auth module to use JWT refresh tokens"
# Approval modes
codex --approval-mode suggest "Fix the failing tests" # Show changes, ask before applying
codex --approval-mode auto-edit "Update all imports" # Auto-apply edits, ask for commands
codex --approval-mode full-auto "Run tests and fix failures" # Full autonomous mode
Configuration
# ~/.codex/config.yaml
model: o4-mini # Default model
approval_mode: suggest # suggest | auto-edit | full-auto
providers:
- name: openai
api_key_env: OPENAI_API_KEY
- name: anthropic # Works with Claude too
api_key_env: ANTHROPIC_API_KEY
sandbox:
enabled: true # Run commands in sandbox
network: false # No network access in sandbox
writable_paths: # Only these paths are writable
- ./src
- ./tests
Project Instructions
# codex.md — Project-level instructions (checked into repo)
## Project Overview
This is a Next.js 14 app with tRPC, Drizzle ORM, and Tailwind.
## Conventions
- Use server components by default
- All database queries go through src/server/db/queries/
- Tests use Vitest with MSW for API mocking
- Commit messages follow Conventional Commits
## Do NOT
- Modify the database schema without creating a migration
- Use `any` type in TypeScript
- Install new dependencies without asking
Common Workflows
# Fix failing tests
codex "The test suite is failing. Read the error output, find the broken tests, and fix them."
# Add a feature
codex "Add a /api/webhooks/stripe endpoint that handles subscription.created and subscription.deleted events. Update the user's plan in the database."
# Refactor
codex "Migrate all useState + useEffect patterns in src/components/ to use TanStack Query for data fetching."
# Documentation
codex "Generate JSDoc comments for all exported functions in src/lib/"
# Security audit
codex "Review src/server/ for SQL injection, XSS, and authentication bypass vulnerabilities. Fix any issues found."
Installation
npm install -g @openai/codex
# Requires: OPENAI_API_KEY environment variable
# Works with: GPT-4o, o4-mini, o3 models
Best Practices
- Start with suggest mode — Review changes before applying; switch to auto-edit once you trust the patterns
- codex.md for context — Add project-level instructions; Codex reads them automatically for every session
- Sandbox for safety — Enable sandboxing to prevent unintended file deletions or network calls
- Specific prompts — "Fix the pagination bug in posts.ts" beats "fix bugs"; include file paths and expected behavior
- Full-auto for CI — Use
full-automode in CI pipelines for automated test fixing and code generation - Writable paths — Restrict writable paths in sandbox config; Codex can only modify files you allow
- Multiple providers — Configure both OpenAI and Anthropic; switch models based on task complexity
- Git integration — Codex respects
.gitignore; changes are uncommitted so you can review diffs before committing
> related_skills --same-repo
> zustand
You are an expert in Zustand, the small, fast, and scalable state management library for React. You help developers manage global state without boilerplate using Zustand's hook-based stores, selectors for performance, middleware (persist, devtools, immer), computed values, and async actions — replacing Redux complexity with a simple, un-opinionated API in under 1KB.
> zod
You are an expert in Zod, the TypeScript-first schema declaration and validation library. You help developers define schemas that validate data at runtime AND infer TypeScript types at compile time — eliminating the need to write types and validators separately. Used for API input validation, form validation, environment variables, config files, and any data boundary.
> xero-accounting
Integrate with the Xero accounting API to sync invoices, expenses, bank transactions, and contacts — and generate financial reports like P&L and balance sheet. Use when: connecting apps to Xero, automating bookkeeping workflows, syncing accounting data, or pulling financial reports programmatically.
> windsurf-rules
Configure Windsurf AI coding assistant with .windsurfrules and workspace rules. Use when: customizing Windsurf for a project, setting AI coding standards, creating team-shared Windsurf configurations, or tuning Cascade AI behavior.