一键导入
rule-effectiveness
Analyze which rules are actively used vs inert. Detect coverage gaps. Recommend pruning to reduce token consumption.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Analyze which rules are actively used vs inert. Detect coverage gaps. Recommend pruning to reduce token consumption.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | rule-effectiveness |
| description | Analyze which rules are actively used vs inert. Detect coverage gaps. Recommend pruning to reduce token consumption. |
Analyze the effectiveness of .claude/rules/ in the current project by cross-referencing rule globs against actual file activity from git history.
Read all .md files in .claude/rules/. For each:
globs: value from YAML frontmatterIf a rule has no globs: or paths: frontmatter, classify as always-loaded (loads every session regardless of files touched).
Rules with globs: load eagerly at session start. Rules with paths: + alwaysApply: false load lazily (only when a matching file is touched). Note: paths: must be unquoted CSV — YAML arrays and quoted strings fail silently.
Run: git log --name-only --pretty=format:'' --since='3 months ago' (or configurable period).
Parse output to build:
If fewer than 5 sessions available, warn that results may not be representative and extend to --since='6 months ago'.
For each rule with a glob pattern:
matched_files: count of unique files that match the globmatch_rate: % of sessions where at least 1 file matched the globtoken_cost: lines of rule content (proxy for context consumption)For the project overall:
covered_files: files that match at least 1 rule globuncovered_files: files touched but matching no rulefile_coverage: covered / total| Classification | Criteria | Action |
|---|---|---|
| Active | match_rate > 50% | Keep — rule loads in most sessions and covers real files |
| Occasional | match_rate 10-50% | Evaluate — may be worth keeping for specific workflows (deploys, migrations) |
| Inert | match_rate < 10% | Candidate for removal — consumes tokens without matching real files |
| Always-loaded | globs: **/* or no globs | Evaluate content — is it generic enough to justify always loading? |
| Overbroad | globs: **/* but content is stack-specific | Should have narrower globs to avoid loading in wrong contexts |
From uncovered_files, group by directory prefix. Report directories with >5 uncovered files:
SIN COBERTURA:
src/utils/ — 12 files touched, no rule covers this path
scripts/ — 8 files touched, no rule covers this path
migrations/ — 5 files touched, no rule covers this path
For each gap, suggest:
migrations/ → supabase), recommend adding stack ruleCalculate approximate token impact:
TOKEN BUDGET:
Always loaded: _common.md (35 lines) + agents.md (52 lines) + memory.md (18 lines) = 105 lines/session
Active rules: backend.md (33 lines × 95%) + testing.md (30 lines × 78%) = ~55 lines avg/session
Inert rules: ios.md (34 lines × 0%) = 34 lines WASTED per session when loaded
POTENTIAL SAVINGS: Remove ios.md → save ~34 lines of context per session
═══ RULE EFFECTIVENESS — {{project}} ═══
Period: last {{N}} months ({{total_sessions}} sessions)
Rules: {{rule_count}} files, {{total_lines}} lines
── ACTIVE (keep) ──
{{rule.md}} — {{match_rate}}% match, {{matched_files}} files, {{lines}} lines
...
── OCCASIONAL (evaluate) ──
{{rule.md}} — {{match_rate}}% match, {{matched_files}} files
...
── INERT (candidates for removal) ──
{{rule.md}} — {{match_rate}}% match, {{matched_files}} files ← {{reason}}
...
── ALWAYS-LOADED ({{total_lines}} lines/session) ──
{{rule.md}} — {{lines}} lines, globs: **/*
...
── COVERAGE ──
Files covered by rules: {{covered}}/{{total}} ({{coverage}}%)
Gaps: {{gap_dirs}}
── TOKEN OPTIMIZATION ──
Current avg load: ~{{current}} lines/session
After pruning inert: ~{{pruned}} lines/session
Potential savings: ~{{savings}} lines/session ({{pct}}% reduction)
── RECOMMENDATIONS ──
1. {{action}} — {{reason}}
2. ...
For each recommendation, offer to execute:
rm .claude/rules/{{file}} (with confirmation).claude/rules/{{name}}.md with suggested globsOnly execute with user confirmation. Show diff before applying.
Audits the Claude Code configuration of a project against the dotforge template. Generates a report with score and gaps.
Sync all GitHub-backed git repos on this machine with origin. Pulls behind repos, pushes ahead repos, reports dirty/non-main/conflict cases for Claude to resolve.
Generate a Claude Code plugin package from the current project's dotforge configuration, ready for marketplace submission.
Fetch official Anthropic/Claude Code docs, detect changes relevant to dotforge, report deltas.
Process the practices inbox, evaluate, incorporate into dotforge, and suggest propagation to projects.
Restore a project's .claude/ directory to the dotforge template from scratch, with backup and rollback option.