AGENTS.md examples for Codex CLI

AGENTS.md 模板库

直接复制项目规则模板,替换真实命令和保护范围,再保存到项目根目录。适合 Codex CLI、Claude Code、Cursor 和 Gemini CLI。

复制模板 2.99 元 Codex 清单

模板先覆盖真实项目边界

好用的 AGENTS.md 不追求长,重点是让 Agent 知道怎么运行、哪里能改、哪里不能碰,以及怎样验收。

Commands 预览、测试、构建、部署命令必须可执行,避免 Agent 只能猜。
Boundaries 明确页面、脚本、数据、支付、账号和用户改动的保护边界。
Acceptance 要求输出检查结果、链接状态、移动端布局和无法运行的测试。

可复制 AGENTS.md 模板

每份模板都保留项目类型、命令、可改范围、保护范围、安全规则和交付格式。

Static Website

适合 HTML/CSS/JS、GitHub Pages、单页销售页、小工具站。

GitHub Pages No build Mobile check
# AGENTS.md

This project is a static website used as a public landing page or browser tool.

## Project Overview

- Stack: HTML, CSS, JavaScript, GitHub Pages
- Runtime: no build step, open HTML directly for local preview
- Main goal: keep pages fast, readable, mobile-friendly, and easy to verify

## Working Mode

- Inspect the current HTML and CSS before editing.
- Keep changes limited to the requested page or directly linked shared files.
- Avoid broad visual redesigns unless the task explicitly asks for it.
- Do not modify unrelated sales links, order amounts, analytics, or legal pages.

## Common Commands

- Preview: open the HTML file in a browser
- HTML check: xmllint --html --noout index.html
- Link check: curl -L -I target-url
- Deploy: git add . && git commit -m "message" && git push

## Editable Scope

- Current task page
- Related CSS inside the same HTML file
- README, sitemap.xml, robots.txt when the public URL changes

## Protected Scope

- Payment links and product prices
- Existing order pages and privacy/terms pages
- User-created files not related to the task
- Historical tracker, ledger, or publishing records

## Acceptance Checks

- Page opens locally without console errors
- 390px mobile viewport has no horizontal overflow
- Primary buttons and copy actions work
- Public URLs return HTTP 200 after deployment
- Summarize changed files and verification results

Vite / React App

适合 Vite、React、TypeScript、小型 SaaS 工具和 dashboard。

npm React TypeScript
# AGENTS.md

This project is a Vite/React application.

## Project Overview

- Stack: Vite, React, TypeScript, CSS modules or app-level CSS
- Package manager: npm unless package-lock or pnpm-lock indicates otherwise
- Main goal: ship focused UI behavior without breaking existing routes

## Working Mode

- Read package.json before running commands.
- Follow existing component and state patterns.
- Keep UI elements stable across mobile and desktop viewports.
- Use existing icons, design tokens, helper functions, and route structure.

## Common Commands

- Install: npm install
- Dev server: npm run dev
- Type check: npm run typecheck
- Lint: npm run lint
- Build: npm run build

## Editable Scope

- src components directly related to the requested feature
- route/page file for the target view
- nearby CSS or design-token files already used by the target view
- tests for changed behavior

## Protected Scope

- Authentication, billing, payment, and permission checks
- API keys, environment files, and production configuration
- Unrelated shared components used across many routes
- Lockfiles unless dependency changes are required

## Acceptance Checks

- npm run lint passes or the existing unrelated failures are documented
- npm run build passes
- Changed UI is checked at mobile and desktop widths
- Buttons, form validation, loading states, and empty states behave correctly
- Final response lists files changed and checks run

Node CLI Tool

适合命令行小工具、批处理脚本、GitHub Action 辅助脚本。

Node.js CLI Batch
# AGENTS.md

This project is a Node.js CLI or automation script.

## Project Overview

- Stack: Node.js, JavaScript or TypeScript
- Runtime: local command line
- Main goal: make file and API operations predictable, logged, and reversible

## Working Mode

