@su-record/vibe 2.9.2 → 2.9.3

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 (59) hide show
  1. package/CLAUDE.md +30 -10
  2. package/README.ko.md +90 -25
  3. package/README.md +139 -25
  4. package/agents/teams/figma/figma-builder.md +29 -1
  5. package/agents/teams/review-debate-team.md +1 -1
  6. package/commands/vibe.analyze.md +324 -170
  7. package/commands/vibe.figma.md +549 -34
  8. package/commands/vibe.harness.md +177 -0
  9. package/commands/vibe.run.md +44 -27
  10. package/commands/vibe.scaffold.md +195 -0
  11. package/commands/vibe.spec.md +375 -947
  12. package/commands/vibe.trace.md +17 -0
  13. package/commands/vibe.verify.md +19 -10
  14. package/dist/cli/commands/init.d.ts.map +1 -1
  15. package/dist/cli/commands/init.js +29 -1
  16. package/dist/cli/commands/init.js.map +1 -1
  17. package/dist/cli/commands/update.d.ts.map +1 -1
  18. package/dist/cli/commands/update.js +4 -2
  19. package/dist/cli/commands/update.js.map +1 -1
  20. package/dist/cli/postinstall/constants.d.ts +1 -1
  21. package/dist/cli/postinstall/constants.d.ts.map +1 -1
  22. package/dist/cli/postinstall/constants.js +6 -1
  23. package/dist/cli/postinstall/constants.js.map +1 -1
  24. package/dist/cli/setup/ProjectSetup.d.ts +12 -1
  25. package/dist/cli/setup/ProjectSetup.d.ts.map +1 -1
  26. package/dist/cli/setup/ProjectSetup.js +259 -72
  27. package/dist/cli/setup/ProjectSetup.js.map +1 -1
  28. package/dist/cli/setup.d.ts +1 -1
  29. package/dist/cli/setup.d.ts.map +1 -1
  30. package/dist/cli/setup.js +1 -1
  31. package/dist/cli/setup.js.map +1 -1
  32. package/hooks/scripts/figma-guard.js +220 -0
  33. package/package.json +1 -1
  34. package/skills/arch-guard/SKILL.md +1 -1
  35. package/skills/capability-loop/SKILL.md +106 -2
  36. package/skills/chub-usage/SKILL.md +43 -43
  37. package/skills/claude-md-guide/SKILL.md +175 -175
  38. package/skills/design-teach/SKILL.md +33 -33
  39. package/skills/devlog/SKILL.md +38 -38
  40. package/skills/event-comms/SKILL.md +23 -13
  41. package/skills/event-ops/SKILL.md +28 -19
  42. package/skills/event-planning/SKILL.md +13 -1
  43. package/skills/priority-todos/SKILL.md +1 -1
  44. package/skills/vibe.figma/SKILL.md +234 -154
  45. package/skills/vibe.figma.convert/SKILL.md +123 -112
  46. package/skills/vibe.figma.extract/SKILL.md +141 -129
  47. package/skills/vibe.interview/SKILL.md +358 -0
  48. package/skills/vibe.interview/checklists/api.md +101 -0
  49. package/skills/vibe.interview/checklists/feature.md +88 -0
  50. package/skills/vibe.interview/checklists/library.md +95 -0
  51. package/skills/vibe.interview/checklists/mobile.md +89 -0
  52. package/skills/vibe.interview/checklists/webapp.md +97 -0
  53. package/skills/vibe.interview/checklists/website.md +99 -0
  54. package/skills/vibe.plan/SKILL.md +216 -0
  55. package/skills/vibe.spec/SKILL.md +1155 -0
  56. package/{commands/vibe.spec.review.md → skills/vibe.spec.review/SKILL.md} +269 -108
  57. package/vibe/templates/claudemd-template.md +74 -0
  58. package/vibe/templates/constitution-template.md +15 -0
  59. package/vibe/templates/plan-template.md +194 -0
