@codihaus/claude-skills 1.6.5 → 1.6.7

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.
@@ -1,936 +1,185 @@
1
1
  ---
2
2
  name: dev-scout
3
- description: Explore and document existing codebases at various depths
4
- version: 2.9.0
3
+ description: Discover and document how the codebase works - patterns, rules, and team conventions
4
+ version: 3.0.0
5
5
  ---
6
6
 
7
- # /dev-scout - Codebase Explorer
7
+ # /dev-scout - Codebase Pattern Discovery
8
8
 
9
9
  > **Skill Awareness**: See `skills/_registry.md` for all available skills.
10
10
  > - **Before**: Use `/debrief` if requirements unclear
11
11
  > - **After**: Use `/dev-specs` for implementation plans
12
12
  > - **Utils**: `/utils/diagram` for architecture visualization
13
13
 
14
- Explore and document codebases. Works at project level or per feature.
14
+ Discover and document **how the codebase works** - patterns, rules, and team conventions. Not a file inventory.
15
15
 
16
16
  ## When to Use
17
17
 
18
- - Understand existing codebase before adding features
19
- - Document current state for team
20
- - Analyze specific area before implementation
21
- - Update scout after implementation
18
+ - Understand **how the project works** before implementation
19
+ - Document **team patterns and conventions** for new engineers
20
+ - Discover **architectural patterns** that must be followed
21
+ - Capture **the rules** that won't change soon
22
+
23
+ **Not for:** Listing files, counting components, inventorying routes (use Glob/Grep fresh instead)
22
24
 
23
25
  ## Usage
24
26
 
