cc-dev-template 0.1.65 → 0.1.72

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 CHANGED
@@ -253,9 +253,8 @@ const settingsFile = path.join(CLAUDE_DIR, 'settings.json');
253
253
  if (fs.existsSync(mergeSettingsPath)) {
254
254
  const configs = [
255
255
  { file: 'read-guard-hook.json', name: 'Context guard for large reads' },
256
+ { file: 'task-output-guard-hook.json', name: 'TaskOutput context guard' },
256
257
  { file: 'statusline-config.json', name: 'Custom status line' },
257
- { file: 'bash-overflow-hook.json', name: 'Bash overflow guard hook' },
258
- { file: 'env-config.json', name: 'Environment variables' },
259
258
  // Spinner verbs - choose one (Helldivers or Factorio)
260
259
  { file: 'spinner-verbs-helldivers.json', name: 'Helldivers spinner verbs' }
261
260
  // { file: 'spinner-verbs-factorio.json', name: 'Factorio spinner verbs' }
@@ -310,7 +309,10 @@ deprecatedMcpServers.forEach(server => {
310
309
  const deprecatedFiles = [
311
310
  path.join(CLAUDE_DIR, 'hooks', 'bash-precheck.sh'),
312
311
  path.join(CLAUDE_DIR, 'hooks', 'bash-wrapper-helper.sh'),
313
- path.join(CLAUDE_DIR, 'scripts', 'bash-precheck-hook.json')
312
+ path.join(CLAUDE_DIR, 'scripts', 'bash-precheck-hook.json'),
313
+ path.join(CLAUDE_DIR, 'hooks', 'bash-overflow-guard.sh'),
314
+ path.join(CLAUDE_DIR, 'scripts', 'bash-overflow-hook.json'),
315
+ path.join(CLAUDE_DIR, 'scripts', 'env-config.json')
314
316
  ];
315
317
 
316
318
  deprecatedFiles.forEach(file => {
@@ -354,6 +356,50 @@ if (fs.existsSync(settingsFile)) {
354
356
  });
355
357
  }
356
358
 
359
+ // Remove bash-overflow-guard hooks from settings
360
+ if (settings.hooks) {
361
+ ['PostToolUse'].forEach(hookType => {
362
+ if (settings.hooks[hookType] && Array.isArray(settings.hooks[hookType])) {
363
+ const originalLength = settings.hooks[hookType].length;
364
+ settings.hooks[hookType] = settings.hooks[hookType].filter(hook => {
365
+ const command = hook.hooks?.[0]?.command || '';
366
+ return !command.includes('bash-overflow-guard');
367
+ });
368
+ if (settings.hooks[hookType].length < originalLength) {
369
+ console.log(`✓ Removed deprecated bash-overflow-guard hook from ${hookType}`);
370
+ settingsModified = true;
371
+ cleanupPerformed = true;
372
+ }
373
+ }
374
+ });
375
+ }
376
+
377
+ // Remove BASH_MAX_OUTPUT_LENGTH from env
378
+ if (settings.env && settings.env.BASH_MAX_OUTPUT_LENGTH !== undefined) {
379
+ delete settings.env.BASH_MAX_OUTPUT_LENGTH;
380
+ console.log('✓ Removed deprecated BASH_MAX_OUTPUT_LENGTH env var');
381
+ settingsModified = true;
382
+ cleanupPerformed = true;
383
+ // Remove env object if empty
384
+ if (Object.keys(settings.env).length === 0) {
385
+ delete settings.env;
386
+ }
387
+ }
388
+
389
+ // Set subagent model to Opus
390
+ if (!settings.env) settings.env = {};
391
+ if (settings.env.CLAUDE_CODE_SUBAGENT_MODEL !== 'opus') {
392
+ settings.env.CLAUDE_CODE_SUBAGENT_MODEL = 'opus';
393
+ console.log('✓ Set CLAUDE_CODE_SUBAGENT_MODEL=opus');
394
+ settingsModified = true;
395
+ }
396
+
397
+ // Enable agent teams (required for spec-interview team workflow)
398
+ if (settings.env.CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS !== '1') {
399
+ settings.env.CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS = '1';
400
+ console.log('✓ Set CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1');
401
+ settingsModified = true;
402
+ }
357
403
 
358
404
  if (settingsModified) {
359
405
  fs.writeFileSync(settingsFile, JSON.stringify(settings, null, 2));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cc-dev-template",
3
- "version": "0.1.65",
3
+ "version": "0.1.72",
4
4
  "description": "Structured AI-assisted development framework for Claude Code",
5
5
  "bin": {
6
6
  "cc-dev-template": "./bin/install.js"
@@ -2,6 +2,7 @@
2
2
  name: spec-implementer
3
3
  description: Implements a single criterion from a spec task file. Only use when explicitly assigned a task file path from the execute-spec workflow.
4
4
  tools: Read, Grep, Glob, Edit, Write, Bash, LSP
5
+ memory: project
5
6
  ---
6
7
 
7
8
  You implement one task from a spec breakdown.
@@ -2,6 +2,7 @@
2
2
  name: spec-validator
3
3
  description: Validates a completed task through code review and E2E testing. Only use when explicitly assigned a task file path from the execute-spec workflow.
4
4
  tools: Read, Grep, Glob, Bash
5
+ memory: project
5
6
  ---
6
7
 
7
8
  You are a senior QA engineer validating completed work.
@@ -3,18 +3,30 @@
3
3
  /**
4
4
  * Custom Status Line for Claude Code
5
5
  *
6
- * Displays project status in 3 lines:
6
+ * Displays project status in a bordered box:
7
7
  * - Line 0: Directory name
8
8
  * - Line 1: Git branch + status
9
9
  * - Line 2: Context window usage bar with percentage and tokens
10
+ * - Line 3: Plan usage limits (5-hour session + 7-day weekly)
10
11
  *
11
12
  * Input: JSON on stdin with context_window data
12
13
  * Output: Formatted status to stdout
13
14
  */
14
15
 
15
- const { readFileSync, readdirSync, statSync } = require('fs');
16
+ const { readFileSync, writeFileSync, readdirSync, statSync } = require('fs');
16
17
  const { join, basename } = require('path');
17
- const { execSync } = require('child_process');
18
+ const { execSync, spawnSync, spawn } = require('child_process');
19
+ const { homedir } = require('os');
20
+
21
+ // Usage API cache
22
+ const USAGE_CACHE_PATH = join(homedir(), '.claude', '.usage-cache.json');
23
+ const USAGE_CACHE_TTL = 45000; // 45 seconds
24
+
25
+ // Background refresh mode: fetch usage data and write cache, then exit
26
+ if (process.argv.includes('--refresh')) {
27
+ refreshUsageCache();
28
+ process.exit(0);
29
+ }
18
30
 
19
31
  /**
20
32
  * Format number as K (e.g., 84000 -> "084K")
@@ -226,6 +238,86 @@ function getModulesWithChanges(projectDir) {
226
238
  return modules;
227
239
  }
228
240
 
241
+ /**
242
+ * Get OAuth access token from system credentials
243
+ */
244
+ function getOAuthToken() {
245
+ if (process.platform === 'darwin') {
246
+ const credJson = execSync(
247
+ 'security find-generic-password -s "Claude Code-credentials" -w',
248
+ { encoding: 'utf-8', timeout: 3000, stdio: ['pipe', 'pipe', 'ignore'] }
249
+ ).trim();
250
+ const creds = JSON.parse(credJson);
251
+ return creds.claudeAiOauth?.accessToken || null;
252
+ }
253
+ // Linux fallback
254
+ const credPath = join(homedir(), '.claude', '.credentials.json');
255
+ try {
256
+ const creds = JSON.parse(readFileSync(credPath, 'utf-8'));
257
+ return creds.claudeAiOauth?.accessToken || null;
258
+ } catch {
259
+ return null;
260
+ }
261
+ }
262
+
263
+ /**
264
+ * Fetch usage data from API and write to cache (runs in background)
265
+ */
266
+ function refreshUsageCache() {
267
+ try {
268
+ const token = getOAuthToken();
269
+ if (!token) return;
270
+
271
+ const result = spawnSync('curl', [
272
+ '-s', '--max-time', '3',
273
+ 'https://api.anthropic.com/api/oauth/usage',
274
+ '-H', `Authorization: Bearer ${token}`,
275
+ '-H', 'anthropic-beta: oauth-2025-04-20',
276
+ '-H', 'Content-Type: application/json',
277
+ ], { encoding: 'utf-8', timeout: 5000 });
278
+
279
+ if (result.status === 0 && result.stdout) {
280
+ const data = JSON.parse(result.stdout.trim());
281
+ if (data.five_hour && data.seven_day) {
282
+ writeFileSync(USAGE_CACHE_PATH, JSON.stringify({
283
+ timestamp: Date.now(),
284
+ data,
285
+ }));
286
+ }
287
+ }
288
+ } catch {
289
+ // Silently fail - stale cache will be used on next render
290
+ }
291
+ }
292
+
293
+ /**
294
+ * Read cached usage data, trigger background refresh if stale
295
+ */
296
+ function getUsageData() {
297
+ let cacheData = null;
298
+ let cacheAge = Infinity;
299
+
300
+ try {
301
+ const raw = readFileSync(USAGE_CACHE_PATH, 'utf-8');
302
+ const cache = JSON.parse(raw);
303
+ cacheData = cache.data;
304
+ cacheAge = Date.now() - cache.timestamp;
305
+ } catch {}
306
+
307
+ // Trigger background refresh if cache is stale
308
+ if (cacheAge > USAGE_CACHE_TTL) {
309
+ try {
310
+ const child = spawn(process.execPath, [__filename, '--refresh'], {
311
+ detached: true,
312
+ stdio: 'ignore',
313
+ });
314
+ child.unref();
315
+ } catch {}
316
+ }
317
+
318
+ return cacheData;
319
+ }
320
+
229
321
  /**
230
322
  * Main function
231
323
  */
@@ -380,11 +472,27 @@ function main() {
380
472
  // Context bar line
381
473
  const ctxLine = makeBoxLine(ctxDisplay);
382
474
 
475
+ // Usage limits line (5-hour session + 7-day weekly)
476
+ const usageLines = [];
477
+ const usageData = getUsageData();
478
+ if (usageData && usageData.five_hour && usageData.seven_day) {
479
+ const pct5h = Math.round(usageData.five_hour.utilization);
480
+ const pct7d = Math.round(usageData.seven_day.utilization);
481
+ const bar5h = generateBar(pct5h, 12);
482
+ const bar7d = generateBar(pct7d, 12);
483
+ const color5h = getContextGreyscale(pct5h);
484
+ const color7d = getContextGreyscale(pct7d);
485
+ const str5h = pct5h.toString().padStart(3, ' ');
486
+ const str7d = pct7d.toString().padStart(3, ' ');
487
+ const usageDisplay = `5HR: ${color5h}[${bar5h}]${str5h}%${DIM_GREY} 7D: ${color7d}[${bar7d}]${str7d}%${DIM_GREY}`;
488
+ usageLines.push(makeBoxLine(usageDisplay));
489
+ }
490
+
383
491
  // Bottom border (add 2 to match content line width)
384
492
  const bottomBorder = `${DIM_GREY}╚${'═'.repeat(width + 2)}╝${RESET}`;
385
493
 
386
494
  // Combine all lines
387
- const allLines = [topBorder, line0, ...branchLines, ctxLine, bottomBorder];
495
+ const allLines = [topBorder, line0, ...branchLines, ctxLine, ...usageLines, bottomBorder];
388
496
  console.log(allLines.join('\n'));
389
497
  } catch (error) {
390
498
  // Log error for debugging (goes to stderr, not visible in status line)
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "hooks": {
3
- "PostToolUse": [
3
+ "PreToolUse": [
4
4
  {
5
- "matcher": "Bash",
5
+ "matcher": "TaskOutput",
6
6
  "hooks": [
7
7
  {
8
8
  "type": "command",
9
- "command": "$HOME/.claude/hooks/bash-overflow-guard.sh"
9
+ "command": "node ~/.claude/scripts/task-output-guard.js"
10
10
  }
11
11
  ]
12
12
  }
@@ -0,0 +1,149 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * task-output-guard.js - Intercept TaskOutput to prevent context bloat
5
+ *
6
+ * TaskOutput returns the full JSONL transcript of a background agent,
7
+ * including every tool call, tool result, and file contents the agent read.
8
+ * Each poll dumps the entire transcript (not a delta) into the orchestrator's
9
+ * context, causing severe bloat with background agents.
10
+ *
11
+ * This hook intercepts TaskOutput calls, reads the output file directly,
12
+ * extracts only the last few assistant messages, and returns those as the
13
+ * deny reason. The orchestrator gets useful status without the full transcript.
14
+ */
15
+
16
+ const fs = require('fs');
17
+ const path = require('path');
18
+
19
+ const MAX_ASSISTANT_MESSAGES = 3;
20
+ const MAX_CHARS_PER_MESSAGE = 500;
21
+
22
+ async function readStdin() {
23
+ return new Promise((resolve) => {
24
+ let data = '';
25
+ process.stdin.setEncoding('utf8');
26
+ process.stdin.on('data', chunk => { data += chunk; });
27
+ process.stdin.on('end', () => {
28
+ try { resolve(JSON.parse(data)); }
29
+ catch { resolve(null); }
30
+ });
31
+ process.stdin.on('error', () => resolve(null));
32
+ });
33
+ }
34
+
35
+ /**
36
+ * Find the output file for a given task ID.
37
+ * Output files live at /private/tmp/claude-{uid}/{cwd-dashed}/tasks/{taskId}.output
38
+ */
39
+ function findOutputFile(taskId, cwd) {
40
+ try {
41
+ const uid = process.getuid();
42
+ const cwdDashed = cwd.replace(/\//g, '-');
43
+ const outputPath = path.join('/private/tmp', `claude-${uid}`, cwdDashed, 'tasks', `${taskId}.output`);
44
+ if (fs.existsSync(outputPath)) return outputPath;
45
+
46
+ // Fallback: search common locations
47
+ const tmpBase = path.join('/private/tmp', `claude-${uid}`);
48
+ if (fs.existsSync(tmpBase)) {
49
+ const dirs = fs.readdirSync(tmpBase);
50
+ for (const dir of dirs) {
51
+ const candidate = path.join(tmpBase, dir, 'tasks', `${taskId}.output`);
52
+ if (fs.existsSync(candidate)) return candidate;
53
+ }
54
+ }
55
+ } catch {
56
+ // Ignore errors in file search
57
+ }
58
+ return null;
59
+ }
60
+
61
+ /**
62
+ * Parse JSONL output file and extract the last N assistant text messages.
63
+ */
64
+ function extractAssistantMessages(filePath) {
65
+ try {
66
+ const content = fs.readFileSync(filePath, 'utf8');
67
+ const lines = content.trim().split('\n');
68
+
69
+ const assistantMessages = [];
70
+
71
+ for (const line of lines) {
72
+ try {
73
+ const entry = JSON.parse(line);
74
+ if (entry.type !== 'assistant' || !entry.message) continue;
75
+ if (entry.message.role !== 'assistant' || !entry.message.content) continue;
76
+
77
+ // Extract text blocks only (skip tool_use blocks)
78
+ const textParts = [];
79
+ const contentArr = Array.isArray(entry.message.content)
80
+ ? entry.message.content
81
+ : [entry.message.content];
82
+
83
+ for (const block of contentArr) {
84
+ if (typeof block === 'string' && block.trim()) {
85
+ textParts.push(block.trim());
86
+ } else if (block.type === 'text' && block.text && block.text.trim()) {
87
+ textParts.push(block.text.trim());
88
+ }
89
+ }
90
+
91
+ if (textParts.length > 0) {
92
+ assistantMessages.push(textParts.join('\n'));
93
+ }
94
+ } catch {
95
+ // Skip malformed lines
96
+ }
97
+ }
98
+
99
+ return assistantMessages.slice(-MAX_ASSISTANT_MESSAGES);
100
+ } catch {
101
+ return [];
102
+ }
103
+ }
104
+
105
+ async function main() {
106
+ const input = await readStdin();
107
+ if (!input) process.exit(0);
108
+
109
+ const taskId = input.tool_input?.task_id;
110
+ const cwd = input.cwd;
111
+
112
+ if (!taskId || !cwd) process.exit(0);
113
+
114
+ const outputFile = findOutputFile(taskId, cwd);
115
+
116
+ if (!outputFile) {
117
+ // Can't find output file — let the call through so Claude gets the
118
+ // "not found" error naturally rather than a confusing deny
119
+ process.exit(0);
120
+ }
121
+
122
+ const messages = extractAssistantMessages(outputFile);
123
+
124
+ let summary;
125
+ if (messages.length === 0) {
126
+ summary = `Agent ${taskId} is running but has no assistant messages yet. Wait for the blocking return instead of polling.`;
127
+ } else {
128
+ const trimmed = messages.map((msg, i) => {
129
+ const truncated = msg.length > MAX_CHARS_PER_MESSAGE
130
+ ? msg.slice(0, MAX_CHARS_PER_MESSAGE) + '...'
131
+ : msg;
132
+ return `[${i + 1}] ${truncated}`;
133
+ });
134
+ summary = `Last ${messages.length} assistant message(s) from agent ${taskId}:\n\n${trimmed.join('\n\n')}`;
135
+ }
136
+
137
+ const output = {
138
+ hookSpecificOutput: {
139
+ hookEventName: "PreToolUse",
140
+ permissionDecision: "deny",
141
+ permissionDecisionReason: summary
142
+ }
143
+ };
144
+
145
+ console.log(JSON.stringify(output));
146
+ process.exit(0);
147
+ }
148
+
149
+ main().catch(() => process.exit(0));
@@ -35,7 +35,6 @@ Loop until all tasks complete:
35
35
  ## Parallelism Strategy
36
36
 
37
37
  - Dispatch ALL ready tasks simultaneously
38
- - Don't wait for one to finish before starting another
39
38
  - The dependency graph controls what can run in parallel
40
39
  - Example: If T002, T003, T004 all depend only on T001, they all start when T001 completes
41
40
 
@@ -44,20 +44,16 @@ Each validator:
44
44
 
45
45
  ## Browser Session Isolation
46
46
 
47
- Validators use isolated sessions:
47
+ Validators use isolated sessions to prevent conflicts when running in parallel:
48
48
  ```
49
49
  --session validator-T001
50
50
  --session validator-T002
51
51
  ...
52
52
  ```
53
53
 
54
- This prevents conflicts when multiple validators test simultaneously.
55
-
56
54
  ## Collecting Results
57
55
 
58
- After all validators complete, read each task file's Review Notes section.
59
-
60
- Structure findings:
56
+ After all validators complete, structure findings:
61
57
  ```
62
58
  Validation Results:
63
59
  T001: PASS
@@ -6,22 +6,38 @@ argument-hint: <spec-name>
6
6
 
7
7
  # Spec Interview
8
8
 
9
- ## Context Hygiene
9
+ ## Team-Based Approach
10
10
 
11
- **IMPORTANT:** During planning, protect the context window. Never write code. Never search, grep, or read files directly.
11
+ **IMPORTANT:** This skill uses an agent team for collaborative spec development. You are the **Lead** — you interview the user, write the spec, and curate team input. Three persistent teammates handle research, critique, and complexity assessment.
12
12
 
13
- Use Explorer subagents for ALL codebase research:
14
- - Explorer uses a faster, cheaper model
15
- - Explorer works better with focused tasks
16
- - Explorer returns only relevant findings, keeping your context clean
13
+ ### Team Composition
17
14
 
18
- **Layered approach:**
19
- 1. First: One Explorer for broad understanding of a system
20
- 2. Then: Multiple Explorers in parallel for deep dives on specifics
15
+ All teammates run on Opus:
16
+ - **Researcher** (researcher): Continuously explores the codebase, maps file landscape, integration points, data model. Drafts technical sections.
17
+ - **Critic** (critic): Reviews the emerging spec for gaps, bad assumptions, edge cases. Absorbs the spec-review completeness checklist and spec-sanity-check logic framework.
18
+ - **Pragmatist** (pragmatist): Evaluates complexity, pushes back on over-engineering, identifies the simplest buildable path.
21
19
 
22
- Spin up as many Explorers as needed. There is no downside to parallel subagents.
20
+ ### Working Directory
23
21
 
24
- **Why this matters:** Search results and file contents that aren't directly relevant cause context rot, degrading planning quality. Subagents curate information before it enters your context.
22
+ The team shares `{spec_dir}/working/`:
23
+ - `context.md` — You (the Lead) write interview updates here. Append-only — each update is a new section with a heading (e.g., `## Step 1: Feature Overview`). This replaces broadcasting — teammates read this file to stay current.
24
+ - Teammates write their findings to `working/` with descriptive filenames. Read these at checkpoints.
25
+ - `spec.md` (parent dir) — The living spec. You own this file. Teammates read it but never write to it.
26
+
27
+ ### Checkpoint Pattern
28
+
29
+ Surface team input at step transitions, not continuously. This keeps the user conversation clean:
30
+ - **After Step 2** (approach selected): Read all working files, curate team findings for user
31
+ - **During Step 4** (deep dive): Read Researcher findings for each subsection, read Critic/Pragmatist feedback
32
+ - **At Step 7** (finalize): Request final assessments from all three, compile and present to user
33
+
34
+ At each checkpoint: read the working files, identify findings that are relevant and actionable, summarize them for the user as "Before we continue, my research team surfaced a few things..." Skip trivial items.
35
+
36
+ ### Team Lifecycle
37
+
38
+ 1. **Spawn** — After Step 1 (once the feature is understood), create the working directory, read the three prompt templates from `references/`, substitute `{spec_dir}` and `{feature_name}`, use TeamCreate to create a team named `spec-{feature-name}`, then spawn the three teammates via the Task tool
39
+ 2. **Communicate** — Update context.md after each step. Message teammates for specific questions. Read their working files at checkpoints.
40
+ 3. **Shutdown** — After Step 7 (user approves the spec), send shutdown requests to all three teammates, then use TeamDelete. Leave the `working/` directory in place as reference for implementation.
25
41
 
26
42
  ## What To Do Now
27
43
 
@@ -0,0 +1,140 @@
1
+ You are the Critic on a spec-interview team producing a feature specification for **{feature_name}**.
2
+
3
+ <role>
4
+ Provide continuous quality review of the emerging spec. You catch issues as they emerge — with full context of the conversation and decisions that produced each section. You replace end-of-pipe reviews with ongoing, informed critique.
5
+ </role>
6
+
7
+ <team>
8
+ - Lead (team-lead): Interviews the user, writes the spec, curates team input
9
+ - Researcher (researcher): Explores the codebase, maps the technical landscape
10
+ - Pragmatist (pragmatist): Evaluates complexity, advocates for simplicity
11
+ - You (critic): Find gaps, challenge assumptions, identify risks
12
+ </team>
13
+
14
+ <working-directory>
15
+ The team shares: `{spec_dir}/working/`
16
+
17
+ - `{spec_dir}/working/context.md` — The Lead writes interview context here. Read this for the "why" behind decisions.
18
+ - `{spec_dir}/spec.md` — The living spec. This is what you review.
19
+ - Read the Researcher's working files for technical grounding.
20
+ - Write your analysis to `{spec_dir}/working/` (e.g., `critic-gaps.md`, `critic-assumptions.md`, `critic-review.md`).
21
+ </working-directory>
22
+
23
+ <responsibilities>
24
+ 1. Read the spec as it evolves. Challenge every section:
25
+ - Does this flow actually work end-to-end?
26
+ - What assumptions are unstated or unverified?
27
+ - What edge cases are missing?
28
+ - What happens when things fail?
29
+ - Are acceptance criteria actually testable?
30
+ 2. Draft proposed content for **Edge Cases** and **Error Handling** sections
31
+ 3. Ask the Researcher to verify claims against the codebase when something seems off
32
+ 4. Ensure verification methods are concrete and executable
33
+ 5. Flag issues by severity: **blocking** (must fix), **gap** (should address), **suggestion** (nice to have)
34
+ 6. Check for conflicts with CLAUDE.md project constraints (read all CLAUDE.md files in the project)
35
+ 7. Review the File Landscape for new files with overlapping purposes. When multiple new components share similar structure, data, or behavior, flag them for consolidation into a shared abstraction. Ask the Researcher to compare the proposed components.
36
+ </responsibilities>
37
+
38
+ <completeness-checklist>
39
+ Before the spec is finalized, all of these must be true:
40
+
41
+ **Must Have (Blocking if missing)**
42
+ - Clear intent — what and why is unambiguous
43
+ - Data model — entities, relationships, constraints are explicit
44
+ - Integration points — what existing code this touches is documented
45
+ - Core behavior — main flows are step-by-step clear
46
+ - Acceptance criteria — testable requirements with verification methods
47
+ - No ambiguities — nothing requires interpretation
48
+ - No unknowns — all information needed for implementation is present
49
+ - CLAUDE.md alignment — no conflicts with project constraints
50
+ - No internal duplication — new components with similar structure or purpose are consolidated into shared abstractions
51
+
52
+ **Should Have (Gaps that cause implementation friction)**
53
+ - Edge cases — error conditions and boundaries addressed
54
+ - External dependencies — APIs, libraries, services documented
55
+ - Blockers section — missing credentials, pending decisions called out
56
+ - UI/UX wireframes — if feature has a user interface
57
+ - Design direction — if feature has UI, visual approach is explicit
58
+
59
+ **Flag these problems:**
60
+ - Vague language ("should handle errors appropriately" — HOW?)
61
+ - Missing details ("integrates with auth" — WHERE? HOW?)
62
+ - Unstated assumptions ("uses the standard pattern" — WHICH pattern?)
63
+ - Blocking dependencies ("needs API access" — DO WE HAVE IT?)
64
+ - Unverifiable criteria ("dashboard works correctly" — HOW DO WE CHECK?)
65
+ - Missing verification ("loads fast" — WHAT COMMAND PROVES IT?)
66
+ - Implicit knowledge ("depends on how X works" — SPECIFY IT)
67
+ - Unverified claims ("the API returns..." — HAS THIS BEEN CONFIRMED?)
68
+ - CLAUDE.md conflicts (spec proposes X but CLAUDE.md requires Y — WHICH IS IT?)
69
+ - Near-duplicate new components (three similar cards, two similar forms, repeated layout patterns — CONSOLIDATE into shared components with configuration)
70
+ </completeness-checklist>
71
+
72
+ <sanity-check-framework>
73
+ For each section of the spec, challenge it through these lenses:
74
+
75
+ **Logic Gaps**
76
+ - Does the described flow actually work end-to-end?
77
+ - Are there steps that assume a previous step succeeded without checking?
78
+ - Are there circular dependencies?
79
+
80
+ **Incorrect Assumptions**
81
+ - Are there assumptions about how existing systems work that might be wrong?
82
+ - Are there assumptions about external APIs or data formats?
83
+ - Use Grep, Glob, Read to verify assumptions against the actual codebase
84
+
85
+ **Unconsidered Scenarios**
86
+ - What happens if external dependencies fail?
87
+ - What happens if data is malformed or missing?
88
+ - What happens at unexpected scale?
89
+
90
+ **Implementation Pitfalls**
91
+ - Common bugs this approach would likely introduce?
92
+ - Security implications not addressed?
93
+ - Race conditions or timing issues?
94
+
95
+ **The "What If" Test**
96
+ - What if [key assumption] is wrong?
97
+ - What if [external dependency] changes?
98
+ </sanity-check-framework>
99
+
100
+ <final-review-format>
101
+ When the Lead asks for a final review, write your findings to `{spec_dir}/working/critic-final-review.md` using this format:
102
+
103
+ ```markdown
104
+ ## Spec Review: {feature_name}
105
+
106
+ ### Status: [READY | NEEDS WORK]
107
+
108
+ ### Blocking Issues
109
+ - [Issue]: [Why this blocks implementation]
110
+
111
+ ### CLAUDE.md Conflicts
112
+ - [Constraint]: [How the spec conflicts]
113
+
114
+ ### Gaps (Non-blocking)
115
+ - [Item]: [What's unclear or incomplete]
116
+
117
+ ### Logic Issues
118
+ - [Issue]: [Why this is a problem]
119
+
120
+ ### Questionable Assumptions
121
+ - [Assumption]: [Why this might be wrong]
122
+
123
+ ### Duplication Concerns
124
+ - [Group of similar new components]: [How they overlap and consolidation recommendation]
125
+
126
+ ### Unconsidered Scenarios
127
+ - [Scenario]: [What could go wrong]
128
+
129
+ ### Recommendation
130
+ [Specific items to address, or "Spec is implementation-ready"]
131
+ ```
132
+ </final-review-format>
133
+
134
+ <communication>
135
+ - Details go in working files. Messages are concise summaries.
136
+ - Message the Lead when issues need user input to resolve.
137
+ - Message the Researcher to request codebase verification.
138
+ - Engage the Pragmatist when you disagree on scope — this tension is productive and improves the spec.
139
+ - Never interact with the user directly. All user communication goes through the Lead.
140
+ </communication>
@@ -0,0 +1,76 @@
1
+ You are the Pragmatist on a spec-interview team producing a feature specification for **{feature_name}**.
2
+
3
+ <role>
4
+ Evaluate implementation complexity and keep the spec grounded in reality. You are the counterbalance to scope creep and over-engineering. Your question is always: "What is the simplest approach that meets the actual requirements?"
5
+ </role>
6
+
7
+ <team>
8
+ - Lead (team-lead): Interviews the user, writes the spec, curates team input
9
+ - Researcher (researcher): Explores the codebase, maps the technical landscape
10
+ - Critic (critic): Reviews the spec for gaps, assumptions, edge cases
11
+ - You (pragmatist): Evaluate complexity, advocate for simplicity
12
+ </team>
13
+
14
+ <working-directory>
15
+ The team shares: `{spec_dir}/working/`
16
+
17
+ - `{spec_dir}/working/context.md` — The Lead writes interview context here.
18
+ - `{spec_dir}/spec.md` — The living spec. Assess its complexity.
19
+ - Read the Researcher's findings for what already exists in the codebase.
20
+ - Read the Critic's analysis to understand proposed additions and edge cases.
21
+ - Write your assessments to `{spec_dir}/working/` (e.g., `pragmatist-complexity.md`, `pragmatist-simplification.md`).
22
+ </working-directory>
23
+
24
+ <responsibilities>
25
+ 1. Assess implementation complexity as the spec takes shape:
26
+ - How many files need to change?
27
+ - How many new concepts or patterns are introduced?
28
+ - What's the dependency chain depth?
29
+ - Where are the riskiest parts?
30
+ 2. Identify simpler alternatives when the spec over-engineers a solution
31
+ 3. Push back on the Critic when edge case handling would add disproportionate complexity — flag what can be deferred to a later iteration
32
+ 4. Identify what can be reused from the existing codebase (ask the Researcher about existing patterns). Also identify duplication within the spec's own new components — when two or more new files could share a common implementation, flag it. Fewer new things means lower complexity.
33
+ 5. Assess whether the task dependency ordering makes practical sense for implementation
34
+ 6. Flag requirements that should be split into "must have now" vs. "iterate later"
35
+ </responsibilities>
36
+
37
+ <evaluation-criteria>
38
+ For each major spec section, assess and write:
39
+ - **Relative complexity**: low / medium / high
40
+ - **Simpler alternative**: does one exist?
41
+ - **Deferral candidate**: could this be cut without losing the core value?
42
+ - **Reuse opportunity**: does an existing pattern cover this, or are we building new? Also: are multiple new things in this spec similar enough to consolidate into one shared abstraction?
43
+ </evaluation-criteria>
44
+
45
+ <final-assessment-format>
46
+ When the Lead asks for a final complexity assessment, write to `{spec_dir}/working/pragmatist-final-assessment.md`:
47
+
48
+ ```markdown
49
+ ## Complexity Assessment: {feature_name}
50
+
51
+ ### Overall Complexity: [Low | Medium | High]
52
+
53
+ ### Critical Path (minimum buildable set)
54
+ - [Requirement]: [Why it's essential]
55
+
56
+ ### Recommended Deferrals
57
+ - [Requirement]: [Why it can wait, estimated complexity saved]
58
+
59
+ ### Reuse Opportunities
60
+ - [Existing pattern/component]: [How it applies]
61
+
62
+ ### Risk Areas
63
+ - [Area]: [Why it's risky, suggested mitigation]
64
+
65
+ ### Summary
66
+ [One paragraph: is this spec practically buildable as written? What would you change?]
67
+ ```
68
+ </final-assessment-format>
69
+
70
+ <communication>
71
+ - Details go in working files. Messages are concise summaries.
72
+ - Message the Lead when simplification opportunities need user input (e.g., "This requirement triples complexity — worth discussing with user").
73
+ - Engage the Critic directly when you disagree on scope — this tension is productive.
74
+ - Ask the Researcher about existing patterns that could simplify the approach.
75
+ - Never interact with the user directly. All user communication goes through the Lead.
76
+ </communication>
@@ -0,0 +1,46 @@
1
+ You are the Researcher on a spec-interview team producing a feature specification for **{feature_name}**.
2
+
3
+ <role>
4
+ Explore the codebase and provide technical grounding for the spec. You accumulate context across the entire interview — unlike disposable subagents, you build a deepening understanding of the relevant codebase as the conversation progresses.
5
+ </role>
6
+
7
+ <team>
8
+ - Lead (team-lead): Interviews the user, writes the spec, curates team input
9
+ - Critic (critic): Reviews the spec for gaps, assumptions, edge cases
10
+ - Pragmatist (pragmatist): Evaluates complexity, advocates for simplicity
11
+ - You (researcher): Explore the codebase, map the technical landscape
12
+ </team>
13
+
14
+ <working-directory>
15
+ The team shares: `{spec_dir}/working/`
16
+
17
+ - `{spec_dir}/working/context.md` — The Lead writes interview context here. Read this to stay current on what the user has discussed. It is append-only with section headings per step.
18
+ - `{spec_dir}/spec.md` — The living spec. Read it to understand what has been decided.
19
+ - Write your findings to `{spec_dir}/working/` with descriptive filenames (e.g., `file-landscape.md`, `integration-points.md`, `data-model.md`, `existing-patterns.md`).
20
+ </working-directory>
21
+
22
+ <responsibilities>
23
+ 1. When you learn what feature is being built, immediately start mapping the relevant codebase areas — existing patterns, conventions, related components
24
+ 2. Map concrete file paths: files to create, files to modify, directory conventions this project follows
25
+ 3. Document how existing systems work that the feature will integrate with
26
+ 4. Draft proposed content for these spec sections: **File Landscape**, **Integration Points**, **Data Model**. Structure your working files to match the spec's section headings so the Lead can incorporate them directly.
27
+ 5. Respond to codebase questions from any teammate via SendMessage
28
+ 6. When you discover something that affects the spec, write details to a working file and message the Lead with a concise summary pointing to the file
29
+ </responsibilities>
30
+
31
+ <communication>
32
+ - Details go in working files. Messages are summaries with a pointer to the file (e.g., "Findings on auth patterns ready — see working/integration-points.md").
33
+ - Message the Lead when findings are ready to incorporate into the spec.
34
+ - Message teammates directly when findings affect their analysis.
35
+ - Read context.md and spec.md regularly to stay aligned with interview progress.
36
+ </communication>
37
+
38
+ <tools>
39
+ Use Glob, Grep, Read, and LSP for all codebase exploration. You have full read access. For very broad searches that might flood your context, use the Task tool with an Explorer subagent to get curated results back.
40
+ </tools>
41
+
42
+ <boundaries>
43
+ - Write only to `{spec_dir}/working/`. Never write to spec.md directly — the Lead owns the spec.
44
+ - Never create or modify source code files. Your role is research only.
45
+ - Never interact with the user directly. All user communication goes through the Lead.
46
+ </boundaries>
@@ -16,6 +16,32 @@ Then explore:
16
16
 
17
17
  ## When to Move On
18
18
 
19
- Move to `references/step-2-ideation.md` when:
19
+ Move on when:
20
20
  - The core problem and user goal are clear
21
21
  - Success criteria are understood at a high level
22
+
23
+ ## Initialize the Team
24
+
25
+ Before proceeding to Step 2, set up the agent team:
26
+
27
+ 1. Create the spec directory at `docs/specs/<feature-name>/` if not already created
28
+ 2. Create `docs/specs/<feature-name>/working/` subdirectory
29
+ 3. Read the three prompt templates:
30
+ - `references/researcher-prompt.md`
31
+ - `references/critic-prompt.md`
32
+ - `references/pragmatist-prompt.md`
33
+ 4. In all three templates, substitute `{spec_dir}` with the actual spec directory path (e.g., `docs/specs/my-feature`) and `{feature_name}` with the feature name
34
+ 5. Use TeamCreate to create a team named `spec-<feature-name>`
35
+ 6. Spawn three teammates in parallel using the Task tool with `subagent_type: "general-purpose"` and `model: "opus"`:
36
+ - Name: `researcher`, prompt: substituted researcher-prompt.md content
37
+ - Name: `critic`, prompt: substituted critic-prompt.md content
38
+ - Name: `pragmatist`, prompt: substituted pragmatist-prompt.md content
39
+ - Set `team_name` to the team you just created
40
+ 7. Send the Researcher an initial message via SendMessage summarizing the feature: problem, user, success criteria — so it can begin exploring immediately
41
+ 8. Write initial context to `{spec_dir}/working/context.md`:
42
+ ```
43
+ ## Step 1: Feature Overview
44
+ [Problem, user, success criteria as discussed with the user]
45
+ ```
46
+
47
+ Now proceed to `references/step-2-ideation.md`.
@@ -52,8 +52,22 @@ Document the chosen approach and why before proceeding.
52
52
 
53
53
  ## When to Move On
54
54
 
55
- Proceed to `references/step-3-ui-ux.md` when:
55
+ Proceed when:
56
56
  - An approach has been selected (or user chose to skip brainstorming)
57
57
  - The rationale for the choice is understood
58
58
 
59
- If the feature has no user interface, skip to `references/step-4-deep-dive.md`.
59
+ ## Team Checkpoint: Post-Ideation
60
+
61
+ Before proceeding to the next step:
62
+
63
+ 1. Update `{spec_dir}/working/context.md` — append:
64
+ ```
65
+ ## Step 2: Approach Selected
66
+ [Chosen approach, rationale, alternatives considered]
67
+ ```
68
+ 2. Message all three teammates individually (not broadcast) informing them of the chosen approach: "We chose [approach] because [rationale]. Read context.md for full details."
69
+ 3. Read all files in `{spec_dir}/working/` to see what the team has found so far
70
+ 4. Curate findings for the user — summarize anything noteworthy from the Researcher's codebase exploration, the Critic's early concerns, or the Pragmatist's complexity notes. Present as: "Before we go deeper, my research team surfaced a few things..." Only surface findings that are relevant and actionable. Skip trivial items.
71
+ 5. If team findings raise concerns that affect the approach, discuss with the user via AskUserQuestion before proceeding
72
+
73
+ If the feature has no user interface, skip to `references/step-4-deep-dive.md`. Otherwise proceed to `references/step-3-ui-ux.md`.
@@ -71,3 +71,13 @@ Proceed to `references/step-4-deep-dive.md` when:
71
71
  - Design direction is agreed upon
72
72
  - Wireframes exist for primary screens
73
73
  - User has confirmed the layout approach
74
+
75
+ ## Update Team Context
76
+
77
+ After design decisions are confirmed, update `{spec_dir}/working/context.md` — append:
78
+ ```
79
+ ## Step 3: Design Decisions
80
+ [Design direction chosen, layout approach, key wireframe descriptions, user flow summaries]
81
+ ```
82
+
83
+ No team checkpoint at this step — design is user-driven. Teammates will read the updated context.md on their own.
@@ -15,23 +15,15 @@ Use AskUserQuestion whenever requirements are ambiguous or multiple approaches e
15
15
  - External services, APIs, or libraries
16
16
  - Data flows in and out
17
17
 
18
- **IMPORTANT:** Use Explorer subagents for all codebase investigation. Never search or read files directly.
18
+ The Researcher has been exploring the codebase since Step 1. Read the Researcher's working files (especially any `integration-points.md` or related files). If the Researcher has already mapped integration points, incorporate them into the spec.
19
19
 
20
- Layered approach:
21
- 1. First Explorer: "How does [system] work at a high level?"
22
- 2. Parallel Explorers: Deep dive into specific components identified in step 1
20
+ If specific questions remain, message the Researcher via SendMessage with targeted questions like "How does authentication work in this codebase?" or "What middleware handles protected routes?" and wait for a response.
23
21
 
24
- Example: To understand auth integration:
25
- - Explorer 1: "How does authentication work in this codebase?"
26
- - Then parallel: "How are auth tokens validated?", "Where is the user session stored?", "What middleware handles protected routes?"
27
-
28
- No assumptions. If you don't know how something works, send an Explorer to find out.
22
+ No assumptions. If something is unclear, ask the Researcher to investigate.
29
23
 
30
24
  ### File Landscape
31
25
 
32
- Once the feature is understood, identify concrete file paths. Ask an Explorer:
33
-
34
- > "To implement [this feature], what files would need to be created or modified? Give me concrete file paths."
26
+ Read the Researcher's `file-landscape.md` working file. The Researcher should have identified concrete file paths by now. If the file landscape is incomplete, message the Researcher: "To implement [this feature], what files would need to be created or modified? Give me concrete file paths."
35
27
 
36
28
  Capture:
37
29
  - **Files to create**: New files with full paths (e.g., `src/models/notification.ts`)
@@ -106,6 +98,22 @@ Write to `docs/specs/<name>/spec.md` with this structure:
106
98
  - [ ] [Blocker]: [what's needed]
107
99
  ```
108
100
 
101
+ ## Team Checkpoint: Deep Dive
102
+
103
+ After completing all deep dive subsections:
104
+
105
+ 1. Update `{spec_dir}/working/context.md` — append:
106
+ ```
107
+ ## Step 4: Deep Dive Complete
108
+ [Summary of what was covered: integration points, file landscape, data model, behaviors, edge cases, blockers]
109
+ ```
110
+ 2. Read all working files from the Critic and Pragmatist
111
+ 3. Present curated findings to the user:
112
+ - Critic's identified gaps, bad assumptions, or logic issues
113
+ - Pragmatist's complexity assessment and simplification suggestions
114
+ 4. Use AskUserQuestion to discuss significant findings. If the Critic found gaps, address them. If the Pragmatist suggests simplifications, let the user decide.
115
+ 5. Update spec.md with any changes from this discussion
116
+
109
117
  ## When to Move On
110
118
 
111
- Move to `references/step-5-research-needs.md` when all areas have been covered and the spec document is substantially complete.
119
+ Move to `references/step-5-research-needs.md` when all areas have been covered, team findings have been addressed, and the spec document is substantially complete.
@@ -12,14 +12,11 @@ This is not about whether Claude knows how to do something in general. It's abou
12
12
 
13
13
  Review the spec's integration points, data model, and behavior sections.
14
14
 
15
- **IMPORTANT:** Use Explorer subagents to check for existing patterns. Never search directly.
15
+ The Researcher has been exploring the codebase throughout the interview and already knows what patterns exist. For each significant implementation element, message the Researcher: "Does this codebase have an existing example of [pattern]? If yes, where and how does it work?"
16
16
 
17
- For each significant implementation element, spawn an Explorer:
18
- - "Does this codebase have an existing example of [pattern]? If yes, where and how does it work?"
17
+ You can ask about multiple patterns in a single message. The Researcher will respond based on accumulated knowledge — faster and more informed than spawning fresh subagents.
19
18
 
20
- Spin up multiple Explorers in parallel for different patterns.
21
-
22
- Based on Explorer findings:
19
+ Based on Researcher findings:
23
20
  - If pattern exists → paradigm is established, no research needed
24
21
  - If not found → this is a new paradigm requiring research
25
22
 
@@ -48,3 +45,9 @@ Proceed to `references/step-6-verification.md` when:
48
45
  - All new paradigms have been researched, OR
49
46
  - User confirmed no research is needed, OR
50
47
  - All patterns have existing codebase examples
48
+
49
+ Update `{spec_dir}/working/context.md` — append:
50
+ ```
51
+ ## Step 5: Research Needs
52
+ [Which paradigms are established, which required research, research outcomes]
53
+ ```
@@ -69,6 +69,21 @@ Use AskUserQuestion to review verification methods with the user:
69
69
 
70
70
  The standard: if the agent executes the verification and it passes, the feature is done. No human checking required.
71
71
 
72
+ ## Team Validation
73
+
74
+ After defining verification methods and before confirming with the user:
75
+
76
+ 1. Message the Critic: "Review the verification methods in spec.md. Are they concrete and executable? Will each one actually prove its criterion works?"
77
+ 2. Message the Pragmatist: "Review the verification methods in spec.md. Are any over-complex? Could simpler verification achieve the same confidence?"
78
+ 3. Read their responses (via working files or SendMessage)
79
+ 4. Adjust verification methods based on valid feedback before presenting to the user
80
+
72
81
  ## When to Move On
73
82
 
74
83
  Proceed to `references/step-7-finalize.md` when every acceptance criterion has a verification method and the user agrees each method proves the criterion works.
84
+
85
+ Update `{spec_dir}/working/context.md` — append:
86
+ ```
87
+ ## Step 6: Verification Methods Defined
88
+ [Summary of verification approach and any team feedback incorporated]
89
+ ```
@@ -2,23 +2,26 @@
2
2
 
3
3
  Review the spec for completeness and soundness, then hand off.
4
4
 
5
- ## Run Both Reviews
5
+ ## Request Final Team Reviews
6
6
 
7
- Invoke both skills in parallel, specifying the spec path:
8
- - `spec-review` — checks completeness, format, and implementation readiness
9
- - `spec-sanity-check` — checks logic, assumptions, and unconsidered scenarios
7
+ Message both the Critic and Pragmatist requesting final assessments:
10
8
 
11
- Both return findings to you. They do not modify the spec directly.
9
+ 1. Message the Critic: "The spec is substantially complete. Please do a final review against your completeness checklist and sanity check framework. Write your complete findings to `{spec_dir}/working/critic-final-review.md` using the format in your prompt."
10
+ 2. Message the Pragmatist: "The spec is substantially complete. Please do a final complexity assessment. Write your findings to `{spec_dir}/working/pragmatist-final-assessment.md` using the format in your prompt."
11
+ 3. Wait for both to respond (they will message you when their files are ready)
12
+ 4. Read their working files: `critic-final-review.md` and `pragmatist-final-assessment.md`
12
13
 
13
14
  ## Curate the Findings
14
15
 
15
- Synthesize findings from both reviews. Some findings may be:
16
+ Synthesize findings from the Critic's review and the Pragmatist's assessment. Some findings may be:
16
17
  - Critical issues that must be addressed
17
18
  - Valid suggestions worth considering
18
19
  - Pedantic or irrelevant items to skip
19
20
 
20
21
  For each finding, form a recommendation: address it or skip it, and why.
21
22
 
23
+ The Critic and Pragmatist have had full context of the entire interview — their findings are more informed than cold reviews. Weight their input accordingly.
24
+
22
25
  ## Walk Through With User
23
26
 
24
27
  Use AskUserQuestion to present findings in batches (2-3 at a time). For each finding:
@@ -36,10 +39,9 @@ After walking through all findings, make the approved changes to the spec.
36
39
 
37
40
  Use AskUserQuestion: "Do you want to run the reviews again?"
38
41
 
39
- If yes, invoke both reviews again with additional context:
40
- - "We already ran a review. These changes were made: [list]. These findings were intentionally skipped: [list]. Look for anything new we haven't considered."
42
+ If yes, message the Critic and Pragmatist again with additional context: "We already ran a review. These changes were made: [list]. These findings were intentionally skipped: [list]. Look for anything new we haven't considered."
41
43
 
42
- Repeat the curate → walk through → offer another pass cycle until user is satisfied.
44
+ Read their updated working files and repeat the curate → walk through → offer another pass cycle until user is satisfied.
43
45
 
44
46
  ## Complete the Interview
45
47
 
@@ -48,5 +50,9 @@ Once user confirms no more review passes needed:
48
50
  1. Show the user the final spec
49
51
  2. Use AskUserQuestion to confirm they are satisfied
50
52
  3. Ask if they want to proceed to task breakdown
53
+ 4. Shutdown the team:
54
+ - Send shutdown requests to all three teammates (researcher, critic, pragmatist) via SendMessage with type "shutdown_request"
55
+ - After all teammates confirm shutdown, use TeamDelete to clean up team resources
56
+ - The `{spec_dir}/working/` directory remains on disk as reference for implementation
51
57
 
52
- If yes, invoke `spec-to-tasks` and specify which spec to break down.
58
+ If yes to task breakdown, invoke `spec-to-tasks` and specify which spec to break down.
@@ -31,6 +31,7 @@ A spec is implementation-ready when ALL of these are satisfied:
31
31
  - [ ] **No ambiguities** - Nothing requires interpretation; all requirements are explicit
32
32
  - [ ] **No unknowns** - All information needed for implementation is present; nothing left to discover
33
33
  - [ ] **CLAUDE.md alignment** - Spec does not conflict with constraints in any CLAUDE.md file
34
+ - [ ] **No internal duplication** - File Landscape contains no sets of new files that serve similar purposes and could share a common implementation
34
35
 
35
36
  ### Should Have (Gaps that cause implementation friction)
36
37
 
@@ -54,6 +55,7 @@ Flag these problems:
54
55
  - Implicit knowledge ("depends on how X works" — SPECIFY IT)
55
56
  - Unverified claims ("the API returns..." — HAS THIS BEEN CONFIRMED?)
56
57
  - CLAUDE.md conflicts (spec proposes X but CLAUDE.md requires Y — WHICH IS IT?)
58
+ - Near-duplicate new components (three card components for different pages — CONSOLIDATE into one shared component with props/configuration)
57
59
 
58
60
  ## Output Format
59
61
 
@@ -73,6 +75,9 @@ Return the review as:
73
75
  ### Gaps (Non-blocking but should address)
74
76
  - [Item]: [What's unclear or incomplete]
75
77
 
78
+ ### Duplication Concerns
79
+ - [Group of similar new files/components]: [How they overlap and consolidation recommendation]
80
+
76
81
  ### Blocking Dependencies
77
82
  - [Dependency]: [What's needed before implementation can start]
78
83
 
@@ -113,6 +113,23 @@ Cross-check task files against each other and the spec.
113
113
  - [ ] Frontmatter format is consistent across all task files
114
114
  - [ ] Implementation Notes and Review Notes sections exist (empty is fine)
115
115
 
116
+ ## 9. Component Consolidation
117
+
118
+ Scan for tasks that create structurally similar files.
119
+
120
+ **Check:**
121
+ - [ ] No two tasks create components with similar names, purposes, or overlapping structure
122
+ - [ ] Shared patterns (cards, forms, list items, layout sections) use a single shared component with configuration, not separate implementations
123
+ - [ ] Utility functions or services with similar logic are consolidated
124
+
125
+ **How to verify:**
126
+ Compare files-to-create across all tasks. Group by similarity (naming patterns, structural role, data shape). When two or more tasks create similar files, flag for consolidation.
127
+
128
+ **Common issues:**
129
+ - Three "card" components for different pages that differ only by displayed fields
130
+ - Two form components with nearly identical validation and submission logic
131
+ - Repeated layout patterns that could be a shared template with slots/children
132
+
116
133
  ---
117
134
 
118
135
  ## Output Format
@@ -1,63 +0,0 @@
1
- #!/bin/bash
2
- # bash-overflow-guard.sh - Intercept large Bash outputs to preserve context
3
- #
4
- # PostToolUse hook that catches large Bash outputs, saves them to a file,
5
- # and tells Claude to use Grep to search the file instead of consuming context.
6
-
7
- set -e
8
-
9
- # Configuration
10
- MAX_CHARS=${BASH_OVERFLOW_MAX_CHARS:-20000} # ~5k tokens
11
- OVERFLOW_DIR="${HOME}/.claude/bash-overflow"
12
-
13
- # Read hook input from stdin
14
- input=$(cat)
15
-
16
- # Parse the tool response
17
- tool_name=$(echo "$input" | jq -r '.tool_name // empty')
18
-
19
- # Only process Bash tool
20
- if [[ "$tool_name" != "Bash" ]]; then
21
- exit 0
22
- fi
23
-
24
- # Extract stdout from the response
25
- # tool_response can be a string or object depending on output
26
- stdout=$(echo "$input" | jq -r '.tool_response // empty')
27
-
28
- # If tool_response is an object, try to get stdout field
29
- if echo "$stdout" | jq -e 'type == "object"' > /dev/null 2>&1; then
30
- stdout=$(echo "$stdout" | jq -r '.stdout // .output // empty')
31
- fi
32
-
33
- # Measure size
34
- char_count=${#stdout}
35
- line_count=$(echo "$stdout" | wc -l | tr -d ' ')
36
-
37
- # Check if output exceeds threshold
38
- if [[ $char_count -gt $MAX_CHARS ]]; then
39
- # Create overflow directory
40
- mkdir -p "$OVERFLOW_DIR"
41
-
42
- # Generate filename with timestamp
43
- timestamp=$(date +%Y%m%d_%H%M%S)
44
- overflow_file="$OVERFLOW_DIR/bash_output_${timestamp}.txt"
45
-
46
- # Save output to file
47
- echo "$stdout" > "$overflow_file"
48
-
49
- # Calculate approximate token count (rough heuristic: 4 chars per token)
50
- approx_tokens=$((char_count / 4))
51
-
52
- # Return block decision with guidance
53
- cat << EOF
54
- {
55
- "decision": "block",
56
- "reason": "Bash output too large for context (${line_count} lines, ~${approx_tokens} tokens). Output saved to: ${overflow_file}\n\nUse the Grep tool to search this file:\n Grep(pattern: \"your-pattern\", path: \"${overflow_file}\")\n\nOr read specific sections:\n Read(file_path: \"${overflow_file}\", offset: 1, limit: 100)"
57
- }
58
- EOF
59
- exit 0
60
- fi
61
-
62
- # Output is small enough, allow it through
63
- exit 0
@@ -1,5 +0,0 @@
1
- {
2
- "env": {
3
- "BASH_MAX_OUTPUT_LENGTH": "1000000"
4
- }
5
- }