agentsmd-generator
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseAgent Context Generator
Agent 上下文生成器
What You'll Do
你需要完成的工作
- 🔍 Inventory the repository's structure, capture a -aware
.gitignoreoutput, and record automation entry points (preferringtree/justtasks when available)make - 🧭 Capture coding conventions, directory ownership, testing expectations, and review workflows so future agents can navigate confidently
- 🧩 Produce an file following the opinionated section order below, honoring scope rules for nested directories
AGENTS.md - ✅ Embed universal wrap-up tasks: ensure the README is updated after significant code changes and summarize changes per conventional commits while resolving any open questions with the developer
- 🔍 盘点代码仓库结构,生成支持的
.gitignore命令输出,并记录自动化入口点(优先使用tree/just任务)make - 🧭 记录编码规范、目录归属、测试要求及评审流程,以便后续Agent能顺利开展工作
- 🧩 按照以下指定的章节顺序生成文件,遵循嵌套目录的范围规则
AGENTS.md - ✅ 嵌入通用收尾任务:重大代码变更后更新README,按照规范提交格式总结变更,并与开发者解决所有未决问题
Phase 1 · Understand the Repository
第一阶段 · 了解代码仓库
- Check for existing AGENTS.md
- Use alternative (
findor repo tree) to discover current files. Determine scope inheritance so you can update or extend instead of duplicating.glob
- Use
- Read Core Docs
- Skim ,
README.md, and other onboarding docs for project philosophy, setup, and workflows.CONTRIBUTING.md - If or
docs/exists, scan for architectural or process references worth surfacing.documentation/
- Skim
- Survey Project Layout
- Note primary directories, languages, build targets, and ownership (e.g., "maintained by Frontend team").
src/ui - Check for ,
plans/, or other knowledge directories. Flag must-read files (ADR indexes, architecture overviews, runbooks) to reference later in AGENTS.md.docs/
- Note primary directories, languages, build targets, and ownership (e.g., "
- Build a Git-aware Tree
- Use the command with the
treeflag (tree ≥ 2.0) so ignored paths stay hidden:--gitignore.tree --gitignore -a -L 3 > tmp/tree.txt - If your build lacks
tree, run--gitignoreand manually prune any ignored directories noted intree -a -L 3 --prune, or install an updated version via your package manager..gitignore - Capture or trim the output before placing it in AGENTS.md (focus on the top 2–3 levels, and note when you omitted details for brevity).
- Use the
- Identify Automation Runners
- If exists, run
Justfile(orjust --listfor extra notes).just --list --unsorted - If exists (and
Makefiledoes not), runjustor inspect phony targets for canonical tasks.make help - Record which commands are recommended for linting, testing, building, syncing data, etc. Link the definitive task names you surface in your notes for inclusion later.
- If
- Catalog Tooling & Environment
- List required runtimes, package managers, env vars, secrets handling, and local services.
- Note down any ,
.env.example, or secrets documentation that agents must review.config/
- Clarify Testing & Quality Gates
- Identify test suites, coverage expectations, linting, formatting, and CI workflows.
- Resolve Ambiguities Early
- Whenever conventions, ownership, or workflows seem unclear, prompt the developer with focused questions before drafting the guide.
- Ask explicitly whether existing or documentation directories are authoritative or stale, and clarify what canon to reference.
plans/
Outcome: A structured notes list describing layout, tooling, commands, testing, release process, documentation references, pending questions, and update expectations.
- 检查现有AGENTS.md文件
- 使用的替代工具(
find或仓库树)查找当前文件。确定范围继承关系,以便进行更新或扩展,而非重复创建。glob
- 使用
- 阅读核心文档
- 浏览、
README.md及其他入职文档,了解项目理念、搭建步骤及工作流程。CONTRIBUTING.md - 若存在或
docs/目录,扫描其中是否有值得纳入的架构或流程参考内容。documentation/
- 浏览
- 调研项目布局
- 记录主要目录、开发语言、构建目标及归属方(例如:“由前端团队维护”)。
src/ui - 检查是否存在、
plans/或其他知识目录。标记必须阅读的文件(ADR索引、架构概述、运行手册),以便后续在AGENTS.md中引用。docs/
- 记录主要目录、开发语言、构建目标及归属方(例如:“
- 生成Git感知的目录树
- 使用带有参数的
--gitignore命令(tree ≥ 2.0版本),隐藏被忽略的路径:tree。tree --gitignore -a -L 3 > tmp/tree.txt - 若你的版本不支持
tree,运行--gitignore并手动剔除tree -a -L 3 --prune中记录的忽略目录,或通过包管理器安装更新版本。.gitignore - 在将输出放入AGENTS.md之前,先整理或裁剪内容(重点展示前2-3级目录,并注明为简洁起见省略了部分细节)。
- 使用带有
- 识别自动化运行器
- 若存在,运行
Justfile(或just --list查看额外说明)。just --list --unsorted - 若存在(且无
Makefile),运行just或检查伪目标以获取标准任务。make help - 记录推荐的代码检查、测试、构建、数据同步等命令。记录你发现的确定任务名称,以便后续纳入指南。
- 若存在
- 整理工具与环境信息
- 列出所需的运行时、包管理器、环境变量、密钥处理方式及本地服务。
- 记录Agent必须查看的、
.env.example或密钥相关文档。config/
- 明确测试与质量门禁
- 识别测试套件、覆盖率要求、代码检查、格式化及CI工作流程。
- 尽早解决歧义
- 每当遇到规范、归属或工作流程不明确的情况,在起草指南前向开发者提出针对性问题。
- 明确询问现有或文档目录是否为权威内容或已过时,并确定需引用的标准内容。
plans/
成果: 一份结构化的笔记列表,描述目录布局、工具、命令、测试、发布流程、文档参考、未决问题及更新要求。
Phase 2 · Plan the AGENTS.md Structure
第二阶段 · 规划AGENTS.md结构
Follow this opinionated order to keep files consistent and scannable:
- Header — Title + short purpose statement.
- Quick Facts — Table or bullet summary (languages, package manager, key scripts, CI).
- Repository Tour — High-level directory map with responsibilities and ownership hints.
- Tooling & Setup — Required runtimes, package managers, environment variables, secrets.
- Common Tasks — Lint/test/build/deploy commands. Prefer listing recipes first, then
justtargets, then raw commands.make - Testing & Quality — When and how to run tests, linting, formatting, coverage, and CI expectations.
- Workflow Expectations — Branching model, review norms, feature flagging, deployment cadence.
- Documentation Duties — When to update , architecture diagrams, or other docs.
README.md - Finish the Task — Mandatory wrap-up checklist for every agent task.
For deeper directories (e.g., ), include a "Scope" note at the top clarifying inheritance from parent AGENTS instructions. Always confirm with the developer before drafting new per-directory AGENTS files so you do not duplicate existing guidance or create unnecessary overhead.
services/api/遵循以下指定的顺序,保持文件一致性和易读性:
- 标题栏 — 标题 + 简短用途说明。
- 快速概览 — 表格或项目符号摘要(开发语言、包管理器、关键脚本、CI)。
- 仓库导览 — 高级别目录映射,包含职责和归属提示。
- 工具与搭建 — 所需的运行时、包管理器、环境变量、密钥。
- 常见任务 — 代码检查/测试/构建/部署命令。优先列出任务,其次是
just目标,最后是原生命令。make - 测试与质量 — 何时及如何运行测试、代码检查、格式化、覆盖率检查,以及CI要求。
- 工作流程要求 — 分支模型、评审规范、功能标记、发布节奏。
- 文档职责 — 何时更新、架构图或其他文档。
README.md - 任务收尾 — 每个Agent任务的强制收尾检查清单。
对于深层目录(如),在顶部添加“范围”说明,明确继承自父级AGENTS指令的内容。在起草新的目录级AGENTS文件前,务必与开发者确认,避免重复现有指南或造成不必要的负担。
services/api/Phase 3 · Compose AGENTS.md
第三阶段 · 编写AGENTS.md
Use the template below and adapt each section to the project:
markdown
undefined使用以下模板,根据项目情况调整各章节:
markdown
undefinedProject Agent Guide
Project Agent Guide
Scope: Root project (applies to all subdirectories unless overridden)
Scope: Root project (applies to all subdirectories unless overridden)
Quick Facts
Quick Facts
- Primary language:
- Package manager:
- Entrypoints:
- CI/CD:
- Primary language:
- Package manager:
- Entrypoints:
- CI/CD:
Repository Tour
Repository Tour
- — description & owner
path/
- — description & owner
path/
Tooling & Setup
Tooling & Setup
- Install instructions (per OS)
- Required environment variables (with purpose)
- Secrets management notes
- Install instructions (per OS)
- Required environment variables (with purpose)
- Secrets management notes
Common Tasks
Common Tasks
- — what it does (preferred)
just <task> - — what it does
make <target> - Raw command fallback when automation missing
- — what it does (preferred)
just <task> - — what it does
make <target> - Raw command fallback when automation missing
Testing & Quality Gates
Testing & Quality Gates
- Unit/integration test commands
- Lint/format commands
- Coverage expectations & thresholds
- CI status command or dashboard link
- Unit/integration test commands
- Lint/format commands
- Coverage expectations & thresholds
- CI status command or dashboard link
Workflow Expectations
Workflow Expectations
- Branch naming and review rules
- Feature toggles or release cadence
- Any approval or ticket linkage requirements
- Branch naming and review rules
- Feature toggles or release cadence
- Any approval or ticket linkage requirements
Documentation Duties
Documentation Duties
- Update when features, setup steps, or developer ergonomics change materially
README.md - List other docs to refresh (architecture, ADRs, etc.)
- Update when features, setup steps, or developer ergonomics change materially
README.md - List other docs to refresh (architecture, ADRs, etc.)
Finish the Task Checklist
Finish the Task Checklist
- Update relevant docs (& if significant changes landed)
README.md - Summarize changes in conventional commit format (e.g., ,
feat: ...)fix: ...
undefined- Update relevant docs (& if significant changes landed)
README.md - Summarize changes in conventional commit format (e.g., ,
feat: ...)fix: ...
undefinedSubdirectory Template (Use Only with Developer Approval)
子目录模板(仅在开发者批准后使用)
markdown
undefinedmarkdown
undefined<Directory Name> Agent Guide
<Directory Name> Agent Guide
Scope: ./path/to/directory (inherits root AGENTS.md unless noted)
Scope: ./path/to/directory (inherits root AGENTS.md unless noted)
Purpose
Purpose
- What lives here
- Who owns it (team/contact)
- What lives here
- Who owns it (team/contact)
Key Files
Key Files
- — why it matters
file_or_folder/
- — why it matters
file_or_folder/
Common Tasks
Common Tasks
- /
just <task>/ command snippets scoped to this directorymake <target>
- /
just <task>/ command snippets scoped to this directorymake <target>
Testing & Quality
Testing & Quality
- Specific tests, linters, or data fixtures for this directory
- Specific tests, linters, or data fixtures for this directory
Hand-off Notes
Hand-off Notes
- Docs or runbooks to reference
- Open questions captured during discovery
Only create these per-directory guides after confirming with the developer which areas need dedicated context and what information should be emphasized.
**Writing Notes:**
- Keep language direct and actionable. Agents should follow commands verbatim.
- Mention the preferred order of operations (e.g., "Always run `just format` before opening a PR").
- When referencing scripts, include relative paths so agents can jump quickly (e.g., ``scripts/bootstrap.sh``).
- Incorporate a trimmed `tree --gitignore` snapshot (or link to the saved artifact) so readers grasp layout quickly.
- In the Repository Tour, highlight where `plans/`, `docs/`, design docs, or ADRs live if present.
- Call out any unanswered questions as action items, and confirm with the developer before creating any per-directory AGENTS overlays.
- If the project mixes languages/platforms, add subsections per component but keep global guidance first.
---- Docs or runbooks to reference
- Open questions captured during discovery
仅在与开发者确认哪些区域需要专属上下文以及需要强调哪些信息后,再创建这些目录级指南。
**编写注意事项:**
- 语言直接且可执行。Agent应严格遵循命令操作。
- 提及操作的优先顺序(例如:“提交PR前务必运行`just format`”)。
- 引用脚本时,包含相对路径以便Agent快速跳转(例如:``scripts/bootstrap.sh``)。
- 加入裁剪后的`tree --gitignore`快照(或链接到保存的工件),以便读者快速了解布局。
- 在仓库导览部分,若存在`plans/`、`docs/`、设计文档或ADR,突出显示其位置。
- 将未解决的问题列为行动项,并在创建任何目录级AGENTS覆盖文件前与开发者确认。
- 若项目混合多种语言/平台,按组件添加子章节,但先保留全局指南。
---Phase 4 · Validate & Wrap Up
第四阶段 · 验证与收尾
- Self-review
- Does the file respect AGENTS scope rules? (Mention inheritance or overrides.)
- Are all critical commands documented, especially automation entry points?
- Is the README update expectation explicit?
- Did you obtain developer approval before adding any per-directory AGENTS files, and is that approval reflected in the write-up?
- Does the "Finish the Task" checklist include the conventional commit summary reminder?
- Formatting
- Ensure headings use Title Case, commands are wrapped in backticks, and lists are concise.
- Keep sections under ~8 bullets unless a table is clearer.
- Handoff Summary
- When delivering the AGENTS.md to the user, include:
- A short summary of major sections added/updated.
- Confirmation that README and conventional commit reminders are present.
- Any follow-up suggestions (e.g., missing tests or outdated scripts).
- When delivering the AGENTS.md to the user, include:
Use this skill whenever a repo lacks AGENTS context or when existing instructions are incomplete or outdated. The goal is to leave future agents with a single, trustworthy map of the project, its tooling, and the expectations for finishing tasks responsibly.
- 自我审查
- 文件是否遵循AGENTS范围规则?(提及继承或覆盖关系。)
- 所有关键命令是否已记录,尤其是自动化入口点?
- README更新要求是否明确?
- 添加任何目录级AGENTS文件前是否已获得开发者批准,且该批准是否已在文档中体现?
- “任务收尾”检查清单是否包含规范提交格式的提醒?
- 格式调整
- 确保标题使用标题大小写,命令用反引号包裹,列表简洁。
- 除非表格更清晰,否则每个章节的项目符号不超过8个。
- 交付总结
- 向用户交付AGENTS.md时,需包含:
- 新增/更新主要章节的简短总结。
- 确认已包含README和规范提交的提醒。
- 任何后续建议(例如:缺失的测试或过时的脚本)。
- 向用户交付AGENTS.md时,需包含:
当仓库缺少AGENTS上下文,或现有指南不完整、过时,即可使用本工具。目标是为后续Agent提供一份单一、可靠的项目地图,涵盖项目工具及负责任完成任务的要求。