agent-config
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseAgent Config
Agent配置
Purpose
用途
A repository's agent layer is one document read by many agents under different filenames.
This skill establishes that layout and then keeps the document honest:
- Init — one real instruction file at the repo root, every other host filename a relative symlink pointing at it.
- Check — find documented commands, paths, directory structures, and counts that have drifted from the actual repo.
It never seeds an ambient rules directory. Code-shaped conventions are applied on demand by
and the skills; only the comment block below is cheap enough to live
in always-loaded instructions.
code-cleanupaudit/仓库的Agent层是一个可被多个不同文件名的Agent读取的文档。本Skill用于建立该布局并确保文档的准确性:
- 初始化——在仓库根目录创建一个真实的指令文件,其他所有宿主文件名均为指向该文件的相对符号链接。
- 检查——找出文档中记录的命令、路径、目录结构和数量与实际仓库不符的漂移情况。
本Skill不会自动创建环境规则目录。代码类规范由和类Skill按需应用;只有下方的注释块足够轻量化,可常驻于加载的指令中。
code-cleanupaudit/Asking the User
询问用户
Every question in this skill is written as options. Use that tool where
the host offers it, or the host's nearest structured-choice equivalent. Where the host has
neither, ask the same question in normal chat as a numbered list of 2–5 options —
recommended first, one short line of description each — and wait for the user to reply
with a number.
AskUserQuestion本Skill中的所有问题均以选项形式编写。若宿主支持该工具则直接使用,或使用宿主最接近的结构化选择等效工具。若两者均不支持,则以普通聊天形式提出问题,列出2-5个带编号的选项——首选项为推荐项,每个选项配一行简短描述——等待用户回复编号。
AskUserQuestionArguments
参数
| Argument | Behavior |
|---|---|
| (none) | Inspect, report, then ask what to do |
| Establish the layout: instruction file, symlinks, comment block |
| Drift report only — never modify anything |
| Report drift and apply the fixable findings without re-confirming each |
initcheckapply| 参数 | 行为说明 |
|---|---|
| (无) | 检查、报告,然后询问用户操作选择 |
| 建立布局:指令文件、符号链接、注释块 |
| 仅生成漂移报告——绝不修改任何内容 |
| 报告漂移情况并应用可修复的结果,无需逐一确认 |
initcheckapplyRequirements
依赖要求
The bundled script needs only , , and — no external dependency. The
drift check reads with ; without , parse it with / and say
that command detection is best-effort. Gradle and Make task names come from
and , which fall outside and will prompt —
both are read-only, so approve them or skip the Commands category and say so in the report.
bashlnreadlinkpackage.jsonjqjqgrepsedgradle tasks --quietmake -qpallowed-tools捆绑脚本仅需要、和——无外部依赖。漂移检查使用读取;若无,则使用/解析,并说明命令检测为尽力而为。Gradle和Make任务名称来自和,这两个命令不在范围内,会触发提示——两者均为只读操作,可批准执行或跳过命令类别并在报告中说明。
bashlnreadlinkjqpackage.jsonjqgrepsedgradle tasks --quietmake -qpallowed-toolsAuto-Activation
自动激活
Trigger phrases live in . When activating on your own initiative rather than
on a request — right after build scripts, directory names, tooling, or documented counts
changed — always run first and never apply without showing the report.
when_to_usecheck触发短语位于中。当自行主动激活而非响应请求时——例如构建脚本、目录名称、工具或文档记录的数量变更后——务必先运行,且未展示报告前绝不执行应用操作。
when_to_usecheckCanonical Layout
标准布局
One real file; everything else is a relative symlink to it.
| Path | Read by | Required |
|---|---|---|
| Claude Code | canonical |
| Codex, OpenCode, pi, and other agents on the AGENTS.md convention | yes |
| Gemini CLI | opt-in |
| GitHub Copilot | opt-in |
CLAUDE.mdAGENTS.mdCLAUDE.mdCLAUDE.mdSymlinks, never copies. Two copies drift the moment one is edited, and no agent will tell
you which one it read.
一个真实文件;其余所有均为指向它的相对符号链接。
| 路径 | 读取方 | 必填状态 |
|---|---|---|
| Claude Code | 标准默认 |
| Codex、OpenCode、pi及其他遵循AGENTS.md规范的Agent | 是 |
| Gemini CLI | 可选加入 |
| GitHub Copilot | 可选加入 |
CLAUDE.mdAGENTS.mdCLAUDE.mdCLAUDE.md使用符号链接,绝不使用副本。两个副本从编辑其中一个的那一刻起就会出现漂移,且没有Agent会告知你它读取的是哪一个。
Workflow
工作流程
1. Inspect before writing anything
1. 写入前先检查
bash
bash <skill-dir>/scripts/agent-config.sh statusExit codes: consistent, no canonical file (or two competing ones), drift found.
023Also note whether the repo is a git repository, what build system it uses, and whether an
instruction file already carries real content. Report present / missing / drifted before
proposing a single edit.
bash
bash <skill-dir>/scripts/agent-config.sh status退出码:表示一致,表示无标准文件(或存在两个冲突文件),表示发现漂移。
023同时记录仓库是否为git仓库、使用的构建系统,以及指令文件是否已包含真实内容。在提议任何编辑前,先报告当前状态:存在/缺失/漂移。
2. Establish the instruction file
2. 创建指令文件
- Missing — draft a minimal file from , scoped to what this repo actually is. Fill it from evidence: the build file, the directory layout, the existing README. Delete every skeleton section the repo does not need. A short accurate file beats a complete-looking one.
assets/instructions-skeleton.md - Exists — leave the prose alone. It is the author's, and the built-in already covers writing one from scratch. Move to step 3.
/init
Never write to , , or any other user-level file.
~/.claude/CLAUDE.md~/.codex/AGENTS.md- 缺失——从生成最小化文件,范围限定为仓库实际需求。根据现有信息填充:构建文件、目录布局、现有README。删除仓库不需要的所有骨架章节。简短准确的文件优于看似完整的文件。
assets/instructions-skeleton.md - 已存在——保留原有内容。内容属于作者,内置的已涵盖从头创建文件的场景。直接进入步骤3。
/init
绝不写入、或任何其他用户级文件。
~/.claude/CLAUDE.md~/.codex/AGENTS.md3. Wire the symlinks
3. 配置符号链接
bash
bash <skill-dir>/scripts/agent-config.sh link AGENTS.md --dry-run
bash <skill-dir>/scripts/agent-config.sh link AGENTS.mdAdd or only when the user says the repo is
used with those agents. Each unused link is one more file to explain.
GEMINI.md.github/copilot-instructions.mdFlags: picks the real file explicitly, moves a conflicting
regular file to first. Without the script refuses to touch a regular
file and tells you to merge it by hand — that is the safe default, since such a file usually
holds instructions someone wrote.
--canonical <file>--force<name>.bak--forceIf the script reports both and are regular files, stop and ask
which is authoritative. Then merge the other into it and re-run with .
CLAUDE.mdAGENTS.md--canonicalbash
bash <skill-dir>/scripts/agent-config.sh link AGENTS.md --dry-run
bash <skill-dir>/scripts/agent-config.sh link AGENTS.md仅当用户表示仓库会与这些Agent配合使用时,才添加或。每个未使用的链接都需要额外解释。
GEMINI.md.github/copilot-instructions.md参数:明确指定真实文件,先将冲突的常规文件移动到。若无,脚本会拒绝修改常规文件并提示手动合并——这是安全默认,因为此类文件通常包含有人编写的指令。
--canonical <file>--force<name>.bak--force若脚本报告**和均为常规文件**,请停止操作并询问哪个是权威文件。然后将另一个文件合并到权威文件中,再使用重新运行脚本。
CLAUDE.mdAGENTS.md--canonical4. Add the comment block
4. 添加注释块
Insert into the instruction file verbatim, as its own
section, if and only if:
assets/comments.md## Comments- the repo has source files using line comments (or the block is adapted to the language's line-comment marker), and
// - the file does not already document comment conventions.
If it already has a comment section, report the difference and let the user decide. Do not
merge two opinionated blocks.
This block is the one ambient rule that survived: comment prefixes are a local convention a
model cannot infer, and they are worth a handful of lines in every session.
仅当满足以下条件时,将原样插入指令文件,作为独立的章节:
assets/comments.md## 注释- 仓库中的源文件使用行注释(或已适配为对应语言的行注释标记),并且
// - 文件尚未记录注释规范。
若文件已有注释章节,报告差异并由用户决定。不要合并两个带有主观观点的块。
此块是唯一保留的环境规则:注释前缀是模型无法推断的本地规范,值得在每次会话中占用几行内容。
5. Run the drift check
5. 运行漂移检查
Read and follow it. In short: parse the file into sections,
keep only the ones making structural claims, collect the matching ground truth, classify
each finding, report grouped by section with line numbers.
references/drift-checks.mdStop after the report when the mode is .
check阅读并遵循其步骤。简而言之:将文件解析为章节,仅保留包含结构声明的章节,收集匹配的实际情况,对每个发现进行分类,按章节分组并附带行号进行报告。
references/drift-checks.md若为模式,报告后停止操作。
check6. Apply
6. 应用修复
Apply only , , and findings, plus ones the
user confirmed. findings are reported and never applied — deciding what
deserves documenting belongs to the author.
STALECOUNT_MISMATCHPATH_MISSINGRENAMEDINFORMATIONALEdits are surgical. Change the reference, not the surrounding prose.
仅应用、和类型的发现,以及用户确认的类型发现。类型发现仅报告绝不应用——决定哪些内容值得记录属于作者的职责。
STALECOUNT_MISMATCHPATH_MISSINGRENAMEDINFORMATIONAL编辑需精准。仅修改引用内容,不改动周围文本。
7. Verify
7. 验证
Re-run , then and so the user sees exactly what changed. A
new symlink shows up in as a mode entry — that is correct, not a
mistake.
statusgit statusgit diffgit diff120000重新运行,然后运行和,让用户清楚看到所有变更。新的符号链接在中会显示为模式的条目——这是正确的,并非错误。
statusgit statusgit diffgit diff120000Adjacent Skills
关联Skill
- owns
editor-config/.zedand is a separate decision — mention it as a follow-up when this skill has just initialized a repo, but do not run it implicitly..vscode - owns GitHub-side settings. Unrelated to the instruction layer.
repo-hardening - ,
skill-audit, and the rest ofci-auditown quality judgments. This skill only checks factual agreement between the instruction file and the repo.audit/
- 负责
editor-config/.zed相关配置,是独立决策——当本Skill刚初始化仓库时可作为后续操作提及,但不要隐式运行。.vscode - 负责GitHub端设置。与指令层无关。
repo-hardening - 、
skill-audit及其他ci-audit类Skill负责质量判断。本Skill仅检查指令文件与仓库之间的事实一致性。audit/
Edge Cases
边缘情况
- No instruction file and no intent. In
initmode, report that there is nothing to check and offercheck. Do not create a file in check mode.init - Non-git directory. The layout still works; skip the verification and say so.
git status - is a copy, not a link. The common failure mode. Diff it against the canonical file first: if they agree, replace it with a symlink; if not, the divergence is content someone wrote — show the diff and ask before collapsing it.
AGENTS.md - A host that reads a directory, not a file. ,
.cursor/rules/, and friends are out of scope. Report them if present, leave them untouched..claude/rules/ - Symlinks on Windows checkouts. A repo cloned without symlink support materializes
as a text file containing the target path. If a one-line file whose content is a path shows up, that is the cause — say so instead of treating it as a duplicate.
AGENTS.md - Monorepos. This skill handles the repo root. Package-level instruction files are the author's business.
- 无指令文件且无初始化意图。在模式下,报告无可检查内容并提供初始化选项。不要在check模式下创建文件。
check - 非git目录。布局仍然有效;跳过验证并说明情况。
git status - 是副本而非链接。常见故障模式。先对比其与标准文件的差异:若内容一致,替换为符号链接;若不一致,说明差异是有人编写的内容——展示差异并在合并前询问用户。
AGENTS.md - 读取目录而非文件的宿主。、
.cursor/rules/等不在范围内。若存在则报告,但不修改。.claude/rules/ - Windows检出中的符号链接。未开启符号链接支持克隆的仓库会将生成为包含目标路径的文本文件。若出现内容为路径的单行文件,需说明原因而非视为重复文件。
AGENTS.md - 单体仓库。本Skill仅处理仓库根目录。包级指令文件由作者自行处理。