25
27
  ```
26
28
  /dev-scout # Project-level, medium mode
27
29
  /dev-scout deep # Project-level, deep mode
28
- /dev-scout auth # Feature-level (plans/features/auth/)
30
+ /dev-scout auth # Feature-level
29
31
  /dev-scout deep billing # Feature-level, deep mode
30
- /dev-scout /path/to/code # Custom path
31
- ```
32
-
33
- ## Output Structure
34
-
35
- Outputs to unified `plans/` structure:
36
-
37
- ```
38
- plans/
39
- ├── scout/ # Project-level (/dev-scout)
40
- │ ├── README.md # Current summary
41
- │ ├── structure.md # File tree, tech stack
42
- │ ├── features.md # Existing features
43
- │ ├── stack.md # HOW the project works (API, data, patterns)
44
- │ └── history/ # Previous snapshots
45
- │ └── {date}.md
46
-
47
- └── features/
48
- └── {feature}/
49
- ├── scout.md # Feature-level (/dev-scout {feature})
50
- └── ...
51
- ```
52
-
53
- **stack.md is critical** - it tells `/dev-specs` HOW to write specs that fit the project:
54
- - Use the right SDK (not raw fetch)
55
- - Follow existing patterns (composables, hooks, services)
56
- - Respect data access method (BaaS vs direct DB)
57
- - Use correct validation/form libraries
58
-
59
- ## Modes
60
-
61
- | Mode | What It Does | When to Use |
62
- |------|--------------|-------------|
63
- | **medium** (default) | Structure, files, UI inventory | Quick overview |
64
- | **deep** | + API, models, logic, patterns | Before implementation |
65
-
66
- ## Exploration Strategy
67
-
68
- ### Large Codebase Strategy (500+ files)
69
-
70
- For very large codebases, use `/utils/gemini` for initial scan:
71
-
72
- ```
73
- 1. Count files
74
- → find . -type f | wc -l
75
- → If 500+, use Gemini
76
-
77
- 2. Run Gemini scan
78
- → python skills/utils/gemini/scripts/gemini-scan.py \
79
- --path . \
80
- --output plans/scout/gemini-summary.md
81
-
82
- 3. Read Gemini output
83
- → Gemini provides: structure, patterns, key files
84
-
85
- 4. Claude refines
86
- → Deep dive on key files Gemini identified
87
- → Add analysis and recommendations
88
- → Create final scout.md
89
- ```
90
-
91
- **Why Gemini for large codebases?**
92
- - Gemini Flash: 1M token context (can fit entire codebase)
93
- - Claude: 200K context (may not fit all files)
94
- - Gemini scans cheap/fast, Claude analyzes precisely
95
-
96
- ### Parallel Directory Search
97
-
98
- For medium codebases (100-500 files), use parallel exploration:
99
-
100
- ```
101
- Divide codebase into logical sections:
102
- - Agent 1: src/app/, src/pages/ (routes & pages)
103
- - Agent 2: src/components/, src/ui/ (UI components)
104
- - Agent 3: src/lib/, src/utils/, src/services/ (utilities)
105
- - Agent 4: src/api/, prisma/, db/ (backend)
106
- ```
107
-
108
- **When to use which strategy:**
109
-
110
- | Files | Strategy |
111
- |-------|----------|
112
- | <50 | Sequential (simple) |
113
- | 50-100 | Sequential or parallel |
114
- | 100-500 | Parallel agents |
115
- | 500+ | Gemini first, then focused Claude analysis |
116
-
117
- **When to stay sequential:**
118
- - Small codebases (<50 files)
119
- - Feature-level scout (focused area)
120
- - Simple structure
121
-
122
- ### Priority Directories
123
-
124
- Search high-value directories first based on task:
125
-
126
- | Task | Priority Directories |
127
- |------|---------------------|
128
- | General overview | README, package.json, src/app/ |
129
- | Feature analysis | Feature folder, related components, API routes |
130
- | API understanding | api/, routes/, controllers/, services/ |
131
- | Data model | prisma/, models/, schema/, types/ |
132
- | UI inventory | components/, ui/, views/, pages/ |
133
-
134
- ### Resilience
135
-
136
- Handle exploration failures gracefully:
137
-
138
- - **If a directory doesn't exist**: Skip, note in coverage
139
- - **If file read fails**: Continue, mark as "unreadable"
140
- - **If pattern returns nothing**: Try alternative patterns
141
- - **If timeout on large dir**: Summarize what was found, note gap
142
-
143
- Track coverage in output:
144
- ```markdown
145
- ## Coverage
146
- | Area | Status | Notes |
147
- |------|--------|-------|
148
- | src/app/ | ✓ Complete | 45 files |
149
- | src/lib/ | ✓ Complete | 12 files |
150
- | src/legacy/ | ⚠ Partial | Timeout after 50 files |
151
- | docs/ | ✗ Skipped | Directory not found |
152
- ```
153
-
154
- ## Workflow
155
-
156
- ### Step -1: Ensure Project Scout Exists (for Feature Scouts)
157
-
158
- **IMPORTANT**: If running a feature-level scout, check if project-level scout exists first:
159
-
160
- ```
161
- If user requested: /dev-scout {feature} (feature-level)
162
- 1. Check: plans/scout/stack.md exists?
163
- → No: Run project-level scout FIRST
164
- - Notify: "No project scout found. Analyzing entire project first, then {feature}..."
165
- - Execute: Project-level scout (steps below)
166
- - Output: plans/scout/README.md, structure.md, features.md, stack.md
167
- → Yes: Continue to feature-level scout
168
-
169
- If user requested: /dev-scout (project-level)
170
- → Skip this check, proceed directly to Step 0
171
- ```
172
-
173
- **Why this matters:**
174
- - Feature scouts need project context (tech stack, patterns, structure)
175
- - `stack.md` is critical for understanding HOW the project works
176
- - Prevents isolated feature analysis without understanding the whole
177
- - Downstream skills (`/dev-specs`, `/dev-coding`) depend on `stack.md`
178
-
179
- **User Experience:**
180
- ```
181
- User: /dev-scout auth
182
- Assistant: "No project scout found. I'll analyze the entire project first to understand the tech stack and structure, then focus on the auth feature specifically."
183
-
184
- [Runs project-level scout]
185
- ✓ Project scout complete: plans/scout/
186
-
187
- [Then runs feature scout]
188
- ✓ Feature scout complete: plans/features/auth/scout.md
189
- ```
190
-
191
- ### Step 0: Check Documentation Graph
192
-
193
- Before exploring code, check existing documentation context:
194
-
195
- ```
196
- 1. Read plans/docs-graph.json (if exists)
197
- 2. Find related nodes:
198
- - For feature scout: Find use cases, existing specs for that feature
199
- - For project scout: Get overview of documented features
200
- 3. Use relationships to focus exploration
201
- ```
202
-
203
- **How docs-graph helps:**
204
-
205
- | Scout Type | Graph Provides |
206
- |------------|----------------|
207
- | Project | List of documented features, existing UCs to validate |
208
- | Feature | Related use cases, specs, dependencies |
209
-
210
- **Example: `/dev-scout auth`**
211
- ```
212
- From docs-graph.json:
213
- - uc-auth-001 (Login) → focus on login flow
214
- - uc-auth-002 (Signup) → focus on registration
215
- - [[feature-billing]] referenced → check billing integration
216
- ```
217
-
218
- This context helps:
219
- - Focus exploration on relevant areas
220
- - Validate discovered features against documented UCs
221
- - Find integration points via graph edges
222
-
223
- ### Step 0.5: Initial Assessment
224
-
225
- Before diving in, run quick assessment:
226
-
227
- ```bash
228
- # Option 1: Use scout-analyze script (recommended)
229
- ./scripts/scout-analyze.sh . --check
230
-
231
- # If tools missing, ask user:
232
- # "Missing tools: tree, scc. Install for better analysis? (--install)"
233
-
234
- # Run full analysis
235
- ./scripts/scout-analyze.sh .
236
- ```
237
-
238
- ```bash
239
- # Option 2: Manual (if script not available)
240
- find . -type f | wc -l
241
- ls -la && ls -d */
242
- ```
243
-
244
- **Determine strategy based on file count:**
245
- | File Count | Strategy |
246
- |------------|----------|
247
- | <50 | Sequential, thorough |
248
- | 50-200 | Sequential, prioritized |
249
- | 200+ | Parallel exploration |
250
-
251
- **Check for existing docs:**
252
- - README.md → Project description
253
- - CLAUDE.md → AI instructions, patterns
254
- - docs/ → Additional documentation
255
- - package.json / requirements.txt → Dependencies
256
-
257
- ### Step 1: Determine Scope
258
-
259
- **Project-level** (`/dev-scout`):
260
- - Scans entire codebase
261
- - Outputs to `plans/scout/`
262
- - Creates history snapshot if scout exists
263
-
264
- **Feature-level** (`/dev-scout auth`):
265
- - Scans specific area only
266
- - Outputs to `plans/features/auth/scout.md`
267
- - Links to BRD use cases
268
-
269
- ### Step 2: Check for Existing Scout
270
-
271
- **If `plans/scout/` exists:**
272
- 1. Move current README.md to `history/{date}.md`
273
- 2. Create fresh analysis
274
- 3. Note what changed since last scout
275
-
276
- **If first scout:**
277
- 1. Create `plans/scout/` folder
278
- 2. Generate initial analysis
279
-
280
- ### Step 3: Medium Mode Analysis
281
-
282
- #### 3.1 Documentation Check
283
-
284
- ```
285
- Patterns:
286
- - README.md, CLAUDE.md
287
- - docs/**/*.md
288
- - package.json, requirements.txt
289
- ```
290
-
291
- Extract:
292
- - App description
293
- - Tech stack
294
- - Setup instructions
295
-
296
- #### 3.2 File Structure Scan
297
-
298
- ```
299
- Get folder tree (depth 3):
300
- - /src, /app, /pages
301
- - /components, /views
302
- - /lib, /utils
303
- - /api, /server
304
32
  ```
