01 · 选择技术栈预设(12 套)
Web Full-Stack02 · 包管理器与验证命令
03 · 目标编程 Agent
04 · 安全与工程护栏
AGENTS.md 实时 AgentLint 体检分
# Next.js App Platform — AGENTS.md TypeScript + Next.js App Router web application with server actions, typed API handlers, and automated Vitest checks. This file is the canonical engineering harness for Claude Code, Codex CLI, Cursor, GitHub Copilot, Gemini CLI; tool-specific adapter files point back here instead of duplicating rules. ## Commands - Package manager / build tool: `pnpm` - Fast single test: `npx vitest run src/lib/billing.test.ts` - Full build and test: `pnpm test && pnpm build` - Lint and static check: `npx tsc --noEmit && pnpm lint` ## Repository Map & Conditional Reading - `app/` — Next.js App Router pages, layouts, and Route Handlers - `src/components/` — Reusable UI primitives and client islands - `src/lib/` — Domain logic, schemas, and server data helpers - When editing database migrations or auth middleware, read `docs/architecture.md` before changing public contracts or data models. ## Engineering Boundaries - Don't add 'use client' to page layouts or data-fetching wrappers. Instead isolate interactive leaf components under `src/components/`. Because server components keep bundles small and keep secrets off the client. - Don't bypass schema validation in Route Handlers or Server Actions. Instead parse inputs with Zod in `src/lib/schemas.ts`. Because unvalidated payloads cause silent runtime errors in production. - Don't run the full build on every small edit. Instead run the fast single-test command above and run the full build before handoff. Because fast feedback keeps iteration loops under 15 seconds. - Don't refactor unrelated modules or reformat untouched files outside the requested task. Instead keep every diff scoped to the target requirement and log follow-up ideas in `docs/exec-plans/`. Because broad diffs hide regressions and complicate code review. - Don't commit `.env` files, API tokens, private keys, or personal home directory paths. Instead read credentials from environment variables and keep `.env` and `CLAUDE.local.md` in `.gitignore`. Because leaked credentials and host paths break CI and create security incidents. - Don't reference mutable GitHub Actions version tags such as `@v4` in workflows. Instead pin third-party actions to full 40-character commit SHAs with an inline version comment. Because floating tags expose automated pull requests to supply-chain drift. ## Verification & Session Continuity - Run the fast single-test command after every focused edit, and run the full build and test suite before reporting completion. - Record active multi-step plans in `docs/exec-plans/` and update `HANDOFF.md` with verified commands, changed files, and open risks before ending a session. - Keep this file concise (60-150 lines) and well under Claude Code's 40,000-character limit; move deep subsystem tables into linked `docs/` files. ## Tool Adapters - `CLAUDE.md` — thin `@AGENTS.md` pointer plus Claude Code hook notes - `.cursor/rules/project.mdc` — glob-scoped Cursor adapter referencing this file - `.github/copilot-instructions.md` — mirror pointer directing Copilot to `AGENTS.md` - `GEMINI.md` — mirror pointer directing Gemini CLI to `AGENTS.md`
npm install -g agentlint-ai && agentlint check为什么这套四文件组合不会发生规则漂移?
唯一事实源
集中存放架构地图、快测命令、Don't/Instead/Because 边界与跨会话交接规则,控制在 60-150 行黄金区间。
@AGENTS.md 指针
Claude Code 通过 @AGENTS.md 直接载入主文件,只保留 CLAUDE.local.md 与合法 PascalCase Hook 事件提醒。
按目录 Glob 生效
带有合法 YAML frontmatter 与 globs 路径匹配,只在编辑对应语言源码时按需注入,避免污染上下文窗口。
PR 自动门禁
每次 PR 修改规则或 CI 文件时自动运行 AgentLint 并回帖评分(pr-comment: true),防止团队回退。
常见问题
为什么生成器把 AGENTS.md 作为主文件,而把 CLAUDE.md 设为 @AGENTS.md 指针?
在 4,533 个开源仓库实证研究中,同时维护多份独立规则文件的项目会在几周内出现规则漂移。把 AGENTS.md 设为唯一事实源,让 CLAUDE.md 通过 @AGENTS.md 引入并只保留 Claude Code 专属 Hook 提示,可以同时服务 Claude Code、Codex CLI、Cursor、Copilot 和 Gemini CLI。
生成的 AGENTS.md 为什么能稳定拿到 95 分以上?
每套默认技术栈模板都会在首 10 行给出清晰的项目定位、提供秒级单测与全量构建命令、包含条件加载文档指针、全部负向边界采用 Don't / Instead / Because 句式、零喊口号关键词、零人设废话,并内置跨会话交接与密钥防护规则。
生成的内容会上传到服务器吗?
不会。向导生成与 AgentLint 实时评分 100% 在本地浏览器内运行,不上传任何项目名称或命令配置。
如何把生成的 CI Workflow 接入 Pull Request 自动评论?
将 .github/workflows/agentlint.yml 提交到仓库即可。该工作流默认开启 pr-comment: true 并采用最小权限配置,每次修改 AGENTS.md、CLAUDE.md 或 Cursor 规则时自动在 PR 中输出体检报告。
在线体检现有规则
粘贴已有 CLAUDE.md 或输入任意 GitHub 公开仓库地址,立即获得 0-100 评分与徽章。
打开在线体检器已有规则一键互转
在 CLAUDE.md、AGENTS.md、.cursorrules、.mdc、Copilot 与 GEMINI.md 之间零损耗转换。
打开格式转换器浏览 58 项检查规则
查看每条确定性规则背后的 Anthropic、NeurIPS、ETH Zurich 与 4,533 仓库实证依据。
查看规则百科