calibrate-rules
Skill1 starsChanged 6 months agoMITView on GitHub
Audits and tunes every `.claude/rules/**/*.md` across user / project / plugin-self. Flags oversized files (> 200 effective lines), language- or area-specific rules missing `paths:` frontmatter (always-on context cost), plugin-shipped rules without `paths:` (load for every user who enables the plugin), broken globs, contradictions with CLAUDE.md, multi-step workflow bodies that should be a skill instead, and committed secrets. Also handles the `create` row when a recurring `claude-md:vague-rules` or `hook:exit-1-non-blocking` pattern needs a new path-scoped rule file scaffolded. Invoked by the calibration orchestrator (`/calibrate`) and standalone via `/claude-calibration:calibrate-rules`.
In this repository25 other files it gives its agents.
- agents/CLAUDE.mdCLAUDE.md
- CLAUDE.mdCLAUDE.md
- .claude/skills/CLAUDE.mdCLAUDE.md
- hooks/CLAUDE.mdCLAUDE.md
- rules/CLAUDE.mdCLAUDE.md
- skills/CLAUDE.mdCLAUDE.md
- docs-statusSkill
- docs-updateSkill
- plugin-updateSkill
- calibrate-claude-mdSkill
- calibrate-generalSkill
- calibrate-hooksSkill
- calibrate-mcpSkill
- calibrate-pluginsSkill
- calibrate-settingsSkill
- calibrateSkill
- calibrate-skillsSkill
- calibrate-subagentsSkill
- calibration-auditSkill
- calibration-diffSkill
- calibration-doctorSkill
- calibration-flowSkill
- calibration-onboardingSkill
- calibrationSkill
- calibration-trackSkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 1 is distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 72
When the planner detects a recurrence that this bundle owns (per rules/dispatch.md):
- Very specific: line 85
After every edit or create, re-run bash <BUNDLE>/scripts/lint.sh <changed path> and record verify: ✓ if the signature no longer fires (or …
- Very specific: line 90
Never write a rule without paths: frontmatter unless the rule is genuinely universal (in which case its content belongs in CLAUDE.md, not …
- Distinctive: line 94
Don't reformat unrelated content in a rule file when applying a fix.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
calibrate-rules — per-feature bundle
You audit and tune .claude/rules/ files. You receive one of two kinds of work:
- Direct invocation (
/claude-calibration:calibrate-rules) — audit everything, report findings, propose fixes inline. The user drives the conversation. - Dispatch from the calibrator — one approved plan row at a time, applied surgically.
In both cases the workflow is the same; only the framing differs.
1. Enumerate
bash <BUNDLE>/scripts/enumerate.sh "$PROJECT_DIR"Yields TSV scope\tpath. Scope is user (~/.claude/rules/...), project
(<PROJECT_DIR>/.claude/rules/...), or plugin-self (<plugin-root>/rules/... when the project
itself is a plugin).
2. Lint
bash <BUNDLE>/scripts/lint.sh <path …>Yields TSV path\tsignature\tseverity\tdetail. The signatures this bundle owns
(see reference.md):
rule:secret-leak(CRITICAL)rule:over-200(MEDIUM)rule:no-paths-when-language-specific(MEDIUM)rule:plugin-shipped-no-paths(HIGH)rule:bad-glob(HIGH)rule:contradicts-claude-md(LOW)rule:should-be-skill(LOW)
3. Fix — kind: edit rows
For each finding, the remediation pattern is in examples/<case>/:
rule:over-200→examples/over-200/{before,after}.md(split into focused files)rule:no-paths-when-language-specific→examples/no-paths/{before,after}.md(add frontmatter with apaths:list)rule:plugin-shipped-no-paths→ same fix asno-pathsplus a note that the rule ships to every user who enables the plugin.rule:secret-leak→ remove the secret, rotate it, add to.gitignoreor move to.local.rule:bad-glob→ fix the YAML list shape.rule:contradicts-claude-md→ reconcile: move the canonical statement to one place, link from the other.rule:should-be-skill→ propose a new skill at.claude/skills/<name>/SKILL.md; remove the rule file or leave it as a one-line pointer.
4. Create — kind: create rows
When the planner detects a recurrence that this bundle owns (per rules/dispatch.md):
claude-md:vague-rules×N → scaffold a path-scoped rule at.claude/rules/conventions.mdlisting the canonical wordings (usestemplates/rule.md.tmpl).hook:exit-1-non-blocking×N → scaffold a doc-rule at.claude/rules/hook-conventions.mdcodifying "useexit 2to block,exit 0to pass,exit 1only for non-blocking warnings".
For both, copy templates/rule.md.tmpl, fill in name, description, paths:, and the body.
5. Verify
After every edit or create, re-run bash <BUNDLE>/scripts/lint.sh <changed path> and record
verify: ✓ if the signature no longer fires (or verify: ✗ <signature> if it still does).
Hard rules
- Never write a rule without
paths:frontmatter unless the rule is genuinely universal (in which case its content belongs in CLAUDE.md, not.claude/rules/). - Plugin-shipped rules (under
<plugin-root>/rules/) MUST havepaths:— they load for every user who enables the plugin. - Don't reformat unrelated content in a rule file when applying a fix.
- Effective-line counts come from
lint.sh; don't pre-compute them yourself.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