@@ -0,0 +1,177 @@
1
+ ---
2
+ description: Diagnose project Harness Engineering maturity across 6 axes
3
+ argument-hint: (no arguments)
4
+ ---
5
+
6
+ # /vibe.harness
7
+
8
+ Diagnose project Harness Engineering maturity across 6 axes and suggest targeted improvements.
9
+
10
+ > Harness = the working environment that enables AI to operate effectively on its own.
11
+ > Encompasses context, constraints, workflows, verification, and compounding — not just guardrails.
12
+
13
+ ## Step 0: Detect Project Type
14
+
15
+ Before scoring, read `CLAUDE.md` and `package.json` to determine project type:
16
+
17
+ | Type | Signal | Effect |
18
+ |------|--------|--------|
19
+ | **Application** (webapp, api, fullstack, mobile) | `type` in config, app-like structure | Full rubric applies |
20
+ | **Package/Library** | `"main"` or `"exports"` in package.json, "npm package" in CLAUDE.md | Skip docs/, .dev/ items (mark N/A), adjust total denominator |
21
+ | **Monorepo** | `workspaces` in package.json, `apps/` or `packages/` dirs | Score each workspace separately |
22
+
23
+ When items are N/A, **remove their points from the total** rather than scoring 0. A library scoring 65/80 (N/A items excluded) = 81%, not 65%.
24
+
25
+ ---
26
+
27
+ ## Process
28
+
29
+ ### 1. Collect Project State (Parallel Agents)
30
+
31
+ Dispatch 3 explorer agents in a single message:
32
+
33
+ ```text
34
+ Agent(subagent_type="explorer-low", model="haiku",
35
+ prompt="Check project scaffolding: 1) Does docs/ exist with business documents? 2) Does .dev/ exist for AI logs? 3) Is src/ organized by role (not flat)? 4) Is tests/ separate from src/? 5) List top-level directory structure.")
36
+
37
+ Agent(subagent_type="explorer-low", model="haiku",
38
+ prompt="Check project context and boundaries: 1) Does CLAUDE.md exist? How many lines? 2) Does .claude/rules/ or .claude/vibe/ exist? How many rule files? 3) Does .claude/settings.local.json exist with hooks? 4) Does .claude/vibe/config.json exist? 5) Are there any .claude/skills/ directories?")
39
+
40
+ Agent(subagent_type="explorer-low", model="haiku",
41
+ prompt="Check project planning, execution, and verification: 1) Are there SPEC files in .claude/vibe/specs/? 2) Are there Feature (BDD) files in .claude/vibe/features/? 3) Are there test files? How many? 4) Is there CI config (.github/workflows, etc.)? 5) Are there .dev/learnings/ files?")
42
+ ```
43
+
44
+ ### 2. Score Each Axis
45
+
46
+ #### Axis 1: Scaffolding — /20
47
+
48
+ | Item | Criteria | Points |
49
+ |------|----------|--------|
50
+ | Role-based folders | src/ subdivided by role (components/, services/, models/, etc.) | /5 |
51
+ | docs/ exists | Business document directory with content (N/A for packages/libraries) | /4 |
52
+ | .dev/ exists | AI work log directory (N/A for packages/libraries) | /3 |
53
+ | tests/ separated | Tests not co-located with source files | /3 |
54
+ | .gitignore complete | Includes out/, .dev/scratch/, settings.local.json | /2 |
55
+ | Layer separation | Domain/service/infra or similar architectural layers | /3 |
56
+
57
+ #### Axis 2: Context — /20
58
+
59
+ | Item | Criteria | Points |
60
+ |------|----------|--------|
61
+ | CLAUDE.md exists | Serves as project map | /5 |
62
+ | CLAUDE.md is concise | ~100 lines or fewer, pointer-based | /3 |
63
+ | Rules defined | Coding rules and test conventions in .claude/rules/ or similar | /4 |
64
+ | Progressive disclosure | Skill tier separation or rules loaded via glob patterns | /3 |
65
+ | docs/ referenced | CLAUDE.md references docs/ for business context | /3 |
66
+ | Language rules | Stack-specific coding standards defined | /2 |
67
+
68
+ #### Axis 3: Planning — /15
69
+
70
+ | Item | Criteria | Points |
71
+ |------|----------|--------|
72
+ | SPEC workflow | System for generating spec/feature files | /5 |
73
+ | Requirements gathering | Interview or requirements collection process exists | /4 |
74
+ | Approval gates | Confirmation step between planning and implementation | /3 |
75
+ | Templates | SPEC/Feature templates available | /3 |
76
+
77
+ #### Axis 4: Orchestration — /15
78
+
79
+ | Item | Criteria | Points |
80
+ |------|----------|--------|
81
+ | Agents or skills | Specialized agents or skills defined | /5 |
82
+ | Team composition | Agent teams (architect + implementer + tester, etc.) | /4 |
83
+ | Permission model | Per-agent permission separation (read-only vs write) | /3 |
84
+ | Non-code workflows | Support for documentation, research, and other non-code tasks | /3 |
85
+
86
+ #### Axis 5: Verification — /15
87
+
88
+ | Item | Criteria | Points |
89
+ |------|----------|--------|
90
+ | Automated quality checks | PostToolUse hooks for code inspection | /4 |
91
+ | Tests exist | Test files present and executable | /4 |
92
+ | CI/CD | Automated build/test pipeline configured | /4 |
93
+ | Traceability | SPEC → code → test mapping (RTM) | /3 |
94
+
95
+ #### Axis 6: Compounding — /15
96
+
97
+ | Item | Criteria | Points |
98
+ |------|----------|--------|
99
+ | Learnings recorded | Troubleshooting records in .dev/learnings/ (N/A for packages/libraries) | /4 |
100
+ | Pattern accumulation | Repeated tasks codified as skills or rules | /4 |
101
+ | Auto-improvement | Evolution Engine or similar self-improvement mechanism | /4 |
102
+ | Memory | Cross-session learning persistence mechanism | /3 |
103
+
104
+ ### 3. Generate Report
105
+
106
+ ```markdown
107
+ ## Harness Diagnosis (N/100)
108
+
109
+ ### Score and Grade
110
+ - **Score**: N/100
111
+ - **Grade**: [S / A / B / C / D]
112
+
113
+ | Grade | Range | Description |
114
+ |-------|-------|-------------|
115
+ | S | 90-100 | Production-ready Harness |
116
+ | A | 75-89 | Well-structured, minor gaps |
117
+ | B | 60-74 | Functional but missing key elements |
118
+ | C | 40-59 | Basic setup, significant gaps |
119
+ | D | 0-39 | Minimal or no Harness |
120
+
121
+ ### Axis Scores
122
+
123
+ | Axis | Score | Details |
124
+ |------|-------|---------|
125
+ | Scaffolding | /20 | [findings] |
126
+ | Context | /20 | [findings] |
127
+ | Planning | /15 | [findings] |
128
+ | Orchestration | /15 | [findings] |
129
+ | Verification | /15 | [findings] |
130
+ | Compounding | /15 | [findings] |
131
+
132
+ ### Top 3 Improvements
133
+
134
+ 1. **[lowest axis]**: [specific action with command]
135
+ 2. **[second lowest]**: [specific action with command]
136
+ 3. **[third lowest]**: [specific action with command]
137
+
138
+ ### Auto-Fixable Items
139
+
140
+ The following can be improved immediately:
141
+ 1. [ ] `/vibe.scaffold` — generate missing project directories
142
+ 2. [ ] `vibe init` — initialize AI configuration
143
+ 3. [ ] `vibe update` — regenerate CLAUDE.md from project analysis
144
+
145
+ Proceed with auto-fix? (y/n)
146
+ ```
147
+
148
+ ### 4. Save Report
149
+
150
+ Save results to `.claude/vibe/reports/harness-{date}.md` for historical tracking.
151
+
152
+ ### 5. Self-Repair Chain
153
+
154
+ After scoring, if actionable gaps are detected:
155
+
156
+ | Condition | Auto-Suggestion |
157
+ |-----------|-----------------|
158
+ | Scaffolding < 10/20 | Suggest `/vibe.scaffold` to generate missing directories |
159
+ | Context < 10/20 | Suggest `vibe update` to regenerate CLAUDE.md |
160
+ | Planning < 8/15 | Suggest `/vibe.spec` to establish SPEC workflow |
161
+ | Verification < 8/15 | Suggest `vibe init` to install quality hooks |
162
+ | Compounding < 8/15 | Suggest creating `.dev/learnings/` and enabling evolution engine |
163
+
164
+ If user approves auto-fix, execute the suggested commands in sequence, then re-run `/vibe.harness` to verify improvement.
165
+
166
+ ---
167
+
168
+ ## Principles
169
+
170
+ 1. **Score honestly** — never inflate scores
171
+ 2. **Suggest specific actions** — executable commands, not vague advice like "improve structure"
172
+ 3. **Focus on top 3** — don't try to fix everything at once
173
+ 4. **Track over time** — enable score comparison across runs via saved reports
174
+
175
+ ---
176
+
177
+ ARGUMENTS: $ARGUMENTS
@@ -132,7 +132,7 @@ After implementing each scenario, **automatic verification**:
132
132
  │ → Fix code (Read full file first) │