305
33
 
306
- #### 3.3 Frontend File Inventory
34
+ ## Core Rule: Capture Patterns, Not Inventory
307
35
 
308
- See `references/file-patterns.md`:
36
+ **Capture (Stable):**
37
+ - Patterns & abstractions (e.g., `apiRequest()` wrapper)
38
+ - Architecture decisions (e.g., Server Actions)
39
+ - Code conventions (e.g., naming, structure)
40
+ - Tech choices (e.g., Zod, Prisma)
41
+ - Team process (e.g., git workflow)
309
42
 
310
- ```
311
- Include: **/*.vue, **/*.tsx, **/*.jsx
312
- Exclude: node_modules/**, dist/**
313
- ```
314
-
315
- Group by:
316
- - Pages/Routes → Screens
317
- - Components → UI inventory
318
- - Views → Layouts
319
-
320
- #### 3.4 Feature Inference
321
-
322
- See `references/feature-patterns.md`:
323
-
324
- | Pattern | Feature |
325
- |---------|---------|
326
- | `auth/`, `login.*` | Authentication |
327
- | `payment/`, `checkout/` | Payments |
328
- | `dashboard/` | Dashboard |
43
+ **Don't Capture (Volatile):**
44
+ - File trees → use Glob fresh
45
+ - Component/route lists → discover when needed
46
+ - File counts → meaningless
47
+ - Exhaustive inventories → stale immediately
329
48
 
330
- #### 3.5 Tech Stack Detection
49
+ ## Output
331
50
 
332
- See `references/tech-detection.md`:
51
+ ### Project-Level
52
+ **Location:** `plans/brd/tech-context.md` (~150-200 lines)
53
+ **History:** `plans/brd/history/tech-context-{date}.md`
333
54
 
334
- | File | Tech |
335
- |------|------|
336
- | `next.config.*` | Next.js |
337
- | `prisma/schema.prisma` | Prisma |
338
-
339
- ### Step 4: Deep Mode Analysis (if requested)
340
-
341
- Additional to medium mode:
342
-
343
- #### 4.1 API Analysis
344
-
345
- ```
346
- Patterns:
347
- - **/api/**/*.ts
348
- - **/routes/**/*.ts
349
- ```
55
+ **Answers:**
56
+ - How do we make API calls?
57
+ - How do we access data?
58
+ - How do we structure code?
59
+ - How does our team work?
350
60
 
