cc-dev-template 0.1.31 → 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.
Files changed (37) hide show
  1. package/bin/install.js +5 -9
  2. package/package.json +1 -1
  3. package/src/commands/done.md +52 -0
  4. package/src/commands/prime.md +40 -4
  5. package/src/hooks/bash-precheck.sh +2 -2
  6. package/src/mcp-servers/qa-server/README.md +10 -8
  7. package/src/mcp-servers/qa-server/src/index.ts +20 -27
  8. package/src/skills/initialize-project/SKILL.md +88 -0
  9. package/src/agents/adr-agent.md +0 -167
  10. package/src/agents/claude-md-agent.md +0 -124
  11. package/src/agents/decomposition-agent.md +0 -170
  12. package/src/agents/execution-agent.md +0 -232
  13. package/src/agents/rca-agent.md +0 -192
  14. package/src/agents/tdd-agent.md +0 -205
  15. package/src/commands/create-agent-skill.md +0 -11
  16. package/src/commands/finalize.md +0 -48
  17. package/src/commands/heal-skill.md +0 -69
  18. package/src/hooks/orchestration-guidance.sh +0 -56
  19. package/src/hooks/orchestration-hook.json +0 -14
  20. package/src/scripts/adr-list.js +0 -298
  21. package/src/scripts/adr-tags.js +0 -242
  22. package/src/scripts/validate-yaml.js +0 -142
  23. package/src/scripts/yaml-validation-hook.json +0 -15
  24. package/src/skills/orchestration/SKILL.md +0 -161
  25. package/src/skills/orchestration/references/debugging/describe.md +0 -144
  26. package/src/skills/orchestration/references/debugging/fix.md +0 -117
  27. package/src/skills/orchestration/references/debugging/learn.md +0 -185
  28. package/src/skills/orchestration/references/debugging/rca.md +0 -92
  29. package/src/skills/orchestration/references/debugging/verify.md +0 -102
  30. package/src/skills/orchestration/references/execution/complete.md +0 -175
  31. package/src/skills/orchestration/references/execution/start.md +0 -77
  32. package/src/skills/orchestration/references/execution/tasks.md +0 -114
  33. package/src/skills/orchestration/references/planning/draft.md +0 -269
  34. package/src/skills/orchestration/references/planning/explore.md +0 -160
  35. package/src/skills/orchestration/references/planning/finalize.md +0 -184
  36. package/src/skills/orchestration/references/planning/start.md +0 -119
  37. 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 = ['agents', 'commands', 'scripts', 'skills', 'hooks', 'mcp-servers'];
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cc-dev-template",
3
- "version": "0.1.31",
3
+ "version": "0.1.33",
4
4
  "description": "Structured AI-assisted development framework for Claude Code",
5
5
  "bin": {
6
6
  "cc-dev-template": "./bin/install.js"
@@ -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.
@@ -1,11 +1,47 @@
1
1
  ---
2
- description: Navigate project planning and execution workflows
2
+ description: Start a session - get oriented and decide what to work on
3
3
  ---
4
4
 
5
- Invoke the orchestration skill immediately:
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: "orchestration")
22
+ Skill(skill: "initialize-project")
9
23
  ```
10
24
 
11
- The skill contains all workflow instructions. Do not proceed with any other actions until you have invoked the skill.
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.
@@ -79,8 +79,8 @@ if [ "$__size" -gt "$__max" ]; then
79
79
 
80
80
  echo "=== OUTPUT TRUNCATED (${__lines} lines, ~${__tokens} tokens) ==="
81
81
  echo ""
82
- echo "--- First 40 lines ---"
83
- head -n 40 "$__tmpfile"
82
+ echo "--- First 5 lines ---"
83
+ head -n 5 "$__tmpfile"
84
84
  echo ""
85
85
  echo "--- Last 5 lines ---"
86
86
  tail -n 5 "$__tmpfile"
@@ -4,7 +4,7 @@ MCP server that spawns a Claude sub-agent for frontend visual inspection.
4
4
 
5
5
  ## Problem
6
6
 
7
- Chrome DevTools MCP adds ~20k tokens to context just from tool definitions, even when browser inspection isn't needed. This wastes context in long sessions.
7
+ Playwright MCP adds ~20k tokens to context just from tool definitions, even when browser inspection isn't needed. This wastes context in long sessions.
8
8
 
9
9
  ## Solution
10
10
 
@@ -15,11 +15,13 @@ Main Conversation (~500 tokens)
15
15
 
16
16
  └── mcp__qa__inspect_frontend
17
17
 
18
- └── Sub-agent with chrome-devtools MCP (full control)
18
+ └── Sub-agent with @playwright/mcp (full browser control)
19
19
 
20
20
  └── Returns QA report
21
21
  ```
22
22
 
23
+ **Note:** No system Chrome installation is required. Playwright automatically downloads and manages its own Chromium browser.
24
+
23
25
  ## Installation
24
26
 
