ai-development-framework 0.1.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 (56) hide show
  1. package/.claude/agents/_template/AGENT.md +36 -0
  2. package/.claude/agents/architect-agent/AGENT.md +60 -0
  3. package/.claude/agents/architect-agent/decisions/log.md +18 -0
  4. package/.claude/agents/architect-agent/frontend/.gitkeep +0 -0
  5. package/.claude/agents/architect-agent/index.md +32 -0
  6. package/.claude/agents/architect-agent/modules/.gitkeep +0 -0
  7. package/.claude/agents/architect-agent/shared/patterns.md +19 -0
  8. package/.claude/agents/mobile-tester-agent/AGENT.md +46 -0
  9. package/.claude/agents/mobile-tester-agent/screen-patterns.md +42 -0
  10. package/.claude/agents/tester-agent/AGENT.md +44 -0
  11. package/.claude/agents/tester-agent/auth-state.md +22 -0
  12. package/.claude/agents/tester-agent/test-patterns.md +36 -0
  13. package/.claude/agents/ui-ux-analyzer/AGENT.md +75 -0
  14. package/.claude/commands/create-prd.md +55 -0
  15. package/.claude/commands/evolve.md +84 -0
  16. package/.claude/commands/execute.md +76 -0
  17. package/.claude/commands/plan-feature.md +100 -0
  18. package/.claude/commands/plan-project.md +110 -0
  19. package/.claude/commands/prime.md +71 -0
  20. package/.claude/commands/setup.md +81 -0
  21. package/.claude/commands/ship.md +73 -0
  22. package/.claude/commands/start.md +63 -0
  23. package/.claude/commands/validate.md +72 -0
  24. package/.claude/hooks/architect-sync.sh +18 -0
  25. package/.claude/hooks/branch-guard.sh +15 -0
  26. package/.claude/hooks/evolve-reminder.sh +13 -0
  27. package/.claude/hooks/plan-required.sh +20 -0
  28. package/.claude/hooks/session-primer.sh +38 -0
  29. package/.claude/references/claude-md-template.md +90 -0
  30. package/.claude/references/code-patterns.md +37 -0
  31. package/.claude/references/issue-template.md +56 -0
  32. package/.claude/references/plan-template.md +92 -0
  33. package/.claude/references/prd-template.md +119 -0
  34. package/.claude/rules/_global.md +22 -0
  35. package/.claude/rules/_template.md +23 -0
  36. package/.claude/rules/backend.md +29 -0
  37. package/.claude/rules/database.md +28 -0
  38. package/.claude/rules/frontend.md +34 -0
  39. package/.claude/rules/mobile.md +33 -0
  40. package/.claude/rules/testing.md +37 -0
  41. package/.claude/settings.local.json +27 -0
  42. package/.claude/skills/e2e-test/SKILL.md +87 -0
  43. package/.claude/skills/playwright-cli/SKILL.md +97 -0
  44. package/CLAUDE.md +65 -0
  45. package/README.md +83 -0
  46. package/cli/index.js +35 -0
  47. package/cli/init.js +219 -0
  48. package/cli/update.js +120 -0
  49. package/docs/command-reference.md +41 -0
  50. package/docs/customization.md +33 -0
  51. package/docs/getting-started.md +68 -0
  52. package/docs/methodology.md +78 -0
  53. package/docs/plans/2026-03-30-ai-development-framework-design.md +483 -0
  54. package/docs/plugin-install-guide.md +66 -0
  55. package/docs/superpowers/plans/2026-03-30-framework-implementation.md +3462 -0
  56. package/package.json +28 -0