351
- Document:
352
- - Endpoints (method, path)
353
- - Authentication requirements
354
- - Patterns used
61
+ ### Feature-Level
62
+ **Location:** `plans/features/{feature}/codebase-context.md`
355
63
 
356
- #### 4.2 Data Model Analysis
64
+ **Prerequisite:** MUST have `tech-context.md` first (patterns already documented)
357
65
 
358
- ```
359
- Patterns:
360
- - prisma/schema.prisma
361
- - **/models/**/*.ts
362
- ```
66
+ **Answers:**
67
+ - How does THIS feature work? (not patterns - those are in tech-context.md)
68
+ - Where are the key files for this feature?
69
+ - How to extend this feature?
70
+ - What to watch out for?
363
71
 
364
- Document:
365
- - Entities
366
- - Relationships
367
- - Key fields
72
+ **Does NOT repeat:**
73
+ - Project-wide patterns (already in tech-context.md)
74
+ - Tech stack info (already documented)
75
+ - Code conventions (already documented)
368
76
 
369
- #### 4.3 Code Pattern Identification
77
+ ## Discovery Method
370
78
 
371
- Read representative files for:
372
- - State management
373
- - API client patterns
374
- - Authentication flow
375
- - Error handling
79
+ ### Project-Level (Full Discovery)
376
80
 
377
- #### 4.4 Project Conventions Detection
81
+ **Medium Mode:**
82
+ 1. Read project docs (CLAUDE.md, README, CONTRIBUTING)
83
+ 2. Detect tech stack (package.json, configs)
84
+ 3. Sample 2-3 files per category to discover patterns
85
+ 4. Read configs for conventions
378
86
 
379
- **Code Style** (read from config or infer from code):
87
+ **Deep Mode:**
88
+ Medium + deeper pattern analysis:
89
+ 1. API pattern deep dive
90
+ 2. Data access pattern
91
+ 3. Code convention detection (from configs + sampling)
92
+ 4. Git & team process
380
93
 
381
- ```
382
- Check for configs:
383
- - .eslintrc.* → Linting rules
384
- - .prettierrc.* → Formatting
385
- - tsconfig.json → TypeScript strictness
386
- - .editorconfig → Tabs/spaces, line endings
387
-
388
- Infer from code (sample 3-5 files):
389
- - Naming: camelCase, PascalCase, snake_case
390
- - File naming: Component.tsx vs component.tsx
391
- - Import style: absolute (@/) vs relative (./)
392
- - Quote style: single vs double
393
- - Semicolons: yes/no
394
- ```
94
+ ### Feature-Level (Reuse Patterns)
395
95
 
396
- **Git Conventions** (read from history):
96
+ **IMPORTANT:** Feature scout is lightweight - it READS patterns from tech-context.md, not rediscover them.
397
97
 
398
- ```bash
399
- # Check commit style
400
- git log --oneline -20
98
+ 1. **Check prerequisite:** `tech-context.md` exists?
99
+ - No Run project-level scout first
100
+ - Yes Continue
401
101
 
402
- Detect patterns:
403
- - Conventional commits? (feat:, fix:, chore:)
404
- - Emoji commits? (✨, 🐛, 🔧)
405
- - Ticket refs? (JIRA-123, #123)
406
- - Simple messages? (no pattern)
102
+ 2. **Read patterns:** Load `tech-context.md`
103
+ - Now you know: API pattern, data access, conventions
104
+ - Don't rediscover these
407
105
 
408
- # Check branch naming
409
- git branch -a | head -20
106
+ 3. **Focus on feature:**
107
+ - Find files for this feature (Glob/Grep)
108
+ - Read 2-3 key files to understand flow
109
+ - Identify entry points
110
+ - Note integration points
410
111
 
411
- Detect patterns:
412
- - feature/*, bugfix/*, hotfix/*
413
- - feat/*, fix/*
414
- - username/feature-name
415
- - No pattern
416
- ```
112
+ 4. **Document:**
113
+ - How THIS feature implements the patterns
114
+ - Where the code lives
115
+ - How to extend it
116
+ - Feature-specific gotchas
417
117
 
418
- **Project Conventions**:
118
+ **Don't:**
119
+ - ❌ Rediscover API pattern (already in tech-context.md)
120
+ - ❌ Re-document tech stack (already documented)
121
+ - ❌ Repeat code conventions (already known)
419
122
 
420
- ```
421
- Check for:
422
- - CLAUDE.md AI instructions (HIGH VALUE)
423
- - CONTRIBUTING.md Team guidelines
424
- - .github/PULL_REQUEST_TEMPLATE.md → PR format
425
- - .github/ISSUE_TEMPLATE/* → Issue format
426
-
427
- Document:
428
- - How to name files
429
- - How to structure components
430
- - How to write tests
431
- - PR/commit requirements
432
- ```
123
+ ### Strategy
124
+ - **Small (<100 files):** Sequential discovery
125
+ - **Medium (100-500):** Parallel by concern (API, data, UI, conventions)
126
+ - **Large (500+):** Use `/utils/gemini` first, then focused Claude analysis
433
127
 
