codex-skill by feiskyer/claude-code-settings
npx skills add https://github.com/feiskyer/claude-code-settings --skill codex-skill您正在 codex exec 模式下运行——一种用于无干预任务执行的交互式自动化模式。
在使用此技能前,请确保已安装并配置 Codex CLI:
安装验证 :
codex --version
首次设置 :如果未安装,请引导用户使用命令 npm i -g @openai/codex 或 brew install codex 安装 Codex CLI。
Codex 使用沙盒策略来控制允许的操作:
只读模式(默认)
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
codex exec 时的默认模式工作区写入模式(推荐用于编程)
--full-auto 或 -s workspace-write 来启用文件编辑危险-完全访问模式
-s danger-full-accessCodex 默认使用 ~/.codex/config.toml 中配置的模型。除非用户明确要求使用特定模型,否则不要传递 -m/--model 参数。
# 默认:使用 config.toml 中的模型(推荐)
codex exec --full-auto "重构支付处理模块"
# 仅当用户明确指定模型时:
codex exec -m gpt-5.2 --full-auto "实现用户认证功能"
使用 -s 或 --sandbox 控制执行权限(可能的值:read-only, workspace-write, danger-full-access):
codex exec "分析代码库结构并统计代码行数"
codex exec -s read-only "审查代码质量并提出改进建议"
分析代码而不做任何修改。
codex exec -s workspace-write "实现用户认证功能"
codex exec --full-auto "修复登录流程中的错误"
在工作区内读取和写入文件。必须显式启用(非默认)。将此用于大多数编程任务。
codex exec -s danger-full-access "安装依赖项并更新 API 集成"
网络访问和系统级操作。仅在必要时使用。
codex exec --full-auto "实现用户认证功能"
等同于:-s workspace-write(启用文件编辑)。这是大多数编程任务的推荐命令,因为它允许 codex 修改您的代码库。
使用 -c 或 --config 内联覆盖任何 config.toml 值:
# 为单次运行覆盖模型
codex exec -c model="o3" --full-auto "实现该功能"
# 覆盖沙盒权限
codex exec -c 'sandbox_permissions=["disk-full-read-access"]' "分析所有文件"
# 使用点分隔路径覆盖嵌套配置值
codex exec -c shell_environment_policy.inherit=all --full-auto "运行构建"
使用 --enable 和 --disable 启用或禁用功能:
codex exec --enable multi_agent --full-auto "跨多个文件实现功能"
codex exec --disable plan_tool --full-auto "快速修复拼写错误"
等同于 -c features.<name>=true 或 -c features.<name>=false。
使用 -i 或 --image 将图像附加到提示词:
codex exec -i screenshot.png "实现此截图中显示的 UI"
codex exec -i mockup.png -i spec.png --full-auto "构建符合此设计的组件"
使用 codex exec review 运行代码审查:
# 审查未提交的更改(已暂存、未暂存和未跟踪)
codex exec review --uncommitted
# 针对基础分支审查更改
codex exec review --base main
# 审查特定提交
codex exec review --commit abc1234
# 自定义审查指令
codex exec review --base main "重点关注安全漏洞和错误处理"
# 为总结添加标题进行审查
codex exec review --base main --title "认证功能审查"
# 以 JSON 格式输出审查结果
codex exec review --uncommitted --json -o review.json
使用 -p 或 --profile 从 ~/.codex/config.toml 加载已保存的配置文件:
codex exec -p production "部署最新更改"
codex exec --profile development "运行集成测试"
配置文件可以指定默认模型、沙盒模式和其他选项。
使用 -C 或 --cd 指定不同的工作目录:
codex exec -C /path/to/project --full-auto "实现该功能"
codex exec --cd ~/projects/myapp --full-auto "运行测试并修复失败项"
使用 --add-dir 允许在主工作区之外的额外目录进行写入:
codex exec --full-auto --add-dir /tmp/output --add-dir ~/shared "在多个位置生成报告"
codex exec --json "运行测试并报告结果"
codex exec --json -s read-only "分析安全漏洞"
输出结构化的 JSON Lines 格式,包含推理、命令、文件更改和指标。
约束模型的最终响应以匹配 JSON 模式:
codex exec --output-schema schema.json "分析代码库并报告发现"
codex exec -o report.txt "生成安全审计报告"
codex exec -o results.json --json "运行性能基准测试"
将最终消息写入文件而非标准输出。
运行时不将会话文件持久化到磁盘:
codex exec --ephemeral --full-auto "快速一次性修复"
codex exec --skip-git-repo-check "分析此非 git 目录"
绕过目录必须是 git 仓库的要求。
# 恢复最近的会话
codex exec resume --last "现在实现下一个功能"
# 按 ID 恢复特定会话
codex exec resume <session-id> "继续处理 API"
# 显示所有会话(不按当前目录过滤)
codex exec resume --all
通过本地提供商使用开源模型:
codex exec --oss "分析此代码"
codex exec --oss --local-provider ollama "重构此函数"
codex exec --oss --local-provider lmstudio "实现该功能"
极其危险——仅在外部的沙盒环境(容器、虚拟机)中使用
codex exec --dangerously-bypass-approvals-and-sandbox "执行该任务"
跳过所有确认提示,并在没有沙盒保护的情况下执行命令。
为复杂场景组合多个标志:
# 工作区写入并输出 JSON
codex exec -s workspace-write --json "实现认证并输出结果"
# 使用配置文件并自定义工作目录
codex exec -p production -C /var/www/app "部署更新"
# 全自动模式,带额外目录和输出文件
codex exec --full-auto --add-dir /tmp/logs -o summary.txt "重构并记录更改"
# 基于图像驱动的实现,使用全自动模式
codex exec -i design.png --full-auto "实现与此设计匹配的 UI"
# 配置覆盖与临时模式
codex exec -c model_reasoning_effort="high" --ephemeral --full-auto "解决此复杂错误"
# 代码审查,JSON 输出保存到文件
codex exec review --base main --json -o review-report.json
仅在遇到以下情况时暂停以获取用户输入:
对于所有其他决策,请使用最佳判断自主进行。
始终以结构化总结结束:
✓ 任务成功完成
所做的更改:
- [已修改/创建的文件列表]
- [关键的代码更改]
结果:
- [指标:更改的行数、受影响的文件数、运行的测试数]
- [现在可以工作而之前不能的功能]
验证:
- [运行的测试、执行的检查]
后续步骤(如果适用):
- [后续任务的建议]
用户:"按语言统计此项目的代码行数"
codex exec "统计此项目的总代码行数,按语言细分"
用户:"修复登录流程中的认证错误"
codex exec --full-auto "修复登录流程中的认证错误"
用户:"让 codex 为 UI 实现深色模式支持"
codex exec --full-auto "为 UI 添加深色模式支持,包括主题上下文和样式更新"
用户:"在我推送之前审查我的更改"
codex exec review --uncommitted
用户:"根据此模型构建 UI"
codex exec -i mockup.png --full-auto "实现与此设计匹配的 UI 组件"
用户:"安装新的支付 SDK 并集成它"
codex exec -s danger-full-access "安装支付 SDK 依赖项并集成 API"
用户:"在后端项目中实现 API"
codex exec -C ~/projects/backend --full-auto "为用户管理实现 REST API 端点"
用户:"分析这个不在 git 中的遗留代码库"
codex exec --skip-git-repo-check "分析架构并提出现代化方案"
发生错误时:
如果执行被中断:
每周安装量
105
仓库
GitHub 星标数
1.4K
首次出现
2026年1月23日
安全审计
安装于
codex91
opencode90
gemini-cli87
cursor84
github-copilot79
claude-code76
You are operating in codex exec - a non-interactive automation mode for hands-off task execution.
Before using this skill, ensure Codex CLI is installed and configured:
Installation verification :
codex --version
First-time setup : If not installed, guide the user to install Codex CLI with command npm i -g @openai/codex or brew install codex.
Codex uses sandbox policies to control what operations are permitted:
Read-Only Mode (Default)
codex execWorkspace-Write Mode (Recommended for Programming)
--full-auto or -s workspace-write to enable file editingDanger-Full-Access Mode
-s danger-full-accessCodex uses the model configured in ~/.codex/config.toml by default. Do NOT pass -m/--model unless the user explicitly asks to use a specific model.
# Default: uses model from config.toml (recommended)
codex exec --full-auto "refactor the payment processing module"
# Only when user specifies a model explicitly:
codex exec -m gpt-5.2 --full-auto "implement the user authentication feature"
Control execution permissions with -s or --sandbox (possible values: read-only, workspace-write, danger-full-access):
codex exec "analyze the codebase structure and count lines of code"
codex exec -s read-only "review code quality and suggest improvements"
Analyze code without making any modifications.
codex exec -s workspace-write "implement the user authentication feature"
codex exec --full-auto "fix the bug in login flow"
Read and write files within the workspace. Must be explicitly enabled (not the default). Use this for most programming tasks.
codex exec -s danger-full-access "install dependencies and update the API integration"
Network access and system-level operations. Use only when necessary.
codex exec --full-auto "implement the user authentication feature"
Convenience alias for : -s workspace-write (enables file editing). This is the recommended command for most programming tasks since it allows codex to make changes to your codebase.
Override any config.toml value inline with -c or --config:
# Override model for a single run
codex exec -c model="o3" --full-auto "implement the feature"
# Override sandbox permissions
codex exec -c 'sandbox_permissions=["disk-full-read-access"]' "analyze all files"
# Override nested config values using dotted paths
codex exec -c shell_environment_policy.inherit=all --full-auto "run build"
Enable or disable features with --enable and --disable:
codex exec --enable multi_agent --full-auto "implement feature across multiple files"
codex exec --disable plan_tool --full-auto "quick fix for typo"
Equivalent to -c features.<name>=true or -c features.<name>=false.
Attach images to the prompt with -i or --image:
codex exec -i screenshot.png "implement the UI shown in this screenshot"
codex exec -i mockup.png -i spec.png --full-auto "build this component matching the design"
Run code reviews with codex exec review:
# Review uncommitted changes (staged, unstaged, and untracked)
codex exec review --uncommitted
# Review changes against a base branch
codex exec review --base main
# Review a specific commit
codex exec review --commit abc1234
# Custom review instructions
codex exec review --base main "focus on security vulnerabilities and error handling"
# Review with a title for the summary
codex exec review --base main --title "Auth feature review"
# Output review as JSON
codex exec review --uncommitted --json -o review.json
Use saved profiles from ~/.codex/config.toml with -p or --profile:
codex exec -p production "deploy the latest changes"
codex exec --profile development "run integration tests"
Profiles can specify default model, sandbox mode, and other options.
Specify a different working directory with -C or --cd:
codex exec -C /path/to/project --full-auto "implement the feature"
codex exec --cd ~/projects/myapp --full-auto "run tests and fix failures"
Allow writing to additional directories outside the main workspace with --add-dir:
codex exec --full-auto --add-dir /tmp/output --add-dir ~/shared "generate reports in multiple locations"
codex exec --json "run tests and report results"
codex exec --json -s read-only "analyze security vulnerabilities"
Outputs structured JSON Lines format with reasoning, commands, file changes, and metrics.
Constrain the model's final response to match a JSON schema:
codex exec --output-schema schema.json "analyze the codebase and report findings"
codex exec -o report.txt "generate a security audit report"
codex exec -o results.json --json "run performance benchmarks"
Writes the final message to a file instead of stdout.
Run without persisting session files to disk:
codex exec --ephemeral --full-auto "quick one-off fix"
codex exec --skip-git-repo-check "analyze this non-git directory"
Bypasses the requirement for the directory to be a git repository.
# Resume the most recent session
codex exec resume --last "now implement the next feature"
# Resume a specific session by ID
codex exec resume <session-id> "continue working on the API"
# Show all sessions (not filtered by current directory)
codex exec resume --all
Use open-source models via local providers:
codex exec --oss "analyze this code"
codex exec --oss --local-provider ollama "refactor this function"
codex exec --oss --local-provider lmstudio "implement the feature"
EXTREMELY DANGEROUS — only use in externally sandboxed environments (containers, VMs)
codex exec --dangerously-bypass-approvals-and-sandbox "perform the task"
Skips ALL confirmation prompts and executes commands WITHOUT sandboxing.
Combine multiple flags for complex scenarios:
# Workspace write with JSON output
codex exec -s workspace-write --json "implement authentication and output results"
# Use profile with custom working directory
codex exec -p production -C /var/www/app "deploy updates"
# Full-auto with additional directories and output file
codex exec --full-auto --add-dir /tmp/logs -o summary.txt "refactor and log changes"
# Image-driven implementation with full-auto
codex exec -i design.png --full-auto "implement the UI matching this design"
# Config override with ephemeral mode
codex exec -c model_reasoning_effort="high" --ephemeral --full-auto "solve this complex bug"
# Code review with JSON output saved to file
codex exec review --base main --json -o review-report.json
Only pause for user input when encountering:
For all other decisions, proceed autonomously using best judgment.
Always conclude with a structured summary:
✓ Task completed successfully
Changes made:
- [List of files modified/created]
- [Key code changes]
Results:
- [Metrics: lines changed, files affected, tests run]
- [What now works that didn't before]
Verification:
- [Tests run, checks performed]
Next steps (if applicable):
- [Suggestions for follow-up tasks]
User : "Count the lines of code in this project by language"
codex exec "count the total number of lines of code in this project, broken down by language"
User : "Fix the authentication bug in the login flow"
codex exec --full-auto "fix the authentication bug in the login flow"
User : "Let codex implement dark mode support for the UI"
codex exec --full-auto "add dark mode support to the UI with theme context and style updates"
User : "Review my changes before I push"
codex exec review --uncommitted
User : "Build the UI from this mockup"
codex exec -i mockup.png --full-auto "implement the UI component matching this design"
User : "Install the new payment SDK and integrate it"
codex exec -s danger-full-access "install the payment SDK dependencies and integrate the API"
User : "Implement the API in the backend project"
codex exec -C ~/projects/backend --full-auto "implement the REST API endpoints for user management"
User : "Analyze this legacy codebase that's not in git"
codex exec --skip-git-repo-check "analyze the architecture and suggest modernization approach"
When errors occur:
If execution is interrupted:
Weekly Installs
105
Repository
GitHub Stars
1.4K
First Seen
Jan 23, 2026
Security Audits
Gen Agent Trust HubFailSocketPassSnykFail
Installed on
codex91
opencode90
gemini-cli87
cursor84
github-copilot79
claude-code76
通过 LiteLLM 代理让 Claude Code 对接 GitHub Copilot 运行 | 高级变通方案指南
40,000 周安装