/ruledoctor:ruledoctorfrom ruledoctor
Enforces project rule files (CLAUDE.md, AGENTS.md, .cursorrules, etc.) before git push, deploy, bulk delete, or after context compaction. Reads required rules, refuses violations, and re-reads after long sessions.
Ships in ruledoctor. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
| 层 | 作用 |
|---|---|
| 本 Skill | 提醒你先读规则、拒绝违禁操作、压缩后重读(软约束) |
CLI ruledoctor | 用户要求时,用本地会话日志做事后核对 |
Hook(ruledoctor setup) | 在 Bash 执行前硬拦截部分命令;SessionStart/压缩后注入规则摘要;CLI 可用时结束出报告 |
读规则 ≠ 一定遵守。「必须用中文、要汇报、要写验证」 靠本 Skill + 项目规则(软约束);只有能写成明确 shell 命令规则的危险操作 才适合 Hook 硬拦。人话说明:Hook 是什么?
.cursor/rules/,或 .ruledoctor.json 里有 required_readsCLAUDE.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。required_reads 里每一项(文件必须存在)。默认只说:
required_reads)仅当用户说「展开规则 / 完整摘要 / 列出全部」时,再发更长摘要。
git push 搭配 --force / -f / --force-with-lease、rm -rf /、提交密钥。required_reads 项;默认仍用「文件列表 + 3 条硬约束」汇报。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 SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub syf2211/ruledoctor --plugin ruledoctorOther plugins' skills for the same job