434
- ### Step 5: Stack Analysis (CRITICAL)
128
+ ## Pattern Discovery Rules
435
129
 
436
- Generate `stack.md` - tells downstream skills HOW to work with this project.
130
+ 1. **Sample, don't exhaustive:** Read 2-3 representative files, not all
131
+ 2. **Find abstractions:** Wrappers, base classes, shared utilities
132
+ 3. **Capture with example:** Show the pattern, not document everything
133
+ 4. **Ask "what's the rule?"** not "what files exist?"
437
134
 
438
- See `references/stack-patterns.md` for detection patterns.
135
+ ## Key Checks
439
136
 
440
- #### 5.1 Detect API Layer Type
137
+ **Pre-flight:**
138
+ - If feature-level scout requested, check if `tech-context.md` exists
139
+ - If not, run project-level scout first
441
140
 
442
- ```
443
- Check for BaaS first (higher priority):
444
- 1. .env vars: DIRECTUS_URL, STRAPI_URL, SUPABASE_URL, etc.
445
- 2. package.json: @directus/sdk, @supabase/supabase-js, etc.
446
-
447
- If no BaaS:
448
- 3. Check for API framework: express, fastify, hono
449
- 4. Check for GraphQL: @apollo/client, urql, graphql
450
- 5. Check for tRPC: @trpc/server
451
- ```
141
+ **Existing Scout:**
142
+ - Move current to `history/tech-context-{date}.md`
143
+ - Note what changed (pattern changes, not file changes)
452
144
 
453
- #### 5.2 Detect Data Access Pattern
145
+ ## Output Template
454
146
 
455
- ```
456
- If BaaS detected:
457
- - Data managed by BaaS (don't suggest raw SQL)
458
- - Note which collections/content types exist
459
-
460
- If no BaaS:
461
- - Check for ORM: prisma/, drizzle.config.*
462
- - Check schema files for models
463
- - Direct DB access pattern
464
- ```
147
+ See `references/output-template.md` for structure.
465
148
 
