Step 1: Load Rule Index
Load the complete rule index:
- @.claude/context/rule-index.json
This contains all 1,081+ available rules.
Step 2: Analyze Codebase
Scan the codebase to identify technologies used:
- File extensions:
.tsx, .py, .sol, etc.
- Package files:
package.json, requirements.txt, Cargo.toml
- Framework files:
next.config.js, fastapi imports, etc.
- Directory structure:
app/, components/, routers/, etc.
See reference/coverage-analysis.md for detailed analysis patterns.
Step 3: Identify Technologies
Extract technologies from codebase:
- Primary languages (TypeScript, Python, etc.)
- Frameworks (Next.js, FastAPI, etc.)
- Testing tools (Cypress, Playwright, Jest, etc.)
- Build tools (Docker, Kubernetes, etc.)
Step 4: Query Rule Index
For each detected technology, query the index:
- Use
technology_map to find all rules for each technology
- Collect all potentially relevant rules
- Remove duplicates
Step 5: Compare with Active Rules
Check which rules are currently active:
- Check
.claude/rules/manifest.yaml for loaded rules
- Check
.claude/config.yaml for agent-specific rules
- Identify which indexed rules are NOT currently loaded
Step 6: Generate Recommendations
For each missing rule, provide:
- Rule name and description: From index metadata
- Why it's relevant: Connection to codebase technologies
- Priority: High/Medium/Low based on codebase usage
- How to activate: Instructions for loading the rule
- Be Specific: Explain why each rule is relevant
- Prioritize: High priority for core technologies, low for edge cases
- Provide Context: Show how rule connects to codebase
- Actionable: Include clear activation instructions
- Comprehensive: Check all technologies, not just obvious ones
Structure recommendations clearly:
## Rule Coverage Analysis
**Codebase Technologies**: [list]
**Currently Active Rules**: [count]
**Recommended Rules**: [count]
### High Priority Recommendations
#### [Rule Name]
**Path**: [path from index]
**Type**: [master/archive]
**Relevance**: [why it applies]
**Priority**: High
**Description**: [from index metadata]
**Why You Need This**:
[Explanation of why this rule is important for your codebase]
**How to Activate**:
[Instructions for loading the rule]
---
### Medium Priority Recommendations
[Similar structure]
---
### Low Priority Recommendations
[Similar structure]
### Summary
- **Total rules available**: [count]
- **Rules currently active**: [count]
- **Rules recommended**: [count]
- **Coverage gap**: [percentage]
High Priority:
- Core framework rules (Next.js, React, TypeScript for TS projects)
- Universal standards (PROTOCOL_ENGINEERING)
- Testing rules matching test framework used
- Security rules for production code
Medium Priority:
- Framework-specific optimizations
- Code style rules for secondary languages
- Tool-specific rules (Docker, CI/CD)
Low Priority:
- Niche technology rules
- Deprecated framework rules
- Rules for unused features
1---2name: recommending-rules3description: Analyzes codebase to find gaps in rule coverage and suggests rule improvements. Compares codebase against all indexed rules to identify missing standards. Use when setting up new projects or reviewing rule coverage.4---5
6<identity>
7Recommending Rules - Analyzes codebase to identify gaps in rule coverage by comparing against all indexed rules.
8</identity>
9
10<capabilities>
11- Setting up a new project
12- Reviewing rule coverage for existing project
13- User asks "What rules should I use?"
14- Identifying missing standards
15- Project uses technologies without corresponding rules
16</capabilities>
17
18<instructions>
19<execution_process>
20
21### Step 1: Load Rule Index
22
23Load the complete rule index:
24
25- @.claude/context/rule-index.json
26
27This contains all 1,081+ available rules.
28
29### Step 2: Analyze Codebase
30
31Scan the codebase to identify technologies used:
32
33- **File extensions**: `.tsx`, `.py`, `.sol`, etc.
34- **Package files**: `package.json`, `requirements.txt`, `Cargo.toml`
35- **Framework files**: `next.config.js`, `fastapi` imports, etc.
36- **Directory structure**: `app/`, `components/`, `routers/`, etc.
37
38See [reference/coverage-analysis.md](reference/coverage-analysis.md) for detailed analysis patterns.
39
40### Step 3: Identify Technologies
41
42Extract technologies from codebase:
43
44- Primary languages (TypeScript, Python, etc.)
45- Frameworks (Next.js, FastAPI, etc.)
46- Testing tools (Cypress, Playwright, Jest, etc.)
47- Build tools (Docker, Kubernetes, etc.)
48
49### Step 4: Query Rule Index
50
51For each detected technology, query the index:
52
53- Use `technology_map` to find all rules for each technology
54- Collect all potentially relevant rules
55- Remove duplicates
56
57### Step 5: Compare with Active Rules
58
59Check which rules are currently active:
60
61- Check `.claude/rules/manifest.yaml` for loaded rules
62- Check `.claude/config.yaml` for agent-specific rules
63- Identify which indexed rules are NOT currently loaded
64
65### Step 6: Generate Recommendations
66
67For each missing rule, provide:
68
69- **Rule name and description**: From index metadata
70- **Why it's relevant**: Connection to codebase technologies
71- **Priority**: High/Medium/Low based on codebase usage
72- **How to activate**: Instructions for loading the rule
73 </execution_process>
74
75<best_practices>
76
771. **Be Specific**: Explain why each rule is relevant
782. **Prioritize**: High priority for core technologies, low for edge cases
793. **Provide Context**: Show how rule connects to codebase
804. **Actionable**: Include clear activation instructions
815. **Comprehensive**: Check all technologies, not just obvious ones
82 </best_practices>
83 </instructions>
84
85<examples>
86<formatting_example>
87**Output Format**
88
89Structure recommendations clearly:
90
91```markdown
92## Rule Coverage Analysis
93
94**Codebase Technologies**: [list]
95**Currently Active Rules**: [count]
96**Recommended Rules**: [count]
97
98### High Priority Recommendations
99
100#### [Rule Name]
101
102**Path**: [path from index]
103**Type**: [master/archive]
104**Relevance**: [why it applies]
105**Priority**: High
106
107**Description**: [from index metadata]
108
109**Why You Need This**:
110[Explanation of why this rule is important for your codebase]
111
112**How to Activate**:
113[Instructions for loading the rule]
114
115---
116
117### Medium Priority Recommendations
118
119[Similar structure]
120
121---
122
123### Low Priority Recommendations
124
125[Similar structure]
126
127### Summary
128
129- **Total rules available**: [count]
130- **Rules currently active**: [count]
131- **Rules recommended**: [count]
132- **Coverage gap**: [percentage]
133```
134
135</formatting_example>
136</examples>
137
138<examples>
139<code_example>
140**Recommendation Criteria**:
141
142**High Priority**:
143
144- Core framework rules (Next.js, React, TypeScript for TS projects)
145- Universal standards (PROTOCOL_ENGINEERING)
146- Testing rules matching test framework used
147- Security rules for production code
148
149**Medium Priority**:
150
151- Framework-specific optimizations
152- Code style rules for secondary languages
153- Tool-specific rules (Docker, CI/CD)
154
155**Low Priority**:
156
157- Niche technology rules
158- Deprecated framework rules
159- Rules for unused features
160 </code_example>
161 </examples>