@@ -0,0 +1,3462 @@
1
+ # AIDevelopmentFramework — Full Implementation Plan
2
+
3
+ > **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
4
+
5
+ **Goal:** Create the complete AIDevelopmentFramework — an open-source agentic AI coding framework with PIV+E loop, progressive disclosure, 10 pipeline commands, 4 agent templates, auto-loading rules, hooks, and CLI tool.
6
+
7
+ **Architecture:** Layered pipeline — Layer 1 (commands) drives the user-facing workflow, Layer 2 (agents + skills) provides specialist intelligence, Layer 3 (rules + references) provides auto-loading knowledge. External plugins/skills are installed by the user for latest versions; the framework owns the orchestration.
8
+
9
+ **Tech Stack:** Claude Code CLI (commands, agents, skills, rules, hooks), Node.js (CLI tool), Markdown (all config), Bash (hooks)
10
+
11
+ ---
12
+
13
+ ## File Map
14
+
15
+ ### Root
16
+ - Create: `CLAUDE.md` — Framework root config (~140 lines)
17
+ - Create: `.claude/settings.local.json` — Permission whitelist
18
+ - Create: `package.json` — CLI package definition
19
+ - Create: `README.md` — Project overview
20
+
21
+ ### Rules (.claude/rules/)
22
+ - Create: `.claude/rules/_global.md` — Always-active rules
23
+ - Create: `.claude/rules/backend.md` — Backend domain rules
24
+ - Create: `.claude/rules/frontend.md` — Frontend domain rules
25
+ - Create: `.claude/rules/mobile.md` — Mobile domain rules
26
+ - Create: `.claude/rules/database.md` — Database domain rules
27
+ - Create: `.claude/rules/testing.md` — Testing domain rules
28
+ - Create: `.claude/rules/_template.md` — Custom domain rule scaffold
29
+
30
+ ### References (.claude/references/)
31
+ - Create: `.claude/references/prd-template.md` — PRD structure
32
+ - Create: `.claude/references/plan-template.md` — Implementation plan structure
33
+ - Create: `.claude/references/claude-md-template.md` — CLAUDE.md generation template
34
+ - Create: `.claude/references/issue-template.md` — GitHub issue template
35
+ - Create: `.claude/references/code-patterns.md` — Placeholder for project-specific patterns
36
+
37
+ ### Hooks (.claude/hooks/)
38
+ - Create: `.claude/hooks/branch-guard.sh` — Block commits to main/master
39
+ - Create: `.claude/hooks/plan-required.sh` — Warn if no plan for current branch
40
+ - Create: `.claude/hooks/architect-sync.sh` — Remind to update knowledge base
41
+ - Create: `.claude/hooks/evolve-reminder.sh` — Remind to run /evolve after PR
42
+ - Create: `.claude/hooks/session-primer.sh` — Auto context load on session start
43
+
44
+ ### Agents (.claude/agents/)
45
+ - Create: `.claude/agents/architect-agent/AGENT.md`
46
+ - Create: `.claude/agents/architect-agent/index.md`
47
+ - Create: `.claude/agents/architect-agent/modules/.gitkeep`
48
+ - Create: `.claude/agents/architect-agent/frontend/.gitkeep`
49
+ - Create: `.claude/agents/architect-agent/shared/patterns.md`
50
+ - Create: `.claude/agents/architect-agent/decisions/log.md`
51
+ - Create: `.claude/agents/tester-agent/AGENT.md`
52
+ - Create: `.claude/agents/tester-agent/test-patterns.md`
53
+ - Create: `.claude/agents/tester-agent/auth-state.md`
54
+ - Create: `.claude/agents/mobile-tester-agent/AGENT.md`
55
+ - Create: `.claude/agents/mobile-tester-agent/screen-patterns.md`
56
+ - Create: `.claude/agents/ui-ux-analyzer/AGENT.md`
57
+ - Create: `.claude/agents/_template/AGENT.md`
58
+
59
+ ### Skills (.claude/skills/)
60
+ - Create: `.claude/skills/e2e-test/SKILL.md`
61
+ - Create: `.claude/skills/playwright-cli/SKILL.md`
62
+
63
+ ### Commands (.claude/commands/)
64
+ - Create: `.claude/commands/start.md`
65
+ - Create: `.claude/commands/prime.md`
66
+ - Create: `.claude/commands/create-prd.md`
67
+ - Create: `.claude/commands/plan-project.md`
68
+ - Create: `.claude/commands/plan-feature.md`
69
+ - Create: `.claude/commands/execute.md`
70
+ - Create: `.claude/commands/validate.md`
71
+ - Create: `.claude/commands/ship.md`
72
+ - Create: `.claude/commands/evolve.md`
73
+ - Create: `.claude/commands/setup.md`
74
+
75
+ ### Documentation (docs/)
76
+ - Create: `docs/methodology.md`
77
+ - Create: `docs/getting-started.md`
78
+ - Create: `docs/command-reference.md`
79
+ - Create: `docs/customization.md`
80
+ - Create: `docs/plugin-install-guide.md`
81
+
82
+ ### CLI (cli/)
83
+ - Create: `cli/index.js`
84
+ - Create: `cli/init.js`
85
+
86
+ ---
87
+
88
+ ## Task 1: Root Configuration
89
+
90
+ **Files:**
91
+ - Create: `CLAUDE.md`
92
+ - Create: `.claude/settings.local.json`
93
+
94
+ - [ ] **Step 1: Create CLAUDE.md**
95
+
96
+ ```markdown
97
+ # AIDevelopmentFramework
98
+
99
+ ## Overview
100
+
101
+ Open-source agentic AI coding framework built on the PIV+E loop (Plan, Implement, Validate, Evolve). Claude Code primary, methodology portable to any AI coding tool.
102
+
103
+ ## Tech Stack
104
+
105
+ - Claude Code CLI (commands, agents, skills, rules, hooks)
106
+ - Node.js (CLI tool)
107
+ - GitHub (issues, milestones, PRs)
108
+
109
+ ## Core Principles
110
+
111
+ 1. **Context is precious** — manage it deliberately; recommend context resets for complex work
112
+ 2. **Plans are artifacts** — they survive session boundaries and pass the "no prior knowledge" test
113
+ 3. **Discipline scales with complexity** — XL features get full ceremony, S tweaks get fast-tracked
114
+ 4. **The system self-improves** — every AI mistake becomes a rule, pattern, or guardrail
115
+ 5. **Ship everything, install nothing** — framework works out of the box; external plugins stay fresh from source
116
+
117
+ ## Pipeline Commands (PIV+E)
118
+
119
+ | Command | Phase | Purpose |
120
+ |---------|-------|---------|
121
+ | `/start` | Router | Detects scope level, routes to correct pipeline |
122
+ | `/prime` | Plan | Loads codebase context into session |
123
+ | `/create-prd` | Plan | Generates PRD from idea (includes brainstorming) |
124
+ | `/plan-project` | Plan | Decomposes PRD into GitHub milestones + issues |
125
+ | `/plan-feature` | Plan | Creates detailed implementation plan for a feature |
126
+ | `/execute` | Implement | Executes plan with TDD, domain skills, parallel agents |
127
+ | `/validate` | Validate | Runs verification, testing agents, code review |
128
+ | `/ship` | Validate | Commits, pushes, creates PR, finishes branch |
129
+ | `/evolve` | Evolve | Updates rules and knowledge base from learnings |
130
+ | `/setup` | Utility | Checks installed plugins/skills, reports health |
131
+
132
+ ## Scope Levels
133
+
134
+ - **L0 (Project):** /brainstorm → /create-prd → /plan-project → /create-rules → per-issue L2
135
+ - **L1 (Feature):** /brainstorm → /plan-feature → creates issue(s) → per-issue L2
136
+ - **L2 (Issue):** gh issue view → /prime → /writing-plans → /execute → /validate → /ship
137
+ - **L3 (Bug):** gh issue view → /prime → /systematic-debugging → fix → /validate → /ship
138
+
139
+ ## Mode Selection
140
+
141
+ For non-trivial tasks, choose your discipline level:
142
+
143
+ - **Superpowers Mode:** Full PIV+E pipeline — brainstorm → plan → TDD → execute → verify → review → ship → evolve
144
+ - **Standard Mode:** Lighter workflow — plan → implement → validate → ship
145
+
146
+ ## Agents
147
+
148
+ - **architect-agent** — Codebase knowledge base. Call before structural changes (RETRIEVE/IMPACT/RECORD/PATTERN)
149
+ - **tester-agent** — Web browser testing via playwright-cli (VERIFY/FLOW)
150
+ - **mobile-tester-agent** — Mobile app testing via mobile-mcp (VERIFY/FLOW)
151
+ - **ui-ux-analyzer** — Design audit agent with screenshots and reports
152
+
153
+ ## Rules & References
154
+
155
+ - Domain-specific rules auto-load from `.claude/rules/` based on file paths being edited
156
+ - Reference templates in `.claude/references/` are loaded on-demand by commands
157
+ - See `docs/customization.md` for adding custom rules and agents
158
+
159
+ ## External Dependencies
160
+
161
+ Run `/setup` to check what's installed. See `docs/plugin-install-guide.md` for full list.
162
+ ```
163
+
164
+ - [ ] **Step 2: Create .claude/settings.local.json**
165
+
166
+ ```json
167
+ {
168
+ "permissions": {
169
+ "allow": [
170
+ "Bash(git *)",
171
+ "Bash(gh *)",
172
+ "Bash(ls *)",
173
+ "Bash(tree *)",
174
+ "Bash(cat *)",
175
+ "Bash(mkdir *)",
176
+ "Bash(npx *)",
177
+ "Bash(npm *)",
178
+ "Bash(pnpm *)",
179
+ "Bash(node *)",
180
+ "WebFetch(*)",
181
+ "WebSearch(*)",
182
+ "mcp__plugin_context7_context7__resolve-library-id",
183
+ "mcp__plugin_context7_context7__query-docs",
184
+ "mcp__shadcn__search_items_in_registries",
185
+ "mcp__shadcn__view_items_in_registries",
186
+ "mcp__shadcn__get_item_examples_from_registries",
187
+ "mcp__shadcn__get_add_command_for_items",
188
+ "mcp__shadcn__list_items_in_registries"
189
+ ],
190
+ "deny": []
191
+ },
192
+ "enableAllProjectMcpServers": true
193
+ }
194
+ ```
195
+
196
+ - [ ] **Step 3: Commit**
197
+
198
+ ```bash
199
+ git add CLAUDE.md .claude/settings.local.json
200
+ git commit -m "feat: add root CLAUDE.md and settings configuration"
201
+ ```
202
+
203
+ ---
204
+
205
+ ## Task 2: Rules System
206
+
207
+ **Files:**
208
+ - Create: `.claude/rules/_global.md`
209
+ - Create: `.claude/rules/backend.md`
210
+ - Create: `.claude/rules/frontend.md`
211
+ - Create: `.claude/rules/mobile.md`
212
+ - Create: `.claude/rules/database.md`
213
+ - Create: `.claude/rules/testing.md`
214
+ - Create: `.claude/rules/_template.md`
215
+
216
+ - [ ] **Step 1: Create _global.md**
217
+
218
+ This rule is always active regardless of file context.
219
+
220
+ ```markdown
221
+ # Global Rules
222
+
223
+ ## Git Workflow
224
+
225
+ - Branch naming: `{type}/{description}` (e.g., `feat/user-auth`, `fix/login-redirect`)
226
+ - Conventional commits: `feat:`, `fix:`, `refactor:`, `docs:`, `chore:`, `test:`
227
+ - Always link PRs to GitHub issues
228
+ - Never commit directly to main/master — use feature branches
229
+
230
+ ## Code Standards
231
+
232
+ - TypeScript strict mode where applicable
233
+ - Self-documenting code — comments only for non-obvious logic
234
+ - No unnecessary abstractions or over-engineering (YAGNI)
235
+ - DRY — but three similar lines beats a premature abstraction
236
+
237
+ ## Pipeline Discipline
238
+
239
+ - For non-trivial work: choose Superpowers or Standard mode before starting
240
+ - Plans are mandatory for L/XL tasks — run `/plan-feature` first
241
+ - Run `/validate` before claiming work is done
242
+ - Run `/evolve` after merging to keep the system improving
243
+ ```
244
+
245
+ - [ ] **Step 2: Create backend.md**
246
+
247
+ ```markdown
248
+ ---
249
+ description: Backend development rules — auto-loads when editing backend/server files
250
+ globs: ["**/backend/**", "**/server/**", "**/api/**", "**/*.controller.*", "**/*.service.*", "**/*.module.*", "**/*.guard.*", "**/*.middleware.*", "**/*.resolver.*"]
251
+ ---
252
+
253
+ # Backend Rules
254
+
255
+ ## Skill Chain
256
+
257
+ When working on backend code, follow this order:
258
+ 1. **architect-agent RETRIEVE** — understand current module structure before changes
259
+ 2. **context7 MCP** — verify framework API (NestJS, FastAPI, Express, etc.) before writing
260
+ 3. **Database MCP** — if schema changes needed, use Supabase MCP or direct SQL
261
+ 4. **Implement** — follow patterns from `.claude/references/code-patterns.md`
262
+ 5. **architect-agent RECORD** — update knowledge base after structural changes
263
+
264
+ ## Conventions
265
+
266
+ - Every endpoint needs input validation (DTOs/schemas)
267
+ - Error responses follow consistent format: `{ error: string, statusCode: number }`
268
+ - Business logic lives in services, not controllers
269
+ - Database queries go through a repository/service layer
270
+ - Environment-specific config via env vars, never hardcoded
271
+
272
+ ## Testing
273
+
274
+ - Service methods: unit test with mocked dependencies
275
+ - Controllers: integration test with real service, mocked DB if needed
276
+ - E2E: API endpoint tests with real DB for critical paths
277
+ ```
278
+
279
+ - [ ] **Step 3: Create frontend.md**
280
+
281
+ ```markdown
282
+ ---
283
+ description: Frontend development rules — auto-loads when editing frontend/web files
284
+ globs: ["**/web/**", "**/frontend/**", "**/app/**", "**/*.tsx", "**/*.jsx", "**/components/**", "**/pages/**"]
285
+ ---
286
+
287
+ # Frontend Rules
288
+
289
+ ## Design Skill Gate (MANDATORY)
290
+
291
+ Before creating any UI component or page, ask the user which design approach:
292
+
293
+ 1. **`/frontend-design`** — Full page/component creation with bold aesthetics
294
+ 2. **`/frontend-aesthetics`** — Lightweight guardrails (typography, color, motion)
295
+ 3. **`/ui-ux-pro-max`** — Design planning and exploration (50 styles, 21 palettes)
296
+
297
+ Combination rules:
298
+ - `/frontend-aesthetics` can combine with either of the other two
299
+ - Never combine `/frontend-design` + `/ui-ux-pro-max` — they conflict
300
+
301
+ ## Skill Chain
302
+
303
+ 1. **architect-agent RETRIEVE** — understand page/component structure
304
+ 2. **Design skill** — chosen via gate above
305
+ 3. **shadcn MCP** — search and install components: `search_items_in_registries`, `view_items_in_registries`, `get_add_command_for_items`
306
+ 4. **context7 MCP** — verify framework API (Next.js, React, etc.)
307
+ 5. **tester-agent VERIFY/FLOW** — verify UI after implementation
308
+
309
+ ## Conventions
310
+
311
+ - Functional components with hooks
312
+ - Form handling: React Hook Form + Zod validation
313
+ - State: prefer server state (React Query/SWR) over client state
314
+ - Styling: follow project convention (Tailwind, CSS Modules, etc.)
315
+ - Accessibility: semantic HTML, ARIA labels, keyboard navigation
316
+ ```
317
+
318
+ - [ ] **Step 4: Create mobile.md**
319
+
320
+ ```markdown
321
+ ---
322
+ description: Mobile development rules — auto-loads when editing mobile/native files
323
+ globs: ["**/mobile/**", "**/native/**", "**/*.native.*", "**/expo/**"]
324
+ ---
325
+
326
+ # Mobile Rules
327
+
328
+ ## Expo Skills (use the right one for the task)
329
+
330
+ | Task | Skill |
331
+ |------|-------|
332
+ | Building screens, components, navigation | `/expo-app-design:building-native-ui` |
333
+ | API calls, caching, offline support | `/expo-app-design:native-data-fetching` |
334
+ | Tailwind/NativeWind setup | `/expo-app-design:expo-tailwind-setup` |
335
+ | Dev client builds, TestFlight | `/expo-app-design:expo-dev-client` |
336
+ | API routes with EAS Hosting | `/expo-app-design:expo-api-routes` |
337
+ | Web code in native webview | `/expo-app-design:use-dom` |
338
+ | SwiftUI components | `/expo-app-design:expo-ui-swift-ui` |
339
+ | Jetpack Compose components | `/expo-app-design:expo-ui-jetpack-compose` |
340
+
341
+ ## Skill Chain
342
+
343
+ 1. **architect-agent RETRIEVE** — understand screen/navigation structure
344
+ 2. **Expo skill** — appropriate skill from table above
345
+ 3. **context7 MCP** — verify Expo/React Native API
346
+ 4. **mobile-tester-agent VERIFY/FLOW** — verify on simulator after implementation
347
+
348
+ ## Conventions
349
+
350
+ - Follow Expo Router file-based routing
351
+ - Use platform-specific extensions (`.ios.tsx`, `.android.tsx`) only when necessary
352
+ - Animations via `react-native-reanimated`
353
+ - Navigation state managed by Expo Router, not manually
354
+ ```
355
+
356
+ - [ ] **Step 5: Create database.md**
357
+
358
+ ```markdown
359
+ ---
360
+ description: Database rules — auto-loads when editing migrations, schemas, SQL files
361
+ globs: ["**/migrations/**", "**/*.sql", "**/schema*", "**/prisma/**", "**/drizzle/**", "**/supabase/**"]
362
+ ---
363
+
364
+ # Database Rules
365
+
366
+ ## Skill Chain
367
+
368
+ 1. **Supabase MCP** (if using Supabase): `list_tables` → `execute_sql` → `apply_migration` → `get_advisors`
369
+ 2. **`/supabase-postgres-best-practices`** — for schema design and query optimization
370
+ 3. **`/mongodb`** or **`/mongodb-development`** — if using MongoDB
371
+
372
+ ## Conventions
373
+
374
+ - Every migration is reversible (include up AND down)
375
+ - Never modify existing migrations — always create new ones
376
+ - Add indexes for frequently queried columns
377
+ - Use foreign key constraints for referential integrity
378
+ - RLS policies on all user-facing tables (Supabase)
379
+
380
+ ## Post-DDL Checklist
381
+
382
+ After any schema change:
383
+ - [ ] Run Supabase advisors (`get_advisors`) or equivalent linter
384
+ - [ ] Verify RLS policies still work
385
+ - [ ] Update TypeScript types (`generate_typescript_types` or equivalent)
386
+ - [ ] Update architect-agent knowledge base
387
+ ```
388
+
389
+ - [ ] **Step 6: Create testing.md**
390
+
391
+ ```markdown
392
+ ---
393
+ description: Testing rules — auto-loads when editing test files
394
+ globs: ["**/*.test.*", "**/*.spec.*", "**/test/**", "**/tests/**", "**/__tests__/**", "**/e2e/**"]
395
+ ---
396
+
397
+ # Testing Rules
398
+
399
+ ## Test Naming
400
+
401
+ - Describe behavior, not implementation: `it('returns 404 when user not found')` not `it('tests getUserById')`
402
+ - Group by feature/module with `describe` blocks
403
+
404
+ ## Test Structure
405
+
406
+ - **Arrange** — set up test data and dependencies
407
+ - **Act** — call the function/endpoint under test
408
+ - **Assert** — verify the result
409
+
410
+ ## What to Test
411
+
412
+ - Happy path (expected inputs → expected outputs)
413
+ - Edge cases (empty inputs, boundary values, null/undefined)
414
+ - Error cases (invalid inputs, network failures, permission denied)
415
+ - Do NOT test framework internals or third-party libraries
416
+
417
+ ## Mock Policy
418
+
419
+ - Use real databases for integration tests where possible
420
+ - Mock external APIs and third-party services
421
+ - Never mock the module under test
422
+ - Prefer dependency injection over module mocking
423
+
424
+ ## Coverage
425
+
426
+ - Critical business logic: aim for high coverage
427
+ - UI components: test behavior (clicks, form submissions), not rendering details
428
+ - Don't chase 100% — test what matters
429
+ ```
430
+
431
+ - [ ] **Step 7: Create _template.md**
432
+
433
+ ```markdown
434
+ ---
435
+ description: <Describe when this rule should load>
436
+ globs: ["<glob pattern for file paths>"]
437
+ ---
438
+
439
+ # [Domain] Rules
440
+
441
+ ## Skill Chain
442
+
443
+ 1. <First skill or agent to use>
444
+ 2. <Second skill>
445
+ 3. <Verification step>
446
+
447
+ ## Conventions
448
+
449
+ - <Convention 1>
450
+ - <Convention 2>
451
+ - <Convention 3>
452
+
453
+ ## Checklist
454
+
455
+ - [ ] <Post-implementation check 1>
456
+ - [ ] <Post-implementation check 2>
457
+ ```
458
+
459
+ - [ ] **Step 8: Commit**
460
+
461
+ ```bash
462
+ git add .claude/rules/
463
+ git commit -m "feat: add auto-loading domain rules system (global, backend, frontend, mobile, database, testing)"
464
+ ```
465
+
466
+ ---
467
+
468
+ ## Task 3: Reference Templates
469
+
470
+ **Files:**
471
+ - Create: `.claude/references/prd-template.md`
472
+ - Create: `.claude/references/plan-template.md`
473
+ - Create: `.claude/references/claude-md-template.md`
474
+ - Create: `.claude/references/issue-template.md`
475
+ - Create: `.claude/references/code-patterns.md`
476
+
477
+ - [ ] **Step 1: Create prd-template.md**
478
+
479
+ ```markdown
480
+ # PRD Template
481
+
482
+ Use this structure when generating a PRD via `/create-prd`.
483
+
484
+ ---
485
+
486
+ # [Project Name] — Product Requirements Document
487
+
488
+ ## 1. Executive Summary
489
+
490
+ One paragraph: what is this product, who is it for, what problem does it solve.
491
+
492
+ ## 2. Problem Statement
493
+
494
+ - What pain point exists today?
495
+ - Who experiences it?
496
+ - What are they currently doing instead?
497
+
498
+ ## 3. Goals & Success Criteria
499
+
500
+ | Goal | Metric | Target |
501
+ |------|--------|--------|
502
+ | | | |
503
+
504
+ ## 4. Target Users
505
+
506
+ | Persona | Description | Key Needs |
507
+ |---------|-------------|-----------|
508
+ | | | |
509
+
510
+ ## 5. User Stories
511
+
512
+ ### Epic: [Epic Name]
513
+
514
+ - [ ] As a [user], I want to [action] so that [benefit]
515
+ - [ ] As a [user], I want to [action] so that [benefit]
516
+
517
+ ### Epic: [Epic Name]
518
+
519
+ - [ ] ...
520
+
521
+ ## 6. Scope
522
+
523
+ ### In Scope (MVP)
524
+
525
+ - [x] Feature 1
526
+ - [x] Feature 2
527
+
528
+ ### Out of Scope (Future)
529
+
530
+ - [ ] Feature 3
531
+ - [ ] Feature 4
532
+
533
+ ## 7. Technical Architecture
534
+
535
+ ### Tech Stack
536
+
537
+ | Layer | Technology | Rationale |
538
+ |-------|-----------|-----------|
539
+ | Frontend | | |
540
+ | Backend | | |
541
+ | Database | | |
542
+ | Auth | | |
543
+ | Hosting | | |
544
+
545
+ ### System Diagram
546
+
547
+ Describe the high-level architecture: which services exist, how they communicate, where data lives.
548
+
549
+ ## 8. Data Model
550
+
551
+ List core entities, their key fields, and relationships.
552
+
553
+ ## 9. API Design
554
+
555
+ List key endpoints or API surface area.
556
+
557
+ | Method | Endpoint | Purpose |
558
+ |--------|----------|---------|
559
+ | | | |
560
+
561
+ ## 10. UI/UX Overview
562
+
563
+ Describe key screens/pages and user flows. Reference wireframes if available.
564
+
565
+ ## 11. Implementation Phases
566
+
567
+ ### Phase 1: Foundation (MVP)
568
+ - ...
569
+
570
+ ### Phase 2: Enhancement
571
+ - ...
572
+
573
+ ### Phase 3: Scale
574
+ - ...
575
+
576
+ ## 12. Security Considerations
577
+
578
+ - Authentication method
579
+ - Authorization model
580
+ - Data protection
581
+ - OWASP concerns
582
+
583
+ ## 13. Performance Requirements
584
+
585
+ - Response time targets
586
+ - Concurrent user capacity
587
+ - Data volume expectations
588
+
589
+ ## 14. Risks & Mitigations
590
+
591
+ | Risk | Impact | Likelihood | Mitigation |
592
+ |------|--------|-----------|------------|
593
+ | | | | |
594
+
595
+ ## 15. Open Questions
596
+
597
+ - [ ] Question 1
598
+ - [ ] Question 2
599
+ ```
600
+
601
+ - [ ] **Step 2: Create plan-template.md**
602
+
603
+ ```markdown
604
+ # Implementation Plan Template
605
+
606
+ Use this structure when generating plans via `/plan-feature`.
607
+
608
+ ---
609
+
610
+ # [Feature Name] Implementation Plan
611
+
612
+ > **For agentic workers:** Use superpowers:subagent-driven-development or superpowers:executing-plans to implement this plan task-by-task.
613
+
614
+ **Goal:** [One sentence]
615
+
616
+ **Architecture:** [2-3 sentences about approach]
617
+
618
+ **Tech Stack:** [Key technologies]
619
+
620
+ **Confidence Score:** [1-10] for one-pass implementation success
621
+
622
+ **Context Reset:** [Recommended / Not needed] between planning and implementation
623
+
624
+ ---
625
+
626
+ ## Mandatory Reading
627
+
628
+ Before implementing, read these files to understand the codebase context:
629
+
630
+ | File | Lines | What to Learn |
631
+ |------|-------|--------------|
632
+ | `path/to/file` | 1-50 | Pattern for X |
633
+
634
+ ## File Map
635
+
636
+ ### New Files
637
+ | File | Responsibility |
638
+ |------|---------------|
639
+ | `path/to/new/file` | Description |
640
+
641
+ ### Modified Files
642
+ | File | Changes |
643
+ |------|---------|
644
+ | `path/to/existing` | What changes and why |
645
+
646
+ ## Dependencies
647
+
648
+ Install before starting:
649
+ ```bash
650
+ <install commands if any>
651
+ ```
652
+
653
+ ## Tasks
654
+
655
+ ### Task 1: [Component Name]
656
+
657
+ **Files:**
658
+ - Create: `exact/path/to/file`
659
+ - Modify: `exact/path/to/existing:lines`
660
+ - Test: `tests/exact/path/to/test`
661
+
662
+ - [ ] Step 1: Write the failing test
663
+ ```language
664
+ <actual test code>
665
+ ```
666
+
667
+ - [ ] Step 2: Run test to verify it fails
668
+ Run: `<exact command>`
669
+ Expected: FAIL with "<message>"
670
+
671
+ - [ ] Step 3: Write minimal implementation
672
+ ```language
673
+ <actual implementation code>
674
+ ```
675
+
676
+ - [ ] Step 4: Run test to verify it passes
677
+ Run: `<exact command>`
678
+ Expected: PASS
679
+
680
+ - [ ] Step 5: Commit
681
+ ```bash
682
+ git add <files>
683
+ git commit -m "<conventional commit message>"
684
+ ```
685
+
686
+ ### Task 2: ...
687
+
688
+ ## Acceptance Criteria
689
+
690
+ - [ ] Criterion 1
691
+ - [ ] Criterion 2
692
+
693
+ ## GOTCHA Warnings
694
+
695
+ - **GOTCHA:** [Specific pitfall and how to avoid it]
696
+ ```
697
+
698
+ - [ ] **Step 3: Create claude-md-template.md**
699
+
700
+ ```markdown
701
+ # CLAUDE.md Generation Template
702
+
703
+ Used by `/create-rules` to auto-generate a project CLAUDE.md.
704
+ Fill in sections based on codebase analysis.
705
+
706
+ ---
707
+
708
+ # [Project Name]
709
+
710
+ ## Overview
711
+
712
+ [Auto-generated: 1-2 sentences about the project, detected from README/package.json]
713
+
714
+ ## Tech Stack
715
+
716
+ [Auto-detected from package.json, requirements.txt, go.mod, etc.]
717
+
718
+ | Layer | Technology |
719
+ |-------|-----------|
720
+ | Language | |
721
+ | Framework | |
722
+ | Database | |
723
+ | ORM | |
724
+ | Auth | |
725
+ | Styling | |
726
+ | Testing | |
727
+ | Package Manager | |
728
+
729
+ ## Pipeline Commands (PIV+E)
730
+
731
+ | Command | Phase | Purpose |
732
+ |---------|-------|---------|
733
+ | `/start` | Router | Detects scope level, routes to correct pipeline |
734
+ | `/prime` | Plan | Loads codebase context |
735
+ | `/create-prd` | Plan | Generates PRD (includes brainstorming) |
736
+ | `/plan-project` | Plan | PRD → GitHub milestones + issues |
737
+ | `/plan-feature` | Plan | Creates implementation plan |
738
+ | `/execute` | Implement | Executes plan with TDD |
739
+ | `/validate` | Validate | Verification + testing agents |
740
+ | `/ship` | Validate | Commit + push + PR |
741
+ | `/evolve` | Evolve | Updates rules + knowledge base |
742
+ | `/setup` | Utility | Checks plugin/skill health |
743
+
744
+ ## Project Structure
745
+
746
+ [Auto-generated: tree -L 2 output of key directories]
747
+
748
+ ```
749
+ project/
750
+ ├── src/ # [detected purpose]
751
+ ├── tests/ # [detected purpose]
752
+ └── ...
753
+ ```
754
+
755
+ ## Development Commands
756
+
757
+ [Auto-detected from package.json scripts, Makefile, etc.]
758
+
759
+ ```bash
760
+ # Start development
761
+ <detected dev command>
762
+
763
+ # Run tests
764
+ <detected test command>
765
+
766
+ # Build
767
+ <detected build command>
768
+ ```
769
+
770
+ ## Code Conventions
771
+
772
+ [Auto-detected from codebase analysis]
773
+
774
+ - [Naming convention: camelCase/snake_case/etc.]
775
+ - [Import style: absolute/relative]
776
+ - [Component pattern: functional/class]
777
+ - [Error handling pattern]
778
+
779
+ ## Agents
780
+
781
+ - **architect-agent** — Call before structural changes (RETRIEVE/IMPACT/RECORD/PATTERN)
782
+ - **tester-agent** — Web UI testing after changes (VERIFY/FLOW)
783
+ - **mobile-tester-agent** — Mobile testing after changes (VERIFY/FLOW)
784
+ - **ui-ux-analyzer** — Design audits on request
785
+
786
+ ## Rules & References
787
+
788
+ - Domain rules auto-load from `.claude/rules/` based on file paths
789
+ - Code patterns in `.claude/references/code-patterns.md`
790
+ - See `docs/customization.md` for extending the framework
791
+ ```
792
+
793
+ - [ ] **Step 4: Create issue-template.md**
794
+
795
+ ```markdown
796
+ # GitHub Issue Template
797
+
798
+ Used by `/plan-project` and `/plan-feature` to create structured issues.
799
+
800
+ ---
801
+
802
+ ## Issue Structure
803
+
804
+ ### Title Format
805
+ `[type]: brief description`
806
+
807
+ Types: `feat`, `fix`, `refactor`, `docs`, `chore`, `test`
808
+
809
+ ### Body Template
810
+
811
+ ```markdown
812
+ ## Description
813
+
814
+ [1-2 sentences: what needs to be built/fixed and why]
815
+
816
+ ## Acceptance Criteria
817
+
818
+ - [ ] Criterion 1
819
+ - [ ] Criterion 2
820
+ - [ ] Criterion 3
821
+
822
+ ## Technical Notes
823
+
824
+ - Key files to modify: `path/to/file`
825
+ - Pattern to follow: [reference existing similar implementation]
826
+ - Dependencies: [other issues that must be completed first]
827
+
828
+ ## Size Estimate
829
+
830
+ [S / M / L / XL]
831
+
832
+ - **S** (< 1 hour): Config change, copy update, simple fix
833
+ - **M** (1-4 hours): Single component/endpoint, moderate logic
834
+ - **L** (4-16 hours): Multi-file feature, new module
835
+ - **XL** (> 16 hours): Consider breaking into smaller issues
836
+ ```
837
+
838
+ ### Labels
839
+
840
+ Apply these labels via `gh issue create --label`:
841
+
842
+ | Label | When |
843
+ |-------|------|
844
+ | `feat` | New functionality |
845
+ | `fix` | Bug fix |
846
+ | `refactor` | Code improvement, no behavior change |
847
+ | `docs` | Documentation only |
848
+ | `priority:high` | Blocks other work or critical path |
849
+ | `priority:medium` | Important but not blocking |
850
+ | `priority:low` | Nice to have |
851
+ | `size:S/M/L/XL` | Estimated effort |
852
+ ```
853
+
854
+ - [ ] **Step 5: Create code-patterns.md**
855
+
856
+ ```markdown
857
+ # Code Patterns
858
+
859
+ This file is generated per-project by `/create-rules`. It contains real code patterns detected from your codebase.
860
+
861
+ Run `/create-rules` to populate this file with patterns from your actual code.
862
+
863
+ ## How This File Works
864
+
865
+ When `/create-rules` scans your codebase, it extracts:
866
+
867
+ 1. **Controller/Route patterns** — how endpoints are structured
868
+ 2. **Service/business logic patterns** — how business logic is organized
869
+ 3. **Data access patterns** — how database queries are written
870
+ 4. **Component patterns** — how UI components are structured
871
+ 5. **Form patterns** — how forms and validation work
872
+ 6. **Error handling patterns** — how errors are caught and reported
873
+ 7. **Test patterns** — how tests are structured
874
+ 8. **Common pitfalls** — mistakes specific to your codebase
875
+
876
+ Each pattern includes a real code example from your project, so the AI follows YOUR conventions, not generic ones.
877
+
878
+ ## Template
879
+
880
+ When populating, use this format per pattern:
881
+
882
+ ### [Pattern Name]
883
+
884
+ **File:** `path/to/example.ts`
885
+ **When:** [When to use this pattern]
886
+
887
+ ```language
888
+ // Actual code from the project
889
+ ```
890
+
891
+ **Key points:**
892
+ - [What makes this pattern important]
893
+ - [Common mistake to avoid]
894
+ ```
895
+
896
+ - [ ] **Step 6: Commit**
897
+
898
+ ```bash
899
+ git add .claude/references/
900
+ git commit -m "feat: add reference templates (PRD, plan, CLAUDE.md, issue, code patterns)"
901
+ ```
902
+
903
+ ---
904
+
905
+ ## Task 4: Hooks
906
+
907
+ **Files:**
908
+ - Create: `.claude/hooks/branch-guard.sh`
909
+ - Create: `.claude/hooks/plan-required.sh`
910
+ - Create: `.claude/hooks/architect-sync.sh`
911
+ - Create: `.claude/hooks/evolve-reminder.sh`
912
+ - Create: `.claude/hooks/session-primer.sh`
913
+
914
+ - [ ] **Step 1: Create branch-guard.sh**
915
+
916
+ ```bash
917
+ #!/bin/bash
918
+ # Hook: PreToolUse on Bash
919
+ # Purpose: Prevents direct commits and pushes to main/master
920
+ # Behavior: BLOCK
921
+
922
+ COMMAND="$*"
923
+
924
+ if echo "$COMMAND" | grep -qE 'git (commit|push).*(main|master)'; then
925
+ echo "BLOCKED: Direct commits/pushes to main/master are not allowed."
926
+ echo "Create a feature branch first: git checkout -b feat/your-feature"
927
+ echo "Then use /ship to commit, push, and create a PR."
928
+ exit 1
929
+ fi
930
+
931
+ exit 0
932
+ ```
933
+
934
+ - [ ] **Step 2: Create plan-required.sh**
935
+
936
+ ```bash
937
+ #!/bin/bash
938
+ # Hook: PreToolUse on Edit/Write (implementation files only)
939
+ # Purpose: Warns if no plan file exists for the current branch
940
+ # Behavior: WARN (does not block)
941
+
942
+ BRANCH=$(git branch --show-current 2>/dev/null)
943
+
944
+ if [ -z "$BRANCH" ] || [ "$BRANCH" = "main" ] || [ "$BRANCH" = "master" ]; then
945
+ exit 0
946
+ fi
947
+
948
+ PLAN_EXISTS=$(find docs/plans docs/superpowers/plans -name "*.md" 2>/dev/null | head -1)
949
+
950
+ if [ -z "$PLAN_EXISTS" ]; then
951
+ echo "NOTE: No implementation plan found for this branch."
952
+ echo "For L/XL tasks, consider running /plan-feature first."
953
+ echo "For small tasks, this is fine — carry on."
954
+ fi
955
+
956
+ exit 0
957
+ ```
958
+
959
+ - [ ] **Step 3: Create architect-sync.sh**
960
+
961
+ ```bash
962
+ #!/bin/bash
963
+ # Hook: PostToolUse on Write/Edit
964
+ # Purpose: Reminds to update architect-agent after structural changes
965
+ # Behavior: REMIND
966
+
967
+ FILE="$1"
968
+
969
+ if echo "$FILE" | grep -qE '\.(module|controller|service|guard|middleware|resolver)\.(ts|js)$'; then
970
+ echo "REMINDER: Structural file changed. After completing this feature,"
971
+ echo "run architect-agent RECORD to update the codebase knowledge base."
972
+ fi
973
+
974
+ if echo "$FILE" | grep -qE '(migration|schema|\.sql)'; then
975
+ echo "REMINDER: Database schema changed. Run architect-agent RECORD"
976
+ echo "and check Supabase advisors (get_advisors) for security/performance."
977
+ fi
978
+
979
+ exit 0
980
+ ```
981
+
982
+ - [ ] **Step 4: Create evolve-reminder.sh**
983
+
984
+ ```bash
985
+ #!/bin/bash
986
+ # Hook: Stop (after PR-related commands)
987
+ # Purpose: Reminds to run /evolve after merging
988
+ # Behavior: REMIND
989
+
990
+ echo ""
991
+ echo "If you just merged a PR, run /evolve to:"
992
+ echo " - Update CLAUDE.md with learnings from this session"
993
+ echo " - Update architect-agent knowledge base"
994
+ echo " - Improve the system for next time"
995
+ echo ""
996
+
997
+ exit 0
998
+ ```
999
+
1000
+ - [ ] **Step 5: Create session-primer.sh**
1001
+
1002
+ ```bash
1003
+ #!/bin/bash
1004
+ # Hook: Notification (session start)
1005
+ # Purpose: Shows quick context on session start
1006
+ # Behavior: INFORM
1007
+
1008
+ echo "=== Session Context ==="
1009
+
1010
+ BRANCH=$(git branch --show-current 2>/dev/null)
1011
+ if [ -n "$BRANCH" ]; then
1012
+ echo "Branch: $BRANCH"
1013
+ fi
1014
+
1015
+ RECENT=$(git log --oneline -3 2>/dev/null)
1016
+ if [ -n "$RECENT" ]; then
1017
+ echo ""
1018
+ echo "Recent commits:"
1019
+ echo "$RECENT"
1020
+ fi
1021
+
1022
+ if [ -n "$BRANCH" ] && [ "$BRANCH" != "main" ] && [ "$BRANCH" != "master" ]; then
1023
+ PLANS=$(find docs/plans docs/superpowers/plans -name "*.md" -newer .git/HEAD 2>/dev/null | head -3)
1024
+ if [ -n "$PLANS" ]; then
1025
+ echo ""
1026
+ echo "Active plans:"
1027
+ echo "$PLANS"
1028
+ fi
1029
+ fi
1030
+
1031
+ STATUS=$(git status --short 2>/dev/null | wc -l | tr -d ' ')
1032
+ if [ "$STATUS" != "0" ]; then
1033
+ echo ""
1034
+ echo "Uncommitted changes: $STATUS files"
1035
+ fi
1036
+
1037
+ echo "========================"
1038
+ echo "Run /start to begin or /prime for full context."
1039
+
1040
+ exit 0
1041
+ ```
1042
+
1043
+ - [ ] **Step 6: Make hooks executable and commit**
1044
+
1045
+ ```bash
1046
+ chmod +x .claude/hooks/*.sh
1047
+ git add .claude/hooks/
1048
+ git commit -m "feat: add pipeline hooks (branch-guard, plan-required, architect-sync, evolve-reminder, session-primer)"
1049
+ ```
1050
+
1051
+ ---
1052
+
1053
+ ## Task 5: Architect Agent
1054
+
1055
+ **Files:**
1056
+ - Create: `.claude/agents/architect-agent/AGENT.md`
1057
+ - Create: `.claude/agents/architect-agent/index.md`
1058
+ - Create: `.claude/agents/architect-agent/modules/.gitkeep`
1059
+ - Create: `.claude/agents/architect-agent/frontend/.gitkeep`
1060
+ - Create: `.claude/agents/architect-agent/shared/patterns.md`
1061
+ - Create: `.claude/agents/architect-agent/decisions/log.md`
1062
+
1063
+ - [ ] **Step 1: Create AGENT.md**
1064
+
1065
+ ```markdown
1066
+ # Architect Agent
1067
+
1068
+ Project architecture knowledge base. Call before creating/modifying modules, routes, DB tables, or endpoints.
1069
+
1070
+ ## Query Types
1071
+
1072
+ ### RETRIEVE domain:<area>
1073
+ Returns: file map, endpoints, DB tables, integration points, gotchas for the specified domain.
1074
+ Read `index.md` to find the right domain file, then read that file.
1075
+
1076
+ ### IMPACT
1077
+ Analyzes what a planned change will affect.
1078
+ Read relevant domain files, trace dependencies, report:
1079
+ - Files that will need changes
1080
+ - Other modules that integrate with this area
1081
+ - Database tables affected
1082
+ - Potential breaking changes
1083
+ - Patterns to follow (from shared/patterns.md)
1084
+
1085
+ ### RECORD domain:<area>
1086
+ Main agent reports that changes were made. Verify the changes exist, then update the relevant domain file and index.md.
1087
+ - Use Glob and Grep to verify new files/endpoints exist
1088
+ - Update the domain knowledge file with new information
1089
+ - Add a decision to decisions/log.md if this was an architectural choice
1090
+
1091
+ ### PATTERN
1092
+ Returns established conventions from shared/patterns.md.
1093
+ Read the patterns file and return relevant conventions.
1094
+
1095
+ ## Tools
1096
+
1097
+ - Read, Glob, Grep — for codebase exploration
1098
+ - Edit, Write — for updating knowledge base files
1099
+
1100
+ ## Response Format
1101
+
1102
+ - Max ~30 lines per response
1103
+ - Structured: use tables and bullet lists
1104
+ - Include file paths with line numbers where relevant
1105
+ - Flag GOTCHA warnings for known pitfalls
1106
+
1107
+ ## Knowledge Base Structure
1108
+
1109
+ ```
1110
+ architect-agent/
1111
+ ├── index.md ← TOC: lists all domains with brief descriptions
1112
+ ├── modules/ ← One file per backend module/domain
1113
+ ├── frontend/ ← Frontend-specific knowledge (routes, components)
1114
+ ├── shared/
1115
+ │ └── patterns.md ← Cross-cutting conventions and patterns
1116
+ └── decisions/
1117
+ └── log.md ← Architecture decision records
1118
+ ```
1119
+
1120
+ ## Initialization
1121
+
1122
+ When first set up for a project, the main agent should:
1123
+ 1. Run /prime to understand the codebase
1124
+ 2. Use RECORD to populate initial domain files from codebase exploration
1125
+ 3. The knowledge base grows organically as RECORD queries accumulate
1126
+ ```
1127
+
1128
+ - [ ] **Step 2: Create index.md**
1129
+
1130
+ ```markdown
1131
+ # Architecture Knowledge Base — Index
1132
+
1133
+ This file is the table of contents for the architect-agent knowledge base.
1134
+ It is populated by RECORD queries as the project evolves.
1135
+
1136
+ ## How to Use
1137
+
1138
+ - **RETRIEVE domain:X** — Look up domain X below, read the linked file
1139
+ - **IMPACT** — Read relevant domains, trace dependencies
1140
+ - **RECORD domain:X** — After changes, update the linked file
1141
+ - **PATTERN** — Read `shared/patterns.md`
1142
+
1143
+ ## Domains
1144
+
1145
+ > This section is populated as the project grows. Run architect-agent RECORD to add domains.
1146
+
1147
+ | Domain | File | Description |
1148
+ |--------|------|-------------|
1149
+ | _example_ | `modules/example.md` | _Example: authentication module — endpoints, guards, strategies_ |
1150
+
1151
+ ## Frontend
1152
+
1153
+ | Area | File | Description |
1154
+ |------|------|-------------|
1155
+ | _example_ | `frontend/routes.md` | _Example: route map and page inventory_ |
1156
+
1157
+ ## Shared
1158
+
1159
+ | Resource | File |
1160
+ |----------|------|
1161
+ | Cross-cutting patterns | `shared/patterns.md` |
1162
+ | Architecture decisions | `decisions/log.md` |
1163
+ ```
1164
+
1165
+ - [ ] **Step 3: Create shared/patterns.md**
1166
+
1167
+ ```markdown
1168
+ # Cross-Cutting Patterns
1169
+
1170
+ Conventions that apply across all domains. Updated by architect-agent RECORD and /evolve.
1171
+
1172
+ ## Naming Conventions
1173
+
1174
+ > Populated by /create-rules when it analyzes the codebase.
1175
+
1176
+ ## File Organization
1177
+
1178
+ > Populated by /create-rules when it analyzes the codebase.
1179
+
1180
+ ## Error Handling
1181
+
1182
+ > Populated by /create-rules when it analyzes the codebase.
1183
+
1184
+ ## API Design
1185
+
1186
+ > Populated by /create-rules when it analyzes the codebase.
1187
+ ```
1188
+
1189
+ - [ ] **Step 4: Create decisions/log.md**
1190
+
1191
+ ```markdown
1192
+ # Architecture Decision Log
1193
+
1194
+ Records of significant architectural choices and their rationale.
1195
+ Added by architect-agent RECORD when structural decisions are made.
1196
+
1197
+ ## Format
1198
+
1199
+ ### ADR-NNN: [Decision Title]
1200
+
1201
+ **Date:** YYYY-MM-DD
1202
+ **Status:** Accepted / Superseded by ADR-XXX
1203
+ **Context:** Why was this decision needed?
1204
+ **Decision:** What was decided?
1205
+ **Consequences:** What are the implications (positive and negative)?
1206
+
1207
+ ---
1208
+
1209
+ > No decisions recorded yet. Decisions are added as the project evolves.
1210
+ ```
1211
+
1212
+ - [ ] **Step 5: Create .gitkeep files and commit**
1213
+
1214
+ ```bash
1215
+ touch .claude/agents/architect-agent/modules/.gitkeep
1216
+ touch .claude/agents/architect-agent/frontend/.gitkeep
1217
+ git add .claude/agents/architect-agent/
1218
+ git commit -m "feat: add architect-agent with knowledge base structure"
1219
+ ```
1220
+
1221
+ ---
1222
+
1223
+ ## Task 6: Tester Agent
1224
+
1225
+ **Files:**
1226
+ - Create: `.claude/agents/tester-agent/AGENT.md`
1227
+ - Create: `.claude/agents/tester-agent/test-patterns.md`
1228
+ - Create: `.claude/agents/tester-agent/auth-state.md`
1229
+
1230
+ - [ ] **Step 1: Create AGENT.md**
1231
+
1232
+ ```markdown
1233
+ # Tester Agent
1234
+
1235
+ Browser testing agent. Runs playwright-cli to verify web UI renders correctly and user flows work. Reports concise pass/fail results.
1236
+
1237
+ ## Query Types
1238
+
1239
+ ### VERIFY page:<path> Checks: <list>
1240
+ Spot-checks on a single page. Navigate to the page, verify each check.
1241
+
1242
+ Example:
1243
+ ```
1244
+ VERIFY page:/dashboard Checks: renders heading, shows user name, sidebar has 5 links
1245
+ ```
1246
+
1247
+ ### FLOW: <scenario> Steps: 1. ... 2. ...
1248
+ Multi-step user journey. Execute steps in order, verify each one.
1249
+
1250
+ Example:
1251
+ ```
1252
+ FLOW: User login Steps: 1. Navigate to /login 2. Fill email and password 3. Click submit 4. Verify redirected to /dashboard
1253
+ ```
1254
+
1255
+ ## Tools
1256
+
1257
+ - **Bash** — run playwright-cli commands
1258
+ - **Read** — read test-patterns.md and auth-state.md
1259
+
1260
+ ## Setup
1261
+
1262
+ 1. Read `test-patterns.md` to understand the page inventory
1263
+ 2. Read `auth-state.md` for login credentials if testing authenticated pages
1264
+ 3. Launch browser: `npx playwright-cli open <base-url>`
1265
+
1266
+ ## Configuration
1267
+
1268
+ - **Base URL:** Read from test-patterns.md (default: http://localhost:3000)
1269
+ - **Dev command:** Read from test-patterns.md
1270
+
1271
+ ## Response Format
1272
+
1273
+ - Max ~20 lines per response
1274
+ - PASS or FAIL per check
1275
+ - On FAIL: include screenshot and brief description of what went wrong
1276
+ - On PASS: one-line confirmation, no screenshot
1277
+ ```
1278
+
1279
+ - [ ] **Step 2: Create test-patterns.md**
1280
+
1281
+ ```markdown
1282
+ # Test Patterns
1283
+
1284
+ Page inventory and common test patterns for the tester-agent.
1285
+ Populated by /create-rules and updated by /evolve.
1286
+
1287
+ ## Configuration
1288
+
1289
+ - **Base URL:** http://localhost:3000
1290
+ - **Dev command:** `npm run dev`
1291
+ - **Auth required:** Yes/No
1292
+
1293
+ ## Page Inventory
1294
+
1295
+ > Populated when /create-rules scans the project's routes/pages.
1296
+
1297
+ | Route | Auth Required | Key Elements |
1298
+ |-------|--------------|-------------|
1299
+ | `/` | No | Hero section, navigation |
1300
+ | `/login` | No | Email field, password field, submit button |
1301
+ | `/dashboard` | Yes | User greeting, sidebar, main content |
1302
+
1303
+ ## Common UI Elements
1304
+
1305
+ > Populated when /create-rules detects component patterns.
1306
+
1307
+ - Navigation: [describe nav pattern]
1308
+ - Forms: [describe form pattern]
1309
+ - Modals: [describe modal pattern]
1310
+ - Tables: [describe table pattern]
1311
+
1312
+ ## Form Patterns
1313
+
1314
+ > Populated from codebase analysis.
1315
+
1316
+ | Form | Route | Fields | Validation |
1317
+ |------|-------|--------|------------|
1318
+ ```
1319
+
1320
+ - [ ] **Step 3: Create auth-state.md**
1321
+
1322
+ ```markdown
1323
+ # Auth State
1324
+
1325
+ Test credentials for the tester-agent. Fill in when setting up the project.
1326
+
1327
+ ## Test User
1328
+
1329
+ - **Email:** test@example.com
1330
+ - **Password:** testpassword123
1331
+
1332
+ ## Login Flow
1333
+
1334
+ 1. Navigate to `/login`
1335
+ 2. Fill email field
1336
+ 3. Fill password field
1337
+ 4. Click submit button
1338
+ 5. Wait for redirect to `/dashboard`
1339
+
1340
+ ## Session Management
1341
+
1342
+ - Auth state is stored in browser cookies/localStorage
1343
+ - If session expires, re-run the login flow above
1344
+ - For persistent state, save browser state after login
1345
+ ```
1346
+
1347
+ - [ ] **Step 4: Commit**
1348
+
1349
+ ```bash
1350
+ git add .claude/agents/tester-agent/
1351
+ git commit -m "feat: add tester-agent with test patterns and auth state templates"
1352
+ ```
1353
+
1354
+ ---
1355
+
1356
+ ## Task 7: Mobile Tester Agent
1357
+
1358
+ **Files:**
1359
+ - Create: `.claude/agents/mobile-tester-agent/AGENT.md`
1360
+ - Create: `.claude/agents/mobile-tester-agent/screen-patterns.md`
1361
+
1362
+ - [ ] **Step 1: Create AGENT.md**
1363
+
1364
+ ```markdown
1365
+ # Mobile Tester Agent
1366
+
1367
+ Mobile app testing agent. Uses mobile-mcp tools to test Expo/React Native apps on iOS simulator. Reports concise pass/fail results.
1368
+
1369
+ ## Query Types
1370
+
1371
+ ### VERIFY screen:<ScreenName> Checks: <list>
1372
+ Spot-checks on a single screen.
1373
+
1374
+ Example:
1375
+ ```
1376
+ VERIFY screen:HomeScreen Checks: renders header, shows tab bar, lists 3 items
1377
+ ```
1378
+
1379
+ ### FLOW: <scenario> Steps: 1. ... 2. ...
1380
+ Multi-step user journey on mobile.
1381
+
1382
+ Example:
1383
+ ```
1384
+ FLOW: Add item Steps: 1. Tap + button 2. Fill title field 3. Tap save 4. Verify item appears in list
1385
+ ```
1386
+
1387
+ ## Tools
1388
+
1389
+ - **mobile-mcp tools:** mobile_list_available_devices, mobile_launch_app, mobile_take_screenshot, mobile_click_on_screen_at_coordinates, mobile_type_keys, mobile_swipe_on_screen, mobile_press_button, mobile_list_elements_on_screen
1390
+ - **Read** — read screen-patterns.md and auth-state.md
1391
+
1392
+ ## App Launch Sequence
1393
+
1394
+ 1. `mobile_list_available_devices` — find booted iOS simulator
1395
+ 2. `mobile_launch_app` or `mobile_open_url` with Expo URL
1396
+ 3. `mobile_take_screenshot` — verify app loaded
1397
+ 4. If login required: read `../tester-agent/auth-state.md` and authenticate
1398
+
1399
+ ## Response Format
1400
+
1401
+ - Max ~20 lines per response
1402
+ - PASS or FAIL per check
1403
+ - On FAIL: include screenshot and brief description
1404
+ - On PASS: one-line confirmation, no screenshot
1405
+
1406
+ ## Navigation
1407
+
1408
+ - **Tab bar:** Tap coordinates from screen-patterns.md
1409
+ - **Back:** `mobile_swipe_on_screen` from left edge or tap back button
1410
+ - **Scroll:** `mobile_swipe_on_screen` vertical
1411
+ ```
1412
+
1413
+ - [ ] **Step 2: Create screen-patterns.md**
1414
+
1415
+ ```markdown
1416
+ # Screen Patterns
1417
+
1418
+ Screen inventory and navigation patterns for the mobile-tester-agent.
1419
+ Populated by /create-rules and updated by /evolve.
1420
+
1421
+ ## Configuration
1422
+
1423
+ - **App URL:** exp://localhost:8081
1424
+ - **Dev command:** `npx expo start`
1425
+ - **Platform:** iOS Simulator
1426
+
1427
+ ## Navigation Structure
1428
+
1429
+ > Populated when /create-rules scans the mobile app's routing.
1430
+
1431
+ ### Tab Bar
1432
+ | Tab | Screen | Icon Position (approx) |
1433
+ |-----|--------|----------------------|
1434
+ | Home | HomeScreen | Bottom-left |
1435
+ | Search | SearchScreen | Bottom-center-left |
1436
+ | Profile | ProfileScreen | Bottom-right |
1437
+
1438
+ ### Stack Screens
1439
+ | Parent | Screen | Trigger |
1440
+ |--------|--------|---------|
1441
+ | Home | DetailScreen | Tap list item |
1442
+
1443
+ ## Screen Inventory
1444
+
1445
+ > Populated when /create-rules scans the mobile app's screens.
1446
+
1447
+ | Screen | Auth Required | Key Elements |
1448
+ |--------|--------------|-------------|
1449
+ | HomeScreen | No | Header, list, tab bar |
1450
+ | LoginScreen | No | Email field, password field, submit |
1451
+ | ProfileScreen | Yes | Avatar, name, settings list |
1452
+
1453
+ ## Common Patterns
1454
+
1455
+ - **Pull to refresh:** Swipe down from top of list
1456
+ - **Infinite scroll:** Swipe up at bottom of list
1457
+ - **Modal dismiss:** Swipe down from modal header or tap X
1458
+ ```
1459
+
1460
+ - [ ] **Step 3: Commit**
1461
+
1462
+ ```bash
1463
+ git add .claude/agents/mobile-tester-agent/
1464
+ git commit -m "feat: add mobile-tester-agent with screen patterns template"
1465
+ ```
1466
+
1467
+ ---
1468
+
1469
+ ## Task 8: UI/UX Analyzer Agent + Agent Template
1470
+
1471
+ **Files:**
1472
+ - Create: `.claude/agents/ui-ux-analyzer/AGENT.md`
1473
+ - Create: `.claude/agents/_template/AGENT.md`
1474
+
1475
+ - [ ] **Step 1: Create ui-ux-analyzer AGENT.md**
1476
+
1477
+ ```markdown
1478
+ # UI/UX Analyzer Agent
1479
+
1480
+ Professional UI/UX audit agent. Discovers pages, captures full-page screenshots (desktop and mobile viewports), analyzes design quality, and produces a detailed audit report with actionable findings.
1481
+
1482
+ ## How to Invoke
1483
+
1484
+ Provide the base URL and optionally credentials:
1485
+ ```
1486
+ Audit the UI at http://localhost:3000
1487
+ Credentials: test@example.com / testpassword123
1488
+ ```
1489
+
1490
+ ## Process
1491
+
1492
+ 1. **Discover pages** — Read tester-agent/test-patterns.md for page inventory, or crawl from the base URL
1493
+ 2. **Capture screenshots** — For each page:
1494
+ - Desktop viewport (1440px)
1495
+ - Tablet viewport (768px)
1496
+ - Mobile viewport (375px)
1497
+ 3. **Analyze** each page for:
1498
+ - Visual hierarchy and layout
1499
+ - Typography consistency
1500
+ - Color usage and contrast (WCAG AA)
1501
+ - Spacing and alignment
1502
+ - Responsive behavior
1503
+ - Interactive element sizing (touch targets)
1504
+ - Loading states and empty states
1505
+ - Error state handling
1506
+ 4. **Generate report** — Write to `.claude/ui-audit/AUDIT_REPORT.md`
1507
+
1508
+ ## Tools
1509
+
1510
+ - **Bash** — run agent-browser commands for navigation and screenshots
1511
+ - **Read, Glob, Grep** — read project files and patterns
1512
+ - **Write** — generate audit report
1513
+
1514
+ ## Report Format
1515
+
1516
+ ```markdown
1517
+ # UI/UX Audit Report
1518
+
1519
+ **Date:** YYYY-MM-DD
1520
+ **Base URL:** <url>
1521
+ **Pages audited:** N
1522
+
1523
+ ## Summary
1524
+
1525
+ [Overall assessment: 1-2 paragraphs]
1526
+
1527
+ ## Findings
1528
+
1529
+ ### [Finding Title]
1530
+ - **Severity:** Critical / Major / Minor / Enhancement
1531
+ - **Page(s):** /path
1532
+ - **Description:** What the issue is
1533
+ - **Screenshot:** [reference]
1534
+ - **Recommendation:** How to fix it
1535
+
1536
+ ## Scores
1537
+
1538
+ | Category | Score (1-10) |
1539
+ |----------|-------------|
1540
+ | Visual Design | |
1541
+ | Consistency | |
1542
+ | Accessibility | |
1543
+ | Responsiveness | |
1544
+ | Overall | |
1545
+ ```
1546
+
1547
+ ## After Audit
1548
+
1549
+ The main agent should:
1550
+ 1. Read `.claude/ui-audit/AUDIT_REPORT.md`
1551
+ 2. Create GitHub issues for each Critical/Major finding
1552
+ 3. Add Minor/Enhancement findings to a tracking issue
1553
+ ```
1554
+
1555
+ - [ ] **Step 2: Create _template/AGENT.md**
1556
+
1557
+ ```markdown
1558
+ # [Agent Name]
1559
+
1560
+ [One-line description of what this agent does]
1561
+
1562
+ ## Query Types
1563
+
1564
+ ### [QUERY_TYPE_1] [parameters]
1565
+ [Description of what this query does and what it returns]
1566
+
1567
+ ### [QUERY_TYPE_2] [parameters]
1568
+ [Description]
1569
+
1570
+ ## Tools
1571
+
1572
+ - [Tool 1] — [what it's used for]
1573
+ - [Tool 2] — [what it's used for]
1574
+
1575
+ ## Response Format
1576
+
1577
+ - Max ~[20-30] lines per response
1578
+ - [Format guidelines]
1579
+
1580
+ ## Knowledge Base
1581
+
1582
+ ```
1583
+ agent-name/
1584
+ ├── AGENT.md ← This file (protocol definition)
1585
+ └── [other files] ← Agent-specific knowledge files
1586
+ ```
1587
+
1588
+ ## Usage Example
1589
+
1590
+ ```
1591
+ Agent: [QUERY_TYPE_1] [example parameters]
1592
+ → Agent responds with: [example output format]
1593
+ ```
1594
+ ```
1595
+
1596
+ - [ ] **Step 3: Commit**
1597
+
1598
+ ```bash
1599
+ git add .claude/agents/ui-ux-analyzer/ .claude/agents/_template/
1600
+ git commit -m "feat: add ui-ux-analyzer agent and agent scaffold template"
1601
+ ```
1602
+
1603
+ ---
1604
+
1605
+ ## Task 9: Framework-Specific Skills
1606
+
1607
+ **Files:**
1608
+ - Create: `.claude/skills/e2e-test/SKILL.md`
1609
+ - Create: `.claude/skills/playwright-cli/SKILL.md`
1610
+
1611
+ - [ ] **Step 1: Create e2e-test SKILL.md**
1612
+
1613
+ ```markdown
1614
+ ---
1615
+ name: e2e-test
1616
+ description: End-to-end testing orchestration. Discovers user journeys, runs browser tests, validates database state, auto-fixes bugs found during testing, generates report.
1617
+ ---
1618
+
1619
+ # E2E Test Skill
1620
+
1621
+ Orchestrates a comprehensive end-to-end testing run across the application.
1622
+
1623
+ ## When to Use
1624
+
1625
+ - After implementing a feature (before /ship)
1626
+ - As part of /validate
1627
+ - When verifying existing functionality still works
1628
+
1629
+ ## Process
1630
+
1631
+ ### Phase 1: Pre-flight
1632
+ 1. Check that the application is running (curl the base URL)
1633
+ 2. If not running, start it using the dev command from test-patterns.md
1634
+ 3. Verify agent-browser or playwright-cli is available
1635
+
1636
+ ### Phase 2: Discovery
1637
+ Launch 2-3 parallel sub-agents to gather intelligence:
1638
+
1639
+ **Agent 1 — App Structure:**
1640
+ - Read tester-agent/test-patterns.md
1641
+ - Identify all user-facing pages/routes
1642
+ - Map critical user journeys (signup, login, use feature, logout)
1643
+
1644
+ **Agent 2 — Data Flows:**
1645
+ - Read architect-agent knowledge base
1646
+ - Identify data-modifying operations (create, update, delete)
1647
+ - Note expected database state changes
1648
+
1649
+ **Agent 3 — Bug Hunting:**
1650
+ - Read recent git changes (git diff main...HEAD)
1651
+ - Identify areas most likely to have bugs
1652
+ - Prioritize testing for changed code paths
1653
+
1654
+ ### Phase 3: Test Execution
1655
+
1656
+ For each discovered user journey:
1657
+
1658
+ 1. **Navigate** to the starting page
1659
+ 2. **Execute** each step in the journey
1660
+ 3. **Verify** UI state after each step (elements visible, correct content)
1661
+ 4. **Verify** database state after data-modifying steps (query DB directly)
1662
+ 5. **Test** at 3 viewports: desktop (1440px), tablet (768px), mobile (375px)
1663
+ 6. **Screenshot** on failures only
1664
+
1665
+ ### Phase 4: Fix Loop
1666
+
1667
+ When a test fails:
1668
+ 1. Diagnose the root cause
1669
+ 2. Fix the code
1670
+ 3. Re-run the failing step
1671
+ 4. Screenshot the fix
1672
+ 5. Continue testing
1673
+
1674
+ ### Phase 5: Report
1675
+
1676
+ Generate a test report:
1677
+
1678
+ ```markdown
1679
+ # E2E Test Report — YYYY-MM-DD
1680
+
1681
+ ## Summary
1682
+ - Journeys tested: N
1683
+ - Steps executed: N
1684
+ - Passed: N
1685
+ - Failed: N (M auto-fixed)
1686
+
1687
+ ## Journeys
1688
+
1689
+ ### [Journey Name]
1690
+ - Status: PASS / FAIL
1691
+ - Steps: N/N passed
1692
+ - Viewports: desktop, tablet, mobile
1693
+ - Fixes applied: [list if any]
1694
+
1695
+ ## Auto-Fixes Applied
1696
+ - [File: change description]
1697
+
1698
+ ## Remaining Issues
1699
+ - [Issue description — create GitHub issue]
1700
+ ```
1701
+ ```
1702
+
1703
+ - [ ] **Step 2: Create playwright-cli SKILL.md**
1704
+
1705
+ ```markdown
1706
+ ---
1707
+ name: playwright-cli
1708
+ description: Browser automation command reference for playwright-cli. Navigation, interaction, screenshots, forms, state management, debugging.
1709
+ ---
1710
+
1711
+ # Playwright CLI Reference
1712
+
1713
+ ## Core Commands
1714
+
1715
+ ### Navigation
1716
+ ```bash
1717
+ npx playwright-cli open <url> # Open URL
1718
+ npx playwright-cli navigate <url> # Navigate to URL
1719
+ npx playwright-cli snapshot # Get DOM snapshot with element refs
1720
+ ```
1721
+
1722
+ ### Interaction
1723
+ ```bash
1724
+ npx playwright-cli click <ref> # Click element by ref from snapshot
1725
+ npx playwright-cli fill <ref> <value> # Fill input field
1726
+ npx playwright-cli select <ref> <value> # Select dropdown option
1727
+ npx playwright-cli check <ref> # Check checkbox
1728
+ npx playwright-cli uncheck <ref> # Uncheck checkbox
1729
+ npx playwright-cli hover <ref> # Hover over element
1730
+ npx playwright-cli press <key> # Press keyboard key
1731
+ npx playwright-cli type <text> # Type text (character by character)
1732
+ ```
1733
+
1734
+ ### Screenshots and Recording
1735
+ ```bash
1736
+ npx playwright-cli screenshot <path> # Take screenshot
1737
+ npx playwright-cli screenshot --full <path> # Full page screenshot
1738
+ npx playwright-cli video start <path> # Start recording
1739
+ npx playwright-cli video stop # Stop recording
1740
+ ```
1741
+
1742
+ ### Waiting
1743
+ ```bash
1744
+ npx playwright-cli wait <ref> # Wait for element visible
1745
+ npx playwright-cli wait-hidden <ref> # Wait for element hidden
1746
+ npx playwright-cli wait-navigation # Wait for page navigation
1747
+ ```
1748
+
1749
+ ### Dialog Handling
1750
+ ```bash
1751
+ npx playwright-cli dialog accept # Accept alert/confirm/prompt
1752
+ npx playwright-cli dialog dismiss # Dismiss dialog
1753
+ npx playwright-cli dialog accept <text> # Accept prompt with text
1754
+ ```
1755
+
1756
+ ### Session and State
1757
+ ```bash
1758
+ npx playwright-cli storage save <path> # Save browser state (cookies, localStorage)
1759
+ npx playwright-cli storage load <path> # Load saved state
1760
+ npx playwright-cli cookies get # Get all cookies
1761
+ npx playwright-cli cookies clear # Clear cookies
1762
+ ```
1763
+
1764
+ ### Network
1765
+ ```bash
1766
+ npx playwright-cli network intercept <pattern> <response-file> # Mock network request
1767
+ npx playwright-cli network log # Show network requests
1768
+ ```
1769
+
1770
+ ### Viewport
1771
+ ```bash
1772
+ npx playwright-cli viewport <width> <height> # Set viewport size
1773
+ ```
1774
+
1775
+ ## Common Patterns
1776
+
1777
+ ### Login Flow
1778
+ ```bash
1779
+ npx playwright-cli open http://localhost:3000/login
1780
+ npx playwright-cli snapshot
1781
+ npx playwright-cli fill ref:email "test@example.com"
1782
+ npx playwright-cli fill ref:password "testpassword123"
1783
+ npx playwright-cli click ref:submit
1784
+ npx playwright-cli wait-navigation
1785
+ npx playwright-cli snapshot # Verify dashboard loaded
1786
+ npx playwright-cli storage save auth-state.json # Save for reuse
1787
+ ```
1788
+
1789
+ ### Responsive Testing
1790
+ ```bash
1791
+ # Desktop
1792
+ npx playwright-cli viewport 1440 900
1793
+ npx playwright-cli screenshot desktop.png
1794
+
1795
+ # Tablet
1796
+ npx playwright-cli viewport 768 1024
1797
+ npx playwright-cli screenshot tablet.png
1798
+
1799
+ # Mobile
1800
+ npx playwright-cli viewport 375 812
1801
+ npx playwright-cli screenshot mobile.png
1802
+ ```
1803
+ ```
1804
+
1805
+ - [ ] **Step 3: Commit**
1806
+
1807
+ ```bash
1808
+ git add .claude/skills/
1809
+ git commit -m "feat: add e2e-test and playwright-cli skills"
1810
+ ```
1811
+
1812
+ ---
1813
+
1814
+ ## Task 10: Command — /start (Smart Router)
1815
+
1816
+ **Files:**
1817
+ - Create: `.claude/commands/start.md`
1818
+
1819
+ - [ ] **Step 1: Create start.md**
1820
+
1821
+ ```markdown
1822
+ # /start — Smart Pipeline Router
1823
+
1824
+ You are the entry point to the AIDevelopmentFramework PIV+E pipeline. Your job is to detect where the user is in their workflow and route them to the right commands.
1825
+
1826
+ ## Step 1: Gather Context
1827
+
1828
+ Run these in parallel:
1829
+ 1. Check if `CLAUDE.md` exists in the project root (not the framework's own CLAUDE.md)
1830
+ 2. Check if any PRD exists: `find docs/plans -name "PRD*" -o -name "prd*" 2>/dev/null`
1831
+ 3. Check current git branch and status
1832
+ 4. Check for existing GitHub issues: `gh issue list --limit 5 2>/dev/null`
1833
+ 5. Check for existing plan files: `find docs/plans docs/superpowers/plans -name "*.md" 2>/dev/null`
1834
+
1835
+ ## Step 2: Detect Scope Level
1836
+
1837
+ Based on context, determine the entry point:
1838
+
1839
+ **L-1 (Onboard)** — No CLAUDE.md found for the project
1840
+ → "This project hasn't been set up with the framework yet."
1841
+ → Suggest: `/prime` then `/create-rules` then come back to `/start`
1842
+
1843
+ **L0 (New Project)** — No PRD, no issues, minimal/no code
1844
+ → "Looks like a fresh project. Let's plan it from scratch."
1845
+ → Route to: `/create-prd` then `/plan-project`
1846
+
1847
+ **L1 (New Feature)** — Project exists, user has a feature idea (no specific issue)
1848
+ → "Let's plan this feature."
1849
+ → Route to: `/plan-feature`
1850
+
1851
+ **L2 (Issue Work)** — User has or references a specific issue number
1852
+ → "Let's work on this issue."
1853
+ → Route to: `/prime` then `/plan-feature #<issue>` or direct `/execute` if plan exists
1854
+
1855
+ **L3 (Bug Fix)** — User describes a bug or references a bug issue
1856
+ → "Let's debug this."
1857
+ → Route to: `/prime` then use superpowers:systematic-debugging
1858
+
1859
+ ## Step 3: Ask if Uncertain
1860
+
1861
+ If the scope level isn't clear from context, ask:
1862
+
1863
+ > **What are you working on today?**
1864
+ >
1865
+ > 1. **Starting a new project from an idea** (L0 — full planning pipeline)
1866
+ > 2. **Building a new feature** (L1 — brainstorm + plan + implement)
1867
+ > 3. **Working on a specific GitHub issue** (L2 — plan + implement)
1868
+ > 4. **Fixing a bug** (L3 — debug + fix)
1869
+ > 5. **Joining this project for the first time** (L-1 — onboard)
1870
+
1871
+ ## Step 4: Mode Selection
1872
+
1873
+ For L0, L1, and complex L2 tasks, ask:
1874
+
1875
+ > **Which mode?**
1876
+ >
1877
+ > - **Superpowers Mode** — Full discipline: brainstorm, plan, TDD, execute, verify, review, ship, evolve
1878
+ > - **Standard Mode** — Lighter: plan, implement, validate, ship
1879
+
1880
+ For L3 (bugs) and simple L2 (size S/M), default to Standard Mode without asking.
1881
+
1882
+ ## Step 5: Route
1883
+
1884
+ Execute the appropriate command chain based on the detected level and chosen mode. Provide the user with a brief summary of what will happen next.
1885
+ ```
1886
+
1887
+ - [ ] **Step 2: Commit**
1888
+
1889
+ ```bash
1890
+ git add .claude/commands/start.md
1891
+ git commit -m "feat: add /start smart router command"
1892
+ ```
1893
+
1894
+ ---
1895
+
1896
+ ## Task 11: Command — /prime (Context Loader)
1897
+
1898
+ **Files:**
1899
+ - Create: `.claude/commands/prime.md`
1900
+
1901
+ - [ ] **Step 1: Create prime.md**
1902
+
1903
+ ```markdown
1904
+ # /prime — Context Loader
1905
+
1906
+ Load the full codebase context into the current session. Run at the start of any session, after a context reset, or when switching tasks.
1907
+
1908
+ ## Process
1909
+
1910
+ Run these in parallel for speed:
1911
+
1912
+ ### 1. Project Structure
1913
+ ```bash
1914
+ git ls-files | head -200
1915
+ ```
1916
+ ```bash
1917
+ tree -L 3 -I 'node_modules|.next|dist|build|.git|__pycache__|.expo' --dirsfirst
1918
+ ```
1919
+
1920
+ ### 2. Project Documentation
1921
+ Read these files if they exist:
1922
+ - `CLAUDE.md` (project root)
1923
+ - `README.md`
1924
+ - `docs/plans/PRD.md` (or latest PRD)
1925
+ - Any plan file matching the current branch name
1926
+
1927
+ ### 3. Recent History
1928
+ ```bash
1929
+ git log --oneline -10
1930
+ ```
1931
+ ```bash
1932
+ git status --short
1933
+ ```
1934
+ ```bash
1935
+ git branch --show-current
1936
+ ```
1937
+
1938
+ ### 4. Active Context
1939
+ - If on a feature branch, extract the issue number from the branch name
1940
+ - If issue number found: `gh issue view <number>`
1941
+ - Check for existing plan: look for files in `docs/plans/` or `docs/superpowers/plans/` matching branch name
1942
+
1943
+ ### 5. Configuration
1944
+ - Read `.claude/agents/architect-agent/index.md` (knowledge base TOC)
1945
+ - Read `.claude/agents/tester-agent/test-patterns.md` (page inventory)
1946
+ - Check `package.json` or equivalent for available scripts/commands
1947
+
1948
+ ## Output Format
1949
+
1950
+ Present a structured summary:
1951
+
1952
+ ```
1953
+ === Project Context ===
1954
+
1955
+ Project: [name from package.json/CLAUDE.md]
1956
+ Branch: [current branch]
1957
+ Issue: [linked issue if found, or "none"]
1958
+ Plan: [active plan file if found, or "none"]
1959
+
1960
+ Structure: [key directories and their purposes]
1961
+
1962
+ Recent Activity:
1963
+ [last 5 commits, one line each]
1964
+
1965
+ Uncommitted Changes:
1966
+ [summary of staged/unstaged changes]
1967
+
1968
+ Available Commands:
1969
+ [dev, test, build commands from package.json]
1970
+
1971
+ Knowledge Base: [N domains documented in architect-agent]
1972
+
1973
+ === Ready. Run /start to begin or specify a command. ===
1974
+ ```
1975
+ ```
1976
+
1977
+ - [ ] **Step 2: Commit**
1978
+
1979
+ ```bash
1980
+ git add .claude/commands/prime.md
1981
+ git commit -m "feat: add /prime context loader command"
1982
+ ```
1983
+
1984
+ ---
1985
+
1986
+ ## Task 12: Command — /create-prd
1987
+
1988
+ **Files:**
1989
+ - Create: `.claude/commands/create-prd.md`
1990
+
1991
+ - [ ] **Step 1: Create create-prd.md**
1992
+
1993
+ ```markdown
1994
+ # /create-prd — Product Requirements Document Generator
1995
+
1996
+ Generate a comprehensive PRD from a product idea. This command ALWAYS starts with brainstorming.
1997
+
1998
+ ## Arguments
1999
+
2000
+ - `$ARGUMENTS` — optional: the product idea in brief (can also be discussed interactively)
2001
+
2002
+ ## Process
2003
+
2004
+ ### Phase 1: Brainstorm (MANDATORY)
2005
+
2006
+ Invoke the brainstorming skill to explore the idea before writing anything:
2007
+
2008
+ 1. If `$ARGUMENTS` is provided, use it as the starting point
2009
+ 2. If not, ask: "What are you building? Give me the elevator pitch."
2010
+ 3. Explore through conversation:
2011
+ - What problem does this solve?
2012
+ - Who is the target user?
2013
+ - What are the constraints (timeline, budget, team size, tech preferences)?
2014
+ - What does success look like?
2015
+ - What's explicitly OUT of scope?
2016
+ 4. Propose 2-3 architectural approaches with tradeoffs
2017
+ 5. Get user's choice before proceeding
2018
+
2019
+ ### Phase 2: Generate PRD
2020
+
2021
+ 1. Read `.claude/references/prd-template.md` for the structure
2022
+ 2. Fill in every section based on the brainstorming conversation
2023
+ 3. Be specific — no placeholder text, no "TBD" sections
2024
+ 4. User stories should be concrete and testable
2025
+ 5. Implementation phases should be ordered by dependency and value
2026
+
2027
+ ### Phase 3: Review and Save
2028
+
2029
+ 1. Present the PRD to the user section by section
2030
+ 2. Ask for feedback on each major section
2031
+ 3. Incorporate feedback
2032
+ 4. Save to `docs/plans/PRD.md`
2033
+
2034
+ ### Phase 4: Next Steps
2035
+
2036
+ After saving, tell the user:
2037
+
2038
+ > **PRD saved to `docs/plans/PRD.md`.**
2039
+ >
2040
+ > Next steps:
2041
+ > - Run `/plan-project` to decompose this into GitHub milestones and issues
2042
+ > - Or run `/plan-feature` to start planning a specific feature from the PRD
2043
+
2044
+ Commit the PRD:
2045
+ ```bash
2046
+ git add docs/plans/PRD.md
2047
+ git commit -m "docs: add product requirements document"
2048
+ ```
2049
+ ```
2050
+
2051
+ - [ ] **Step 2: Commit**
2052
+
2053
+ ```bash
2054
+ git add .claude/commands/create-prd.md
2055
+ git commit -m "feat: add /create-prd command with brainstorming integration"
2056
+ ```
2057
+
2058
+ ---
2059
+
2060
+ ## Task 13: Command — /plan-project
2061
+
2062
+ **Files:**
2063
+ - Create: `.claude/commands/plan-project.md`
2064
+
2065
+ - [ ] **Step 1: Create plan-project.md**
2066
+
2067
+ ```markdown
2068
+ # /plan-project — PRD to GitHub Issues Decomposer
2069
+
2070
+ Decomposes a PRD into GitHub milestones and issues. This bridges the gap between project vision and actionable work items.
2071
+
2072
+ ## Arguments
2073
+
2074
+ - `$ARGUMENTS` — optional: path to PRD file (default: `docs/plans/PRD.md`)
2075
+
2076
+ ## Prerequisites
2077
+
2078
+ - A PRD must exist (run `/create-prd` first if it doesn't)
2079
+ - GitHub CLI (`gh`) must be authenticated
2080
+ - Repository must have a GitHub remote
2081
+
2082
+ ## Process
2083
+
2084
+ ### Phase 1: Parse PRD
2085
+
2086
+ 1. Read the PRD file
2087
+ 2. Identify the implementation phases — each becomes a **GitHub milestone**
2088
+ 3. Within each phase, identify discrete features — each becomes a **GitHub issue**
2089
+
2090
+ ### Phase 2: Decompose into Issues
2091
+
2092
+ For each feature/task identified:
2093
+
2094
+ 1. Write issue title: `[type]: brief description`
2095
+ 2. Write issue body using `.claude/references/issue-template.md` format:
2096
+ - Description (what and why)
2097
+ - Acceptance criteria (testable checkboxes)
2098
+ - Technical notes (files to modify, patterns to follow)
2099
+ - Size estimate (S/M/L/XL)
2100
+ 3. Assign labels: type (`feat`/`fix`/`chore`), priority, size
2101
+ 4. Map dependencies: which issues block which
2102
+
2103
+ ### Phase 3: Determine Order
2104
+
2105
+ 1. Build dependency graph
2106
+ 2. Identify critical path (longest chain of blocking dependencies)
2107
+ 3. Identify parallelizable work (independent issues that can be worked simultaneously)
2108
+ 4. Order issues by: dependencies first, then critical path, then highest value, then smallest size
2109
+
2110
+ ### Phase 4: Present for Review
2111
+
2112
+ Present the full breakdown to the user:
2113
+
2114
+ ```
2115
+ ## Milestone 1: [Phase Name]
2116
+
2117
+ ### Issue 1: [feat: description] (Size: M, Priority: High)
2118
+ - Acceptance criteria: ...
2119
+ - Depends on: nothing
2120
+ - Blocks: Issue 2, Issue 3
2121
+
2122
+ ### Issue 2: [feat: description] (Size: L, Priority: High)
2123
+ - Acceptance criteria: ...
2124
+ - Depends on: Issue 1
2125
+ - Blocks: Issue 5
2126
+ ```
2127
+
2128
+ Ask: "Does this breakdown look right? Any issues to add, remove, or resize?"
2129
+
2130
+ ### Phase 5: Create in GitHub
2131
+
2132
+ After user approval, create milestones and issues using `gh` CLI:
2133
+
2134
+ ```bash
2135
+ # Create milestones
2136
+ gh api repos/{owner}/{repo}/milestones -f title="Phase 1: [Name]" -f description="[Description]"
2137
+
2138
+ # Create issues with labels and milestone
2139
+ gh issue create --title "[type]: description" --body "..." --label "feat,priority:high,size:M" --milestone "Phase 1: [Name]"
2140
+ ```
2141
+
2142
+ For issues with dependencies, add a "Blocked by #N" line in the issue body.
2143
+
2144
+ ### Phase 6: Generate Roadmap
2145
+
2146
+ Save a roadmap file to `docs/plans/roadmap.md`:
2147
+
2148
+ ```markdown
2149
+ # Project Roadmap
2150
+
2151
+ Generated from PRD on YYYY-MM-DD
2152
+
2153
+ ## Milestone 1: [Phase Name]
2154
+ - [ ] #1 — [title] (Size: M)
2155
+ - [ ] #2 — [title] (Size: L) — blocked by #1
2156
+
2157
+ ## Critical Path
2158
+ #1 → #2 → #4 → #7 → #9
2159
+
2160
+ ## Parallel Tracks
2161
+ Track A: #1 → #2 → #4
2162
+ Track B: #1 → #3 → #5
2163
+ ```
2164
+
2165
+ Commit:
2166
+ ```bash
2167
+ git add docs/plans/roadmap.md
2168
+ git commit -m "docs: add project roadmap with GitHub issues"
2169
+ ```
2170
+
2171
+ ## Re-running
2172
+
2173
+ When the PRD is updated, run `/plan-project` again. It will:
2174
+ 1. Read existing GitHub issues
2175
+ 2. Diff against updated PRD
2176
+ 3. Suggest: new issues to create, existing issues to update, obsolete issues to close
2177
+ 4. Present changes for approval before executing
2178
+ ```
2179
+
2180
+ - [ ] **Step 2: Commit**
2181
+
2182
+ ```bash
2183
+ git add .claude/commands/plan-project.md
2184
+ git commit -m "feat: add /plan-project command for PRD-to-issues decomposition"
2185
+ ```
2186
+
2187
+ ---
2188
+
2189
+ ## Task 14: Command — /plan-feature
2190
+
2191
+ **Files:**
2192
+ - Create: `.claude/commands/plan-feature.md`
2193
+
2194
+ - [ ] **Step 1: Create plan-feature.md**
2195
+
2196
+ ```markdown
2197
+ # /plan-feature — Feature Implementation Planner
2198
+
2199
+ Creates a detailed implementation plan for a feature. The plan must pass the "no prior knowledge" test — an engineer unfamiliar with the codebase can implement using only the plan.
2200
+
2201
+ ## Arguments
2202
+
2203
+ - `$ARGUMENTS` — feature description OR GitHub issue number (e.g., `#42`)
2204
+
2205
+ ## Process
2206
+
2207
+ ### Phase 1: Feature Understanding
2208
+
2209
+ 1. If an issue number is provided, read it: `gh issue view <number>`
2210
+ 2. If a description is provided, clarify:
2211
+ - What user-facing behavior should change?
2212
+ - What are the acceptance criteria?
2213
+ - Is this S/M/L/XL scope?
2214
+ 3. For L/XL features, invoke brainstorming skill first
2215
+ 4. Write user stories in "As a [user], I want [action] so that [benefit]" format
2216
+
2217
+ ### Phase 2: Codebase Intelligence (Parallel Sub-Agents)
2218
+
2219
+ Launch 2-3 parallel sub-agents for speed:
2220
+
2221
+ **Agent 1 — Structure and Patterns:**
2222
+ - Run `/prime` if not already primed
2223
+ - Glob for files related to the feature
2224
+ - Identify existing patterns (how similar features are built)
2225
+ - Map the directory structure for relevant areas
2226
+
2227
+ **Agent 2 — Dependencies and Integration:**
2228
+ - architect-agent RETRIEVE for relevant domains
2229
+ - architect-agent IMPACT to understand what this change affects
2230
+ - Identify integration points with other modules
2231
+ - Check for shared utilities, types, or components to reuse
2232
+
2233
+ **Agent 3 — Testing and Validation:**
2234
+ - Find existing test patterns for similar features
2235
+ - Identify what test infrastructure exists
2236
+ - Note validation commands (lint, type-check, test runners)
2237
+
2238
+ ### Phase 3: External Research
2239
+
2240
+ - Use context7 MCP to verify framework APIs you plan to use
2241
+ - Check library documentation for any unfamiliar APIs
2242
+ - Note any dependencies that need to be installed
2243
+
2244
+ ### Phase 4: Strategic Thinking
2245
+
2246
+ Before writing the plan, think through:
2247
+ - Does this fit the existing architecture? If not, is refactoring needed first?
2248
+ - What are the edge cases? (empty states, error states, concurrent access)
2249
+ - Security implications? (input validation, auth checks, data exposure)
2250
+ - Performance concerns? (N+1 queries, large payloads, unnecessary re-renders)
2251
+ - What could go wrong during implementation?
2252
+
2253
+ ### Phase 5: Plan Generation
2254
+
2255
+ Read `.claude/references/plan-template.md` and generate a complete plan.
2256
+
2257
+ Requirements for every plan:
2258
+ - Exact file paths for every file to create or modify
2259
+ - Complete code in every step (no placeholders)
2260
+ - Exact terminal commands with expected output for every verification step
2261
+ - TDD: tests before implementation in every task
2262
+ - Conventional commit after every task
2263
+ - GOTCHA warnings for known pitfalls
2264
+ - Confidence score (1-10) for one-pass success
2265
+
2266
+ ### Phase 6: GitHub Issue
2267
+
2268
+ If no issue exists for this feature:
2269
+ ```bash
2270
+ gh issue create --title "[type]: description" --body "..." --label "feat,size:M"
2271
+ ```
2272
+
2273
+ If issue exists, add a comment linking to the plan:
2274
+ ```bash
2275
+ gh issue comment <number> --body "Implementation plan: docs/plans/<plan-file>.md"
2276
+ ```
2277
+
2278
+ ### Phase 7: Save and Offer Execution
2279
+
2280
+ Save to `docs/plans/<kebab-case-feature-name>.md`
2281
+
2282
+ Commit:
2283
+ ```bash
2284
+ git add docs/plans/<plan-file>.md
2285
+ git commit -m "docs: add implementation plan for <feature>"
2286
+ ```
2287
+
2288
+ Then offer:
2289
+
2290
+ > **Plan saved. Ready to implement?**
2291
+ >
2292
+ > For complex features (context reset recommended):
2293
+ > Start a new session, run `/prime`, then `/execute docs/plans/<plan-file>.md`
2294
+ >
2295
+ > For simpler features (stay in session):
2296
+ > Run `/execute docs/plans/<plan-file>.md`
2297
+ ```
2298
+
2299
+ - [ ] **Step 2: Commit**
2300
+
2301
+ ```bash
2302
+ git add .claude/commands/plan-feature.md
2303
+ git commit -m "feat: add /plan-feature command with 5-phase analysis"
2304
+ ```
2305
+
2306
+ ---
2307
+
2308
+ ## Task 15: Command — /execute
2309
+
2310
+ **Files:**
2311
+ - Create: `.claude/commands/execute.md`
2312
+
2313
+ - [ ] **Step 1: Create execute.md**
2314
+
2315
+ ```markdown
2316
+ # /execute — Plan Executor
2317
+
2318
+ Executes an implementation plan task by task with TDD discipline.
2319
+
2320
+ ## Arguments
2321
+
2322
+ - `$ARGUMENTS` — path to plan file (auto-detected from current branch if omitted)
2323
+
2324
+ ## Prerequisites
2325
+
2326
+ - A plan file must exist
2327
+ - If the plan specifies dependencies to install, install them first
2328
+ - Read the plan's "Mandatory Reading" section before starting
2329
+
2330
+ ## Process
2331
+
2332
+ ### Step 1: Load Plan
2333
+
2334
+ 1. If path provided, read that file
2335
+ 2. If not, search for plan files:
2336
+ - `docs/plans/` and `docs/superpowers/plans/`
2337
+ - Match against current branch name
2338
+ - If multiple found, ask user which one
2339
+ 3. Parse the plan into tasks and steps
2340
+
2341
+ ### Step 2: Read Mandatory Files
2342
+
2343
+ Read every file listed in the plan's "Mandatory Reading" section. This ensures you have the codebase context needed for implementation.
2344
+
2345
+ ### Step 3: Execute Tasks
2346
+
2347
+ For each task in the plan:
2348
+
2349
+ 1. **Announce:** "Starting Task N: [task name]"
2350
+ 2. **Read** all files listed in the task's "Files" section
2351
+ 3. **For each step:**
2352
+ - If it's a test step: write the test exactly as specified
2353
+ - If it's a verification step: run the exact command, check output matches expected
2354
+ - If it's an implementation step: write the code as specified
2355
+ - If it's a commit step: stage and commit with the specified message
2356
+ 4. **If a test fails unexpectedly:**
2357
+ - Read the error output carefully
2358
+ - Fix the implementation (not the test, unless the test has a bug)
2359
+ - Re-run the test
2360
+ - If stuck after 3 attempts, stop and report the issue
2361
+ 5. **After task completion:** mark the task checkbox as done in the plan file
2362
+
2363
+ ### Step 4: Validation
2364
+
2365
+ After all tasks are complete:
2366
+ 1. Run the project's full test suite
2367
+ 2. Run lint/type-check if available
2368
+ 3. Verify the application starts without errors
2369
+
2370
+ ### Step 5: Completion Report
2371
+
2372
+ ```
2373
+ === Execution Complete ===
2374
+
2375
+ Plan: [plan file path]
2376
+ Tasks completed: N/N
2377
+ Tests passing: all / N failures
2378
+ Lint: pass / N issues
2379
+ Type check: pass / N errors
2380
+
2381
+ Next steps:
2382
+ - Run /validate for full verification
2383
+ - Run /ship when ready to commit and create PR
2384
+ ```
2385
+
2386
+ ## Error Handling
2387
+
2388
+ - If a task fails and cannot be fixed in 3 attempts: stop, report the issue, ask the user
2389
+ - If the plan has a bug (wrong file path, missing step): fix the plan and continue
2390
+ - If a dependency is missing: install it and continue
2391
+ - Never skip a failing test — either fix the code or report the issue
2392
+ ```
2393
+
2394
+ - [ ] **Step 2: Commit**
2395
+
2396
+ ```bash
2397
+ git add .claude/commands/execute.md
2398
+ git commit -m "feat: add /execute plan executor command"
2399
+ ```
2400
+
2401
+ ---
2402
+
2403
+ ## Task 16: Command — /validate
2404
+
2405
+ **Files:**
2406
+ - Create: `.claude/commands/validate.md`
2407
+
2408
+ - [ ] **Step 1: Create validate.md**
2409
+
2410
+ ```markdown
2411
+ # /validate — Verification Orchestrator
2412
+
2413
+ Runs comprehensive verification: automated checks, visual testing, and code review.
2414
+
2415
+ ## Process
2416
+
2417
+ ### Phase 1: Automated Checks
2418
+
2419
+ Run in parallel:
2420
+
2421
+ ```bash
2422
+ # Lint (detect from project)
2423
+ npm run lint 2>/dev/null || npx eslint . 2>/dev/null || echo "No linter configured"
2424
+
2425
+ # Type check (detect from project)
2426
+ npx tsc --noEmit 2>/dev/null || echo "No TypeScript configured"
2427
+
2428
+ # Tests (detect from project)
2429
+ npm test 2>/dev/null || npx jest 2>/dev/null || npx vitest run 2>/dev/null || echo "No test runner configured"
2430
+ ```
2431
+
2432
+ If any check fails, report the failure and offer to fix it before continuing.
2433
+
2434
+ ### Phase 2: Visual Verification (if applicable)
2435
+
2436
+ Detect what was changed:
2437
+ ```bash
2438
+ git diff --name-only main...HEAD
2439
+ ```
2440
+
2441
+ **If frontend files changed:**
2442
+ - Dispatch tester-agent with VERIFY queries for affected pages
2443
+ - Test at minimum: desktop and mobile viewports
2444
+ - Check: elements render, navigation works, forms submit
2445
+
2446
+ **If mobile files changed:**
2447
+ - Dispatch mobile-tester-agent with VERIFY queries for affected screens
2448
+ - Check: elements visible, navigation works, interactions respond
2449
+
2450
+ **If API/backend files changed:**
2451
+ - Run API tests if they exist
2452
+ - Check: endpoints respond with correct status codes
2453
+ - If Supabase: run `get_advisors` for schema safety
2454
+
2455
+ ### Phase 3: Code Review
2456
+
2457
+ Invoke the code review skill:
2458
+ - Review against the implementation plan (does the code match the plan?)
2459
+ - Check for common issues: error handling, edge cases, security
2460
+ - Verify no debug code left (console.log, TODO comments, commented-out code)
2461
+
2462
+ ### Phase 4: Report
2463
+
2464
+ ```
2465
+ === Validation Report ===
2466
+
2467
+ Automated Checks:
2468
+ - Lint: PASS / N issues
2469
+ - Types: PASS / N errors
2470
+ - Tests: PASS (N/N) / N failures
2471
+
2472
+ Visual Verification:
2473
+ - [Page/Screen]: PASS / FAIL — [description]
2474
+
2475
+ Code Review:
2476
+ - [Finding 1]
2477
+ - [Finding 2]
2478
+
2479
+ Verdict: Ready to ship / Needs fixes
2480
+
2481
+ Next: Run /ship when ready, or fix issues and re-run /validate
2482
+ ```
2483
+ ```
2484
+
2485
+ - [ ] **Step 2: Commit**
2486
+
2487
+ ```bash
2488
+ git add .claude/commands/validate.md
2489
+ git commit -m "feat: add /validate verification orchestrator command"
2490
+ ```
2491
+
2492
+ ---
2493
+
2494
+ ## Task 17: Command — /ship
2495
+
2496
+ **Files:**
2497
+ - Create: `.claude/commands/ship.md`
2498
+
2499
+ - [ ] **Step 1: Create ship.md**
2500
+
2501
+ ```markdown
2502
+ # /ship — Commit, Push, and Create PR
2503
+
2504
+ Handles the full shipping workflow: staging, committing, pushing, and creating a pull request.
2505
+
2506
+ ## Process
2507
+
2508
+ ### Step 1: Pre-flight Check
2509
+
2510
+ 1. Verify all tests pass: `npm test` (or detected test command)
2511
+ 2. Verify no uncommitted changes that shouldn't be included
2512
+ 3. Check current branch is not main/master
2513
+
2514
+ ### Step 2: Stage and Commit
2515
+
2516
+ Use the `/commit` skill (from commit-commands plugin) for proper conventional commit formatting.
2517
+
2518
+ If the commit-commands plugin is not available, fall back to:
2519
+
2520
+ 1. Show `git status` and `git diff --stat`
2521
+ 2. Ask which files to stage (or confirm staging all)
2522
+ 3. Generate conventional commit message from changes:
2523
+ - `feat:` for new features
2524
+ - `fix:` for bug fixes
2525
+ - `refactor:` for code improvements
2526
+ - `docs:` for documentation
2527
+ - `test:` for test additions/changes
2528
+ - `chore:` for maintenance
2529
+ 4. Commit with the generated message
2530
+
2531
+ ### Step 3: Push
2532
+
2533
+ ```bash
2534
+ git push -u origin $(git branch --show-current)
2535
+ ```
2536
+
2537
+ ### Step 4: Create Pull Request
2538
+
2539
+ Detect the linked GitHub issue from:
2540
+ - Branch name (e.g., `feat/user-auth-42` implies issue #42)
2541
+ - Recent commit messages
2542
+ - Active plan file
2543
+
2544
+ Create PR:
2545
+ ```bash
2546
+ gh pr create \
2547
+ --title "[type]: brief description" \
2548
+ --body "## Summary
2549
+ - [what changed and why]
2550
+
2551
+ ## Linked Issue
2552
+ Closes #[number]
2553
+
2554
+ ## Test Plan
2555
+ - [ ] Automated tests pass
2556
+ - [ ] Manual verification of [key behavior]
2557
+ - [ ] Tested on [viewports/devices if applicable]
2558
+ "
2559
+ ```
2560
+
2561
+ ### Step 5: Report
2562
+
2563
+ ```
2564
+ === Shipped ===
2565
+
2566
+ Branch: [branch name]
2567
+ Commit: [hash] — [message]
2568
+ PR: [PR URL]
2569
+ Closes: #[issue number]
2570
+
2571
+ Next steps:
2572
+ - Wait for review
2573
+ - After merge: run /evolve to update the system
2574
+ ```
2575
+ ```
2576
+
2577
+ - [ ] **Step 2: Commit**
2578
+
2579
+ ```bash
2580
+ git add .claude/commands/ship.md
2581
+ git commit -m "feat: add /ship command for commit, push, and PR creation"
2582
+ ```
2583
+
2584
+ ---
2585
+
2586
+ ## Task 18: Command — /evolve
2587
+
2588
+ **Files:**
2589
+ - Create: `.claude/commands/evolve.md`
2590
+
2591
+ - [ ] **Step 1: Create evolve.md**
2592
+
2593
+ ```markdown
2594
+ # /evolve — Self-Improvement
2595
+
2596
+ Updates the framework's rules, knowledge base, and patterns from what was learned in this session. This is what makes the system get smarter over time.
2597
+
2598
+ ## Philosophy
2599
+
2600
+ "Every bug from the AI coding assistant isn't just something to fix — it's an opportunity to address the root cause in your system."
2601
+
2602
+ ## Process
2603
+
2604
+ ### Step 1: Reflect on Session
2605
+
2606
+ Review what happened in this session:
2607
+ 1. `git log --oneline main..HEAD` — what was built
2608
+ 2. Were there any:
2609
+ - Bugs that took multiple attempts to fix?
2610
+ - Patterns the AI got wrong repeatedly?
2611
+ - Missing context that caused mistakes?
2612
+ - New conventions established?
2613
+ - Architecture decisions made?
2614
+
2615
+ ### Step 2: Update CLAUDE.md
2616
+
2617
+ Invoke the revise-claude-md skill (from claude-md-management plugin) to:
2618
+ - Add new conventions discovered
2619
+ - Update tech stack if it changed
2620
+ - Add new commands or scripts
2621
+ - Remove outdated information
2622
+
2623
+ If the plugin isn't available, manually check CLAUDE.md for needed updates.
2624
+
2625
+ ### Step 3: Update Architect Knowledge Base
2626
+
2627
+ If structural changes were made:
2628
+ 1. Dispatch architect-agent with RECORD query
2629
+ 2. Agent verifies changes exist in codebase
2630
+ 3. Agent updates relevant domain files in modules/ and frontend/
2631
+ 4. Agent updates index.md if new domains were added
2632
+ 5. If an architectural decision was made, add to decisions/log.md
2633
+
2634
+ ### Step 4: Update Rules
2635
+
2636
+ Check if any domain rules need updating:
2637
+ - Did a new pattern emerge in backend code? Update rules/backend.md
2638
+ - Did a new component pattern emerge? Update rules/frontend.md
2639
+ - Did a testing anti-pattern surface? Update rules/testing.md
2640
+
2641
+ ### Step 5: Update Code Patterns
2642
+
2643
+ If the /execute phase revealed patterns the AI should follow:
2644
+ - Add to .claude/references/code-patterns.md
2645
+ - Include real code examples from the current codebase
2646
+ - Note common pitfalls with before/after examples
2647
+
2648
+ ### Step 6: Update Test Patterns
2649
+
2650
+ If new pages or screens were created:
2651
+ - Update .claude/agents/tester-agent/test-patterns.md with new routes
2652
+ - Update .claude/agents/mobile-tester-agent/screen-patterns.md if mobile
2653
+
2654
+ ### Step 7: Report
2655
+
2656
+ ```
2657
+ === System Evolution ===
2658
+
2659
+ Updated:
2660
+ - [ ] CLAUDE.md — [what changed]
2661
+ - [ ] architect-agent knowledge base — [domains updated]
2662
+ - [ ] rules/[domain].md — [what changed]
2663
+ - [ ] references/code-patterns.md — [patterns added]
2664
+ - [ ] test-patterns.md — [routes added]
2665
+
2666
+ New decisions recorded:
2667
+ - ADR-N: [decision title]
2668
+
2669
+ System health:
2670
+ The framework is now better equipped to handle [specific scenario].
2671
+ ```
2672
+
2673
+ Commit all updates:
2674
+ ```bash
2675
+ git add CLAUDE.md .claude/
2676
+ git commit -m "chore: evolve framework — update rules and knowledge base"
2677
+ ```
2678
+ ```
2679
+
2680
+ - [ ] **Step 2: Commit**
2681
+
2682
+ ```bash
2683
+ git add .claude/commands/evolve.md
2684
+ git commit -m "feat: add /evolve self-improvement command"
2685
+ ```
2686
+
2687
+ ---
2688
+
2689
+ ## Task 19: Command — /setup
2690
+
2691
+ **Files:**
2692
+ - Create: `.claude/commands/setup.md`
2693
+
2694
+ - [ ] **Step 1: Create setup.md**
2695
+
2696
+ ```markdown
2697
+ # /setup — Framework Health Check
2698
+
2699
+ Checks what external plugins, skills, and MCP servers are installed and reports any gaps.
2700
+
2701
+ ## Process
2702
+
2703
+ ### Step 1: Check Plugins
2704
+
2705
+ Verify each required plugin is installed. Present results as a checklist.
2706
+
2707
+ **Core Workflow (required):**
2708
+
2709
+ | Plugin | Install Command |
2710
+ |--------|----------------|
2711
+ | superpowers | `claude plugin install superpowers` |
2712
+ | feature-dev | `claude plugin install feature-dev` |
2713
+ | code-review | `claude plugin install code-review` |
2714
+ | commit-commands | `claude plugin install commit-commands` |
2715
+ | claude-md-management | `claude plugin install claude-md-management` |
2716
+ | security-guidance | `claude plugin install security-guidance` |
2717
+ | skill-creator | `claude plugin install skill-creator` |
2718
+
2719
+ **Framework Support (recommended):**
2720
+
2721
+ | Plugin | Install Command |
2722
+ |--------|----------------|
2723
+ | firecrawl | `claude plugin install firecrawl` |
2724
+ | frontend-design | `claude plugin install frontend-design` |
2725
+ | claude-code-setup | `claude plugin install claude-code-setup` |
2726
+ | agent-sdk-dev | `claude plugin install agent-sdk-dev` |
2727
+
2728
+ **Stack-Specific (install what applies):**
2729
+
2730
+ | Plugin | When Needed | Install Command |
2731
+ |--------|------------|----------------|
2732
+ | context7 | Any framework/library project | `claude plugin install context7` |
2733
+ | supabase | Supabase projects | `claude plugin install supabase` |
2734
+ | typescript-lsp | TypeScript projects | `claude plugin install typescript-lsp` |
2735
+ | expo-app-design | Expo/React Native projects | `claude plugin install expo-app-design --marketplace expo-plugins` |
2736
+
2737
+ ### Step 2: Check MCP Servers
2738
+
2739
+ Verify project-level MCP server configuration if applicable:
2740
+ - shadcn — for shadcn/ui component projects
2741
+ - context7 — for documentation lookup
2742
+ - supabase — for database operations
2743
+ - mobile-mcp — for mobile testing
2744
+
2745
+ ### Step 3: Check Framework Files
2746
+
2747
+ Verify .claude/ structure is complete:
2748
+ - commands/ (10 files)
2749
+ - agents/ (4 agents + template)
2750
+ - rules/ (6 rules + template)
2751
+ - references/ (5 templates)
2752
+ - hooks/ (5 scripts)
2753
+ - settings.local.json
2754
+
2755
+ ### Step 4: Report
2756
+
2757
+ ```
2758
+ === Framework Health Check ===
2759
+
2760
+ Plugins:
2761
+ [check] superpowers
2762
+ [check] feature-dev
2763
+ [missing] firecrawl — run: claude plugin install firecrawl
2764
+
2765
+ MCP Servers:
2766
+ [check] context7
2767
+ [missing] shadcn — add to .mcp.json if using shadcn/ui
2768
+
2769
+ Framework Files:
2770
+ [check] .claude/commands/ (10 commands)
2771
+ [check] .claude/agents/ (4 agents)
2772
+ [check] .claude/rules/ (6 rules)
2773
+ [check] .claude/references/ (5 templates)
2774
+ [check] .claude/hooks/ (5 hooks)
2775
+
2776
+ Status: Ready (install missing items above for full functionality)
2777
+ ```
2778
+ ```
2779
+
2780
+ - [ ] **Step 2: Commit**
2781
+
2782
+ ```bash
2783
+ git add .claude/commands/setup.md
2784
+ git commit -m "feat: add /setup health check command"
2785
+ ```
2786
+
2787
+ ---
2788
+
2789
+ ## Task 20: Documentation
2790
+
2791
+ **Files:**
2792
+ - Create: `docs/methodology.md`
2793
+ - Create: `docs/getting-started.md`
2794
+ - Create: `docs/command-reference.md`
2795
+ - Create: `docs/customization.md`
2796
+ - Create: `docs/plugin-install-guide.md`
2797
+
2798
+ - [ ] **Step 1: Create methodology.md**
2799
+
2800
+ ```markdown
2801
+ # PIV+E Methodology
2802
+
2803
+ A tool-agnostic methodology for reliable AI-assisted software development.
2804
+
2805
+ ## The Problem
2806
+
2807
+ AI coding assistants are powerful but unpredictable. They write code that looks right but subtly isn't. They lose context. They make the same mistakes repeatedly. The solution isn't a better AI — it's a better system around the AI.
2808
+
2809
+ ## The PIV+E Loop
2810
+
2811
+ ```
2812
+ PLAN -> IMPLEMENT -> VALIDATE -> EVOLVE
2813
+ ^ |
2814
+ +-------------------------------+
2815
+ System gets smarter
2816
+ ```
2817
+
2818
+ ### Plan (Human decides, AI structures)
2819
+
2820
+ The human owns what gets built. The AI helps structure the thinking.
2821
+
2822
+ - **Brainstorm** the idea — explore alternatives, constraints, tradeoffs
2823
+ - **Write a spec** (PRD for projects, plan for features)
2824
+ - **Decompose** into implementable units (GitHub issues)
2825
+
2826
+ The key output is a plan document that passes the "no prior knowledge test."
2827
+
2828
+ ### Implement (AI executes, guided by plan)
2829
+
2830
+ The AI does the heavy lifting, constrained by the plan.
2831
+
2832
+ - **Test-Driven Development** — write the test first, then make it pass
2833
+ - **Follow the plan** — don't improvise, don't add features, don't refactor unrelated code
2834
+ - **Use specialists** — architecture agents, design skills, framework-specific tools
2835
+ - **Commit frequently** — small, atomic commits after each task
2836
+
2837
+ ### Validate (Human + AI verify together)
2838
+
2839
+ Both human and AI verify the work.
2840
+
2841
+ - **Automated checks** — lint, type-check, test suite (AI runs these)
2842
+ - **Visual verification** — browser/mobile testing agents (AI runs these)
2843
+ - **Code review** — review agents flag issues (AI runs, human decides)
2844
+ - **Human review** — the final authority (human approves the PR)
2845
+
2846
+ ### Evolve (System learns from each cycle)
2847
+
2848
+ The system improves after every cycle.
2849
+
2850
+ - **Update rules** — new patterns become rules, mistakes become warnings
2851
+ - **Update knowledge base** — architecture agent learns new modules/endpoints
2852
+ - **Update test patterns** — new pages/screens get added to test inventories
2853
+ - **Record decisions** — why things were done this way
2854
+
2855
+ ## Context Management
2856
+
2857
+ - **Plans are artifacts** — they survive session boundaries
2858
+ - **Context resets are a feature** — start fresh for implementation after heavy planning
2859
+ - **Progressive disclosure** — load information as needed, not all at once
2860
+ - **Knowledge bases** — structured information that agents can query
2861
+
2862
+ ## Discipline Scaling
2863
+
2864
+ | Complexity | Ceremony Level |
2865
+ |-----------|---------------|
2866
+ | XL (new module) | Full PIV+E with brainstorming, PRD, parallel agents |
2867
+ | L (new feature) | Plan + TDD + testing agents |
2868
+ | M (single task) | Quick plan + implement + verify |
2869
+ | S (tweak) | Just do it + verify |
2870
+ | Bug | Debug + fix + verify |
2871
+
2872
+ ## Principles
2873
+
2874
+ 1. Context is precious — manage it deliberately
2875
+ 2. Plans are artifacts — they survive session boundaries
2876
+ 3. Discipline scales with complexity
2877
+ 4. The system self-improves — every mistake becomes a rule
2878
+ 5. Human stays in control — AI assists, human decides
2879
+ ```
2880
+
2881
+ - [ ] **Step 2: Create getting-started.md**
2882
+
2883
+ ```markdown
2884
+ # Getting Started
2885
+
2886
+ ## Quick Start (Existing Project)
2887
+
2888
+ 1. Copy the `.claude/` folder into your project root
2889
+ 2. Run `/setup` to check what plugins/skills you need
2890
+ 3. Install missing dependencies (commands provided by /setup)
2891
+ 4. Run `/prime` to load your codebase context
2892
+ 5. Run `/start` to begin your first task
2893
+
2894
+ ## Quick Start (New Project)
2895
+
2896
+ 1. Copy the `.claude/` folder into your project root
2897
+ 2. Run `/setup` to check dependencies
2898
+ 3. Run `/start` — it will detect a new project and guide you through:
2899
+ - `/create-prd` — brainstorm and define what you're building
2900
+ - `/plan-project` — create GitHub issues from the PRD
2901
+ - Per-issue implementation via the PIV+E loop
2902
+
2903
+ ## Your First Feature (Walkthrough)
2904
+
2905
+ ### 1. Start
2906
+ ```
2907
+ /start
2908
+ > What are you working on? -> 3. Working on a specific GitHub issue
2909
+ > Issue number? -> #1
2910
+ ```
2911
+
2912
+ ### 2. Plan
2913
+ ```
2914
+ /plan-feature #1
2915
+ ```
2916
+ Review the plan. Adjust if needed.
2917
+
2918
+ ### 3. Implement
2919
+ ```
2920
+ /execute docs/plans/my-feature.md
2921
+ ```
2922
+
2923
+ ### 4. Validate
2924
+ ```
2925
+ /validate
2926
+ ```
2927
+
2928
+ ### 5. Ship
2929
+ ```
2930
+ /ship
2931
+ ```
2932
+
2933
+ ### 6. Evolve (after merge)
2934
+ ```
2935
+ /evolve
2936
+ ```
2937
+
2938
+ ## Commands Quick Reference
2939
+
2940
+ | Command | When to Use |
2941
+ |---------|------------|
2942
+ | `/start` | Beginning of any work session |
2943
+ | `/prime` | Load/reload codebase context |
2944
+ | `/create-prd` | Planning a new project from scratch |
2945
+ | `/plan-project` | Breaking a PRD into GitHub issues |
2946
+ | `/plan-feature` | Planning a specific feature |
2947
+ | `/execute` | Implementing a plan |
2948
+ | `/validate` | Verifying work before shipping |
2949
+ | `/ship` | Committing, pushing, creating PR |
2950
+ | `/evolve` | Updating the system after completing work |
2951
+ | `/setup` | Checking framework health |
2952
+ ```
2953
+
2954
+ - [ ] **Step 3: Create command-reference.md**
2955
+
2956
+ ```markdown
2957
+ # Command Reference
2958
+
2959
+ ## /start — Smart Router
2960
+ **Phase:** Router | **Arguments:** None
2961
+ Detects scope level and routes to the correct pipeline.
2962
+
2963
+ ## /prime — Context Loader
2964
+ **Phase:** Plan | **Arguments:** None
2965
+ Loads codebase context. Run at session start or after context reset.
2966
+
2967
+ ## /create-prd — PRD Generator
2968
+ **Phase:** Plan (L0) | **Arguments:** Optional idea description
2969
+ Brainstorms and generates a Product Requirements Document. Output: `docs/plans/PRD.md`
2970
+
2971
+ ## /plan-project — PRD Decomposer
2972
+ **Phase:** Plan (L0) | **Arguments:** Optional PRD path (default: `docs/plans/PRD.md`)
2973
+ Breaks PRD into GitHub milestones and issues. Output: GitHub issues + `docs/plans/roadmap.md`
2974
+
2975
+ ## /plan-feature — Feature Planner
2976
+ **Phase:** Plan (L1/L2) | **Arguments:** Feature description or issue number (e.g., `#42`)
2977
+ 5-phase analysis producing a detailed implementation plan. Output: `docs/plans/<feature>.md`
2978
+
2979
+ ## /execute — Plan Executor
2980
+ **Phase:** Implement | **Arguments:** Optional plan path (auto-detected if omitted)
2981
+ Executes plan task-by-task with TDD. Reads mandatory files, runs validation commands.
2982
+
2983
+ ## /validate — Verification Orchestrator
2984
+ **Phase:** Validate | **Arguments:** None
2985
+ Runs lint, tests, type-check, visual testing (tester agents), and code review.
2986
+
2987
+ ## /ship — Commit + Push + PR
2988
+ **Phase:** Validate | **Arguments:** None
2989
+ Stages, commits (conventional), pushes, creates PR linked to issue.
2990
+
2991
+ ## /evolve — Self-Improvement
2992
+ **Phase:** Evolve | **Arguments:** None
2993
+ Updates CLAUDE.md, architect knowledge base, rules, code patterns, test patterns.
2994
+
2995
+ ## /setup — Health Check
2996
+ **Phase:** Utility | **Arguments:** None
2997
+ Checks installed plugins, skills, MCP servers. Reports health and install commands.
2998
+ ```
2999
+
3000
+ - [ ] **Step 4: Create customization.md**
3001
+
3002
+ ```markdown
3003
+ # Customization Guide
3004
+
3005
+ ## Adding Custom Rules
3006
+
3007
+ 1. Copy `.claude/rules/_template.md` to `.claude/rules/your-domain.md`
3008
+ 2. Set the `globs` pattern to match your file paths
3009
+ 3. Add your conventions and skill chains
3010
+ 4. Rules auto-load when editing matching files
3011
+
3012
+ ## Adding Custom Agents
3013
+
3014
+ 1. Copy `.claude/agents/_template/AGENT.md` to `.claude/agents/your-agent/AGENT.md`
3015
+ 2. Define query types, tools, and response format
3016
+ 3. Add knowledge base files as needed
3017
+ 4. Reference the agent from your commands or rules
3018
+
3019
+ ## Customizing Commands
3020
+
3021
+ Commands are markdown files in `.claude/commands/`. Edit existing commands or add new ones. Commands are invoked as `/command-name` in Claude Code.
3022
+
3023
+ ## Customizing Hooks
3024
+
3025
+ Hooks are shell scripts in `.claude/hooks/`. Edit existing hooks or add new ones. Make sure hooks are executable (`chmod +x`).
3026
+
3027
+ ## Overriding Rules per Project
3028
+
3029
+ Each project gets its own `.claude/` folder. Customize CLAUDE.md, rules, and agent knowledge bases per project. The framework's commands stay the same.
3030
+
3031
+ ## Contributing
3032
+
3033
+ 1. Fork the repository
3034
+ 2. Add your contribution
3035
+ 3. Submit a PR with description, usage, and testing notes
3036
+ ```
3037
+
3038
+ - [ ] **Step 5: Create plugin-install-guide.md**
3039
+
3040
+ ```markdown
3041
+ # Plugin and Skill Install Guide
3042
+
3043
+ ## Required Plugins
3044
+
3045
+ ### Core Workflow (Must Have)
3046
+ ```bash
3047
+ claude plugin install superpowers
3048
+ claude plugin install feature-dev
3049
+ claude plugin install code-review
3050
+ claude plugin install commit-commands
3051
+ claude plugin install claude-md-management
3052
+ claude plugin install security-guidance
3053
+ claude plugin install skill-creator
3054
+ ```
3055
+
3056
+ ### Framework Support (Recommended)
3057
+ ```bash
3058
+ claude plugin install firecrawl
3059
+ claude plugin install frontend-design
3060
+ claude plugin install claude-code-setup
3061
+ claude plugin install agent-sdk-dev
3062
+ ```
3063
+
3064
+ ### Stack-Specific (Install What You Use)
3065
+ ```bash
3066
+ # For any project using frameworks/libraries
3067
+ claude plugin install context7
3068
+
3069
+ # For Supabase projects
3070
+ claude plugin install supabase
3071
+
3072
+ # For TypeScript projects
3073
+ claude plugin install typescript-lsp
3074
+
3075
+ # For Expo/React Native projects
3076
+ claude plugin install expo-app-design --marketplace expo-plugins
3077
+ ```
3078
+
3079
+ ## Global Skills
3080
+
3081
+ Skills are installed separately from plugins. Key categories:
3082
+
3083
+ **Web and Frontend:** agent-browser, frontend-design, frontend-aesthetics, ui-ux-pro-max, shadcn-ui, nextjs-app-router-patterns, vercel-react-best-practices, web-design-guidelines
3084
+
3085
+ **Backend and Database:** fastapi-python, mongodb, mongodb-development, supabase-postgres-best-practices, stripe-best-practices
3086
+
3087
+ **Testing and Security:** qa-test-planner, security-audit, web-security-testing, pentest-expert
3088
+
3089
+ **Research and Content:** research, search, crawl, extract, multi-ai-research, tavily-best-practices
3090
+
3091
+ **Mobile:** All expo-app-design sub-skills (building-native-ui, native-data-fetching, expo-tailwind-setup, expo-dev-client, expo-api-routes, use-dom, expo-ui-swift-ui, expo-ui-jetpack-compose)
3092
+
3093
+ ## MCP Servers
3094
+
3095
+ Configure per project as needed:
3096
+
3097
+ | Server | Purpose |
3098
+ |--------|---------|
3099
+ | context7 | Framework/library documentation |
3100
+ | shadcn | shadcn/ui component search |
3101
+ | supabase | Database operations |
3102
+ | mobile-mcp | Mobile simulator testing |
3103
+
3104
+ ## Checking Installation
3105
+
3106
+ Run `/setup` at any time to see what's installed and what's missing.
3107
+ ```
3108
+
3109
+ - [ ] **Step 6: Commit**
3110
+
3111
+ ```bash
3112
+ git add docs/
3113
+ git commit -m "docs: add methodology, getting-started, command-reference, customization, and plugin guides"
3114
+ ```
3115
+
3116
+ ---
3117
+
3118
+ ## Task 21: README and Package
3119
+
3120
+ **Files:**
3121
+ - Create: `README.md`
3122
+ - Create: `package.json`
3123
+
3124
+ - [ ] **Step 1: Create README.md**
3125
+
3126
+ ```markdown
3127
+ # AIDevelopmentFramework
3128
+
3129
+ The system around the AI that makes the AI reliable.
3130
+
3131
+ An open-source framework for structured AI-assisted software development. Built on the **PIV+E loop** (Plan, Implement, Validate, Evolve) — a methodology where the human owns planning and validation, the AI owns implementation, and the system gets smarter with every cycle.
3132
+
3133
+ ## Why This Exists
3134
+
3135
+ AI coding assistants are powerful but unpredictable. They lose context, repeat mistakes, and produce code that looks right but isn't. The solution isn't a better AI — it's a better **system around the AI**: plans that survive session boundaries, rules that prevent known mistakes, agents that maintain architectural knowledge, and a self-improving feedback loop.
3136
+
3137
+ ## Quick Start
3138
+
3139
+ ### Existing Project
3140
+ 1. Copy `.claude/` into your project root
3141
+ 2. Run `/setup` to check installed plugins
3142
+ 3. Run `/prime` to load context
3143
+ 4. Run `/start` to begin
3144
+
3145
+ ### New Project
3146
+ 1. Copy `.claude/` into your project root
3147
+ 2. Run `/setup` to install dependencies
3148
+ 3. Run `/start` and choose "Starting a new project"
3149
+
3150
+ ## The PIV+E Loop
3151
+
3152
+ **Plan** — Brainstorm, write specs, decompose into issues
3153
+ **Implement** — TDD, execute plans, use specialist agents
3154
+ **Validate** — Automated checks, visual testing, code review
3155
+ **Evolve** — Update rules and knowledge from what was learned
3156
+
3157
+ ## Pipeline Commands
3158
+
3159
+ | Command | Phase | Purpose |
3160
+ |---------|-------|---------|
3161
+ | `/start` | Router | Detects what you're doing, routes to the right pipeline |
3162
+ | `/prime` | Plan | Loads codebase context into session |
3163
+ | `/create-prd` | Plan | Brainstorms and generates a PRD |
3164
+ | `/plan-project` | Plan | Decomposes PRD into GitHub milestones and issues |
3165
+ | `/plan-feature` | Plan | Creates detailed implementation plan |
3166
+ | `/execute` | Implement | Executes plan with TDD, step by step |
3167
+ | `/validate` | Validate | Runs lint, tests, visual testing, code review |
3168
+ | `/ship` | Validate | Commits, pushes, creates PR |
3169
+ | `/evolve` | Evolve | Updates rules and knowledge base |
3170
+ | `/setup` | Utility | Checks framework health |
3171
+
3172
+ ## What's Inside
3173
+
3174
+ ```
3175
+ .claude/
3176
+ ├── commands/ 10 pipeline commands (the workflow)
3177
+ ├── agents/ 4 specialist agents + template
3178
+ ├── skills/ Framework-specific skills
3179
+ ├── rules/ Auto-loading domain rules
3180
+ ├── references/ Templates (PRD, plan, issue, patterns)
3181
+ └── hooks/ Guardrails (branch protection, reminders)
3182
+ ```
3183
+
3184
+ ## Scope Levels
3185
+
3186
+ | Level | Entry Point | Pipeline |
3187
+ |-------|------------|---------|
3188
+ | L0 | "I have an idea" | /create-prd then /plan-project then per-issue L2 |
3189
+ | L1 | "I need a feature" | /plan-feature then per-issue L2 |
3190
+ | L2 | "I have issue #42" | /prime then /plan then /execute then /validate then /ship |
3191
+ | L3 | "There's a bug" | /prime then debug then fix then /validate then /ship |
3192
+
3193
+ ## Documentation
3194
+
3195
+ - [Methodology](docs/methodology.md) — The PIV+E loop explained
3196
+ - [Getting Started](docs/getting-started.md) — Setup and walkthrough
3197
+ - [Command Reference](docs/command-reference.md) — All commands
3198
+ - [Customization](docs/customization.md) — Adding agents, rules, skills
3199
+ - [Plugin Install Guide](docs/plugin-install-guide.md) — Dependencies
3200
+
3201
+ ## Credits
3202
+
3203
+ Synthesizes approaches from:
3204
+ - [Cole Medin's AI Coding Summit Workshop](https://github.com/coleam00/ai-coding-summit-workshop-2) — PIV loop, context resets, plan-as-specification
3205
+ - Real-world battle-tested Claude Code configurations from production development
3206
+
3207
+ ## License
3208
+
3209
+ MIT
3210
+ ```
3211
+
3212
+ - [ ] **Step 2: Create package.json**
3213
+
3214
+ ```json
3215
+ {
3216
+ "name": "ai-development-framework",
3217
+ "version": "0.1.0",
3218
+ "description": "The system around the AI that makes the AI reliable. Structured AI-assisted development with the PIV+E loop.",
3219
+ "bin": {
3220
+ "ai-framework": "./cli/index.js"
3221
+ },
3222
+ "keywords": [
3223
+ "ai",
3224
+ "claude",
3225
+ "claude-code",
3226
+ "development-framework",
3227
+ "agentic",
3228
+ "piv-loop"
3229
+ ],
3230
+ "author": "Cristian-Robert Iosef",
3231
+ "license": "MIT",
3232
+ "files": [
3233
+ "cli/",
3234
+ ".claude/",
3235
+ "docs/",
3236
+ "CLAUDE.md",
3237
+ "README.md"
3238
+ ],
3239
+ "engines": {
3240
+ "node": ">=18"
3241
+ }
3242
+ }
3243
+ ```
3244
+
3245
+ - [ ] **Step 3: Commit**
3246
+
3247
+ ```bash
3248
+ git add README.md package.json
3249
+ git commit -m "feat: add README and package.json"
3250
+ ```
3251
+
3252
+ ---
3253
+
3254
+ ## Task 22: CLI Tool
3255
+
3256
+ **Files:**
3257
+ - Create: `cli/index.js`
3258
+ - Create: `cli/init.js`
3259
+
3260
+ - [ ] **Step 1: Create cli/index.js**
3261
+
3262
+ ```javascript
3263
+ #!/usr/bin/env node
3264
+
3265
+ const command = process.argv[2];
3266
+
3267
+ switch (command) {
3268
+ case 'init':
3269
+ require('./init.js');
3270
+ break;
3271
+ case '--help':
3272
+ case '-h':
3273
+ case undefined:
3274
+ console.log(`
3275
+ AIDevelopmentFramework CLI
3276
+
3277
+ Usage:
3278
+ ai-framework init Set up the framework in the current project
3279
+ ai-framework --help Show this help message
3280
+ `);
3281
+ break;
3282
+ default:
3283
+ console.error('Unknown command: ' + command);
3284
+ console.log('Run "ai-framework --help" for usage information.');
3285
+ process.exit(1);
3286
+ }
3287
+ ```
3288
+
3289
+ - [ ] **Step 2: Create cli/init.js**
3290
+
3291
+ ```javascript
3292
+ const fs = require('fs');
3293
+ const path = require('path');
3294
+ const readline = require('readline');
3295
+
3296
+ const rl = readline.createInterface({
3297
+ input: process.stdin,
3298
+ output: process.stdout,
3299
+ });
3300
+
3301
+ function ask(question) {
3302
+ return new Promise((resolve) => rl.question(question, resolve));
3303
+ }
3304
+
3305
+ function copyDirRecursive(src, dest) {
3306
+ if (!fs.existsSync(dest)) {
3307
+ fs.mkdirSync(dest, { recursive: true });
3308
+ }
3309
+ const entries = fs.readdirSync(src, { withFileTypes: true });
3310
+ for (const entry of entries) {
3311
+ const srcPath = path.join(src, entry.name);
3312
+ const destPath = path.join(dest, entry.name);
3313
+ if (entry.isDirectory()) {
3314
+ copyDirRecursive(srcPath, destPath);
3315
+ } else {
3316
+ fs.copyFileSync(srcPath, destPath);
3317
+ }
3318
+ }
3319
+ }
3320
+
3321
+ function detectTechStack() {
3322
+ const detected = [];
3323
+ try {
3324
+ const pkg = JSON.parse(fs.readFileSync('package.json', 'utf-8'));
3325
+ const deps = Object.assign({}, pkg.dependencies, pkg.devDependencies);
3326
+ if (deps['next']) detected.push('Next.js');
3327
+ if (deps['react']) detected.push('React');
3328
+ if (deps['vue']) detected.push('Vue');
3329
+ if (deps['express']) detected.push('Express');
3330
+ if (deps['@nestjs/core']) detected.push('NestJS');
3331
+ if (deps['expo']) detected.push('Expo');
3332
+ if (deps['@supabase/supabase-js']) detected.push('Supabase');
3333
+ if (deps['tailwindcss']) detected.push('Tailwind');
3334
+ if (deps['stripe']) detected.push('Stripe');
3335
+ } catch (e) {
3336
+ // No package.json or parse error
3337
+ }
3338
+
3339
+ if (fs.existsSync('requirements.txt') || fs.existsSync('pyproject.toml')) {
3340
+ detected.push('Python');
3341
+ }
3342
+ if (fs.existsSync('go.mod')) {
3343
+ detected.push('Go');
3344
+ }
3345
+
3346
+ return detected;
3347
+ }
3348
+
3349
+ async function main() {
3350
+ console.log('\nWelcome to AIDevelopmentFramework!\n');
3351
+
3352
+ const hasGit = fs.existsSync('.git');
3353
+ const hasClaudeDir = fs.existsSync('.claude');
3354
+
3355
+ const projectType = await ask(
3356
+ 'Is this a new project or existing codebase? (new/existing): '
3357
+ );
3358
+
3359
+ const stack = detectTechStack();
3360
+ if (stack.length > 0) {
3361
+ console.log('\nDetected tech stack: ' + stack.join(', '));
3362
+ await ask('Press Enter to confirm (or type your stack): ');
3363
+ } else {
3364
+ await ask('What tech stack are you using? ');
3365
+ }
3366
+
3367
+ await ask('Do you use GitHub Issues for task tracking? (yes/no): ');
3368
+
3369
+ // Copy .claude/ structure
3370
+ if (!hasClaudeDir) {
3371
+ const frameworkDir = path.join(__dirname, '..');
3372
+ const sourceClaudeDir = path.join(frameworkDir, '.claude');
3373
+ const targetClaudeDir = path.join(process.cwd(), '.claude');
3374
+ console.log('\nCopying .claude/ framework structure...');
3375
+ copyDirRecursive(sourceClaudeDir, targetClaudeDir);
3376
+ console.log(' Done.');
3377
+ } else {
3378
+ console.log('\n.claude/ already exists. Skipping copy.');
3379
+ }
3380
+
3381
+ // Create docs directory
3382
+ const docsDir = path.join(process.cwd(), 'docs', 'plans');
3383
+ if (!fs.existsSync(docsDir)) {
3384
+ fs.mkdirSync(docsDir, { recursive: true });
3385
+ console.log('Created docs/plans/ directory.');
3386
+ }
3387
+
3388
+ console.log('\nSetup complete!\n');
3389
+ console.log('Next steps:');
3390
+ console.log(' 1. Run /setup in Claude Code to check plugin dependencies');
3391
+ console.log(' 2. Run /prime to load codebase context');
3392
+ console.log(' 3. Run /start to begin your first task\n');
3393
+
3394
+ rl.close();
3395
+ }
3396
+
3397
+ main().catch(function (err) {
3398
+ console.error('Error: ' + err.message);
3399
+ process.exit(1);
3400
+ });
3401
+ ```
3402
+
3403
+ - [ ] **Step 3: Make CLI executable and commit**
3404
+
3405
+ ```bash
3406
+ chmod +x cli/index.js
3407
+ git add cli/
3408
+ git commit -m "feat: add CLI tool (npx ai-framework init)"
3409
+ ```
3410
+
3411
+ ---
3412
+
3413
+ ## Task 23: .gitignore and Final Cleanup
3414
+
3415
+ **Files:**
3416
+ - Create: `.gitignore`
3417
+
3418
+ - [ ] **Step 1: Create .gitignore**
3419
+
3420
+ ```
3421
+ node_modules/
3422
+ dist/
3423
+ build/
3424
+ .next/
3425
+ .expo/
3426
+ *.log
3427
+ .env
3428
+ .env.local
3429
+ .env.*.local
3430
+ .DS_Store
3431
+ .idea/
3432
+ .vscode/
3433
+ *.swp
3434
+ *.swo
3435
+ ```
3436
+
3437
+ - [ ] **Step 2: Commit**
3438
+
3439
+ ```bash
3440
+ git add .gitignore
3441
+ git commit -m "chore: add .gitignore"
3442
+ ```
3443
+
3444
+ ---
3445
+
3446
+ ## Self-Review Checklist
3447
+
3448
+ - [x] **Spec coverage:** All items from the design document are covered:
3449
+ - 10 commands (Tasks 10-19)
3450
+ - 4 agents + template (Tasks 5-8)
3451
+ - 2 skills (Task 9)
3452
+ - 7 rules (Task 2)
3453
+ - 5 references (Task 3)
3454
+ - 5 hooks (Task 4)
3455
+ - Documentation (Task 20)
3456
+ - CLI (Task 22)
3457
+ - README + package.json (Task 21)
3458
+ - CLAUDE.md + settings (Task 1)
3459
+
3460
+ - [x] **Placeholder scan:** No TBD or TODO text. Template files (code-patterns.md, agent knowledge bases) are intentionally empty — they get populated per-project by /create-rules and /evolve.
3461
+
3462
+ - [x] **Type consistency:** File paths, command names, agent query types, and skill names are consistent across all files.