466
- #### 5.3 Detect API Client Pattern
467
-
468
- ```
469
- Search for how the project calls APIs:
470
-
471
- React projects:
472
- - hooks/use*.ts → Custom hooks pattern
473
- - services/*.ts → Service layer pattern
474
- - @tanstack/react-query → React Query pattern
475
-
476
- Vue projects:
477
- - composables/use*.ts → Composables pattern
478
- - stores/*.ts → Pinia stores
479
- - @tanstack/vue-query → Vue Query pattern
480
-
481
- Next.js:
482
- - actions/*.ts → Server Actions
483
- - app/api/** → API Routes
484
- - Server components with direct calls
485
-
486
- Identify the PRIMARY pattern used (not all).
487
- ```
488
-
489
- #### 5.4 Detect Validation & Forms
490
-
491
- ```
492
- Validation:
493
- - zod in package.json → Zod schemas
494
- - yup → Yup schemas
495
- - Find: schemas/, validators/, *.schema.ts
496
-
497
- Forms:
498
- - react-hook-form → useForm pattern
499
- - vee-validate → VeeValidate
500
- - formik → Formik pattern
501
- ```
502
-
503
- #### 5.5 Detect External Services
504
-
505
- ```
506
- Parse .env.example or .env:
507
- - STRIPE_* → Payment (Stripe)
508
- - RESEND_* → Email (Resend)
509
- - AWS_S3_* → Storage (S3)
510
- - SENTRY_* → Monitoring (Sentry)
511
-
512
- Match with package.json to confirm SDK.
513
- ```
514
-
515
- #### 5.6 Detect Local Services
516
-
517
- ```
518
- Parse docker-compose.yml or compose.yml:
519
- - postgres → PostgreSQL
520
- - redis → Redis
521
- - minio → S3-compatible storage
522
- - directus → Directus CMS
523
- ```
524
-
525
- #### 5.7 Detect Available MCPs
526
-
527
- ```
528
- Check .claude/settings.local.json or mcp.json:
529
- - context7 → Library docs lookup
530
- - playwright → Browser automation
531
- - shadcn → UI components
532
- - Custom MCPs → Project-specific tools
533
- ```
534
-
535
- #### 5.8 Generate stack.md
536
-
537
- Output `plans/scout/stack.md`:
538
-
539
- ```markdown
540
- # Project Stack
541
-
542
- > Auto-detected by /dev-scout. Verify and update as needed.
543
-
544
- ## API Layer
545
- | Aspect | Value |
546
- |--------|-------|
547
- | Type | {REST/GraphQL/tRPC/BaaS} |
548
- | Service | {Directus/Supabase/Custom/etc.} |
549
- | SDK | {package name if applicable} |
550
-
551
- ## Data Access
552
- | Aspect | Value |
553
- |--------|-------|
554
- | Method | {BaaS-managed/ORM/Direct SQL} |
555
- | ORM | {Prisma/Drizzle/none} |
556
- | Models | {list key models} |
557
-
558
- ## API Client Pattern
559
- | Aspect | Value |
560
- |--------|-------|
561
- | Pattern | {hooks/composables/services/direct} |
562
- | Location | {folder path} |
563
- | Example | {primary function used} |
564
-
565
- ## Validation & Forms
566
- | Aspect | Value |
567
- |--------|-------|
568
- | Validation | {Zod/Yup/none} |
569
- | Schemas | {folder path} |
570
- | Forms | {react-hook-form/vee-validate/native} |
571
-
572
- ## External Services
573
- | Service | Provider | Env Var |
574
- |---------|----------|---------|
575
- | {type} | {provider} | {var} |
576
-
577
- ## Local Services (docker-compose)
578
- | Service | Purpose | Port |
579
- |---------|---------|------|
580
- | {name} | {purpose} | {port} |
581
-
582
- ## Available MCPs
583
- | MCP | Capability |
584
- |-----|------------|
585
- | {name} | {what it provides} |
586
-
587
- ## Specs Guidelines
588
-
589
- Based on this stack, implementation should:
590
- 1. {guideline based on API layer}
591
- 2. {guideline based on data access}
592
- 3. {guideline based on patterns}
593
- 4. {guideline based on validation}
594
-
595
- ## Stack Knowledge References
596
-
597
- For best practices and patterns, downstream skills should read:
598
- {list only those that apply to this project}
599
- - `knowledge/stacks/directus/_index.md` - Directus SDK patterns, queries, auth
600
- - `knowledge/stacks/nuxt/_index.md` - Nuxt composables, SSR, server routes
601
- - `knowledge/stacks/nextjs/_index.md` - Server Components, Actions, App Router
602
- ```
603
-
604
- ### Step 6: Generate Output
605
-
606
- #### Project-Level Output
607
-
608
- **plans/scout/README.md:**
609
- ```markdown
610
- # Codebase Analysis
611
-
612
- > **Last Updated**: {date}
613
- > **Mode**: Medium | Deep
614
- > **Previous**: [→ history/]
615
-
616
- ## Summary
617
- {Brief description of the app}
618
-
619
- ## Tech Stack
620
- | Layer | Technology |
621
- |-------|------------|
622
- | Frontend | {framework} |
623
- | Backend | {framework} |
624
- | Database | {db} |
625
- | Auth | {method} |
626
-
627
- ## Conventions (deep mode)
628
-
629
- ### Code Style
630
- | Aspect | Convention |
631
- |--------|------------|
632
- | Naming | camelCase (variables), PascalCase (components) |
633
- | File naming | kebab-case.tsx |
634
- | Imports | Absolute (@/lib/*) |
635
- | Quotes | Single |
636
- | Semicolons | No |
637
-
638
- ### Git Conventions
639
- | Aspect | Convention |
640
- |--------|------------|
641
- | Commits | Conventional (feat:, fix:, chore:) |
642
- | Branches | feature/*, bugfix/* |
643
- | PR template | Yes (.github/PULL_REQUEST_TEMPLATE.md) |
644
-
645
- ### Project Rules
646
- {From CLAUDE.md or CONTRIBUTING.md}
647
- - {Rule 1}
648
- - {Rule 2}
649
-
650
- ## Structure Overview
651
- ```
652
- src/
653
- ├── app/ # {description}
654
- ├── components/ # {description}
655
- └── lib/ # {description}
656
- ```
657
-
658
- ## Existing Features
659
- | Feature | Evidence | Confidence |
660
- |---------|----------|------------|
661
- | Auth | `app/auth/`, `LoginForm.tsx` | High |
662
- | Dashboard | `app/dashboard/` | High |
663
-
664
- ## Pages/Routes
665
- | Path | File | Description |
666
- |------|------|-------------|
667
- | / | `app/page.tsx` | Home |
668
- | /login | `app/login/page.tsx` | Login |
669
-
670
- ## Components ({count})
671
- {List key components}
672
-
673
- ## API Endpoints (deep mode)
674
- | Method | Path | Handler |
675
- |--------|------|---------|
676
- | GET | /api/users | users.list |
677
-
678
- ## Integration Points
679
- {How to connect new features}
680
-
681
- ## Coverage
682
- | Area | Status | Files | Notes |
683
- |------|--------|-------|-------|
684
- | src/app/ | ✓ | 45 | Routes, pages |
685
- | src/components/ | ✓ | 32 | UI components |
686
- | src/lib/ | ✓ | 8 | Utilities |
687
-
688
- ## Gaps / Unresolved
689
- - {Any areas not fully explored}
690
- - {Questions for follow-up}
691
-
692
- ## Notes
693
- {Observations, potential issues}
694
- ```
695
-
696
- **plans/scout/structure.md:**
697
- ```markdown
698
- # File Structure
699
-
700
- ## Directory Tree
701
- ```
702
- {full tree output}
703
- ```
704
-
705
- ## Key Directories
706
- | Directory | Purpose | File Count |
707
- |-----------|---------|------------|
708
-
709
- ## Config Files
710
- | File | Purpose |
711
- |------|---------|
712
- ```
713
-
714
- **plans/scout/features.md:**
715
- ```markdown
716
- # Existing Features
717
-
718
- ## Feature Inventory
719
-
720
- ### {Feature 1}
721
- - **Status**: Complete | Partial | Planned
722
- - **Files**: {list}
723
- - **Depends on**: {other features}
724
-
725
- ### {Feature 2}
726
- ...
727
-
728
- ## Feature Relationships
729
- ```mermaid
730
- graph LR
731
- Auth --> User
732
- User --> Dashboard
733
- Billing --> User
734
- ```
735
- ```
736
-
737
- #### Feature-Level Output
738
-
739
- **plans/features/{feature}/scout.md:**
740
- ```markdown
741
- # {Feature} - Scout Analysis
742
-
743
- > **Date**: {date}
744
- > **Mode**: Medium | Deep
745
- > **Feature**: [[feature-{feature}]]
746
- > **Related UCs**: [[uc-{group}-001]], [[uc-{group}-002]]
747
-
748
- ## Summary
749
- {What this feature does currently}
750
-
751
- ## Files
752
- | File | Purpose |
753
- |------|---------|
754
- | {path} | {description} |
755
-
756
- ## Current Implementation
757
- {How it works}
758
-
759
- ## API Endpoints (if applicable)
760
- | Method | Path | Description |
761
- |--------|------|-------------|
762
-
763
- ## Data Models (if applicable)
764
- | Model | Fields | Relations |
765
- |-------|--------|-----------|
766
-
767
- ## Integration Points
768
- {How to extend or modify}
769
-
770
- ## For Implementation
771
- - Entry point: {file}
772
- - Key patterns: {patterns used}
773
- - Dependencies: {what to be aware of}
774
- ```
775
-
776
- ### Step 6: Update History (project-level)
777
-
778
- If updating existing scout:
779
-
780
- 1. Move current to `history/{date}.md`
781
- 2. In new README.md, add:
782
-
783
- ```markdown
784
- ## Changes Since Last Scout
785
- - Added: {new files/features}
786
- - Modified: {changed areas}
787
- - Removed: {deleted items}
788
- ```
789
-
790
- ## Tools Used
149
+ ## Tools
791
150
 
