Ruledoctor
Use when the project has rule files (CLAUDE.md, AGENTS.md, .cursorrules, CONTRIBUTING.md, .github/copilot-instructions.md, .cursor/rules) or .ruledoctor.json required_reads; before git push, deploy, bulk delete, or when context was compacted. Read listed rules and required_reads first; refuse violations; re-read after long sessions. Default user message: files read + 3 hard constraints only unless user asks for full summary.From its SKILL.md
npx -y skills add syf2211/ruledoctor --skill ruledoctorAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- 15 stars15 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
- runs commandsInstructs the agent to run 1 command, including `ruledoctor --cwd "<项目根>" --last-session`.
SKILL.md
3.3 KB, ~1.0k tokens by cl100k_base, as published. Nobody here has run it
RuleDoctor — 项目规则优先
三层分工(向用户说明时用)
| 层 | 作用 |
|---|---|
| 本 Skill | 提醒你先读规则、拒绝违禁操作、压缩后重读(软约束) |
CLI ruledoctor | 用户要求时,用本地会话日志做事后核对 |
Hook(ruledoctor setup) | 在 Bash 执行前硬拦截部分命令;SessionStart/压缩后注入规则摘要;CLI 可用时结束出报告 |
读规则 ≠ 一定遵守。「必须用中文、要汇报、要写验证」 靠本 Skill + 项目规则(软约束);只有能写成明确 shell 命令规则的危险操作 才适合 Hook 硬拦。人话说明:Hook 是什么?
何时启用
- 存在根规则文件或
.cursor/rules/,或.ruledoctor.json里有required_reads - 用户要 push、部署、大批量删除
- 用户说上下文被压缩、忘了规则
规则文件从哪来(不要扫全仓库)
- 自动认的根文件(存在则读):
CLAUDE.md、AGENTS.md、.cursorrules、CONTRIBUTING.md、.github/copilot-instructions.md、.cursor/rules/*.{md,mdc} - 必读清单(只读列表里的路径):项目根
.ruledoctor.json→required_reads数组,例如:"required_reads": ["docs/agent_workflow_protocol.md", "README.md"]README.md只有写进清单才强制 Read,不会默认扫全库。忽略绝对路径、..逃逸和指向项目外的 symlink。
触发后做什么
1. 读取(工具调用)
- Glob/Read:上面「自动认」+
required_reads里每一项(文件必须存在)。
2. 对用户的开场(两层输出,避免念经)
默认只说:
- 已 Read 的文件名列表(含
required_reads) - 最多 3 条本场硬约束(一句话一条)
仅当用户说「展开规则 / 完整摘要 / 列出全部」时,再发更长摘要。
3. 动手前
- 将违反硬约束的命令 → 不执行,说明哪一条、建议替代。
- 默认拒绝:
git push搭配--force/-f/--force-with-lease、rm -rf /、提交密钥。
4. 长对话 / 压缩后
- 重新 Read 规则文件 +
required_reads项;默认仍用「文件列表 + 3 条硬约束」汇报。
5. 仅当用户要「体检 / 报告」
ruledoctor --cwd "<项目根>" --last-session
若本机没有 ruledoctor CLI,不要直接 npx ruledoctor;说明 CLI/Hook 是可选增强,并让用户按仓库文档 clone、build 后再运行报告。
安装
~/.claude/skills/ruledoctor/ · ~/.codex/skills/ruledoctor/ · Cursor:~/.cursor/skills/ruledoctor/
仓库:https://github.com/syf2211/ruledoctor (skills/ruledoctor)
用户文档:https://github.com/syf2211/ruledoctor/blob/main/docs/用户指南.md
What ships with it: 1 file
250 B alongside SKILL.md
agents/
- openai.yaml250 B
Gives 0 of the 12 instructions most memory context skills give in ~1.0k tokens
Counted across 754 of the 1,056 authors here whose files we hold, read 2026-09-06
- Preserve existing content structurein 15 of 754, across 9 files
- Front-load the leading wordin 14 of 754, across 10 files
- Update existing entries instead of duplicatingin 14 of 754, across 7 files
- Keep CLAUDE.md under one hundred linesin 14 of 754, across 12 files
- Read CLAUDE.md at the project rootin 14 of 754
- Keep each meaning in a single source of truthin 12 of 754, across 8 files
- Redact sensitive information before committingin 11 of 754, across 4 files
- Scan for all CLAUDE.md filesin 11 of 754, across 7 files
- Use frontmatter for metadata on filesin 10 of 754, across 3 files
- Repeat user interactions 10 timesin 10 of 754, across 4 files
- Write the CLAUDE.md file into the target folderin 10 of 754, across 8 files
- Use memlab to process snapshotsin 9 of 754, across 3 files
Said here and by no other author read
- Read listed rule files first
- Report read files and three constraints
- Refuse rule violations
- Reread rules after long sessions
Grouped from the skills themselves: near-identical wordings counted once, and counted by distinct author, so one author publishing three of these counts once. Length counted with cl100k_base; the agent that loads this file may tokenize it differently.