- Read package.json, CLI entrypoints, and README before editing.
- Prefer structured parsers for JSON, CSV, YAML, Markdown, and HTML.
- Keep command output concise and useful for debugging.
- Do not add network calls, credential usage, or destructive file operations without explicit need.

## Common Commands

- Install: npm install
- Run: node path/to/script.js --help
- Test: npm test
- Lint: npm run lint
- Build: npm run build

## Editable Scope

- CLI entrypoint and directly imported helper modules
- Test fixtures and tests for changed behavior
- README usage examples when flags or output changes

## Protected Scope

- Secrets, tokens, cookies, and local credential files
- User data directories unless the task explicitly asks to modify them
- Published package metadata unless release work is requested

## Acceptance Checks

- --help output still works
- A dry-run or fixture-based run succeeds
- Tests pass or known unrelated failures are reported
- Error messages explain the failing input and next step
- Final response includes exact command examples

Python Data Script

适合 Excel/CSV 清洗、报告生成、PDF/文档批处理。

Python CSV Excel
# AGENTS.md

This project contains Python scripts for data cleanup, spreadsheet processing, or report generation.

## Project Overview

- Stack: Python 3, CSV/Excel/Markdown/PDF tooling
- Runtime: local scripts
- Main goal: preserve source data, produce auditable outputs, and keep missing values explicit

## Working Mode

- Inspect input files and column names before writing transformations.
- Prefer pandas, openpyxl, csv, pathlib, and structured document libraries over ad hoc string parsing.
- Keep generated outputs separate from raw source files.
- Do not overwrite user source files unless the task explicitly asks for it.

## Common Commands

- Run script: python script.py
- Check syntax: python -m py_compile script.py
- Optional tests: pytest
- Inspect output: python - <<'PY'
from pathlib import Path
print(Path("output").exists())
PY

## Editable Scope

- Python scripts directly related to the requested transformation
- Small helper modules used by the script
- Output README or data dictionary when the output schema changes

## Protected Scope

- Raw input files
- Customer files, private transcripts, and source workbooks
- Credentials and API keys
- Existing generated outputs unless regeneration is part of the task

## Acceptance Checks

- Script runs on a representative sample
- Output row count, column names, and empty-value handling are checked
- Generated workbook or CSV opens successfully
- Any missing or inferred values are clearly marked
- Final response includes output path and validation summary

Obsidian Content Vault

适合 Obsidian 插件、内容库、Markdown 工作流和小红书资料库。

Markdown Obsidian Content
# AGENTS.md

This project is an Obsidian vault, Markdown content system, or local content workflow.

## Project Overview

- Stack: Markdown, Obsidian, local folders, optional plugin scripts
- Runtime: local files opened in Obsidian or plain text editors
- Main goal: preserve knowledge structure while creating clear, reusable deliverables

## Working Mode

- Read the nearest README, index note, or 清单.md before editing.
- Keep final notes beside the source list unless the user gives another folder.
- Preserve frontmatter, backlinks, headings, and existing naming conventions.
- Prefer concise human writing over generic AI-sounding summaries.

## Common Commands

- Search files: rg "keyword" target-folder
- List markdown files: rg --files -g "*.md"
- Preview: open the Markdown file in Obsidian or a text editor

## Editable Scope

- Notes directly related to the requested topic
- Local template files for the same workflow
- README or index notes when a new reusable workflow is added

## Protected Scope

- Unrelated vault areas
- Private chats, transcripts, or customer records not needed for the task
- Plugin source code unless plugin changes are explicitly requested
- User-authored drafts outside the requested folder

## Acceptance Checks

- Final note has clear title, source metadata, and readable sections
- Links and paths point to existing local files where practical
- No unrelated notes are reformatted
- Deliverable is saved in the requested folder
- Final response gives the saved path

需要 Codex 新手排障清单

2.99 元包适合刚装 Codex、不知道第一次任务怎么写、经常卡在登录/权限/上下文/测试验证的新手。付款后通过闲鱼聊天发送 ZIP 资料包。

我要 Codex 入门排障清单 2.99 元版,拍下后请发送 ZIP 资料包。

边界:这是清单和提示词模板包,不是代写代码、远程配置、账号共享或保证解决所有环境问题。