AGENTS.md
# AGENTS.md Use this file to guide coding agents working in this repository. It is plain Markdown, so keep the sections direct and easy to scan. ## Project Context - Project type: Next.js - Tech stack: Next.js, TypeScript, React, CSS modules - Coding style: Prefer small components, explicit types, accessible UI, and existing project patterns. - AI tool target: Coding agents ## Project Commands - Package manager: npm - Test: `npm test` - Build: `npm run build` - Lint: `npm run lint` ## Converted Instructions Source format: New instructions Inspect the repository before editing. Preserve existing patterns. Run lint and tests before handoff when possible. Summarize changed files and any checks that could not be run. ## Agent Workflow - Inspect nearby files and reuse established project patterns before editing. - Make small, reviewable changes and avoid unrelated churn. - Do not introduce new dependencies unless they clearly reduce complexity. - Preserve unrelated user changes in the working tree. - Before handoff, summarize changed files, validation results, and follow-up risks.
使用 AGENTS.md 生成器与转换器记录编码代理在仓库中应该如何检查、编辑、测试和交接。可以粘贴已有 CLAUDE.md、Cursor Rules 或团队备注,再输出 AGENTS.md、CLAUDE.md 或 .cursor/rules/project.mdc。
AGENTS.md 为什么有帮助
AGENTS.md 为代理工作流提供可移植的事实来源。公开格式是普通 Markdown,可以描述仓库布局、验证命令、安全期待和交接方式,而不绑定单一编辑器。
转换工作流
需要跨工具复用时输出 AGENTS.md;只给 Claude Code 项目记忆使用时输出 CLAUDE.md;需要 Cursor 的 .mdc frontmatter、globs 和编辑器规则时输出 Cursor Rules。
最佳实践
保持指令稳定,避免密钥,并优先使用开发者本地可运行的命令。如果命令很慢,同时记录定向检查和完整发布检查。Monorepo 可以在根目录放通用规则,在子包附近放更具体的规则。
常见问题
AGENTS.md 是工具专属的吗?
不是。它适合作为不同编码代理之间可复用的指令文件。
可以把 CLAUDE.md 转成 AGENTS.md 吗?
可以。保留稳定的仓库上下文、命令、代码规范、验证期待和交接规则;Claude 专属命令可以移到单独小节。
什么时候输出 Cursor Rules?
当指令需要 .mdc frontmatter、文件 globs 或 Cursor 编辑器内行为时,输出 Cursor Rules 更合适。
AGENTS.md 应避免什么?
避免私有 token、空泛风格口号、失效命令,以及只适用于单个开发者机器的本地路径。