133
133
  │ → Re-run failed scenario only │
134
134
  │ → PASS? → Next scenario │
135
- │ → FAIL? → Retry (max 3)
135
+ │ → FAIL (same as prev)? → STUCK Ask user
136
136
  │ │
137
137
  │ 핵심: 검증이 가벼울수록 루프는 더 많이 돈다 │
138
138
  │ - 접근성 트리: button "Sign In" = 15 chars │
@@ -171,9 +171,17 @@ Scenario verification failed (코드 분석 또는 E2E)
171
171
 
172
172
  [Re-verify] - Re-run ONLY failed scenario (save tokens)
173
173
 
174
- Repeat until pass (max 3 times)
174
+ Repeat until pass (라운드 캡 없음 — stuck 감지로 종료)
175
175
  ```
176
176
 
177
+ **Termination conditions:**
178
+ - ✅ PASS → 다음 scenario
179
+ - ⚠️ Stuck (같은 failure가 이전 라운드와 동일) → 사용자 질문:
180
+ 1. 직접 수정 방법 제공 (예: "LoginForm.tsx 42줄 수정") → 재시도
181
+ 2. "proceed" — 남은 실패 TODO 기록 후 다음 scenario
182
+ 3. "abort" — 구현 중단
183
+ - `ultrawork` 모드: stuck 시 프롬프트 없이 TODO 기록 후 다음 scenario
184
+
177
185
  ---
178
186
 
179
187
  ## **ULTRAWORK Mode** (ulw)
@@ -191,7 +199,7 @@ When you include `ultrawork` (or `ulw`), ALL of these activate automatically:
191
199
  | **Context Compression** | Aggressive auto-save at 70%+ context |
192
200
  | **No Pause** | Doesn't wait for confirmation between phases |
193
201
  | **External LLMs** | Auto-consults GPT/Gemini if enabled |
194
- | **Error Recovery** | Auto-retries on failure (up to 3 times) |
202
+ | **Error Recovery** | Loops until 100% or stuck; on stuck auto-records TODO and proceeds (no user prompt) |
195
203
  | **Race Review (v2.6.9)** | Multi-LLM review (GPT+Gemini) with cross-validation |
196
204
 
197
205
  ### Boulder Loop (Inspired by Sisyphus)
@@ -258,7 +266,7 @@ Like Sisyphus rolling the boulder, ULTRAWORK **keeps going until done**:
258
266
  │ └──────────────────────────────────────────────────────────┘ │
259
267
  │ │ │
260
268
  │ ┌──────────┴──────────┐ │
261
- │ │ Coverage 95%? │ │
269
+ │ │ Coverage == 100%? │ │
262
270
  │ └──────────┬──────────┘ │
263
271
  │ │ │ │
264
272
  │ NO YES │
@@ -273,9 +281,18 @@ Like Sisyphus rolling the boulder, ULTRAWORK **keeps going until done**:
273
281
  │ │ │
274
282
  │ └──────────→ [Re-generate RTM] │
275
283
  │ │
276
- MAX_ITERATIONS: 5 (prevent infinite loops)
277
- COVERAGE_THRESHOLD: 95% (quality gate)
278
- ZERO TOLERANCE for scope reduction
284
+
285
+
286
+ Stuck? (coverage unchanged from prev iteration)
287
+ │ │ │
288
+ │ ├─ Interactive: Ask user │
289
+ │ │ 1. Provide resolution → retry │
290
+ │ │ 2. "proceed" → TODO + done │
291
+ │ │ 3. "abort" → stop │
292
+ │ └─ ultrawork: TODO + done │
293
+ │ │
294
+ │ NO iteration cap — loop until 100% OR stuck │
295
+ │ ZERO TOLERANCE for silent scope reduction │
279
296
  └─────────────────────────────────────────────────────────────────┘
280
297
  ```