25
27
  ```bash
@@ -50,10 +52,10 @@ Or in `~/.claude.json`:
50
52
 
51
53
  ## After Setup
52
54
 
53
- Remove chrome-devtools from your main config to save tokens:
55
+ Remove Playwright MCP from your main config to save tokens (if previously added):
54
56
 
55
57
  ```bash
56
- claude mcp remove chrome-devtools
58
+ claude mcp remove playwright
57
59
  ```
58
60
 
59
61
  ## Usage
@@ -94,11 +96,11 @@ The sub-agent will:
94
96
 
95
97
  ## Sub-agent Capabilities
96
98
 
97
- The spawned sub-agent uses Opus (best visual understanding) and has access to:
99
+ The spawned sub-agent uses Opus (best visual understanding) and has access to Playwright MCP tools:
98
100
 
99
- - **Navigation**: navigate_page, new_page, list_pages, select_page, wait_for
100
- - **Inspection**: take_screenshot, take_snapshot, list_console_messages
101
- - **Interaction**: click, fill, fill_form, hover, press_key, handle_dialog
101
+ - **Navigation**: browser_navigate, browser_tab_new, browser_tab_list, browser_tab_select, browser_wait_for
102
+ - **Inspection**: browser_screenshot, browser_snapshot, browser_console_messages
103
+ - **Interaction**: browser_click, browser_type, browser_hover, browser_press_key, browser_handle_dialog
102
104
 
103
105
  ## Token Savings
104
106
 
@@ -4,7 +4,7 @@
4
4
  *
5
5
  * This server exposes a single `inspect_frontend` tool that:
6
6
  * 1. Takes a URL and task description
7
- * 2. Spawns a Claude sub-agent with chrome-devtools MCP access
7
+ * 2. Spawns a Claude sub-agent with Playwright MCP access
8
8
  * 3. The sub-agent navigates, screenshots, clicks, and inspects
9
9
  * 4. Returns a structured QA report
10
10
  *
@@ -110,16 +110,17 @@ Task: ${task}
110
110
  **Context:** A developer needs verification that this frontend is working correctly. Your assessment helps them catch issues before users do.
111
111
 
112
112
  **Available tools:**
113
- - navigate_page: Go to the URL
114
- - take_screenshot: See the visual state (use this to understand what the page looks like)
115
- - take_snapshot: Get element references for clicking/filling
116
- - list_console_messages: Check for JavaScript errors
117
- - click, fill, fill_form: Interact with elements
113
+ - browser_navigate: Go to the URL
114
+ - browser_take_screenshot: See the visual state (use this to understand what the page looks like)
115
+ - browser_click: Click elements
116
+ - browser_fill: Fill form fields
117
+ - browser_get_text: Read page content
118
+ - browser_wait_for: Wait for elements or conditions
118
119
 
119
120
  **Success criteria:** Provide a clear QA report covering visual state, console errors, task completion, and overall pass/fail assessment.
120
121
  `;
121
122
 
122
- // Spawn sub-agent with chrome-devtools MCP access
123
+ // Spawn sub-agent with Playwright MCP access
123
124
  const result = query({
124
125
  prompt: taskPrompt,
125
126
  options: {
@@ -127,30 +128,22 @@ Task: ${task}
127
128
  cwd: process.cwd(),
128
129
  systemPrompt: QA_SYSTEM_PROMPT,
129
130
  mcpServers: {
130
- "chrome-devtools": {
131
+ "playwright": {
131
132
  command: "npx",
132
- args: ["chrome-devtools-mcp@latest", "--headless"],
133
+ args: ["@playwright/mcp@latest", "--vision", "--headless"],
133
134
  },
134
135
  },
135
136
  allowedTools: [
136
- // Navigation
137
- "mcp__chrome-devtools__navigate_page",
138
- "mcp__chrome-devtools__new_page",
139
- "mcp__chrome-devtools__list_pages",
140
- "mcp__chrome-devtools__select_page",
141
- "mcp__chrome-devtools__wait_for",
142
- // Inspection
143
- "mcp__chrome-devtools__take_screenshot",
144
- "mcp__chrome-devtools__take_snapshot",
145
- "mcp__chrome-devtools__list_console_messages",
146
- "mcp__chrome-devtools__get_console_message",
147
- // Interaction
148
- "mcp__chrome-devtools__click",
149
- "mcp__chrome-devtools__fill",
150
- "mcp__chrome-devtools__fill_form",
151
- "mcp__chrome-devtools__hover",
152
- "mcp__chrome-devtools__press_key",
153
- "mcp__chrome-devtools__handle_dialog",
137
+ "mcp__playwright__browser_navigate",
138
+ "mcp__playwright__browser_click",
139
+ "mcp__playwright__browser_fill",
140
+ "mcp__playwright__browser_take_screenshot",
141
+ "mcp__playwright__browser_wait_for",
142
+ "mcp__playwright__browser_get_text",
143
+ "mcp__playwright__browser_hover",
144
+ "mcp__playwright__browser_press_key",
145
+ "mcp__playwright__browser_scroll",
146
+ "mcp__playwright__browser_get_url",
154
147
  ],
155
148
  },
156
149
  });
@@ -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
@@ -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