@codihaus/claude-skills 1.0.0

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 (46) hide show
  1. package/README.md +167 -0
  2. package/bin/cli.js +58 -0
  3. package/package.json +46 -0
  4. package/skills/_quality-attributes.md +392 -0
  5. package/skills/_registry.md +189 -0
  6. package/skills/debrief/SKILL.md +647 -0
  7. package/skills/debrief/references/change-request-template.md +124 -0
  8. package/skills/debrief/references/file-patterns.md +173 -0
  9. package/skills/debrief/references/group-codes.md +72 -0
  10. package/skills/debrief/references/research-queries.md +106 -0
  11. package/skills/debrief/references/use-case-template.md +141 -0
  12. package/skills/debrief/scripts/generate_questionnaire.py +195 -0
  13. package/skills/dev-arch/SKILL.md +747 -0
  14. package/skills/dev-changelog/SKILL.md +378 -0
  15. package/skills/dev-coding/SKILL.md +470 -0
  16. package/skills/dev-coding-backend/SKILL.md +361 -0
  17. package/skills/dev-coding-frontend/SKILL.md +534 -0
  18. package/skills/dev-coding-frontend/references/nextjs.md +477 -0
  19. package/skills/dev-review/SKILL.md +548 -0
  20. package/skills/dev-scout/SKILL.md +723 -0
  21. package/skills/dev-scout/references/feature-patterns.md +210 -0
  22. package/skills/dev-scout/references/file-patterns.md +252 -0
  23. package/skills/dev-scout/references/tech-detection.md +211 -0
  24. package/skills/dev-scout/scripts/scout-analyze.sh +280 -0
  25. package/skills/dev-specs/SKILL.md +577 -0
  26. package/skills/dev-specs/references/checklist.md +176 -0
  27. package/skills/dev-specs/references/spec-templates.md +460 -0
  28. package/skills/dev-test/SKILL.md +364 -0
  29. package/skills/utils/diagram/SKILL.md +205 -0
  30. package/skills/utils/diagram/references/common-errors.md +305 -0
  31. package/skills/utils/diagram/references/diagram-types.md +636 -0
  32. package/skills/utils/docs-graph/SKILL.md +204 -0
  33. package/skills/utils/gemini/SKILL.md +292 -0
  34. package/skills/utils/gemini/scripts/gemini-scan.py +340 -0
  35. package/skills/utils/gemini/scripts/setup.sh +169 -0
  36. package/src/commands/add.js +64 -0
  37. package/src/commands/doctor.js +179 -0
  38. package/src/commands/init.js +251 -0
  39. package/src/commands/list.js +88 -0
  40. package/src/commands/remove.js +60 -0
  41. package/src/commands/update.js +72 -0
  42. package/src/index.js +26 -0
  43. package/src/utils/config.js +272 -0
  44. package/src/utils/deps.js +599 -0
  45. package/src/utils/skills.js +253 -0
  46. package/templates/CLAUDE.md.template +58 -0
