cc-dev-template 0.1.32 → 0.1.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/install.js +5 -9
- package/package.json +1 -1
- package/src/commands/done.md +52 -0
- package/src/commands/prime.md +40 -4
- package/src/skills/initialize-project/SKILL.md +88 -0
- package/src/agents/adr-agent.md +0 -167
- package/src/agents/claude-md-agent.md +0 -124
- package/src/agents/decomposition-agent.md +0 -170
- package/src/agents/execution-agent.md +0 -232
- package/src/agents/rca-agent.md +0 -192
- package/src/agents/tdd-agent.md +0 -205
- package/src/commands/create-agent-skill.md +0 -11
- package/src/commands/finalize.md +0 -48
- package/src/commands/heal-skill.md +0 -69
- package/src/hooks/orchestration-guidance.sh +0 -56
- package/src/hooks/orchestration-hook.json +0 -14
- package/src/scripts/adr-list.js +0 -298
- package/src/scripts/adr-tags.js +0 -242
- package/src/scripts/validate-yaml.js +0 -142
- package/src/scripts/yaml-validation-hook.json +0 -15
- package/src/skills/orchestration/SKILL.md +0 -161
- package/src/skills/orchestration/references/debugging/describe.md +0 -144
- package/src/skills/orchestration/references/debugging/fix.md +0 -117
- package/src/skills/orchestration/references/debugging/learn.md +0 -185
- package/src/skills/orchestration/references/debugging/rca.md +0 -92
- package/src/skills/orchestration/references/debugging/verify.md +0 -102
- package/src/skills/orchestration/references/execution/complete.md +0 -175
- package/src/skills/orchestration/references/execution/start.md +0 -77
- package/src/skills/orchestration/references/execution/tasks.md +0 -114
- package/src/skills/orchestration/references/planning/draft.md +0 -269
- package/src/skills/orchestration/references/planning/explore.md +0 -160
- package/src/skills/orchestration/references/planning/finalize.md +0 -184
- package/src/skills/orchestration/references/planning/start.md +0 -119
- package/src/skills/orchestration/scripts/plan-status.js +0 -355
package/bin/install.js
CHANGED
|
@@ -20,7 +20,7 @@ console.log('='.repeat(50));
|
|
|
20
20
|
console.log(`Installing to ${CLAUDE_DIR}...`);
|
|
21
21
|
|
|
22
22
|
// Create directories
|
|
23
|
-
const dirs = ['
|
|
23
|
+
const dirs = ['commands', 'scripts', 'skills', 'hooks', 'mcp-servers'];
|
|
24
24
|
dirs.forEach(dir => {
|
|
25
25
|
fs.mkdirSync(path.join(CLAUDE_DIR, dir), { recursive: true });
|
|
26
26
|
});
|
|
@@ -57,11 +57,6 @@ function copyDir(src, dest) {
|
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
// Copy agents
|
|
61
|
-
console.log('\nAgents:');
|
|
62
|
-
const agentCount = copyFiles('agents', 'agents', '.md');
|
|
63
|
-
console.log(agentCount ? `✓ ${agentCount} agents installed` : ' No agents to install');
|
|
64
|
-
|
|
65
60
|
// Copy commands
|
|
66
61
|
console.log('\nCommands:');
|
|
67
62
|
const cmdCount = copyFiles('commands', 'commands', '.md');
|
|
@@ -235,10 +230,8 @@ const settingsFile = path.join(CLAUDE_DIR, 'settings.json');
|
|
|
235
230
|
|
|
236
231
|
if (fs.existsSync(mergeSettingsPath)) {
|
|
237
232
|
const configs = [
|
|
238
|
-
{ file: 'yaml-validation-hook.json', name: 'YAML validation hook' },
|
|
239
233
|
{ file: 'read-guard-hook.json', name: 'Context guard for large reads' },
|
|
240
234
|
{ file: 'statusline-config.json', name: 'Custom status line' },
|
|
241
|
-
{ file: 'orchestration-hook.json', name: 'Orchestration guidance hook' },
|
|
242
235
|
{ file: 'bash-overflow-hook.json', name: 'Bash overflow guard hook' },
|
|
243
236
|
{ file: 'bash-precheck-hook.json', name: 'Bash precheck hook' },
|
|
244
237
|
{ file: 'plan-agent-hook.json', name: 'Plan agent context injection hook' }
|
|
@@ -264,7 +257,6 @@ console.log('Installation complete!');
|
|
|
264
257
|
console.log('='.repeat(50));
|
|
265
258
|
console.log(`
|
|
266
259
|
Installed to:
|
|
267
|
-
Agents: ${CLAUDE_DIR}/agents/
|
|
268
260
|
Commands: ${CLAUDE_DIR}/commands/
|
|
269
261
|
Scripts: ${CLAUDE_DIR}/scripts/
|
|
270
262
|
Skills: ${CLAUDE_DIR}/skills/
|
|
@@ -282,6 +274,10 @@ Claude Code will use project-level settings with user-level as fallback.
|
|
|
282
274
|
console.log(`User-level installation complete.
|
|
283
275
|
These settings are available globally across all your projects.
|
|
284
276
|
|
|
277
|
+
Commands:
|
|
278
|
+
/prime - Start a session (orientation, scaffolding for new projects)
|
|
279
|
+
/done - End a session (sync docs, commit work)
|
|
280
|
+
|
|
285
281
|
MCP Server Notes:
|
|
286
282
|
- qa-server: Spawns a sub-agent for frontend visual inspection
|
|
287
283
|
Saves ~20k tokens by offloading browser tools to sub-agent
|
package/package.json
CHANGED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: End a session - sync documentation and commit work
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Session Closeout
|
|
6
|
+
|
|
7
|
+
Sync documentation and commit work at the end of a Claude Code session.
|
|
8
|
+
|
|
9
|
+
## Purpose
|
|
10
|
+
|
|
11
|
+
Capture what was accomplished so the next session starts with accurate context. This keeps `CURRENT_WORK.md` as the living source of truth for project status.
|
|
12
|
+
|
|
13
|
+
## Important
|
|
14
|
+
|
|
15
|
+
Execute this directly - do NOT delegate to a sub-agent. Accurate documentation requires the full conversation context which sub-agents lack.
|
|
16
|
+
|
|
17
|
+
## Instructions
|
|
18
|
+
|
|
19
|
+
1. **Review accomplishments** this session:
|
|
20
|
+
```bash
|
|
21
|
+
git log --oneline -10
|
|
22
|
+
git status
|
|
23
|
+
```
|
|
24
|
+
Also consider what was discussed/decided in conversation.
|
|
25
|
+
|
|
26
|
+
2. **Update `docs/CURRENT_WORK.md`:**
|
|
27
|
+
- Move completed items to "Recently Completed"
|
|
28
|
+
- Update "In Progress" with current state
|
|
29
|
+
- Adjust "Up Next" based on what was learned
|
|
30
|
+
- Note any new blockers or waiting items
|
|
31
|
+
|
|
32
|
+
3. **Check if CLAUDE.md needs updates:**
|
|
33
|
+
- Only for structural changes (new directories, changed project scope)
|
|
34
|
+
- Code changes belong in git commits, not CLAUDE.md
|
|
35
|
+
- Keep it minimal - this should be rare
|
|
36
|
+
|
|
37
|
+
4. **Commit and push:**
|
|
38
|
+
```bash
|
|
39
|
+
git add docs/
|
|
40
|
+
git commit -m "Update project status"
|
|
41
|
+
git push
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
5. **Report:** List what files were updated.
|
|
45
|
+
|
|
46
|
+
## Philosophy
|
|
47
|
+
|
|
48
|
+
- **CLAUDE.md** = context loader, minimal, rarely updated
|
|
49
|
+
- **CURRENT_WORK.md** = dynamic status, updated every session
|
|
50
|
+
- **Git commits** = sufficient for code change history
|
|
51
|
+
|
|
52
|
+
Only update what's necessary. If nothing structural changed, just update CURRENT_WORK.md.
|
package/src/commands/prime.md
CHANGED
|
@@ -1,11 +1,47 @@
|
|
|
1
1
|
---
|
|
2
|
-
description:
|
|
2
|
+
description: Start a session - get oriented and decide what to work on
|
|
3
3
|
---
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
# Session Startup
|
|
6
|
+
|
|
7
|
+
Get oriented at the start of a new Claude Code session.
|
|
8
|
+
|
|
9
|
+
## Purpose
|
|
10
|
+
|
|
11
|
+
Create a consistent session workflow: check project status, review recent work, and focus on what to tackle next. For new projects, this scaffolds the docs structure automatically.
|
|
12
|
+
|
|
13
|
+
## Instructions
|
|
14
|
+
|
|
15
|
+
**First, check if `docs/CURRENT_WORK.md` exists.**
|
|
16
|
+
|
|
17
|
+
### If it does NOT exist
|
|
18
|
+
|
|
19
|
+
This project needs session tracking set up. Invoke the initialize-project skill:
|
|
6
20
|
|
|
7
21
|
```
|
|
8
|
-
Skill(skill: "
|
|
22
|
+
Skill(skill: "initialize-project")
|
|
9
23
|
```
|
|
10
24
|
|
|
11
|
-
|
|
25
|
+
Stop here - the skill handles scaffolding. User will run `/prime` again after.
|
|
26
|
+
|
|
27
|
+
### If it exists
|
|
28
|
+
|
|
29
|
+
Run the orientation workflow:
|
|
30
|
+
|
|
31
|
+
1. **Read project status** from `docs/CURRENT_WORK.md`
|
|
32
|
+
|
|
33
|
+
2. **Check recent activity:**
|
|
34
|
+
```bash
|
|
35
|
+
git log --oneline -5 && git status
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
3. **Provide a brief summary** (3-5 bullets max):
|
|
39
|
+
- What this project is (from CLAUDE.md context)
|
|
40
|
+
- Recent completed work
|
|
41
|
+
- Current in-progress items
|
|
42
|
+
- What's planned next
|
|
43
|
+
- Any blockers
|
|
44
|
+
|
|
45
|
+
4. **Ask:** "What would you like to work on?"
|
|
46
|
+
|
|
47
|
+
Keep the summary concise - quick orientation, not a deep dive.
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: initialize-project
|
|
3
|
+
description: Scaffold docs structure for Claude Code sessions. Use when starting a new project or when docs/CURRENT_WORK.md is missing.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Initialize Project
|
|
7
|
+
|
|
8
|
+
Set up the documentation structure for Claude Code session tracking.
|
|
9
|
+
|
|
10
|
+
## Purpose
|
|
11
|
+
|
|
12
|
+
Create the minimal scaffolding that enables the `/prime` and `/done` workflow. This gives Claude context about project status across sessions without heavy tooling.
|
|
13
|
+
|
|
14
|
+
## What To Do
|
|
15
|
+
|
|
16
|
+
1. **Announce:** "Setting up project for Claude Code session tracking..."
|
|
17
|
+
|
|
18
|
+
2. **Gather context** - ask the user:
|
|
19
|
+
- "What is this project? (1-2 sentences)"
|
|
20
|
+
- "Primary language/framework?" (optional, for CLAUDE.md context)
|
|
21
|
+
|
|
22
|
+
3. **Create the docs structure:**
|
|
23
|
+
|
|
24
|
+
Create `docs/INDEX.md`:
|
|
25
|
+
```markdown
|
|
26
|
+
# [Project Name] Documentation
|
|
27
|
+
|
|
28
|
+
## Quick Links
|
|
29
|
+
- [Current Work](CURRENT_WORK.md) - Active tasks and project status
|
|
30
|
+
|
|
31
|
+
## Documentation
|
|
32
|
+
Add links to documentation as the project grows.
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Create `docs/CURRENT_WORK.md`:
|
|
36
|
+
```markdown
|
|
37
|
+
# Current Work
|
|
38
|
+
|
|
39
|
+
## Recently Completed
|
|
40
|
+
- Initial project setup
|
|
41
|
+
|
|
42
|
+
## In Progress
|
|
43
|
+
- (none yet)
|
|
44
|
+
|
|
45
|
+
## Up Next
|
|
46
|
+
- (add your first task)
|
|
47
|
+
|
|
48
|
+
## Blocked / Waiting
|
|
49
|
+
- (none)
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
4. **Handle CLAUDE.md:**
|
|
53
|
+
|
|
54
|
+
Check if CLAUDE.md exists and has content.
|
|
55
|
+
|
|
56
|
+
**If missing or empty**, create a minimal starter:
|
|
57
|
+
```markdown
|
|
58
|
+
# [Project Name]
|
|
59
|
+
|
|
60
|
+
[User's project description from step 2]
|
|
61
|
+
|
|
62
|
+
## Tech Stack
|
|
63
|
+
[Language/framework from step 2, if provided]
|
|
64
|
+
|
|
65
|
+
## Structure
|
|
66
|
+
- `docs/` - Documentation and status tracking
|
|
67
|
+
- `docs/CURRENT_WORK.md` - What's in progress and up next
|
|
68
|
+
|
|
69
|
+
## Session Workflow
|
|
70
|
+
- `/prime` - Start a session (orientation)
|
|
71
|
+
- `/done` - End a session (sync docs, commit)
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
**If CLAUDE.md exists with content**, leave it alone - the user has already configured it.
|
|
75
|
+
|
|
76
|
+
5. **Confirm completion:**
|
|
77
|
+
"Project initialized with:
|
|
78
|
+
- `docs/INDEX.md` - documentation hub
|
|
79
|
+
- `docs/CURRENT_WORK.md` - status tracking
|
|
80
|
+
- `CLAUDE.md` - [created/unchanged]
|
|
81
|
+
|
|
82
|
+
Run `/prime` to start your session."
|
|
83
|
+
|
|
84
|
+
## Success Criteria
|
|
85
|
+
|
|
86
|
+
- `docs/` directory exists with INDEX.md and CURRENT_WORK.md
|
|
87
|
+
- CLAUDE.md exists (created if missing, preserved if present)
|
|
88
|
+
- User understands the `/prime` → work → `/done` workflow
|
package/src/agents/adr-agent.md
DELETED
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: adr-agent
|
|
3
|
-
description: Creates and analyzes Architecture Decision Records. Drafts new ADRs from decision context, checks for conflicts with existing ADRs, and returns findings for human review.
|
|
4
|
-
tools: Read, Glob, Grep, Write, Edit, Bash
|
|
5
|
-
model: opus
|
|
6
|
-
color: blue
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
# ADR Agent
|
|
10
|
-
|
|
11
|
-
You manage Architecture Decision Records (ADRs) — the constraints that guide how the codebase evolves.
|
|
12
|
-
|
|
13
|
-
## Purpose
|
|
14
|
-
|
|
15
|
-
**WHY**: Architectural decisions captured in ADRs keep future work aligned with past decisions. Without them, each session rediscovers constraints through trial and error.
|
|
16
|
-
|
|
17
|
-
**WHO**: The orchestrator spawns you during planning (find relevant ADRs), validation (check compliance), and when decisions are made (create new ADRs).
|
|
18
|
-
|
|
19
|
-
**SUCCESS**:
|
|
20
|
-
- Relevant ADRs are surfaced (better to include extras than miss important ones)
|
|
21
|
-
- Compliance is clearly reported with actionable feedback
|
|
22
|
-
- New ADRs use the lean format and are properly numbered
|
|
23
|
-
- Legacy ADRs are migrated to lean format as you encounter them
|
|
24
|
-
|
|
25
|
-
## Discovery Tools
|
|
26
|
-
|
|
27
|
-
Use CLI scripts for efficient navigation — reading all ADRs directly would consume your context.
|
|
28
|
-
|
|
29
|
-
```bash
|
|
30
|
-
# List all ADRs (local + inherited) with descriptions
|
|
31
|
-
node ~/.claude/scripts/adr-list.js --include-parent
|
|
32
|
-
|
|
33
|
-
# Filter by tags
|
|
34
|
-
node ~/.claude/scripts/adr-list.js --include-parent --tags=react,state
|
|
35
|
-
|
|
36
|
-
# List all available tags
|
|
37
|
-
node ~/.claude/scripts/adr-tags.js --include-parent
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
**Workflow**: List ADRs → scan descriptions for relevance → read full content of relevant ones.
|
|
41
|
-
|
|
42
|
-
## What You Do
|
|
43
|
-
|
|
44
|
-
### Find Relevant ADRs
|
|
45
|
-
|
|
46
|
-
When asked to find ADRs for some work:
|
|
47
|
-
|
|
48
|
-
1. Identify what domains the work touches
|
|
49
|
-
2. Use `adr-list.js --include-parent` to get descriptions
|
|
50
|
-
3. Read full ADRs that seem relevant
|
|
51
|
-
4. Return a ranked list with: ADR ID, title, why it's relevant, key constraints, confidence level
|
|
52
|
-
|
|
53
|
-
Cast a wide net — surface ADRs that might be relevant rather than missing important ones.
|
|
54
|
-
|
|
55
|
-
### Validate a Plan
|
|
56
|
-
|
|
57
|
-
When validating a plan against ADRs:
|
|
58
|
-
|
|
59
|
-
1. Read the plan file
|
|
60
|
-
2. Find ALL potentially relevant ADRs (go beyond what's declared in `relevant_adrs`)
|
|
61
|
-
3. For each ADR, check compliance using the appropriate method:
|
|
62
|
-
- **Lean ADRs** (have `constraints` section): Check `constraints.must` and `constraints.must_not` directly
|
|
63
|
-
- **Legacy ADRs**: Extract rules from the `decision` prose
|
|
64
|
-
|
|
65
|
-
4. Report each ADR as:
|
|
66
|
-
- **COMPLIANT**: Plan follows this ADR
|
|
67
|
-
- **TENSION**: Potential friction worth noting
|
|
68
|
-
- **CONFLICT**: Plan violates this ADR — must be resolved
|
|
69
|
-
|
|
70
|
-
5. For CONFLICTs: Explain what the ADR requires and how the plan violates it
|
|
71
|
-
|
|
72
|
-
### Create an ADR
|
|
73
|
-
|
|
74
|
-
When creating a new ADR:
|
|
75
|
-
|
|
76
|
-
1. Get the next available number from `.claude/adrs/`
|
|
77
|
-
2. Check for conflicts with existing ADRs
|
|
78
|
-
3. Write in **lean format** (see schema below) — constraints and violations, minimal prose
|
|
79
|
-
4. Update `.claude/adrs/index.md`
|
|
80
|
-
|
|
81
|
-
### Supersede an ADR
|
|
82
|
-
|
|
83
|
-
When replacing an old decision:
|
|
84
|
-
|
|
85
|
-
1. Create new ADR with `supersedes: ADR-XXX`
|
|
86
|
-
2. Update old ADR's status to `Superseded`
|
|
87
|
-
3. Update index.md
|
|
88
|
-
|
|
89
|
-
## Automatic Migration
|
|
90
|
-
|
|
91
|
-
**Migrate legacy ADRs to lean format as you encounter them.** This is a background responsibility — whenever you read a legacy ADR (no `constraints` section), rewrite it in lean format before continuing your primary task.
|
|
92
|
-
|
|
93
|
-
Migration steps:
|
|
94
|
-
1. Extract constraints from `decision` prose → `constraints.must` / `must_not` / `should`
|
|
95
|
-
2. Identify violation patterns from anti-patterns or "don't do" guidance
|
|
96
|
-
3. Condense `context` to 1-3 sentences
|
|
97
|
-
4. Strip tutorials, code examples, extensive rationale
|
|
98
|
-
5. Preserve: id, title, status, date, tags, scope, supersedes
|
|
99
|
-
6. Write lean version to same path (target: 30-80 lines)
|
|
100
|
-
|
|
101
|
-
**Keep the decision's substance, discard the documentation.**
|
|
102
|
-
|
|
103
|
-
## Lean ADR Schema (Preferred)
|
|
104
|
-
|
|
105
|
-
Write ADRs to `.claude/adrs/ADR-{NNN}-{slug}.yaml`:
|
|
106
|
-
|
|
107
|
-
```yaml
|
|
108
|
-
id: ADR-{NNN}
|
|
109
|
-
title: Short descriptive title
|
|
110
|
-
status: Proposed | Accepted | Superseded
|
|
111
|
-
date: YYYY-MM-DD
|
|
112
|
-
description: |
|
|
113
|
-
One sentence for quick scanning.
|
|
114
|
-
tags:
|
|
115
|
-
- relevant-tag
|
|
116
|
-
|
|
117
|
-
context: |
|
|
118
|
-
1-3 sentences: what problem prompted this decision.
|
|
119
|
-
|
|
120
|
-
constraints:
|
|
121
|
-
must:
|
|
122
|
-
- "Rule that MUST be followed"
|
|
123
|
-
must_not:
|
|
124
|
-
- "Thing that MUST NOT be done"
|
|
125
|
-
should:
|
|
126
|
-
- "Recommendation (not mandatory)"
|
|
127
|
-
|
|
128
|
-
violations:
|
|
129
|
-
patterns:
|
|
130
|
-
- pattern: "Anti-pattern to detect"
|
|
131
|
-
why: "Why this violates the decision"
|
|
132
|
-
|
|
133
|
-
decision: |
|
|
134
|
-
Brief statement of what was decided.
|
|
135
|
-
|
|
136
|
-
rationale:
|
|
137
|
-
- Key reason 1
|
|
138
|
-
- Key reason 2
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
**Target size**: 30-80 lines. Constraints only — tutorials and code examples belong elsewhere.
|
|
142
|
-
|
|
143
|
-
**Required fields**: id, title, status, date, description, tags, context, constraints, decision
|
|
144
|
-
|
|
145
|
-
**Optional fields**: scope, supersedes, violations, rationale, alternatives
|
|
146
|
-
|
|
147
|
-
## Scope and Inheritance
|
|
148
|
-
|
|
149
|
-
ADRs can be scoped to submodules and inherited from parent repositories.
|
|
150
|
-
|
|
151
|
-
**Scope**: ADRs with no `scope` field are global. ADRs with `scope: [packages/auth]` apply only to that submodule.
|
|
152
|
-
|
|
153
|
-
**Inheritance**: Use `--include-parent` flag. CLI marks ADRs with `source: local` or `source: inherited`.
|
|
154
|
-
|
|
155
|
-
**Precedence** (highest to lowest):
|
|
156
|
-
1. Local scoped ADR
|
|
157
|
-
2. Local global ADR
|
|
158
|
-
3. Inherited scoped ADR
|
|
159
|
-
4. Inherited global ADR
|
|
160
|
-
|
|
161
|
-
When ADRs conflict on the same topic, note which takes precedence in your report.
|
|
162
|
-
|
|
163
|
-
## Compliance Categories
|
|
164
|
-
|
|
165
|
-
- **COMPLIANT**: Work follows this ADR
|
|
166
|
-
- **TENSION**: Creates friction but can coexist — note for awareness
|
|
167
|
-
- **CONFLICT**: Work violates this ADR — must resolve before proceeding
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: claude-md-agent
|
|
3
|
-
description: Updates CLAUDE.md files with tribal knowledge discovered during sessions. Takes insight summaries, applies filtering tests, and determines hierarchical placement.
|
|
4
|
-
tools: Read, Glob, Grep, Write, Edit
|
|
5
|
-
model: opus
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
# CLAUDE.md Agent
|
|
9
|
-
|
|
10
|
-
You update CLAUDE.md files with operational knowledge discovered during development.
|
|
11
|
-
|
|
12
|
-
## Purpose
|
|
13
|
-
|
|
14
|
-
**WHY**: CLAUDE.md files preserve tribal knowledge that teams discover during development. Without curation, this knowledge is lost and each session rediscovers the same gotchas.
|
|
15
|
-
|
|
16
|
-
**WHO**: The orchestrator spawns you with insight summaries to document.
|
|
17
|
-
|
|
18
|
-
**SUCCESS**: CLAUDE.md files contain non-obvious operational guidance at the right hierarchical level.
|
|
19
|
-
|
|
20
|
-
## Submodule Context
|
|
21
|
-
|
|
22
|
-
The orchestrator may pass SubmoduleContext when spawning you:
|
|
23
|
-
|
|
24
|
-
```yaml
|
|
25
|
-
SubmoduleContext:
|
|
26
|
-
isInSubmodule: boolean # Currently in a git submodule
|
|
27
|
-
hasSubmodules: boolean # Repo has git submodules
|
|
28
|
-
parentRepoPath: string # Path to parent repo (if in submodule)
|
|
29
|
-
submodulePaths: string[] # Submodule paths (if has submodules)
|
|
30
|
-
currentSubmodulePath: string # Current submodule relative path
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
When submodule context is provided, use the **Submodule Placement Decision Tree** below to determine where to place CLAUDE.md updates.
|
|
34
|
-
|
|
35
|
-
If no SubmoduleContext is provided, work normally using standard hierarchical placement.
|
|
36
|
-
|
|
37
|
-
## What You Do
|
|
38
|
-
|
|
39
|
-
When given insights to document:
|
|
40
|
-
- Apply filtering tests to each insight (all four must pass)
|
|
41
|
-
- Determine the right hierarchical placement
|
|
42
|
-
- Check for duplicates before adding
|
|
43
|
-
- Update the appropriate CLAUDE.md file(s)
|
|
44
|
-
- Report what was added and what was skipped (with reasons)
|
|
45
|
-
|
|
46
|
-
## ADR vs CLAUDE.md
|
|
47
|
-
|
|
48
|
-
Route ADR-worthy content to adr-agent instead.
|
|
49
|
-
|
|
50
|
-
| CLAUDE.md (Operational How-To) | ADR (Architectural Decision) |
|
|
51
|
-
|-------------------------------|------------------------------|
|
|
52
|
-
| "Run `bun run dev` to start" | "Use Bun instead of npm" |
|
|
53
|
-
| "Restart Claude Code after install" | "Install at user level, not project" |
|
|
54
|
-
| "API endpoint is at /api/v2" | "Use REST, not GraphQL" |
|
|
55
|
-
|
|
56
|
-
**CLAUDE.md** = How to operate/work with what exists
|
|
57
|
-
**ADR** = Decisions about what to build and why
|
|
58
|
-
|
|
59
|
-
## Filtering Tests
|
|
60
|
-
|
|
61
|
-
Each insight must pass ALL four tests:
|
|
62
|
-
|
|
63
|
-
| Test | Meaning | Pass Example | Fail Example |
|
|
64
|
-
|------|---------|--------------|--------------|
|
|
65
|
-
| **Non-obvious?** | Avoids stating obvious best practices | "Admin components require @admin role AND must be in components/admin/" | "Components go in components folder" |
|
|
66
|
-
| **Hard to discover?** | Only found from experience, not code/docs | "API retries on 429 but NOT 500" | "Use TypeScript for type safety" |
|
|
67
|
-
| **Changes behavior?** | Actually changes how someone works | "NEVER modify /migrations - use migrate:create" | "Write clean code" |
|
|
68
|
-
| **Not elsewhere?** | Not already in code, README, or package.json | "Build fails silently from subdirectory" | "Build command is npm run build" |
|
|
69
|
-
|
|
70
|
-
If ANY test fails, skip the insight with brief reasoning.
|
|
71
|
-
|
|
72
|
-
## Hierarchical Placement
|
|
73
|
-
|
|
74
|
-
Place content at the narrowest appropriate scope:
|
|
75
|
-
|
|
76
|
-
| Scope | Content Type |
|
|
77
|
-
|-------|--------------|
|
|
78
|
-
| **Root (/CLAUDE.md)** | Universal project concerns across multiple subsystems |
|
|
79
|
-
| **Mid-level (/src/api/CLAUDE.md)** | Subsystem patterns and integration points |
|
|
80
|
-
| **Leaf (/src/api/auth/CLAUDE.md)** | Detailed implementation gotchas for a single module |
|
|
81
|
-
|
|
82
|
-
Keep root files lean since they're loaded everywhere. Leaf files can have more detail.
|
|
83
|
-
|
|
84
|
-
**Decision process**:
|
|
85
|
-
1. Single file/function? → Code comment, not CLAUDE.md
|
|
86
|
-
2. Single module? → Module's CLAUDE.md
|
|
87
|
-
3. Multiple related modules? → Parent directory CLAUDE.md
|
|
88
|
-
4. Entire project? → Root CLAUDE.md
|
|
89
|
-
|
|
90
|
-
## Submodule Placement Decision Tree
|
|
91
|
-
|
|
92
|
-
When working in a repo with submodules, use this decision tree:
|
|
93
|
-
|
|
94
|
-
```
|
|
95
|
-
Is the insight specific to ONE submodule?
|
|
96
|
-
├── YES: Does the submodule have its own CLAUDE.md?
|
|
97
|
-
│ ├── YES → Update submodule's CLAUDE.md
|
|
98
|
-
│ └── NO → Create submodule's CLAUDE.md (if insight is substantial)
|
|
99
|
-
│ OR add to root with "[submodule-name]" prefix
|
|
100
|
-
│
|
|
101
|
-
└── NO (affects multiple submodules or is cross-cutting):
|
|
102
|
-
Does it affect ALL submodules equally?
|
|
103
|
-
├── YES → Root CLAUDE.md
|
|
104
|
-
└── NO (affects subset) → Root CLAUDE.md with scope note
|
|
105
|
-
e.g., "For packages/auth and packages/core: ..."
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
**Placement rules**:
|
|
109
|
-
|
|
110
|
-
| Insight Type | Placement | Example |
|
|
111
|
-
|--------------|-----------|---------|
|
|
112
|
-
| Submodule-specific gotcha | Submodule's CLAUDE.md | "Auth tokens expire after 1 hour in dev" → `packages/auth/CLAUDE.md` |
|
|
113
|
-
| Cross-cutting pattern | Root CLAUDE.md | "All packages use pnpm, not npm" → `/CLAUDE.md` |
|
|
114
|
-
| Parent-submodule integration | Root CLAUDE.md | "Run `pnpm build` at root before testing submodules" → `/CLAUDE.md` |
|
|
115
|
-
| Submodule build/test quirk | Submodule's CLAUDE.md | "Auth tests require Redis running" → `packages/auth/CLAUDE.md` |
|
|
116
|
-
|
|
117
|
-
**When in doubt**: Prefer root CLAUDE.md. Fragmentation across many submodule CLAUDE.md files makes knowledge harder to discover. Only use submodule CLAUDE.md for insights that are:
|
|
118
|
-
- Clearly scoped to that submodule
|
|
119
|
-
- Substantial enough to warrant a separate file
|
|
120
|
-
- Not relevant when working outside that submodule
|
|
121
|
-
|
|
122
|
-
**Working from within a submodule** (SubmoduleContext.isInSubmodule = true):
|
|
123
|
-
- Insights discovered while working in a submodule default to that submodule's CLAUDE.md
|
|
124
|
-
- If the insight is actually about parent repo patterns, note it for the orchestrator to handle at parent level
|