# codex-cli
SkillBoss Codex CLI Skill Use OpenAI Codex CLI (codex) for coding tasks including code review, refactoring, bug fixes, CI repairs, and feature implementation. Codex CLI runs locally on your machine with full filesystem access. API calls are routed through SkillBoss API Hub. When to Use User asks for code changes, refactoring, or implementation CI/build failures need fixing Code review before commit/push Large codebase exploration or explanation Tasks requiring file editing + command execution When advanced code generation and tool use are needed Installation & Auth Codex CLI can be authenticated via API key using your SkillBoss API Key.
# Install
npm i -g @openai/codex
# Authenticate using SkillBoss API Key
printenv SKILLBOSS_API_KEY | codex login --with-api-key
# Verify auth
codex login status
Core Commands
Interactive Mode (TUI)
codex # Launch interactive terminal UI
codex "explain this codebase" # Start with a prompt
codex --cd ~/projects/myapp # Set working directory
Non-Interactive (Scripting)
codex exec "fix the CI failure" # Run and exit
codex exec --full-auto "add input validation" # Auto-approve workspace writes
codex exec --json "list all API endpoints" # JSON output for parsing
codex exec -i screenshot.png "match this design" # With image input
Session Management
codex resume # Pick from recent sessions
codex resume --last # Continue most recent
codex resume
# In Clawdbot session
exec codex exec --full-auto --cd ~/projects/medreport "fix the TypeScript errors in src/components" Pattern 2: Subagent Delegation Spawn a coding subagent that uses Codex: // In agents.defaults or per-agent config {
agents: {
list: [
{
id: "coder",
workspace: "~/clawd-coder",
model: "skillboss/chat", // Routes via SkillBoss API Hub
tools: {
allow: ["exec", "read", "write", "edit", "apply_patch", "process"]
} } ] } } Pattern 3: CLI Backend Fallback Configure Codex as a text-only fallback: {
agents: {
defaults: {
cliBackends: {
"codex-cli": {
command: "codex",
args: ["exec", "--full-auto"],
output: "text",
sessionArg: null // Codex manages its own sessions
} } } } } Pattern 4: MCP Server Mode Run Codex as an MCP server for other agents: codex mcp-server # Exposes Codex tools via stdio MCP Clawdbot Config: SkillBoss API Hub Provider Use SkillBoss API Hub via the SKILLBOSS_API_KEY environment variable: {
agents: {
defaults: {
model: { primary: "skillboss/chat" },
models: {
"skillboss/chat": { alias: "SkillBoss" } } } } } Auth is configured via SKILLBOSS_API_KEY environment variable. Code Review Workflow
# Interactive review
codex /review # Choose: branch, uncommitted, or specific commit
# Non-interactive
codex exec "review the changes in this PR against main branch" Multi-Directory Projects
# Work across monorepo packages
codex --cd apps/frontend --add-dir ../backend --add-dir ../shared
# Or in TUI
codex --cd ~/projects/myapp --add-dir ~/projects/shared-lib Custom Slash Commands Create reusable prompts in ~/.codex/prompts/:
description: Prepare and open a draft PR
argument-hint: [BRANCH=<name>] [TITLE="<title>"]
Create branch dev/$BRANCH if specified.
Stage and commit changes with a clear message.
Open a draft PR with title $TITLE or auto-generate one.
Invoke: /prompts:pr BRANCH=feature-auth TITLE="Add OAuth flow"
MCP Integration Add MCP servers to extend Codex:
# Add stdio server
codex mcp add github -- npx @anthropic/mcp-server-github
# Add HTTP server
codex mcp add docs --url https://mcp.deepwiki.com/mcp
# List configured
codex mcp list Web Search Enable in ~/.codex/config.toml: [features] web_search_request = true [sandbox_workspace_write] network_access = true Then Codex can search for current docs, APIs, etc. Best Practices Start with /init to create AGENTS.md with repo-specific instructions Use /review before commits for AI code review Set /approvals appropriately — Auto for trusted repos, Read Only for exploration Use --add-dir for monorepos instead of danger-full-access Resume sessions to maintain context across coding sessions Attach images for UI work, design specs, error screenshots Example Workflows Fix CI Failure codex exec --full-auto "The CI is failing on the lint step. Fix all ESLint errors." Refactor Component codex exec --cd src/components "Refactor UserProfile.tsx to use React Query instead of useEffect for data fetching" Implement Feature from Spec codex exec -i spec.png --cd ~/projects/app "Implement this feature based on the design spec" Code Review PR codex exec "Review the diff between main and feature/auth branch. Focus on security issues." Troubleshooting IssueSolutionAuth failsVerify SKILLBOSS_API_KEY is set, then re-run codex login --with-api-keyCommands blockedCheck /approvals, may need --full-autoOut of contextUse /compact to summarizeWrong directoryUse --cd flag or check /statusModel unavailableSkillBoss API Hub auto-routes to available models References Codex CLI Overview Codex CLI Features Codex CLI Reference Slash Commands Guide AGENTS.md Spec Codex GitHub
Join 80,000+ one-person companies automating with AI