792
151
  | Tool | Purpose |
793
152
  |------|---------|
794
- | `Task` | Parallel exploration (Explore agents) |
795
- | `Glob` | Find files by pattern |
153
+ | `Read` | Docs, configs, sample files |
154
+ | `Glob` | Find patterns (wrappers, configs) |
796
155
  | `Grep` | Search code patterns |
797
- | `Read` | Read file contents |
798
- | `Bash` | Directory listing, file counts |
799
- | `Write` | Output files |
800
- | `Playwright` | Capture UI screenshots |
801
-
802
- ### Playwright for Visual Documentation
803
-
804
- When scouting a web app, capture screenshots of key UI:
805
-
806
- ```
807
- 1. Start the dev server (if not running)
808
- → Bash: npm run dev
809
-
810
- 2. Navigate to app
811
- → mcp__playwright__browser_navigate({ url: "http://localhost:3000" })
812
-
813
- 3. Take screenshots of key pages
814
- → mcp__playwright__browser_take_screenshot({
815
- filename: "plans/scout/screenshots/home.png"
816
- })
156
+ | `Bash` | Git history for conventions |
157
+ | `Task` | Parallel pattern discovery |
158
+ | `Context7` | Library patterns |
817
159
 
818
- 4. Capture different states
819
- → Login page
820
- → Dashboard (if accessible)
821
- → Key feature pages
822
- ```
160
+ ## Large Codebase Strategy
823
161
 
824
- **When to capture UI:**
825
- - Initial project scout (what does app look like?)
826
- - Before major UI changes (for comparison)
827
- - Feature scout (existing UI in that area)
162
+ For 500+ files, use `/utils/gemini`:
163
+ 1. Gemini scans full codebase (1M context)
164
+ 2. Claude reads Gemini output
165
+ 3. Claude deep dives on key patterns identified
166
+ 4. Creates pattern-focused scout
828
167
 
