debug-rules
Skill2 starsChanged 7 months agoMITView on GitHub
Diagnose which rules loaded, which didn't, and why. Reads the InstructionsLoaded audit log and compares against expected rules.
In this repository16 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- audit-vs-fix-disciplineSkill
- block-journeySkill
- clean-worktreesSkill
- debuggingSkill
- debug-wpSkill
- figmaSkill
- handoffSkill
- module-depth-reviewSkill
- playwrightSkill
- qa-checkSkill
- review-memorySkill
- swift-concurrency-reviewSkill
- test-planSkill
- tool-usageSkill
- vibe-userSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
15 rules. About 0 are common, 5 are distinctive, and 10 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
10
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 15
Use this skill when:
- Very specific: line 48
Check ~/.claude/hooks/log-instructions.sh exists and is executable
- Very specific: line 49
Check ~/.claude/settings.json has an InstructionsLoaded entry pointing to it
- Very specific: line 50
Check ~/.claude/instruction-audit.log exists and is non-empty
- Very specific: line 56
Read ~/.claude/instruction-audit.log.
- Very specific: line 60
Read all files in ~/.claude/rules/.
- Very specific: line 61
If it has no paths: frontmatter → it should appear with reason: session_start
- Very specific: line 62
If it has paths: frontmatter → it should appear with reason: path_glob_match only when matching files are read
- Distinctive: line 76
If always-on: this is a problem - it should have loaded at session_start
- Very specific: line 77
If conditional: list what glob patterns it expects, and check the log for any trigger_file_path entries that should have matched.
- Very specific: line 88
If conditional rules aren't firing: check if paths: uses YAML array syntax (broken in user-level rules) vs CSV string format (works).
- Very specific: line 89
If unexpected files are loading: suggest moving them out of ~/.claude/rules/
- Distinctive: line 90
If everything looks correct: say so
- Distinctive: line 94
Read-only: Do not modify any files. Report only.
- Distinctive: line 95
Check the log, don't guess: Every conclusion must be backed by a log entry or absence of one.
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 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
<!-- Last updated: 2026-03-23T16:30+11:00 -->Skill: debug-rules
When to Use
Use this skill when:
- Conditional rules don't seem to be loading
- Claude is ignoring instructions that should be in a rule file
- You changed rule frontmatter and want to verify it works
- You want to see what rules loaded in a specific session
Prerequisites
This skill requires the InstructionsLoaded audit hook. The hook is not registered by default - it's an on-demand diagnostic tool you enable when needed.
Setup (one-time)
The hook script ~/.claude/hooks/log-instructions.sh should already exist. To enable logging, add this to ~/.claude/settings.json under "hooks":
"InstructionsLoaded": [
{
"hooks": [
{
"type": "command",
"command": "~/.claude/hooks/log-instructions.sh"
}
]
}
]Then start a new session, do some work that touches files matching your conditional rules, and run /debug-rules again.
Remove the hook from settings.json when done - it's lightweight but unnecessary for normal use.
Step 1: Verify hook is active
- Check
~/.claude/hooks/log-instructions.shexists and is executable - Check
~/.claude/settings.jsonhas anInstructionsLoadedentry pointing to it - Check
~/.claude/instruction-audit.logexists and is non-empty
If the hook script is missing, tell the user and stop. If the hook script exists but isn't registered in settings.json, show them the setup instructions above. If the log doesn't exist or is empty, tell the user: "No audit log found. Register the hook, start a new session, do some work, then run /debug-rules again."
Step 2: Read the audit log
Read ~/.claude/instruction-audit.log. If the user provided a timestamp, filter to entries from that session. If they said "latest" or gave no argument, use the most recent session (group by timestamp - entries within 2 seconds of each other are the same session start).
Step 3: Inventory expected rules
Read all files in ~/.claude/rules/. For each file:
- If it has no
paths:frontmatter → it should appear withreason: session_start - If it has
paths:frontmatter → it should appear withreason: path_glob_matchonly when matching files are read
Build a table of expected rules and their type (always-on vs conditional).
Step 4: Compare and report
Present three sections:
Rules that loaded correctly
Table with: file name, load reason, scope (User/Project). These are working as expected.
Rules that did NOT load
For each missing rule:
- Name and expected load type
- If always-on: this is a problem - it should have loaded at session_start
- If conditional: list what glob patterns it expects, and check the log for any
trigger_file_pathentries that should have matched. If matching files were read but the rule didn't fire, flag it as BROKEN (likely the user-level paths: bug)
Unexpected behaviour
Flag any of these:
- Conditional rules loading at
session_start(should only load onpath_glob_match) - Files in
~/.claude/rules/that aren't rule files (no frontmatter closing---) loading as rules - Duplicate loads of the same file
Step 5: Recommendations
Based on findings, suggest:
- If conditional rules aren't firing: check if
paths:uses YAML array syntax (broken in user-level rules) vs CSV string format (works). Show the fix. - If unexpected files are loading: suggest moving them out of
~/.claude/rules/ - If everything looks correct: say so
Rules
- Read-only. Do not modify any files. Report only.
- Check the log, don't guess. Every conclusion must be backed by a log entry or absence of one.
- Show the raw log entries for any problems found so the user can verify.
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.