@@ -0,0 +1,747 @@
1
+ ---
2
+ name: dev-arch
3
+ description: Architecture decisions and technical design for features
4
+ version: 1.1.0
5
+ ---
6
+
7
+ # /dev-arch - Architecture Design
8
+
9
+ > **Skill Awareness**: See `skills/_registry.md` for all available skills.
10
+ > - **Called by**: `/debrief` (can architecture support this?), `/dev-specs` (what patterns to use?)
11
+ > - **Reads**: `_quality-attributes.md` (Architecture Level sections)
12
+ > - **After**: Informs `/dev-specs` with architecture decisions
13
+
14
+ Make architecture decisions for features. Ensures scalability, maintainability, and quality from the start.
15
+
16
+ ## When to Use
17
+
18
+ - New feature that requires structural decisions
19
+ - Existing feature that needs significant changes
20
+ - When `/debrief` needs to validate feasibility
21
+ - When `/dev-specs` needs patterns for implementation
22
+ - Technical debt evaluation
23
+
24
+ ## Usage
25
+
26
+ ```
27
+ /dev-arch auth # Architecture for auth feature
28
+ /dev-arch billing --new # New feature (more thorough)
29
+ /dev-arch payments --evaluate # Evaluate existing architecture
30
+ ```
31
+
32
+ ## When Called
33
+
34
+ ### From `/debrief`
35
+
36
+ ```
37
+ /debrief creates use cases
38
+
39
+ Calls /dev-arch with question:
40
+ "Can current architecture support these requirements?"
41
+
42
+ /dev-arch returns:
43
+ - Yes, existing patterns work
44
+ - Yes, with minor additions (specify)
45
+ - No, need new architecture (propose)
46
+ ```
47
+
48
+ ### From `/dev-specs`
49
+
50
+ ```
51
+ /dev-specs starts generating specs
52
+
53
+ Calls /dev-arch with question:
54
+ "What patterns should specs use?"
55
+
56
+ /dev-arch returns:
57
+ - API patterns (REST/GraphQL, conventions)
58
+ - Data patterns (models, relationships)
59
+ - Component patterns (structure, state)
60
+ - Integration patterns (how pieces connect)
61
+ ```
62
+
63
+ ## Output
64
+
65
+ ```
66
+ plans/features/{feature}/
67
+ ├── architecture.md # Architecture decisions
68
+ ├── adrs/ # Architecture Decision Records
69
+ │ ├── ADR-001-api-style.md
70
+ │ ├── ADR-002-auth-strategy.md
71
+ │ └── ...
72
+ ├── scout.md # From /dev-scout
73
+ └── specs/ # From /dev-specs (uses architecture.md)
74
+ ```
75
+
76
+ ## Workflow
77
+
78
+ ### Phase 0: Mode Detection
79
+
80
+ Determine approach based on existing architecture:
81
+
82
+ ```
83
+ 1. Check: plans/scout/README.md exists?
84
+ Check: plans/features/{feature}/scout.md exists?
85
+
86
+ 2. If scout exists → Read existing patterns
87
+ - API style (REST, GraphQL)
88
+ - Database (PostgreSQL + Prisma, etc.)
89
+ - Frontend (React + Zustand, Vue + Pinia, etc.)
90
+ - Auth (JWT, session, etc.)
91
+ - Folder structure
92
+
93
+ 3. Determine mode:
94
+ ```
95
+
96
+ | Condition | Mode | Approach |
97
+ |-----------|------|----------|
98
+ | Scout has established patterns | **Follow Mode** | Use existing patterns, no questions |
99
+ | Scout exists but feature needs NEW tech | **Extend Mode** | Ask only about the new parts |
100
+ | No scout / greenfield | **Design Mode** | Ask constraint questions |
101
+ | `--new` flag provided | **Design Mode** | Force full architecture design |
102
+
103
+ ### Phase 1: Load Context
104
+
105
+ ```
106
+ 1. Read quality attributes
107
+ → skills/_quality-attributes.md (Architecture Level)
108
+
109
+ 2. Read feature requirements
110
+ → plans/features/{feature}/README.md
111
+ → plans/brd/use-cases/{feature}/*.md
112
+
113
+ 3. Read existing architecture
114
+ → plans/scout/README.md (project-level)
115
+ → plans/features/{feature}/scout.md (feature-level)
116
+
117
+ 4. Read docs-graph
118
+ → plans/docs-graph.json
119
+ ```
120
+
121
+ ### Phase 2A: Follow Mode (Existing Patterns)
122
+
123
+ **When**: Scout detected established patterns.
124
+
125
+ **Approach**: Use what exists, don't ask.
126
+
127
+ ```
128
+ 1. Extract patterns from scout:
129
+ - "Project uses Next.js App Router"
130
+ - "API is REST with /api/{resource} convention"
131
+ - "Database is PostgreSQL with Prisma"
132
+ - "Auth is JWT in httpOnly cookies"
133
+ - "State management: Zustand"
134
+
135
+ 2. Apply to new feature automatically:
136
+ → New endpoints follow existing REST pattern
137
+ → New models use Prisma conventions
138
+ → New components follow existing structure
139
+
140
+ 3. Only flag if requirements CANNOT fit existing patterns
141
+ ```
142
+
143
+ **Output (minimal):**
144
+
145
+ ```markdown
146
+ ## Architecture: {Feature}
147
+
148
+ ### Approach: Follow Existing Patterns
149
+
150
+ Using established project patterns from scout:
151
+
152
+ | Aspect | Existing Pattern | Apply To Feature |
153
+ |--------|------------------|------------------|
154
+ | API | REST `/api/{resource}` | `/api/billing`, `/api/invoices` |
155
+ | Database | Prisma + PostgreSQL | New Invoice, Payment models |
156
+ | Auth | JWT + RBAC | Require `billing:read`, `billing:write` |
157
+ | Frontend | React + Zustand | BillingStore, InvoiceList component |
158
+
159
+ ### New Elements (within existing patterns)
160
+ - Invoice model with relations
161
+ - Stripe webhook endpoint
162
+ - BillingContext for subscription state
163
+
164
+ ### No Architecture Changes Needed
165
+ Existing patterns fully support this feature.
166
+ ```
167
+
168
+ ### Phase 2B: Extend Mode (New Parts Only)
169
+
170
+ **When**: Existing patterns, but feature needs something new.
171
+
172
+ **Approach**: Ask ONLY about the new part.
173
+
174
+ ```
175
+ 1. Identify what's new:
176
+ - "Feature needs real-time updates" (no WebSocket in project)
177
+ - "Feature needs payment processing" (no payment provider yet)
178
+ - "Feature needs file uploads" (no storage configured)
179
+
180
+ 2. Ask ONLY about the gap:
181
+ ```
182
+
183
+ **Example - Need payment provider:**
184
+
185
+ ```markdown
186
+ **New Requirement**: This feature needs payment processing.
187
+ Your project doesn't have a payment provider configured.
188
+
189
+ **Options:**
190
+ | Option | Pros | Cons |
191
+ |--------|------|------|
192
+ | A: Stripe (Recommended) | Most popular, good docs | 2.9% + 30¢ fees |
193
+ | B: Paddle | Handles taxes/VAT | Higher fees, less flexible |
194
+ | C: LemonSqueezy | Simple, handles taxes | Newer, less features |
195
+
196
+ **Which payment provider?**
197
+ ```
198
+
199
+ **Only ask what's truly new. Everything else follows existing patterns.**
200
+
201
+ ### Phase 2C: Design Mode (Greenfield)
202
+
203
+ **When**: No existing patterns OR `--new` flag.
204
+
205
+ **Approach**: Ask constraint questions, present options.
206
+
207
+ **Q1: Project Context**
208
+ - New project (no code yet)
209
+ - Existing project, but new architecture area
210
+ - Complete rebuild
211
+
212
+ **Q2: Team & Deployment**
213
+ - Solo / Small VPS → Recommend simple stack
214
+ - Small team / Managed cloud → Recommend proven patterns
215
+ - Larger team / Full cloud → More options available
216
+
217
+ **Q3: Key Constraints** (multi-select)
218
+ - Must use specific tech (specify)
219
+ - Limited budget/resources
220
+ - Tight timeline
221
+ - Compliance requirements
222
+ - None
223
+
224
+ **Then present options based on constraints:**
225
+
226
+ ```markdown
227
+ ## Architecture Options
228
+
229
+ Based on: Small team, Vercel deployment, tight timeline
230
+
231
+ ### Recommended Stack
232
+
233
+ | Layer | Choice | Why |
234
+ |-------|--------|-----|
235
+ | Framework | Next.js | You're on Vercel, natural fit |
236
+ | Database | PostgreSQL + Prisma | Reliable, good DX |
237
+ | Auth | NextAuth.js | Integrates well, handles OAuth |
238
+ | State | Zustand | Simple, minimal boilerplate |
239
+
240
+ ### Alternatives Considered
241
+
242
+ | Alternative | Why Not |
243
+ |-------------|---------|
244
+ | GraphQL | Adds complexity, REST sufficient for your UCs |
245
+ | MongoDB | Team knows SQL, PostgreSQL better fit |
246
+ | Redux | Overkill for this project size |
247
+
248
+ **Proceed with recommended stack?**
249
+ - Yes, use recommended
250
+ - Modify (specify what to change)
251
+ - Show me other options
252
+ ```
253
+
254
+ ### Phase 3: Gap Analysis
255
+
256
+ For any mode, identify gaps between requirements and architecture:
257
+
258
+ ```markdown
259
+ ## Gap Analysis
260
+
261
+ ### Requirements vs Capabilities
262
+
263
+ | Requirement | Current Support | Gap | Action |
264
+ |-------------|-----------------|-----|--------|
265
+ | User login | ✓ JWT exists | None | Use existing |
266
+ | Payments | ✗ None | Need provider | Asked user → Stripe |
267
+ | Real-time | ✗ None | Need WebSocket | Add Pusher/Ably |
268
+ | File upload | ✓ S3 configured | None | Use existing |
269
+
270
+ ### Gaps Requiring Decisions
271
+ 1. Payment provider → User chose Stripe
272
+ 2. Real-time → Recommend Pusher (simple, managed)
273
+ ```
274
+
275
+ ### Phase 4: Make Decisions (Only for Gaps)
276
+
277
+ Only create ADRs for NEW decisions, not for following existing patterns.
278
+
279
+ For each NEW architecture decision:
280
+
281
+ ```markdown
282
+ ## Decision: {Topic}
283
+
284
+ ### Context
285
+ {Why this decision is needed}
286
+
287
+ ### Options Considered
288
+
289
+ **Option A: {Name}**
290
+ - Pros: {benefits}
291
+ - Cons: {drawbacks}
292
+ - Effort: {Low/Medium/High}
293
+
294
+ **Option B: {Name}**
295
+ - Pros: {benefits}
296
+ - Cons: {drawbacks}
297
+ - Effort: {Low/Medium/High}
298
+
299
+ ### Decision
300
+ {Chosen option and rationale}
301
+
302
+ ### Consequences
303
+ - {What this means for implementation}
304
+ - {Trade-offs accepted}
305
+ ```
306
+
307
+ **Key decisions to make:**
308
+
309
+ | Category | Decisions |
310
+ |----------|-----------|
311
+ | API | REST vs GraphQL, versioning, conventions |
312
+ | Data | Database choice, ORM, schema design |
313
+ | Auth | Strategy (JWT/session/OAuth), permission model |
314
+ | Frontend | State management, component structure |
315
+ | Integration | How services connect, event-driven? |
316
+ | Infrastructure | Caching, queues, external services |
317
+
318
+ ### Phase 4: Apply Quality Attributes
319
+
320
+ Run through `_quality-attributes.md` Architecture Level checklists:
321
+
322
+ ```markdown
323
+ ## Quality Assessment
324
+
325
+ ### Scalability
326
+ - [x] Stateless API design
327
+ - [x] Database can handle 10x load
328
+ - [ ] Caching strategy defined → Need to decide
329
+
330
+ ### Maintainability
331
+ - [x] Clear module boundaries
332
+ - [x] Consistent folder structure
333
+ - [x] Dependencies abstracted
334
+
335
+ ### Security
336
+ - [x] Auth strategy chosen (JWT)
337
+ - [x] Permission model (RBAC)
338
+ - [ ] Data encryption → Need for PII
339
+
340
+ ### Reliability
341
+ - [ ] Single points of failure → Database needs replica
342
+ - [x] Graceful degradation planned
343
+
344
+ ### Performance
345
+ - [x] Latency targets defined (P95 < 200ms)
346
+ - [ ] CDN for static assets → TODO
347
+
348
+ ### Testability
349
+ - [x] Dependencies injectable
350
+ - [x] Test strategy defined
351
+ ```
352
+
353
+ ### Phase 5: Generate Architecture Document
354
+
355
+ Create `plans/features/{feature}/architecture.md`:
356
+
357
+ ```markdown
358
+ # {Feature} Architecture
359
+
360
+ > **Feature**: [[feature-{name}]]
361
+ > **Created**: {date}
362
+ > **Status**: Draft | Approved
363
+
364
+ ## Overview
365
+
366
+ {High-level architecture description}
367
+
368
+ ## Architecture Diagram
369
+
370
+ ```mermaid
371
+ flowchart TB
372
+ subgraph Frontend
373
+ UI[React App]
374
+ State[Zustand Store]
375
+ end
376
+
377
+ subgraph Backend
378
+ API[Next.js API]
379
+ Auth[Auth Middleware]
380
+ DB[(PostgreSQL)]
381
+ end
382
+
383
+ subgraph External
384
+ Payment[Stripe]
385
+ Email[SendGrid]
386
+ end
387
+
388
+ UI --> API
389
+ API --> Auth
390
+ API --> DB
391
+ API --> Payment
392
+ API --> Email
393
+ ```
394
+
395
+ ## Key Decisions
396
+
397
+ | Decision | Choice | Rationale |
398
+ |----------|--------|-----------|
399
+ | API Style | REST | Matches existing patterns, simpler |
400
+ | Auth | JWT + httpOnly cookies | Secure, stateless |
401
+ | State | Zustand | Lightweight, already in project |
402
+ | Database | PostgreSQL | Existing, supports needed features |
403
+
404
+ ## Patterns to Follow
405
+
406
+ ### API Patterns
407
+ - RESTful endpoints: `/{resource}` and `/{resource}/:id`
408
+ - Response format: `{ data, error, meta }`
409
+ - Error format: `{ error: { code, message, details } }`
410
+
411
+ ### Data Patterns
412
+ - Use Prisma ORM
413
+ - Soft deletes with `deletedAt`
414
+ - Timestamps on all tables
415
+
416
+ ### Component Patterns
417
+ - Feature folders: `src/features/{feature}/`
418
+ - Shared components: `src/components/ui/`
419
+ - API clients: `src/lib/api/{feature}.ts`
420
+
421
+ ### Auth Patterns
422
+ - Middleware checks on protected routes
423
+ - Role-based permissions
424
+ - Token refresh on activity
425
+
426
+ ## Quality Checklist
427
+
428
+ ### Scalability
429
+ - [x] Stateless API
430
+ - [x] Pagination on lists
431
+ - [x] Caching strategy: Redis for sessions
432
+ - [x] Background jobs: Queue for emails
433
+
434
+ ### Security
435
+ - [x] Input validation: Zod schemas
436
+ - [x] Auth: JWT in httpOnly cookie
437
+ - [x] Permissions: RBAC with roles table
438
+
439
+ ### Performance
440
+ - [x] Database indexes defined
441
+ - [x] N+1 queries prevented with includes
442
+ - [x] CDN for static assets
443
+
444
+ ## ADRs
445
+
446
+ | ID | Title | Status |
447
+ |----|-------|--------|
448
+ | [ADR-001](./adrs/ADR-001-api-style.md) | REST vs GraphQL | Accepted |
449
+ | [ADR-002](./adrs/ADR-002-auth-strategy.md) | Authentication Strategy | Accepted |
450
+
451
+ ## Risks & Mitigations
452
+
453
+ | Risk | Impact | Mitigation |
454
+ |------|--------|------------|
455
+ | Stripe rate limits | Medium | Implement queue for batch operations |
456
+ | Database growth | Low | Archival strategy after 1 year |
457
+
458
+ ## Open Questions
459
+
460
+ - [ ] {Any unresolved questions}
461
+
462
+ ## Next Steps
463
+
464
+ 1. Review with team
465
+ 2. Create specs with `/dev-specs`
466
+ 3. Implement with `/dev-coding`
467
+ ```
468
+
469
+ ### Phase 6: Generate ADRs (if significant decisions)
470
+
471
+ Create `plans/features/{feature}/adrs/ADR-{NNN}-{slug}.md`:
472
+
473
+ ```markdown
474
+ # ADR-{NNN}: {Title}
475
+
476
+ > **Status**: Proposed | Accepted | Deprecated | Superseded
477
+ > **Date**: {date}
478
+ > **Decision Makers**: {who}
479
+
480
+ ## Context
481
+
482
+ {What is the issue that we're seeing that motivates this decision?}
483
+
484
+ ## Decision
485
+
486
+ {What is the change that we're proposing and/or doing?}
487
+
488
+ ## Options Considered
489
+
490
+ ### Option 1: {Name}
491
+ {Description}
492
+ - **Pros**: {list}
493
+ - **Cons**: {list}
494
+
495
+ ### Option 2: {Name}
496
+ {Description}
497
+ - **Pros**: {list}
498
+ - **Cons**: {list}
499
+
500
+ ## Consequences
501
+
502
+ ### Positive
503
+ - {benefit 1}
504
+ - {benefit 2}
505
+
506
+ ### Negative
507
+ - {drawback 1}
508
+ - {drawback 2}
509
+
510
+ ### Neutral
511
+ - {observation}
512
+
513
+ ## Related Decisions
514
+
515
+ - {Link to related ADRs}
516
+ ```
517
+
518
+ ## Decision Categories
519
+
520
+ ### API Design
521
+
522
+ | Question | Options |
523
+ |----------|---------|
524
+ | Style | REST, GraphQL, tRPC, gRPC |
525
+ | Versioning | URL path, header, none |
526
+ | Auth header | Bearer token, cookie, API key |
527
+ | Response format | JSON:API, custom, none |
528
+
529
+ ### Database
530
+
531
+ | Question | Options |
532
+ |----------|---------|
533
+ | Type | PostgreSQL, MySQL, MongoDB, SQLite |
534
+ | ORM | Prisma, TypeORM, Drizzle, raw SQL |
535
+ | Migrations | ORM-managed, manual, none |
536
+ | Soft deletes | Yes (deletedAt), no |
537
+
538
+ ### Frontend State
539
+
540
+ | Question | Options |
541
+ |----------|---------|
542
+ | Global state | Redux, Zustand, Jotai, Context |
543
+ | Server state | React Query, SWR, manual |
544
+ | Forms | React Hook Form, Formik, native |
545
+
546
+ ### Authentication
547
+
548
+ | Question | Options |
549
+ |----------|---------|
550
+ | Strategy | JWT, session, OAuth only |
551
+ | Token storage | httpOnly cookie, localStorage, memory |
552
+ | Refresh | Sliding window, explicit refresh |
553
+ | Permissions | RBAC, ABAC, simple roles |
554
+
555
+ ### Infrastructure
556
+
557
+ | Question | Options |
558
+ |----------|---------|
559
+ | Caching | Redis, in-memory, CDN |
560
+ | Queue | Redis/BullMQ, SQS, RabbitMQ |
561
+ | File storage | S3, local, Cloudinary |
562
+ | Email | SendGrid, SES, SMTP |
563
+
564
+ ## Tools Used
565
+
566
+ | Tool | Purpose |
567
+ |------|---------|
568
+ | `Read` | Load requirements, scout, quality attributes |
569
+ | `Write` | Create architecture.md, ADRs |
570
+ | `Glob` | Find existing patterns |
571
+ | `Grep` | Search for conventions |
572
+ | `AskUserQuestion` | Clarify decisions |
573
+ | `Context7` | Look up architecture best practices |
574
+ | `WebSearch` | Find architecture patterns |
575
+
576
+ ### Context7 for Architecture Research
577
+
578
+ When making architecture decisions, use Context7 to look up best practices:
579
+
580
+ ```
581
+ 1. Resolve library ID
582
+ → mcp__context7__resolve-library-id({
583
+ libraryName: "prisma",
584
+ query: "database schema design patterns"
585
+ })
586
+
587
+ 2. Query documentation
588
+ → mcp__context7__query-docs({
589
+ libraryId: "/prisma/prisma",
590
+ query: "relations and foreign keys best practices"
591
+ })
592
+ ```
593
+
594
+ **Use for:**
595
+ - ORM patterns (Prisma, TypeORM, Drizzle)
596
+ - Framework architecture (Next.js, NestJS)
597
+ - Auth library patterns (NextAuth, Lucia)
598
+ - API design (REST, GraphQL, tRPC)
599
+
600
+ ## Integration
601
+
602
+ | Skill | Relationship |
603
+ |-------|--------------|
604
+ | `/debrief` | Calls to validate feasibility |
605
+ | `/dev-scout` | Provides current state analysis |
606
+ | `/dev-specs` | Consumes architecture decisions |
607
+ | `/utils/diagram` | Validates mermaid diagrams |
608
+ | `_quality-attributes.md` | Provides checklists |
609
+
610
+ ## Key Principle
611
+
612
+ > **Use existing patterns. Only ask about what's truly new.**
613
+
614
+ The team's current architecture is their comfort zone. They know it, they control it.
615
+ Don't suggest microservices to a monolith team. Don't ask about database choice when they're already on PostgreSQL.
616
+
617
+ ```
618
+ Existing patterns → Follow automatically
619
+ New requirements that don't fit → Ask only about those
620
+ Greenfield → Ask constraint questions
621
+ ```
622
+
623
+ ## Example Flows
624
+
625
+ ### Example 1: Follow Mode (Most Common)
626
+
627
+ ```
628
+ User: /dev-arch notifications
629
+
630
+ 1. Mode detection
631
+ → Scout exists with established patterns
632
+ → Mode: FOLLOW
633
+
634
+ 2. Load context
635
+ → Project uses: Next.js, REST API, PostgreSQL, Prisma
636
+ → Feature needs: notification preferences, email sending
637
+
638
+ 3. Apply existing patterns (NO QUESTIONS)
639
+ → API: POST /api/notifications, GET /api/notifications
640
+ → Database: Notification model with Prisma
641
+ → Frontend: NotificationSettings component
642
+
643
+ 4. Check for gaps
644
+ → Email sending needed
645
+ → Project already has SendGrid configured ✓
646
+ → No gaps!
647
+
648
+ 5. Output (minimal)
649
+ "Using existing patterns. No architecture changes needed.
650
+ - New Notification model
651
+ - New API endpoints following REST convention
652
+ - Uses existing SendGrid for emails"
653
+
654
+ No ADRs created. No questions asked.
655
+ ```
656
+
657
+ ### Example 2: Extend Mode (New Part Only)
658
+
659
+ ```
660
+ User: /dev-arch billing
661
+
662
+ 1. Mode detection
663
+ → Scout exists with established patterns
664
+ → Mode: FOLLOW initially...
665
+
666
+ 2. Load context
667
+ → Project uses: Next.js, REST, PostgreSQL
668
+ → Feature needs: payment processing, subscriptions
669
+
670
+ 3. Check for gaps
671
+ → Payment processing needed
672
+ → Project has NO payment provider ← Gap found!
673
+ → Mode switches to: EXTEND
674
+
675
+ 4. Ask ONLY about the gap
676
+ "Feature needs payment processing. No provider configured.
677
+ Options:
678
+ A: Stripe (Recommended) - Popular, good docs
679
+ B: Paddle - Handles taxes
680
+ C: LemonSqueezy - Simpler
681
+
682
+ Which provider?"
683
+
684
+ → User: "Stripe"
685
+
686
+ 5. Everything else follows existing patterns
687
+ → API: REST endpoints for billing
688
+ → Database: Prisma models
689
+ → Frontend: Existing component patterns
690
+
691
+ 6. Output
692
+ → architecture.md (documents Stripe choice)
693
+ → ADR-001-payment-provider.md (only for the NEW decision)
694
+
695
+ "Stripe selected. All other patterns follow existing project architecture."
696
+ ```
697
+
698
+ ### Example 3: Design Mode (Greenfield)
699
+
700
+ ```
701
+ User: /dev-arch auth --new
702
+
703
+ 1. Mode detection
704
+ → --new flag provided
705
+ → Mode: DESIGN
706
+
707
+ 2. Ask constraint questions
708
+ Q1: "Team size?"
709
+ → Small team (3 devs)
710
+
711
+ Q2: "Deployment target?"
712
+ → Vercel
713
+
714
+ Q3: "Constraints?"
715
+ → Tight timeline
716
+
717
+ 3. Present options based on constraints
718
+ "Based on: Small team, Vercel, tight timeline
719
+
720
+ Recommended:
721
+ - NextAuth.js (simple, works with Vercel)
722
+ - JWT in httpOnly cookies
723
+ - RBAC for permissions
724
+
725
+ Alternatives considered:
726
+ - Auth0: Good but adds external dependency
727
+ - Custom JWT: More work, tight timeline
728
+
729
+ Proceed with NextAuth.js?"
730
+
731
+ → User: "Yes"
732
+
733
+ 4. Generate full architecture
734
+ → architecture.md (complete auth design)
735
+ → ADR-001-auth-strategy.md
736
+ → ADR-002-permission-model.md
737
+ ```
738
+
739
+ ## Summary
740
+
741
+ | Mode | Questions Asked | ADRs Created |
742
+ |------|-----------------|--------------|
743
+ | Follow | None | None |
744
+ | Extend | Only for gaps | Only for new decisions |
745
+ | Design | Full constraint gathering | For all decisions |
746
+
747
+ **Default to Follow mode. Only escalate when necessary.**