281
298
 
@@ -302,18 +319,18 @@ node -e "import('{{VIBE_PATH_URL}}/node_modules/@su-record/vibe/dist/tools/index
302
319
  | Rule | Description |
303
320
  |------|-------------|
304
321
  | **No Scope Reduction** | Never say "simplified" or "basic version" - implement FULL request |
305
- | **Iteration Tracking** | Display `[{{ITER}}/{{MAX}}]` to show progress |
322
+ | **Iteration Tracking** | Display `[{{ITER}}]` to show progress (no max — loop until done) |
306
323
  | **RTM-Based Gap List** | Use `uncoveredRequirements` array - no manual comparison |
307
- | **Coverage Threshold** | Must reach 95% coverage to complete |
308
- | **Max Iterations** | Stop at 5 iterations (report remaining gaps as TODO) |
309
- | **Convergence Detection** | If coverage % unchanged between iterations → STOP (converged) |
310
- | **Diminishing Returns** | Iteration 3+ → only implement unmet core requirements (REQ-*-001~003), rest goes to TODO |
324
+ | **Coverage Threshold** | Must reach 100% coverage to complete |
325
+ | **No Iteration Cap** | Loop until 100% coverage OR stuck (convergence detected) |
326
+ | **Stuck Handling** | If coverage % unchanged between iterations → ask user (proceed/abort/fix), or ultrawork → TODO + done |
327
+ | **Diminishing Returns (Narrowing)** | Iteration 3+ → focus on core requirements (REQ-*-001~003) first; P2/P3 requirements continue to loop but lower priority |
311
328
 
