openai-codex-cli

OpenAI 的 Codex CLI 终端编码代理说明。适用于帮助开发者使用 Codex CLI 在代码库中生成与编辑代码、运行 shell 命令并在终端内应用更改的场景,支持可配置的审批模式(建议、自动编辑、全自动)以及沙盒执行以增强安全性。

仓库最近推送
GitHub Stars
219
Forks
38
Issues / PRs
1

安装方式

先用 Prompt 核对来源与依赖。也可下载安装包。

用 AI 助手安装

复制提示词,让助手先核对固定版本和依赖。

查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "openai-codex-cli":https://skillpi.com/zh/skills/deepskill-1a767063dadf86151c8b584b87e6a5ce93036466549ad38170dab191e5f10bda。安装前核对上游来源和版本:https://github.com/TerminalSkills/skills。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。

来源与配置

github.com

配置方式待核实

请查看原始来源中的适用工具、依赖和权限要求。

安装实测待补充

OpenAI 的 Codex CLI 终端编码代理说明。适用于帮助开发者使用 Codex CLI 在代码库中生成与编辑代码、运行 shell 命令并在终端内应用更改的场景,支持可配置的审批模式(建议、自动编辑、全自动)以及沙盒执行以增强安全性。

0 下载

介绍来源: third_party · TerminalSkills · 1.0.0 参考来源

SkillPi 解读

实测状态
未测试

文件浏览

在原站浏览文件 ↗

原始 SKILL.md

打开原文 ↗
Frontmatter
name: openai-codex-cli
description: >-
  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.
license: Apache-2.0
compatibility: ''
metadata:
  author: terminal-skills
  version: 1.0.0
  category: Developer Tools
  tags:
    - ai-coding
    - terminal
    - cli
    - autonomous-agent
    - openai
    - code-generation

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

  1. Start with suggest mode — Review changes before applying; switch to auto-edit once you trust the patterns
  2. codex.md for context — Add project-level instructions; Codex reads them automatically for every session
  3. Sandbox for safety — Enable sandboxing to prevent unintended file deletions or network calls
  4. Specific prompts — "Fix the pagination bug in posts.ts" beats "fix bugs"; include file paths and expected behavior
  5. Full-auto for CI — Use full-auto mode in CI pipelines for automated test fixing and code generation
  6. Writable paths — Restrict writable paths in sandbox config; Codex can only modify files you allow
  7. Multiple providers — Configure both OpenAI and Anthropic; switch models based on task complexity
  8. Git integration — Codex respects .gitignore; changes are uncommitted so you can review diffs before committing

当前收录版本

1.0.0

核对来源版本 ↗

质量评测

满分100 · 来自 SkillPi LAB 实验室的评测报告。

场景价值78/100

亮点

  • 提供 OpenAI Codex CLI 的完整使用指南,覆盖安装、配置、工作流和最佳实践
  • 支持多种审批模式(suggest/auto-edit/full-auto)和沙盒执行,兼顾效率与安全
触发精准92/100

亮点

  • description 清晰完整,触发词精准覆盖 Codex CLI 核心功能
  • frontmatter 与正文描述一致,无歧义
结构规范95/100

亮点

  • 结构清晰,分章节详述能力、用法、配置与最佳实践
  • 提供丰富代码示例和配置文件模板,便于用户直接应用
执行可靠75/100

待提升项

  • 缺少错误处理说明 原报告严重程度:轻微

    未说明 API key 缺失、网络错误、命令执行失败等常见异常的处理方式

    改进建议:补充错误处理建议,如检查环境变量、网络连接、命令权限等

  • full-auto 模式安全机制不明确 原报告严重程度:轻微

    未详细说明 full-auto 模式下如何防止误操作或提供回滚机制

    改进建议:建议补充 full-auto 模式的风险提示和备份建议

亮点

  • 明确工具来源(@openai/codex npm 包)和参数用法
  • 提及沙盒执行和 writable_paths 限制,体现安全设计
证据可验 (前四项均值)85/100

取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。

正文静态检测

100 / 100 · skillpi-20261123-no-r3-v1

正文未命中当前规则。

分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。

权限与使用前检查

根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。

  • 安装或获取外部依赖

    使用官方来源并锁定版本,在隔离环境检查安装脚本。当前文档检查不覆盖后续下载的代码。

    主文档提及 · 第 35, 113 行

本站展示提示不会授予权限。涉及文件改动、密钥、外部发送或费用时,仍由你使用的工具按需确认。

安全评级与访问范围

safe · 静态证据核验,不代表运行安全保证。

使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。