agents-setup
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chineseagents-setup
agents-setup
Consolidate AI agent configuration into a single AGENTS.md source of truth.
Wire all satellite config files to point to it. Eliminate duplication.
将AI代理配置整合到单一AGENTS.md真相源中。关联所有附属配置文件,使其指向该文件,消除重复内容。
Communication
沟通方式
Always respond in caveman mode (full intensity):
- Drop articles, filler, pleasantries, hedging
- Fragments OK, short synonyms, technical terms exact
- Code blocks unchanged
- Safety override: clear wording for destructive ops, then resume caveman
始终以caveman模式(高强度)回应:
- 省略冠词、填充语、客套话、模棱两可的表述
- 允许使用短句、同义词替代,专业术语需准确
- 代码块保持不变
- 安全例外:执行破坏性操作时使用清晰表述,之后恢复caveman模式
Phase 1: Plan Mode
阶段1:计划模式
Always start here. Never skip.
Open with exactly this:
"Modo plan: Preguntame todo lo que necesites para realizar correctamente esta tarea."
Then ask only what's missing. Scan the project first (see Detection below), then ask only the gaps you can't auto-detect:
- Project name / purpose (if not obvious from package.json or README)
- LLMs/tools in use beyond Claude Code (Cursor? Copilot? OpenCode? Zed?)
- Any existing rules in current AI config files worth preserving?
- Team-specific PR policies, branch conventions, or deployment notes to include?
Present a plan listing every file you'll create or modify. Wait for explicit approval ("go", "sí", "proceed", "yes") before touching anything.
必须从此阶段开始,切勿跳过。
以如下内容开场:
"Modo plan: Preguntame todo lo que necesites para realizar correctamente esta tarea."
随后仅询问缺失的信息。先扫描项目(见下方检测环节),再询问无法自动检测到的信息:
- 项目名称/用途(若从package.json或README中无法明确判断)
- 除Claude Code外正在使用的大语言模型/工具(Cursor?Copilot?OpenCode?Zed?)
- 当前AI配置文件中是否有值得保留的现有规则?
- 是否需要纳入团队特定的PR政策、分支约定或部署说明?
提交一份计划,列出所有将创建或修改的文件。在进行任何操作前,等待用户明确批准(如“go”“s픓proceed”“yes”)。
Phase 2: Auto-Detection
阶段2:自动检测
Scan the project to build an accurate picture of the stack. Do this before asking questions — the answers shape what you ask.
扫描项目,构建技术栈的准确信息。在询问问题前完成此步骤——检测结果将决定询问的内容。
Detect stack
检测技术栈
Read in this order:
- Root package.json — name, scripts, dependencies, devDependencies
- Workspace package.json files — monorepo packages (look for field or multiple
workspacesin subdirs)package.json - Other stack indicators: /
pyproject.toml(Python),requirements.txt(Go),go.mod(Rust),Cargo.toml/pom.xml(Java),build.gradle(Ruby),Gemfile(PHP)composer.json - Build tools: vite.config., webpack.config., turbo.json, nx.json
- Test framework: jest.config., vitest.config., pytest.ini, .mocharc.*
- Lint/format: .eslintrc., .prettierrc., pyproject.toml [tool.ruff], etc.
- Package manager: presence of bun.lock, pnpm-lock.yaml, yarn.lock, package-lock.json
按以下顺序读取文件:
- 根目录package.json —— 名称、脚本、依赖项、开发依赖项
- 工作区package.json文件 —— 单仓库多包项目(查找字段或子目录中的多个
workspaces)package.json - 其他技术栈标识文件:/
pyproject.toml(Python)、requirements.txt(Go)、go.mod(Rust)、Cargo.toml/pom.xml(Java)、build.gradle(Ruby)、Gemfile(PHP)composer.json - 构建工具:vite.config.、webpack.config.、turbo.json、nx.json
- 测试框架:jest.config.、vitest.config.、pytest.ini、.mocharc.*
- 代码检查/格式化工具:.eslintrc.、.prettierrc.、pyproject.toml [tool.ruff]等
- 包管理器:检查是否存在bun.lock、pnpm-lock.yaml、yarn.lock、package-lock.json
Detect existing AI config
检测现有AI配置
Check for these files and read their contents:
AGENTS.md.claude/CLAUDE.md.github/copilot-instructions.md.cursorrules.windsurfrules- (list all)
.agents/rules/*.md MEMORY.md
Flag any rules in satellite files that are NOT already covered by AGENTS.md — these need preserving.
检查并读取以下文件内容:
AGENTS.md.claude/CLAUDE.md.github/copilot-instructions.md.cursorrules.windsurfrules- (列出所有文件)
.agents/rules/*.md MEMORY.md
标记附属文件中未被AGENTS.md覆盖的规则——这些规则需要保留。
Detect project structure
检测项目结构
List top-level directories (excluding node_modules, .git, dist, build, .cache).
For monorepos: list each package and its role if inferable.
列出顶级目录(排除node_modules、.git、dist、build、.cache)。
对于单仓库多包项目:列出每个包及其可推断的角色。
Phase 3: Generate AGENTS.md
阶段3:生成AGENTS.md
Create or update AGENTS.md at project root. Keep under 200 lines.
在项目根目录创建或更新AGENTS.md文件,篇幅控制在200行以内。
Template
模板
markdown
undefinedmarkdown
undefinedAGENTS.md — Project Rules
AGENTS.md — Project Rules
Stack
Stack
[Fill from auto-detection. Be specific: versions, framework names, key libraries.]
[For monorepos: list each package and its role.]
[从自动检测结果中填充信息。需具体:版本、框架名称、核心库。]
[对于单仓库多包项目:列出每个包及其角色。]
Commands
Commands
[Extract real commands from package.json scripts or equivalent.]
[Group by: dev, build, test, lint/format, any project-specific workflows.]
[从package.json脚本或等效文件中提取真实命令。]
[按以下类别分组:开发、构建、测试、代码检查/格式化、项目特定工作流。]
Project Structure
Project Structure
[List top-level dirs with one-line purpose each.]
[For monorepos: list packages + roles.]
[列出顶级目录及单行用途说明。]
[对于单仓库多包项目:列出包+角色。]
Communication Style
Communication Style
Default mode for all AI assistants in this project: caveman (full intensity).
Rules:
- Load skill (level: full) before any response
/caveman - Apply to: chat replies, planning steps, tool preambles, progress updates, summaries
- Disable only on explicit: or
stop cavemannormal mode - Fallback if skill unavailable: emulate caveman style directly
- Safety override: use clear wording for destructive/irreversible ops, then resume caveman
Default mode for all AI assistants in this project: caveman (full intensity).
Rules:
- Load skill (level: full) before any response
/caveman - Apply to: chat replies, planning steps, tool preambles, progress updates, summaries
- Disable only on explicit: or
stop cavemannormal mode - Fallback if skill unavailable: emulate caveman style directly
- Safety override: use clear wording for destructive/irreversible ops, then resume caveman
Plan Before Act
Plan Before Act
Always present plan and wait for explicit approval before implementing any non-trivial change.
Non-trivial = anything beyond single-line fix. Includes: new files, refactors, features, dependency changes, config changes.
Format:
- State what you found
- List proposed changes (files + what changes)
- Flag risks or unknowns
- Wait for "go" / "yes" / "proceed"
Do NOT write code until approved.
Always present plan and wait for explicit approval before implementing any non-trivial change.
Non-trivial = anything beyond single-line fix. Includes: new files, refactors, features, dependency changes, config changes.
Format:
- State what you found
- List proposed changes (files + what changes)
- Flag risks or unknowns
- Wait for "go" / "yes" / "proceed"
Do NOT write code until approved.
PR Policy
PR Policy
[Fill from project conventions or use sensible defaults:]
- One concern per PR
- Run lint + format before committing
- Tests required for new logic
- No TODO left in merged code
undefined[从项目约定中提取或使用合理默认值:]
- One concern per PR
- Run lint + format before committing
- Tests required for new logic
- No TODO left in merged code
undefinedRules for filling the template
模板填充规则
- Stack: exact versions from package.json, not ranges (React 19, not ^19). For monorepos list each package's role.
- Commands: use actual script names from package.json. If is the real command, write that — not
bun run dev.npm run dev - Structure: only include dirs that exist. Skip boilerplate explanation for obvious names (src/, tests/ need no explanation).
- Preserve: any rules from satellite files not already in the template — add them under a relevant section or a new section.
- Length: if approaching 200 lines, cut structure detail first, keep commands and stack exact.
- Stack:使用package.json中的精确版本,而非版本范围(如React 19,而非^19)。对于单仓库多包项目,列出每个包的角色。
- Commands:使用package.json中的真实脚本名称。如果实际命令是,则写该命令——而非
bun run dev。npm run dev - Structure:仅包含存在的目录。对于名称明确的目录无需额外解释(如src/、tests/无需说明)。
- 保留内容:附属文件中未被模板覆盖的规则——将其添加到相关章节或新章节中。
- 篇幅控制:若接近200行,先删减结构细节,保留命令和技术栈的精确信息。
Phase 4: Wire Satellite Files
阶段4:关联附属文件
After AGENTS.md is ready, update each satellite:
AGENTS.md准备就绪后,更新每个附属文件:
.claude/CLAUDE.md
.claude/CLAUDE.md
If file exists: replace entire content with one line.
If file doesn't exist: create it.
Strictly follow the rules in ./AGENTS.md若文件已存在:替换全部内容为一行。
若文件不存在:创建该文件。
Strictly follow the rules in ./AGENTS.md.github/copilot-instructions.md
.github/copilot-instructions.md
Same — one line:
Strictly follow the rules in ./AGENTS.md同样——仅一行:
Strictly follow the rules in ./AGENTS.md.cursorrules (only if file already exists)
.cursorrules(仅当文件已存在时)
Replace with:
Strictly follow the rules in ./AGENTS.md替换为:
Strictly follow the rules in ./AGENTS.md.windsurfrules (only if file already exists)
.windsurfrules(仅当文件已存在时)
Replace with:
Strictly follow the rules in ./AGENTS.md替换为:
Strictly follow the rules in ./AGENTS.md.agents/rules/ (if directory exists)
.agents/rules/(若目录存在)
List all .md files. For each:
- Read content
- If content is fully covered by AGENTS.md → delete file
- If content has rules NOT in AGENTS.md → port those rules to AGENTS.md, then delete file
- Tell user which files were deleted and what (if anything) was ported
列出所有.md文件。针对每个文件:
- 读取内容
- 若内容已完全被AGENTS.md覆盖 → 删除文件
- 若内容包含AGENTS.md中没有的规则 → 将这些规则迁移到AGENTS.md,然后删除文件
- 告知用户哪些文件被删除,以及(如果有)哪些规则被迁移
MEMORY.md
MEMORY.md
If file doesn't exist, create at project root:
markdown
undefined若文件不存在,在项目根目录创建:
markdown
undefinedMEMORY.md — Agent Lessons
MEMORY.md — Agent Lessons
Human-reviewed lessons from past sessions. Agent writes candidates; human approves before merging.
<!-- Add lessons below. Format: date | lesson | why it matters -->
If file exists, leave it untouched.Human-reviewed lessons from past sessions. Agent writes candidates; human approves before merging.
<!-- Add lessons below. Format: date | lesson | why it matters -->
若文件已存在,保持不变。Phase 5: Report
阶段5:报告
After all changes, report:
Done. Changes:
- AGENTS.md: [created/updated]
- .claude/CLAUDE.md: [created/updated] → pointer
- .github/copilot-instructions.md: [created/updated] → pointer
- .agents/rules/: [N files deleted, M rules ported to AGENTS.md]
- MEMORY.md: [created/already existed]
- [any other files touched]
Single source of truth: AGENTS.mdThen ask: "Hay algo que ajustar en AGENTS.md antes de cerrar?"
完成所有更改后,提交报告:
Done. Changes:
- AGENTS.md: [created/updated]
- .claude/CLAUDE.md: [created/updated] → pointer
- .github/copilot-instructions.md: [created/updated] → pointer
- .agents/rules/: [N files deleted, M rules ported to AGENTS.md]
- MEMORY.md: [created/already existed]
- [any other files touched]
Single source of truth: AGENTS.md随后询问:"Hay algo que ajustar en AGENTS.md antes de cerrar?"