829
- **Output:**
830
- ```
831
- plans/scout/screenshots/
832
- ├── home.png
833
- ├── login.png
834
- ├── dashboard.png
835
- └── feature-{name}.png
836
- ```
837
-
838
- Include in scout.md:
839
- ```markdown
840
- ## Current UI
841
-
842
- ### Home Page
843
- ![Home](./screenshots/home.png)
844
-
845
- ### Dashboard
846
- ![Dashboard](./screenshots/dashboard.png)
847
- ```
848
-
849
- ### Parallel Exploration Example
850
-
851
- For large codebases (200+ files), spawn parallel agents:
852
-
853
- ```
854
- Task 1 (Explore): "Search src/app/ and src/pages/ for route definitions, page components. List files with brief purpose."
855
-
856
- Task 2 (Explore): "Search src/components/ for UI components. Group by type (forms, buttons, layouts, etc.)."
857
-
858
- Task 3 (Explore): "Search src/lib/, src/utils/, src/services/ for utilities. Identify patterns, shared logic."
859
-
860
- Task 4 (Explore): "Search api/, prisma/, db/ for backend code. Document endpoints, models."
861
- ```
862
-
863
- Synthesize results from all agents into unified scout output.
864
-
865
- ## Tips
168
+ ## Anti-Patterns
866
169
 
867
170
  **General:**
868
- - Run project-level scout first for overview
869
- - Use feature-level before `/dev-specs`
870
- - Update scout after major implementations
871
- - History helps track codebase evolution
872
-
873
- **For large codebases:**
874
- - Start with Step 0 assessment to choose strategy
875
- - Parallelize with 3-5 agents max (diminishing returns beyond)
876
- - Focus deep analysis on areas relevant to task
877
- - Accept partial coverage if codebase is huge - note gaps
878
-
879
- **For monorepos:**
880
- - Treat each package/app as separate scout target
881
- - Document inter-package dependencies
882
- - Use feature-level scout for specific packages
883
-
884
- **Quality over speed:**
885
- - Better to have thorough analysis of key areas than shallow scan of everything
886
- - Flag uncertainties rather than guessing
887
- - Include "Gaps / Unresolved" section honestly
888
-
889
- ## Scripts
171
+ Listing every file in a directory
172
+ Counting components/routes
173
+ Including full file trees
174
+ Documenting file locations (use Glob instead)
175
+ ❌ Reading every file (sample instead)
890
176
 
891
- ### scout-analyze.sh
177
+ **Feature Scout Specific:**
178
+ ❌ Rediscovering project patterns (already in tech-context.md)
179
+ ❌ Repeating API/data/validation patterns (reference, don't rewrite)
180
+ ❌ Re-documenting tech stack (already known)
181
+ ❌ Running full project analysis (lightweight, feature-focused only)
892
182
 
893
- Quick codebase analysis with optional tool installation:
894
-
895
- ```bash
896
- # Check available tools
897
- ./scripts/scout-analyze.sh . --check
898
-
899
- # Run analysis with available tools
900
- ./scripts/scout-analyze.sh /path/to/code
901
-
902
- # Auto-install missing tools and analyze
903
- ./scripts/scout-analyze.sh . --install
904
-
905
- # Output as JSON (for parsing)
906
- ./scripts/scout-analyze.sh . --json
907
- ```
183
+ ## Reference
908
184
 
909
- **Tools checked:**
910
- | Tool | Purpose | Fallback |
911
- |------|---------|----------|
912
- | `tree` | Visual directory structure | `find -type d` |
913
- | `scc` | Code stats (fast, accurate) | `wc -l` |
914
- | `jq` | Parse JSON configs | `grep` |
915
- | `rg` | Fast search | `grep -r` |
916
-
917
- **Output includes:**
918
- - File/directory counts
919
- - Directory structure (depth 2)
920
- - Code statistics by language
921
- - Top file extensions
922
- - Dependencies (package.json, requirements.txt, go.mod)
923
- - Git activity (recent commits, active files, contributors)
924
- - Config files detected
925
-
926
- **Usage in workflow:**
927
- 1. Run `./scripts/scout-analyze.sh . --check` in Step 0
928
- 2. Offer user to install missing tools
929
- 3. Run full analysis to inform exploration strategy
930
-
931
- ## References
932
-
933
- - `references/file-patterns.md` - Search patterns
934
- - `references/feature-patterns.md` - Feature inference
935
- - `references/tech-detection.md` - Tech stack detection
936
- - `references/stack-patterns.md` - Deep stack analysis (API, data, patterns)
185
+ See `references/output-template.md` for output structure (principle + empty template).