### Setup script example: pip install Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/README.md Example of a setup script command for a Python project. ```text pip install -r requirements.txt ``` -------------------------------- ### Setup script with pip install Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/Codex橙皮书.preview.pdf Example setup script command that installs Python dependencies from a requirements file. Note the missing space in 'install-r' as shown in the source. ```bash pip install-r requirements.txt ``` -------------------------------- ### Setup script purpose Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/README.md Purpose of a setup script. Explains that it installs dependencies. ```text 把项目需要的依赖先装好。 ``` -------------------------------- ### Setup script beginner advice Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/README.md Beginner advice for writing setup scripts. Warns against dangerous commands and secrets. ```text 先用最简单的安装命令。 不要在 setup script 里写危险命令。 不要把密码和 API Key 写进去。 ``` -------------------------------- ### Minimal SKILL.md example Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/README.md A minimal SKILL.md example with frontmatter (name, description) and instructions for generating a README. ```text --- name: readme-skill description: 当用户需要生成 README、项目说明、安装教程、启动步骤时使用。 --- 你是一个 README 文档生成助手。 任务: 根据当前项目生成一份适合新手阅读的 README。 工作流程: 1. 阅读项目结构 2. 查看 package.json、README、入口文件 3. 判断项目类型 4. 生成项目介绍 5. 写安装步骤 6. 写启动命令 7. 说明文件结构 8. 补充常见问题 9. 不确定的地方不要编造 输出格式: 使用 Markdown。 必须包含: - 项目简介 - 功能特点 - 安装步骤 - 启动命令 - 文件结构 - 常见问题 - 后续优化方向 ``` -------------------------------- ### Verify Codex installation with codex --version Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/README.md Recommended first step after installing Codex CLI: run `codex --version` to confirm the installation works before using it. ```text 安装后第一件事,不是直接用,而是先运行 codex --version。 能看到版本号,说明基础安装正常。 ``` -------------------------------- ### Check Node.js and npm versions Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/README.md Check that Node.js and npm are installed and available. If version numbers are displayed, the installation is ready. ```text node -v npm -v ``` -------------------------------- ### Common npm and git commands Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/Codex橙皮书.preview.pdf Common commands and their meanings: npm install installs dependencies, npm run dev starts the development environment, npm run build checks if the project can build, npm test runs tests, git status shows project changes, git diff shows specific changes. ```bash npm install ``` ```bash npm run dev ``` ```bash npm run build ``` ```bash npm test ``` ```bash git status ``` ```bash git diff ``` -------------------------------- ### Recommended simple task Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/Codex橙皮书.preview.pdf An example of a recommended simple task for first-time users. ```text 请帮我做一个简单的产品介绍页,只用 HTML 和 CSS。 ``` -------------------------------- ### Example task with requirements Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/README.md Example of a well-specified task for Codex Web. Includes clear requirements and constraints. ```text 请修复首页按钮点击无反应的问题。 要求: 1. 先分析按钮点击逻辑在哪里 2. 只修改和按钮相关的文件 3. 不要重构整个项目 4. 不要删除现有功能 5. 修复后运行构建或测试命令验证 6. 完成后说明修改了哪些文件 ``` -------------------------------- ### Use Skill with $ui-review-skill Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/README.md Example of using a Skill by prefixing the command with $skill-name. ```text $ui-review-skill 请检查当前首页的视觉问题,并给出修改建议。 ``` -------------------------------- ### Beginner advice for Codex Web Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/README.md Beginner advice: start with local Codex App before using Codex Web. ```text 先用 Codex App 做本地练习。 会 GitHub 后,再用 Codex Web 处理仓库任务。 ``` -------------------------------- ### Start Codex in the project directory with cd and codex Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/Codex橙皮书.preview.pdf Recommended way to start Codex: first cd into the project directory, then run codex. Running Codex from the C drive root, Desktop, Downloads, or important folders can cause it to read the wrong project. ```bash cd D:\AI-Codex-Projects\hello-codex codex ``` -------------------------------- ### Beginner troubleshooting commands Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/Codex橙皮书.pdf Beginner troubleshooting workflow: check installation, login, current directory, project status, environment, permissions, file changes, background tasks, stop stuck commands, and compress context when conversation is too long. ```bash codex --version ``` ```bash codex login status ``` ```bash pwd / cd ``` ```bash git status ``` ```bash codex doctor ``` ```bash /permissions ``` ```bash /diff ``` ```bash /ps ``` ```bash /stop ``` ```bash /compact ``` -------------------------------- ### Initialize Git repository for new project Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/Codex橙皮书.pdf Recommended first steps for new projects to save a version before using Codex. Run these once at the start of a project. ```bash git init ``` ```bash git add. ``` ```bash git commit -m "initial commit" ``` -------------------------------- ### $skill-creator example prompt for README Skill Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/README.md Example prompt for $skill-creator to create a README Skill, including purpose, trigger scenarios, workflow, output format, and constraints. ```text $skill-creator 请帮我创建一个 README Skill。 这个 Skill 的作用: 根据当前项目自动生成一份适合小白阅读的 README。 触发场景: 当我说“生成 README”“写项目说明”“整理项目文档”“写安装教程”时使用。 工作流程: 1. 先阅读项目结构 2. 查看 package.json、README、入口文件 3. 判断项目类型 4. 生成项目简介 5. 写安装步骤 6. 写启动命令 7. 说明主要文件夹作用 8. 补充常见问题 9. 不确定的地方不要编造 输出格式: 使用 Markdown。 必须包含: - 项目简介 - 功能特点 - 安装步骤 - 启动命令 - 文件结构 - 常见问题 - 后续优化方向 注意事项: 不要编造不存在的功能。 不要读取或输出 API Key、密码、token、私钥。 ``` -------------------------------- ### pnpm install 命令 Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/Codex橙皮书.pdf 前端项目安装依赖的替代命令。 ```bash pnpm install ``` -------------------------------- ### Example plan for build fix Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/README.md Example plan that Codex might propose for fixing a build failure. ```text 计划: 1. 先查看 package.json,确认启动命令 2. 运行 npm run build 复现报错 3. 根据报错定位相关文件 4. 最小范围修复问题 5. 再次运行 build 验证 ``` -------------------------------- ### Install Codex CLI with Homebrew Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/Codex橙皮书.pdf Install Codex CLI on macOS using Homebrew. After installation, run 'codex' to start. ```bash brew install--cask codex ``` -------------------------------- ### npm install 安装依赖 Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/Codex橙皮书.pdf 安装项目依赖,失败时可能是网络、源、权限或依赖冲突问题。 ```text npm install ``` -------------------------------- ### Example project name hello-codex Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/Codex橙皮书.pdf Example project name used to illustrate that a project can contain multiple threads, each representing a separate task. ```text hello-codex ``` -------------------------------- ### Example project folder path for sandbox Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/Codex橙皮书.pdf Example project folder path used to explain the sandbox boundary: Codex normally works only within this folder when sandbox is enabled. ```text D:\AI-Codex-Projects\hello-codex ``` -------------------------------- ### Install Codex CLI on Windows (partial) Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/Codex橙皮书.pdf Partial command for installing Codex CLI on Windows. The full command is 'npm install -g @openai/codex'. ```bash -g @openai/codex ``` -------------------------------- ### Install Codex CLI with npm Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/Codex橙皮书.pdf Install Codex CLI globally using npm. Requires Node.js and npm to be installed first. ```bash npm install-g @openai/codex ``` -------------------------------- ### Install Codex CLI with npm on macOS/Linux Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/Codex橙皮书.preview.pdf Install Codex CLI on macOS/Linux using npm. First verify Node.js and npm are installed by checking their versions, then install Codex globally, and finally verify the installation with codex --version. ```bash node -v ``` ```bash npm -v ``` ```bash npm install -g @openai/codex ``` ```bash codex --version ``` -------------------------------- ### MCP server configuration for context7 Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/Codex橙皮书.pdf Example configuration for an MCP server named context7. It specifies the startup command npx with the argument -y @upstash/context7-mcp. ```toml [mcp_servers.context7] command = "npx" args = ["-y", "@upstash/context7-mcp"] ``` -------------------------------- ### Vague task example Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/README.md Example of a vague task that is not recommended. Too ambiguous for Codex to know where to start. ```text 帮我优化一下项目。 ``` -------------------------------- ### First task repository suggestions Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/README.md Examples of simple GitHub repositories suitable for a first Codex Web task. ```text 简单 HTML 页面 React 小项目 个人主页 README 项目 小工具页面 ``` -------------------------------- ### Start Codex with -C shorthand Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/Codex橙皮书.pdf Start Codex in a specified directory using the shorthand '-C' for '--cd'. ```bash codex -C ./hello-Codex ``` -------------------------------- ### List of practice project names Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/README.md Example project names to place inside the practice directory. ```text hello-web ai-tools-page xiaohongshu-cover-tool landing-page-demo ``` -------------------------------- ### First task example: README review Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/README.md Example of a low-risk first task for Codex Web. Focuses on README review and PR creation. ```text 请帮我检查这个项目的 README 是否清楚。 要求: 1. 阅读当前项目结构 2. 说明 README 缺少哪些内容 3. 补充安装步骤、启动命令和项目结构说明 4. 不要修改代码逻辑 5. 完成后创建一个 PR ``` -------------------------------- ### Windows installation commands table Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/Codex橙皮书.pdf Table showing Windows commands to check Node.js/npm versions and install Codex CLI. The table is malformed; the actual commands are 'node -v', 'npm -v', 'npm install -g @openai/codex', and 'codex --version'. ```markdown node|-v| |npm|-v| |npm|install| |codex|--version| ``` -------------------------------- ### Clear Skill description example Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/README.md Example of a clear Skill description that helps Codex automatically decide when to use the Skill. ```text description: 当用户需要生成 README、项目说明、安装教程、启动步骤时使用。 ``` -------------------------------- ### Follow-up instruction: tech homepage Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/Codex橙皮书.preview.pdf An example follow-up instruction to modify the page to look like a tech product homepage. ```text 请把这个页面改得更像科技产品首页。 ``` -------------------------------- ### Run Codex CLI Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/Codex橙皮书.pdf Start Codex CLI directly. On first run, it prompts you to log in. ```bash codex ``` -------------------------------- ### Start Codex with --cd flag Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/Codex橙皮书.pdf Start Codex in a specified directory without using 'cd' first. The '--cd' flag specifies the project path. ```bash codex --cd D:\AI-Codex-Projects\hello-Codex ``` -------------------------------- ### AGENTS.md example content Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/README.md Example AGENTS.md content that defines project rules for Codex, including work rules, test requirements, and commit requirements. ```text # AGENTS.md ## 工作规则 - 修改前必须先阅读项目结构。 - 修改前必须先制定计划,不要直接写代码。 - 一次只实现一个功能点。 - 不要顺手重构无关代码。 - 不要新增不必要依赖。 - 不确定业务逻辑时,先提问,不要自行决定。 ## 测试要求 每次修改后至少检查: - npm run lint - npm run build - 相关页面手动测试 - 浏览器控制台是否有报错 - 移动端布局是否正常 ## 提交要求 提交前需要说明: - 修改了哪些文件 - 每个文件改了什么 - 测试是否通过 - 是否有风险或未完成事项 ``` -------------------------------- ### Sandbox readable file: index.html Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/Codex橙皮书.preview.pdf Example file that Codex can read within the sandbox. ```text index.html ``` -------------------------------- ### Example task: fix homepage button Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/README.md Example task for Codex Web. It shows a typical request that requires reading the repository code to locate and fix the button logic. ```text 请帮我修复首页按钮点击无反应的问题。 ``` -------------------------------- ### Check Node.js and npm versions Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/Codex橙皮书.pdf Check that Node.js and npm are installed before installing Codex CLI via npm. If version numbers are printed, the tools are available. ```bash node-v npm-v ``` -------------------------------- ### Not recommended complex task Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/Codex橙皮书.preview.pdf An example of a complex task that is not recommended for first-time users. ```text 帮我做一个完整的 AI 工具平台,要有登录、支付、数据库、后台管理。 ``` -------------------------------- ### Beginner Advice for Codex App vs Web Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/README.md Beginner advice on when to use Codex App versus Codex Web. ```text 刚开始做本地练习,用 Codex App。 项目已经放到 GitHub 后,再学 Codex Web。 ``` -------------------------------- ### Conventional commit message examples (English) Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/README.md Common conventional commit message formats for English projects. Use these to describe what changed, why, and its impact. ```text feat: add user profile page fix: resolve login redirect issue style: improve homepage responsive layout refactor: simplify product card component docs: update setup guide ``` -------------------------------- ### Avoid broad request: optimize entire homepage Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/README.md A broad request that the guide advises against. It is used as a negative example to illustrate why you should break work into small, focused steps instead of asking for a whole-page optimization at once. ```text 请帮我优化整个首页。 ``` -------------------------------- ### Handling build failure Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/README.md Example of how Codex handles a build failure: read error, locate files, modify, and retry. ```text 运行 npm run build 失败 → 读取报错信息 → 定位相关文件 → 修改代码 → 再次运行 build ``` -------------------------------- ### Task input: simple webpage Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/Codex橙皮书.preview.pdf An example task input for the Codex task window, asking for a simple webpage with a black background and centered text. ```text 请帮我做一个简单网页,黑色背景,中间显示 Hello, Codex。 ``` -------------------------------- ### Change to project directory Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/Codex橙皮书.pdf Change to the project directory before starting Codex. This is the recommended way to work with Codex in a project. ```bash cd D:\AI-Codex-Projects\hello-Codex ``` -------------------------------- ### Vague Skill description example Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/README.md Example of a vague Skill description that is not recommended because Codex cannot determine when to invoke it. ```text description: 帮我写东西。 ``` -------------------------------- ### View MCP tools in Codex CLI with /mcp Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/Codex橙皮书.pdf Workflow to enter a project directory, start Codex CLI, and then use the /mcp command to view available MCP tools in the current session. If MCP tools do not appear, possible causes include failed add, startup failure, wrong name, missing authorization, or configuration not refreshed. ```bash cd 项目目录 ``` ```bash codex ``` ```bash /mcp ``` -------------------------------- ### CLI 斜杠命令:/model、/permissions、/diff、/plan、/init、/status、/quit、/exit Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/Codex橙皮书.pdf CLI 斜杠命令。/model 切换模型和推理强度;/permissions 调整权限;/diff 查看代码改动;/plan 进入计划模式,先给方案不急着改代码;/init 生成 AGENTS.md;/status 查看当前状态;/quit 和 /exit 退出 Codex CLI。 ```bash /model ``` ```bash /permissions ``` ```bash /diff ``` ```bash /plan ``` ```bash /init ``` ```bash /status ``` ```bash /quit ``` ```bash /exit ``` -------------------------------- ### Recommended permission settings Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/README.md Recommended permission settings for beginners: keep approval requests and avoid full access. ```text 保持请求批准。 不要随便开启完全访问权限。 ``` -------------------------------- ### When to use /plan Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/README.md Advice on when to use /plan: simple tasks can be done directly, complex tasks should be planned first. ```text 简单任务可以直接让它做。 复杂任务先让它 /plan。 ``` -------------------------------- ### Basic Git workflow with init, add, commit, status, diff Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/Codex橙皮书.preview.pdf Basic Git workflow for beginners: git init initializes a repository, git add . stages changes, git commit -m "initial commit" saves a version, git status shows changed files, git diff shows specific changes. Recommended to commit before using Codex. ```bash git init ``` ```bash git add . ``` ```bash git commit -m "initial commit" ``` ```bash git status ``` ```bash git diff ``` -------------------------------- ### 模型、权限、沙盒命令:--model、--sandbox、--ask-for-approval Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/Codex橙皮书.pdf 模型、权限、沙盒相关命令。--model 指定模型,-m 是简写;--sandbox 设置沙盒模式(read-only 只读、workspace-write 当前项目可读写、danger-full-access 完全放开限制);-a 和 --ask-for-approval 设置审批模式。新手推荐组合 --sandbox workspace-write 和 --ask-for-approval on-request。 ```bash codex --model 模型名 ``` ```bash codex -m 模型名 ``` ```bash codex --sandbox read-only ``` ```bash codex --sandbox workspace-write ``` ```bash codex --sandbox danger-full-access ``` ```bash codex -a on-request ``` ```bash codex --ask-for-approval on-request ``` -------------------------------- ### Conventional commit message examples (Chinese) Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/README.md Conventional commit message examples in Chinese for projects that use Chinese commit messages. ```text feat: 新增用户资料页 fix: 修复登录后跳转异常 style: 优化首页移动端布局 docs: 更新项目使用说明 ``` -------------------------------- ### When to consider MCP Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/README.md Simple guidance for beginners on when MCP is needed. ```text 普通写代码,不一定需要 MCP。 需要 Codex 访问外部工具或外部数据时,才考虑 MCP。 ``` -------------------------------- ### Explanation of workspace-write and on-request Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/README.md Explains the recommended settings: `workspace-write` permits working in the current project, `on-request` prompts before sensitive operations. ```text workspace-write = 允许在当前项目里工作 on-request = 敏感操作先问你 ``` -------------------------------- ### Recommended sandbox and approval flags Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/Codex橙皮书.preview.pdf Recommended combination for new users: allows Codex to work in the current project but asks for approval on sensitive operations. ```bash codex --sandbox workspace-write --ask-for-approval on-request ``` -------------------------------- ### Branch and PR analogy Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/README.md Analogy to explain branches and pull requests. Use it to help beginners understand the workflow. ```text main = 原稿 新分支 = 复制一份出来修改 PR = 把修改后的版本提交给你检查 ``` -------------------------------- ### 权限与安全:/permissions、/approve、/sandbox-add-read-dir、/status Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/Codex橙皮书.pdf 权限与安全相关命令。/permissions 修改权限策略;/approve 批准一次被自动拒绝的操作;/sandbox-add-read-dir 额外允许读取某个目录;/status 查看权限和可写目录。新手建议默认用 /permissions 保持请求批准,看不懂的操作不要用 /approve,不要随便放开完全访问权限。 ```bash /permissions ``` ```bash /approve ``` ```bash /sandbox-add-read-dir ``` ```bash /status ``` -------------------------------- ### Choose login method: ChatGPT account vs API Key Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/README.md Advice for choosing a login method: use a ChatGPT account for local learning, and API Key login for development, automation, and server scenarios. ```text 本地学习优先用 ChatGPT 账号登录。 API Key 登录更适合开发者、自动化和服务器场景。 ``` -------------------------------- ### Select ChatGPT sign-in option Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/Codex橙皮书.pdf Option to select when logging in with a ChatGPT account. This is the recommended method for beginners. ```text Sign in with ChatGPT ``` -------------------------------- ### Cloud、MCP、插件命令:codex cloud、apply、mcp、plugin Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/Codex橙皮书.pdf Cloud、MCP、插件相关命令。cloud 在终端里浏览或执行 Codex Cloud 任务;apply 把 Codex Cloud 生成的 diff 应用到本地;mcp list/add/remove 查看、添加、删除 MCP server;plugin list/add/remove 查看、安装、删除插件。小白阶段先不用管这些。 ```bash codex cloud ``` ```bash codex apply ``` ```bash codex mcp list ``` ```bash codex mcp add ``` ```bash codex mcp remove ``` ```bash codex plugin list ``` ```bash codex plugin add ``` ```bash codex plugin remove ``` -------------------------------- ### Sandbox modifiable file: style.css Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/Codex橙皮书.preview.pdf Example file that Codex can modify within the sandbox. ```text style.css ``` -------------------------------- ### Create practice project directory Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/README.md Suggested directory path for Codex practice projects on Windows. ```text D:\AI-Codex-Projects ``` -------------------------------- ### Check Codex CLI installation with codex --version, node -v, npm -v, codex doctor Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/Codex橙皮书.preview.pdf Run these commands to verify the Codex CLI installation and environment. If codex --version fails, reinstall Codex CLI or reopen the terminal; node -v and npm -v check the Node.js/npm prerequisites. ```bash codex --version ``` ```bash node -v ``` ```bash npm -v ``` ```bash codex doctor ``` -------------------------------- ### Recommended Codex sandbox and approval settings Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/Codex橙皮书.preview.pdf Recommended sandbox and approval settings. workspace-write allows working in the current project, on-request asks before sensitive operations. Avoid danger-full-access, --yolo, and --dangerously-bypass-approvals-and-sandbox. ```text sandbox:workspace-write approval:on-request ``` -------------------------------- ### Invoke Skill by name in task Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/README.md Example of directly invoking a known Skill by name in a task. ```text 请使用 $readme-skill,根据当前项目生成 README。 ``` -------------------------------- ### 模型与速度:/model、/fast Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/Codex橙皮书.pdf 模型与速度相关命令。/model 选择模型和推理强度;/fast 开启或关闭 Fast 模式。想切换 GPT-5.5、mini、低/中/高推理时用 /model;想让支持的模型更快响应时用 /fast。 ```bash /model ``` ```bash /fast ``` -------------------------------- ### 新手最推荐命令:codex、login、doctor、--version、resume、archive、update、exec、logout Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/Codex橙皮书.pdf 新手最推荐记住的命令排名:1 codex 启动 Codex CLI;2 codex login 登录账号;3 codex login status 检查登录状态;4 codex doctor 排查环境问题;5 codex --version 查看版本;6 codex resume --last 接着上次任务继续;7 codex archive 归档不用的任务;8 codex update 更新 Codex;9 codex exec "任务" 一次性执行任务;10 codex logout 退出登录。 ```bash codex ``` ```bash codex login ``` ```bash codex login status ``` ```bash codex doctor ``` ```bash codex --version ``` ```bash codex resume --last ``` ```bash codex archive ``` ```bash codex update ``` ```bash codex exec "任务" ``` ```bash codex logout ``` -------------------------------- ### Check Codex CLI version Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/Codex橙皮书.pdf Check whether Codex CLI was installed successfully by printing its version. ```bash codex--version ``` -------------------------------- ### Review comment: simplify code Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/Codex橙皮书.preview.pdf An example comment to leave on a code change in the review pane, requesting simplification. ```text 这段代码太复杂,请改成新手更容易理解的写法。 ``` -------------------------------- ### npm run build 构建命令 Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/Codex橙皮书.pdf 运行构建命令,用于验证项目能否正式构建。失败时 Codex 会读取报错信息并定位相关文件。 ```text npm run build ``` -------------------------------- ### Beginner terms for Codex Web Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/README.md Simple terms for beginners to understand Codex Web and Cloud tasks. ```text Codex Web = 网页入口 Cloud task = 云端任务 ``` -------------------------------- ### Simplest Skill folder structure Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/README.md Simplest directory structure for a Skill: .agents/skills/readme-skill/SKILL.md. ```text .agents └── skills └── readme-skill └── SKILL.md ``` -------------------------------- ### 代码检查与 Review:/diff、/review、/copy、/raw Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/Codex橙皮书.pdf 代码检查与 Review 相关命令。/diff 查看当前 Git diff,看新增了什么、删除了什么,修改后必看;/review 让 Codex review 当前改动,提交前检查;/copy 复制最近一次 Codex 输出,方便复制长日志或终端输出;/raw 切换原始输出模式。推荐流程:修改后必看 /diff,提交前检查 /review,日志很长时用 /copy。 ```bash /diff ``` ```bash /review ``` ```bash /copy ``` ```bash /raw ``` -------------------------------- ### Review comment: button color Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/Codex橙皮书.preview.pdf An example comment to leave on a code change in the review pane, requesting a color adjustment. ```text 这里的按钮颜色太亮了,改成更克制的深蓝色。 ``` -------------------------------- ### 创建练习项目目录结构 Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/Codex橙皮书.pdf 推荐的项目目录结构,包含 AI-Codex-Projects 和 hello-codex 子目录,以及 index.html 文件。 ```text AI-Codex-Projects └── hello-codex └── index.html ``` -------------------------------- ### requirements.txt 文件 Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/Codex橙皮书.pdf Python 项目可能需要的依赖文件。 ```text requirements.txt ``` -------------------------------- ### Environment configuration checklist Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/README.md Information needed to configure the cloud environment. Lists what Codex needs to know about the project. ```text 用什么语言 怎么安装依赖 怎么启动项目 怎么运行测试 需要哪些环境变量 是否需要特殊工具 ``` -------------------------------- ### Prompt Codex to analyze doctor output Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/Codex橙皮书.pdf Example prompt to send to Codex with the doctor output for analysis of CLI issues. ```text 请根据 codex doctor 的输出,帮我判断 CLI 哪里有问题。 ``` -------------------------------- ### Network access behavior Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/README.md Network access behavior of Codex Web. Installation may have network access, but agent tasks may be restricted. ```text 安装依赖阶段可能允许联网 真正执行 agent 任务阶段可能默认限制联网 ``` -------------------------------- ### 推荐新手工作流:cd、git status、codex、/diff、git diff、git add、git commit、codex archive、/quit Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/Codex橙皮书.pdf 推荐新手工作流:1 cd 项目目录 进入项目文件夹;2 git status 看当前项目状态;3 codex 启动 Codex CLI;4 输入任务 让 Codex 开始工作;5 /diff 在 Codex 内查看改动;6 git diff 在 Git 里再检查一次;7 git add. 暂存满意的修改;8 git commit -m "说明" 保存一个版本;9 codex archive 归档任务或退出;10 /quit 退出。注意 / 斜杠命令是在进入 Codex 后,在 Codex 输入框里输入,不是在外面的 PowerShell / Terminal 里输入。 ```bash cd 项目目录 ``` ```bash git status ``` ```bash codex ``` ```bash /diff ``` ```bash git diff ``` ```bash git add. ``` ```bash git commit -m "说明" ``` ```bash codex archive ``` ```bash /quit ``` -------------------------------- ### Recommended macOS project path Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/Codex橙皮书.pdf Recommended macOS project path to avoid permission and path issues. ```text ~/AI-Codex-Projects/hello-codex ``` -------------------------------- ### 危险命令和参数:--yolo、--dangerously-bypass-approvals-and-sandbox、--ask-for-approval never、sudo rm -rf、git reset --hard、git clean -fd、curl xxx | sh Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/Codex橙皮书.pdf 危险命令和危险参数。--yolo 是 --dangerously-bypass-approvals-and-sandbox 的别名,跳过审批和沙盒;--ask-for-approval never 使 Codex 操作时不再问你;sudo rm -rf 可能修改系统级内容;git reset --hard 可能丢失未保存改动;git clean -fd 可能删除未跟踪文件;curl xxx | sh 下载脚本并直接执行。看到这些内容,先问 Codex:请解释这条命令的作用、风险,以及有没有更安全的替代方案。新手不要用。 ```bash --yolo ``` ```bash --dangerously-bypass-approvals-and-sandbox ``` ```bash --ask-for-approval never ``` ```bash sudo rm -rf ``` ```bash git reset --hard ``` ```bash git clean -fd ``` ```bash curl xxx | sh ``` -------------------------------- ### Recommended Editors for Beginners Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/README.md Recommended editors for beginners to use with Codex IDE Extension. ```text VS Code 或 Cursor ``` -------------------------------- ### Python project environment requirements Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/Codex橙皮书.preview.pdf Lists the environment requirements for a typical Python project, including the interpreter, package installer, dependency file, and test runner. ```text Python pip requirements.txt pytest ``` -------------------------------- ### npm run dev 启动开发环境 Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/Codex橙皮书.pdf 启动开发环境,失败时可能是依赖没装或脚本不存在。 ```text npm run dev ``` -------------------------------- ### config.toml 配置解释 Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/README.md 解释上述 config.toml 配置的含义。 ```text 有一个 MCP server 叫 context7。 启动命令是 npx -y @upstash/context7-mcp。 ``` -------------------------------- ### Avoid running Codex in system directory Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/Codex橙皮书.pdf Example of a system directory where you should not run Codex on Windows. Avoid running Codex in system directories, desktop, downloads, or important folders. ```text C:\ ``` -------------------------------- ### package.json 配置文件 Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/Codex橙皮书.pdf 前端项目可能需要的配置文件。 ```text package.json ``` -------------------------------- ### macOS common check commands Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/Codex橙皮书.pdf Common macOS check commands: pwd shows current directory, ls lists files, codex --version checks installation, codex doctor checks environment. ```bash pwd ``` ```bash ls ``` ```bash codex --version ``` ```bash codex doctor ``` -------------------------------- ### Commit message format examples Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/Codex橙皮书.pdf Common commit message formats for English and Chinese projects. Use the conventional commit prefix (feat, fix, style, refactor, docs) followed by a concise summary of the change. ```text feat: add user profile page fix: resolve login redirect issue style: improve homepage responsive refactor: simplify product card docs: update setup guide ``` ```text feat: 新增用户资料页 fix: 修复登录后跳转异常 style: 优化首页移动端布局 docs: 更新项目使用说明 ``` -------------------------------- ### /plan 查看方案 Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/Codex橙皮书.pdf 复杂任务先使用 /plan 查看方案,再执行。 ```text /plan ``` -------------------------------- ### Reason for Not Recommended Windows Path Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/README.md Explanation of why the not recommended Windows path is problematic. ```text 中文路径、空格、桌面目录,有时更容易出问题。 ``` -------------------------------- ### Constraint prompt: no unrelated refactoring Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/README.md A constraint prompt to give Codex before starting a small implementation step. It explicitly forbids refactoring unrelated code, renaming, changing directory structure, dependency versions, or global config, and requires that optimization suggestions be recorded rather than applied. ```text 本次只实现当前功能点。 不要顺手重构无关代码。 不要修改命名、目录结构、依赖版本和全局配置。 如果你发现代码可以优化,请先记录为建议,不要直接修改。 ``` -------------------------------- ### Skill 文件目录结构 Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/Codex橙皮书.pdf 手动创建 Skill 的目录结构:最简单的结构只需 SKILL.md,可选包含 scripts、references 和 assets 文件夹。 ```text .agents └── skills └── readme-skill └── SKILL.md ``` ```text .agents └── skills └── readme-skill ├── SKILL.md ├── scripts ├── references └── assets ``` -------------------------------- ### /permissions 检查权限 Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/Codex橙皮书.pdf 检查权限设置,用于处理权限问题。 ```text /permissions ``` -------------------------------- ### Small-step implementation prompt template Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/README.md A ready-to-use prompt template for small-step implementation with Codex. It instructs Codex to change only one feature point, avoid unrelated refactoring, stop after the change, and report the modified files, reasons, risks, and next steps. ```text 请开始小步实现。 当前只执行第【1】步: 【这里写本次只做的一个功能点】 要求: 1. 一次只改这个功能点 2. 只修改和当前功能直接相关的文件 3. 不要顺手重构无关代码 4. 不要修改目录结构 5. 不要新增不必要依赖 6. 不要删除已有功能 7. 不要改计划外的文件 修改完成后请停止,并输出: 1. 本次修改了哪些文件 2. 每个文件改了什么 3. 为什么这些修改是必要的 4. 有没有改到计划外内容 5. 有没有潜在风险 6. 下一步建议做什么 注意: 如果遇到不确定的地方,请先停下来问我,不要自行决定。 ``` -------------------------------- ### Common MCP terminal commands Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/Codex橙皮书.preview.pdf Common MCP terminal commands: codex mcp --help shows help, codex mcp list shows configured servers, codex mcp add adds a server, codex mcp remove deletes one, codex mcp get shows details, codex mcp login authorizes a remote MCP, codex mcp logout cancels authorization, and /mcp lists tools in the current session. ```bash codex mcp --help ``` ```bash codex mcp list ``` ```bash codex mcp add ``` ```bash codex mcp remove ``` ```bash codex mcp get ``` ```bash codex mcp login ``` ```bash codex mcp logout ``` ```bash /mcp ``` -------------------------------- ### 启动时直接发任务:codex、codex -i、codex --image Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/Codex橙皮书.pdf 启动 Codex CLI 并直接发送第一条任务。codex -i 和 codex --image 用于附加图片一起分析。适合简单解释项目、分析报错截图、UI 截图提修改建议。新手更推荐先运行 codex 进入后再输入任务。 ```bash codex "请解释这个项目结构" ``` ```bash codex -i ./error.png "分析这个报错" ``` ```bash codex --image ./ui.png "根据截图优化页面" ``` -------------------------------- ### Repository definition Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/README.md Simple definition of a repository. Use it to explain the concept to beginners. ```text 仓库 = 一个放在 GitHub 上的项目文件夹 ``` -------------------------------- ### sandbox 配置 workspace-write Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/Codex橙皮书.pdf 推荐设置:允许在当前项目里工作,限制沙盒范围。 ```text sandbox:workspace-write ``` -------------------------------- ### 在 Codex CLI 中创建 README Skill 的示例提示词 Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/Codex橙皮书.pdf 在 Codex CLI 中使用 $skill-creator 创建 README Skill 的示例提示词,包含用途、触发场景、工作流程、输出格式和注意事项。 ```text $skill-creator 请帮我创建一个 README Skill。 这个 Skill 的作用: 根据当前项目自动生成一份适合小白阅读的 README。 触发场景: 当我说“生成 README”“写项目说明”“整理项目文档”“写安装教程”时使用。 工作流程: 1. 先阅读项目结构 2. 查看 package.json、README、入口文件 3. 判断项目类型 4. 生成项目简介 5. 写安装步骤 6. 写启动命令 7. 说明主要文件夹作用 8. 补充常见问题 9. 不确定的地方不要编造 输出格式: 使用 Markdown。 必须包含: -项目简介 -功能特点 -安装步骤 -启动命令 -文件结构 -常见问题 -后续优化方向 注意事项: 不要编造不存在的功能。 不要读取或输出 API Key、密码、token、私钥。 ``` -------------------------------- ### Codex CLI workflow overview Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/README.md Shows the overall workflow of Codex CLI as a sequence of steps from reading the project to handling failures. ```text 读取项目 → 理解任务 → 提出计划 → 修改文件 → 运行命令 → 等待批准 → 展示 diff → 处理失败 ``` -------------------------------- ### /mention 指定文件 Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/Codex橙皮书.pdf 指定文件,用于解决 Codex 看不到项目文件的问题。 ```text /mention ``` -------------------------------- ### Initialize Git repository before using Codex Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/Codex橙皮书.preview.pdf Initializes a Git repository, stages all files, and creates an initial commit. Recommended before letting Codex modify a project so changes can be rolled back. ```bash git init git add. git commit-m "initial commit" ``` -------------------------------- ### Codex Web execution steps Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/README.md Typical steps Codex Web performs in the cloud. Shows the workflow from pulling the repo to generating a diff. ```text 1. 拉取 GitHub 仓库代码 2. 切到指定分支或提交 3. 执行 setup script 安装依赖 4. 根据你的任务读取文件 5. 修改代码 6. 运行测试或构建命令 7. 生成 diff 和总结 ``` -------------------------------- ### Local Codex vs Codex Web analogy Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/README.md A simple analogy to distinguish local Codex from Codex Web. Use it to quickly explain the difference to beginners. ```text 本地 Codex = 在你电脑上干活 Codex Web = 在云端帮 GitHub 仓库干活 ``` -------------------------------- ### 沙盒测试:codex sandbox、codex execpolicy Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/Codex橙皮书.pdf 沙盒测试命令。sandbox 在 Codex 的沙盒规则下运行命令;--cd 指定目录运行沙盒命令;execpolicy 检查某条命令会被允许、询问还是阻止。小白阶段不用学,默认用 workspace-write + on-request,不要随便 full access。 ```bash codex sandbox ``` ```bash codex sandbox --cd 项目目录 -- 命令 ``` ```bash codex execpolicy ``` -------------------------------- ### 危险参数:--sandbox danger-full-access Source: https://github.com/a2168006369-svg/codex-orange-book/blob/main/Codex橙皮书.pdf 危险参数:放开文件和网络限制。新手不要用。 ```bash --sandbox danger-full-access ```