312
329
  **Ralph Loop Output Format:**
313
330
 
314
331
  ```
315
332
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
316
- 🔄 RALPH VERIFICATION [Iteration 1/5]
333
+ 🔄 RALPH VERIFICATION [Iteration 1]
317
334
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
318
335
 
319
336
  📊 RTM Coverage Report: login
@@ -334,7 +351,7 @@ Requirements Traceability:
334
351
  ❌ REQ-login-008: Error toast → NOT IMPLEMENTED
335
352
  ✅ REQ-login-009: Session storage → Scenario 4 → (no test)
336
353
 
337
- Overall Coverage: 55% ⚠️ BELOW 95% THRESHOLD
354
+ Overall Coverage: 55% ⚠️ BELOW 100% TARGET
338
355
 
339
356
  UNCOVERED REQUIREMENTS (auto-extracted from RTM):
340
357
  1. REQ-login-004: Remember me checkbox
@@ -345,7 +362,7 @@ UNCOVERED REQUIREMENTS (auto-extracted from RTM):
345
362
  ⚠️ NOT COMPLETE - Implementing uncovered requirements...
346
363
 
347
364
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
348
- 🔄 RALPH VERIFICATION [Iteration 2/5]
365
+ 🔄 RALPH VERIFICATION [Iteration 2]
349
366
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
350
367
 
351
368
  📊 RTM Coverage Report: login
@@ -356,7 +373,7 @@ Requirements Traceability:
356
373
  Feature Covered: 9/9 (100%)
357
374
  Test Covered: 9/9 (100%)
358
375
 
359
- Overall Coverage: 100% ✅ ABOVE 95% THRESHOLD
376
+ Overall Coverage: 100% ✅ TARGET REACHED
360
377
 
361
378
  Build: ✅ Passed
362
379
  Tests: ✅ 12/12 Passed
@@ -396,7 +413,7 @@ Claude:
396
413
  📄 SPEC: .claude/vibe/specs/brick-game.md
397
414
  🎯 4 Phases detected
398
415
  ⚡ Boulder Loop: ENABLED (will continue until all phases complete)
399
- 🔄 Auto-retry: ON (max 3 per phase)
416
+ 🔄 Auto-retry: ON (loop until 100% or stuck → auto-TODO)
400
417
  💾 Context compression: AGGRESSIVE
401
418
 
402
419
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
@@ -416,7 +433,7 @@ Claude:
416
433
  ✅ Exploration complete (6.8s)
417
434
  🔨 Implementing...
418
435
  ❌ Test failed: collision detection
419
- 🔄 Auto-retry 1/3...
436
+ 🔄 Auto-retry [iteration 1]...
420
437
  🔨 Fixing...
421
438
  ✅ Phase 2 complete
422
439
 
@@ -454,13 +471,13 @@ Magic keywords in the user input automatically set the **AutomationLevel**, whic
454
471
 
455
472
  ### Level Definitions
456
473
 
457
- | Level | Name | Keyword(s) | Auto-advance | Auto-retry | Max Retries | Parallel Agents | Checkpoints |
458
- |-------|------|------------|--------------|------------|-------------|-----------------|-------------|
459
- | L0 | Manual | `manual` | No | No | 0 | No | All |
460
- | L1 | Guided | `guided`, `verify` | No | No | 0 | No | All |
461
- | L2 | Semi-auto | `quick` (default) | Yes | Yes | 2 | No | Key points |
462
- | L3 | Auto | `ultrawork`, `ulw` | Yes | Yes | 3 | Yes | Checkpoint-only |
463
- | L4 | Full-auto | `ralph`, `ralplan` | Yes | Yes | 5 | Yes | None |
474
+ | Level | Name | Keyword(s) | Auto-advance | Auto-retry | Stuck Behavior | Parallel Agents | Checkpoints |
475
+ |-------|------|------------|--------------|------------|----------------|-----------------|-------------|
476
+ | L0 | Manual | `manual` | No | No | Ask user every step | No | All |
477
+ | L1 | Guided | `guided`, `verify` | No | No | Ask user on stuck | No | All |
478
+ | L2 | Semi-auto | `quick` (default) | Yes | Yes (low cap: 2) | Ask user after 2 retries | No | Key points |
479
+ | L3 | Auto | `ultrawork`, `ulw` | Yes | Yes (no cap) | Auto-TODO + proceed | Yes | Checkpoint-only |
480
+ | L4 | Full-auto | `ralph`, `ralplan` | Yes | Yes (no cap) | Auto-TODO + proceed | Yes | None |
464
481
 
465
482
  ### Detection Rule
466
483
 
@@ -1043,7 +1060,7 @@ Then: Login success + JWT token returned
1043
1060
  ❌ Then: "Invalid credentials" error message
1044
1061
  Actual: "Error occurred" returned
1045
1062
 
1046
- [Auto-fix 1/3]
1063
+ [Auto-fix iteration 1]
1047
1064
  Cause: Error message not properly set
1048
1065
  Fix: auth.service.ts line 42
1049
1066
 
@@ -1675,7 +1692,7 @@ Then: Login success + JWT token returned
1675
1692
  ❌ Then: "Invalid credentials" error message
1676
1693
  Actual: "Error" returned
1677
1694
 
1678
- 🔄 Auto-fix 1/3...
1695
+ 🔄 Auto-fix [iteration 1]...
1679
1696
  Fix: auth.service.ts line 42
1680
1697
 
1681
1698
  🔍 Re-verifying...
@@ -0,0 +1,195 @@
1
+ ---
2
+ description: Generate or audit project folder structure optimized for AI-assisted development
3
+ argument-hint: --check (audit existing) or project-type
4
+ ---
5
+
6
+ # /vibe.scaffold
7
+
8
+ Design and generate a project structure where AI works effectively on its own.
9
+
10
+ > "A well-designed project structure trains AI to follow it naturally."
11
+
12
+ ## Usage
13
+
14
+ ```
15
+ /vibe.scaffold # Generate structure (auto-detect stack)
16
+ /vibe.scaffold --check # Audit existing structure + suggest improvements
17
+ /vibe.scaffold webapp # Generate webapp-type structure
18
+ /vibe.scaffold api # Generate api-type structure
19
+ ```
20
+
21
+ ---
22
+
23
+ ## Process
24
+
25
+ ### 1. Assess Current State
26
+
27
+ 1. Read `CLAUDE.md`, `package.json`, `pyproject.toml`, `pubspec.yaml`
28
+ 2. Scan existing folder structure via `Glob`
29
+ 3. Read `.claude/vibe/config.json` for detected stacks
30
+
31
+ ### 2. Determine Project Type
32
+
33
+ | Type | Structure |
34
+ |------|-----------|
35
+ | `webapp` | src/ + pages/ + components/ + hooks/ + styles/ |
36
+ | `api` | src/ + routes/ + services/ + models/ + middleware/ |
37
+ | `fullstack` | src/client/ + src/server/ or apps/ monorepo |
38
+ | `library` | src/ + examples/ + benchmarks/ |
39
+ | `mobile` | lib/ (Flutter) or src/ (React Native) |
40
+
41
+ ### 3. Generate Base Structure
42
+
43
+ Common directories for all projects:
44
+
45
+ ```
46
+ my-project/
47
+ ├── src/ # Business logic
48
+ ├── docs/ # Human-maintained business documents (AI reference)
49
+ │ ├── README.md # Explains purpose: business rules, domain defs, ADR
50
+ │ └── adr/ # Architecture Decision Records
51
+ ├── tests/ # Test infrastructure
52
+ ├── .dev/ # AI-generated work logs
53
+ │ ├── README.md # Explains purpose: learnings, debug logs, scratch
54
+ │ ├── learnings/ # Troubleshooting records
55
+ │ └── scratch/ # Experiments, scratchpad (gitignored)
56
+ ├── .claude/ # AI configuration (managed by vibe init)
57
+ ├── out/ # Build artifacts (gitignored)
58
+ └── CLAUDE.md # Project map
59
+ ```
60
+
61
+ ### 4. Stack-Specific src/ Layout
62
+
63
+ **React/Next.js (webapp):**
64
+ ```
65
+ src/
66
+ ├── components/ # Reusable UI components
67
+ │ ├── ui/ # Primitives (Button, Input, Modal)
68
+ │ └── features/ # Feature-specific components
69
+ ├── pages/ or app/ # Routes (varies by Next.js version)
70
+ ├── hooks/ # Custom hooks
71
+ ├── lib/ # Utilities, helpers
72
+ ├── services/ # API calls, external services
73
+ ├── stores/ # State management (zustand, jotai, etc.)
74
+ ├── types/ # Type definitions
75
+ └── styles/ # Global styles
76
+ ```
77
+
78
+ **Express/NestJS/FastAPI (api):**
79
+ ```
80
+ src/
81
+ ├── routes/ # API routes (or controllers/)
82
+ ├── services/ # Business logic
83
+ ├── models/ # Data models, schemas
84
+ ├── middleware/ # Auth, logging, error handling
85
+ ├── lib/ # Utilities
86
+ ├── types/ # Type definitions
87
+ └── config/ # Configuration management
88
+ ```
89
+
90
+ **Flutter (mobile):**
91
+ ```
92
+ lib/
93
+ ├── screens/ # Screen widgets
94
+ ├── widgets/ # Reusable widgets
95
+ ├── services/ # API, local storage
96
+ ├── providers/ # State management
97
+ ├── models/ # Data models
98
+ ├── utils/ # Utilities
99
+ └── config/ # Configuration, constants
100
+ ```
101
+
102
+ ### 5. Clean Architecture Layers (Optional)
103
+
104
+ ```
105
+ src/
106
+ ├── domain/ # Business rules (pure logic, no external deps)
107
+ ├── application/ # Use cases (domain composition)
108
+ ├── infrastructure/ # External integrations (DB, API, files)
109
+ └── presentation/ # UI or API endpoints
110
+ ```
111
+
112
+ Layer rules:
113
+ - Dependency direction: presentation → application → domain (reverse forbidden)
114
+ - domain must not import external packages
115
+ - infrastructure implements domain interfaces
116
+
117
+ ### 6. Generate Supporting Files
118
+
119
+ | File | Content |
120
+ |------|---------|
121
+ | `docs/README.md` | Purpose of docs/ directory |
122
+ | `.dev/README.md` | Purpose of .dev/ directory |
123
+ | `.gitignore` additions | `out/`, `.dev/scratch/` entries |
124
+
125
+ ### 7. Update CLAUDE.md
126
+
127
+ Add generated structure as pointers in CLAUDE.md:
128
+
129
+ ```markdown
130
+ ## Project Structure
131
+ - `src/` — Business logic
132
+ - `docs/` — Human-maintained business docs (AI reads before work)
133
+ - `tests/` — Test infrastructure
134
+ - `.dev/` — AI-generated work logs
135
+ - `.claude/` — AI configuration
136
+ ```
137
+
138
+ ---
139
+
140
+ ## --check Mode: Audit Existing Structure
141
+
142
+ ### Checklist
143
+
144
+ | Item | Criteria | Points |
145
+ |------|----------|--------|
146
+ | `docs/` exists | Business documents separated | /15 |
147
+ | `.dev/` exists | AI work logs separated | /10 |
148
+ | src/ sub-structure | Role-based folder organization | /20 |
149
+ | tests/ separated | Not co-located with source | /15 |
150
+ | CLAUDE.md describes structure | Folder purposes documented | /10 |
151
+ | .gitignore complete | Includes out/, .dev/scratch/ | /5 |
152
+ | Layer separation | Domain/service/infra distinction | /15 |
153
+ | Dependency direction consistency | No reverse imports | /10 |
154
+
155
+ ### Output
156
+
157
+ ```markdown
158
+ ## Scaffold Audit Result (N/100)
159
+
160
+ ### Current Structure
161
+ [tree output]
162
+
163
+ ### Findings
164
+ | Item | Status | Recommendation |
165
+ |------|--------|----------------|
166
+ | docs/ | Missing | `mkdir docs && echo "..." > docs/README.md` |
167
+ | ... | ... | ... |
168
+
169
+ ### Auto-Fixable Items
170
+ 1. [ ] Create docs/
171
+ 2. [ ] Create .dev/
172
+ 3. [ ] Update .gitignore
173
+
174
+ Proceed with auto-fix? (y/n)
175
+ ```
176
+
177
+ ### Self-Repair
178
+
179
+ If audit score < 60, automatically suggest:
180
+ 1. Run `/vibe.scaffold` to generate missing directories
181
+ 2. Run `vibe update` to regenerate CLAUDE.md with structure info
182
+ 3. Run `/vibe.harness` for full maturity assessment
183
+
184
+ ---
185
+
186
+ ## Principles
187
+
188
+ 1. **Never delete or move existing files** — only add new directories
189
+ 2. **Empty directories get a README.md** — purpose description helps AI understand context
190
+ 3. **No structure < bad structure < good structure** — any scaffolding improves AI output
191
+ 4. **Separate by ownership** — human docs (docs/) vs AI logs (.dev/) in different directories
192
+
193
+ ---
194
+
195
+ ARGUMENTS: $ARGUMENTS