@haposoft/cafekit 0.3.11 → 0.4.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 (36) hide show
  1. package/README.md +83 -28
  2. package/bin/install.js +125 -1
  3. package/package.json +5 -3
  4. package/src/claude/hooks/agent.cjs +203 -0
  5. package/src/claude/hooks/lib/color.cjs +95 -0
  6. package/src/claude/hooks/lib/config.cjs +831 -0
  7. package/src/claude/hooks/lib/context.cjs +616 -0
  8. package/src/claude/hooks/lib/counter.cjs +103 -0
  9. package/src/claude/hooks/lib/detect.cjs +474 -0
  10. package/src/claude/hooks/lib/git.cjs +143 -0
  11. package/src/claude/hooks/lib/parser.cjs +182 -0
  12. package/src/claude/hooks/session.cjs +360 -0
  13. package/src/claude/hooks/usage.cjs +179 -0
  14. package/src/claude/migration-manifest.json +27 -2
  15. package/src/claude/settings/status.settings.json +54 -0
  16. package/src/claude/status.cjs +539 -0
  17. package/src/common/skills/code/SKILL.md +55 -0
  18. package/src/common/skills/code/references/execution-loop.md +21 -0
  19. package/src/common/skills/impact-analysis/references/change-detection.md +16 -16
  20. package/src/common/skills/impact-analysis/references/dependency-scouting.md +8 -8
  21. package/src/common/skills/impact-analysis/references/edge-case-identification.md +11 -11
  22. package/src/common/skills/impact-analysis/references/industry-techniques.md +36 -36
  23. package/src/common/skills/impact-analysis/references/practical-techniques-guide.md +16 -16
  24. package/src/common/skills/impact-analysis/references/project-detection.md +1 -1
  25. package/src/common/skills/impact-analysis/references/report-template.md +2 -2
  26. package/src/common/skills/impact-analysis/scripts/README.md +3 -3
  27. package/src/common/skills/review/SKILL.md +46 -0
  28. package/src/common/skills/review/references/review-focus.md +28 -0
  29. package/src/common/skills/spec-design/SKILL.md +66 -0
  30. package/src/common/skills/spec-design/references/design-discovery.md +46 -0
  31. package/src/common/skills/spec-init/SKILL.md +61 -0
  32. package/src/common/skills/spec-requirements/SKILL.md +59 -0
  33. package/src/common/skills/spec-requirements/references/requirements-workflow.md +36 -0
  34. package/src/common/skills/spec-tasks/SKILL.md +60 -0
  35. package/src/common/skills/spec-tasks/references/task-sizing.md +36 -0
  36. package/src/common/skills/test/SKILL.md +40 -0
@@ -1,12 +1,12 @@
1
- # Dependency Scouting - Tìm Files Bị Ảnh Hưởng
1
+ # Dependency Scouting - Finding Affected Files
2
2
 
3
- Phương pháp tìm kiếm phân tích dependencies để xác định phạm vi tác động.
3
+ Methods for finding and analyzing dependencies to determine impact scope.
4
4
 
5
5
  ## Scouting Strategies
6
6
 
7
7
  ### 1. Import Analysis (Direct Dependencies)
8
8
 
9
- Tìm files import code đã sửa:
9
+ Find files that import the modified code:
10
10
 
11
11
  ```bash
12
12
  # JavaScript/TypeScript
@@ -35,7 +35,7 @@ grep -r "from.*utils/auth" src/
35
35
 
36
36
  ### 2. Function/Class Usage (Reverse Dependencies)
37
37
 
38
- Tìm nơi sử dụng functions/classes:
38
+ Find where functions/classes are used:
39
39
 
40
40
  ```bash
41
41
  # Function calls
@@ -60,7 +60,7 @@ grep -r "validateEmail(" src/
60
60
 
61
61
  ### 3. API Endpoint Consumers
62
62
 
63
- Nếu sửa backend API, tìm frontend calls:
63
+ If backend API is modified, find frontend calls:
64
64
 
65
65
  ```bash
66
66
  # Fetch/Axios calls
@@ -84,7 +84,7 @@ grep -r "api/users" src/
84
84
 
85
85
  ### 4. Database Dependencies
86
86
 
87
- Nếu sửa database schema:
87
+ If database schema is modified:
88
88
 
89
89
  ```bash
90
90
  # Table usage
@@ -109,7 +109,7 @@ grep -r "prisma.user.findMany" src/
109
109
 
110
110
  ### 5. Type/Interface Dependencies
111
111
 
112
- Tìm nơi sử dụng types:
112
+ Find where types are used:
113
113
 
114
114
  ```bash
115
115
  # TypeScript interfaces
@@ -134,7 +134,7 @@ grep -r "as User" src/
134
134
 
135
135
  ## Using /ck:scout for Parallel Scouting
136
136
 
137
- Khi nhiều files thay đổi, sử dụng `/ck:scout` để parallel search:
137
+ When multiple files change, use `/ck:scout` for parallel search:
138
138
 
139
139
  ```
140
140
  /ck:scout Scout dependencies for changes.
@@ -1,6 +1,6 @@
1
- # Edge Case Identification - Xác Định Edge Cases
1
+ # Edge Case Identification - Identifying Edge Cases
2
2
 
3
- Phương pháp phát hiện phân tích edge cases để tránh bugs tiềm ẩn.
3
+ Methods for detecting and analyzing edge cases to avoid potential bugs.
4
4
 
5
5
  ## Edge Case Categories
6
6
 
@@ -23,10 +23,10 @@ function getUser(id: string) {
23
23
  ```
24
24
 
25
25
  **Check:**
26
- - [ ] check null/undefined trước khi access?
27
- - [ ] Optional chaining (`?.`) được sử dụng?
28
- - [ ] Nullish coalescing (`??`) cho default values?
29
- - [ ] Type guards cho union types?
26
+ - [ ] Check null/undefined before access?
27
+ - [ ] Optional chaining (`?.`) used?
28
+ - [ ] Nullish coalescing (`??`) for default values?
29
+ - [ ] Type guards for union types?
30
30
 
31
31
  #### Empty Collections
32
32
 
@@ -39,9 +39,9 @@ const firstUser = users.length > 0 ? users[0].name : null;
39
39
  ```
40
40
 
41
41
  **Check:**
42
- - [ ] Array.length check trước khi access index?
43
- - [ ] Empty array handling trong map/filter/reduce?
44
- - [ ] Object.keys() check trước khi iterate?
42
+ - [ ] Array.length check before accessing index?
43
+ - [ ] Empty array handling in map/filter/reduce?
44
+ - [ ] Object.keys() check before iterating?
45
45
 
46
46
  #### Type Coercion
47
47
 
@@ -54,8 +54,8 @@ if (value !== null && value !== undefined) { }
54
54
  ```
55
55
 
56
56
  **Check:**
57
- - [ ] Strict equality (`===`) thay loose (`==`)?
58
- - [ ] Explicit type checks cho boolean logic?
57
+ - [ ] Strict equality (`===`) instead of loose (`==`)?
58
+ - [ ] Explicit type checks for boolean logic?
59
59
  - [ ] Number validation (isNaN, isFinite)?
60
60
 
61
61
  ### 2. Boundary Conditions
@@ -1,10 +1,10 @@
1
1
  # Industry Techniques - Code Change Impact Analysis
2
2
 
3
- Tổng hợp các kỹ thuật công cụ phân tích tác động code changes từ industry research.
3
+ Compilation of techniques and tools for analyzing code change impacts from industry and research.
4
4
 
5
- ## 📚 Nguồn Tham Khảo
5
+ ## 📚 References
6
6
 
7
- Dựa trên research industry best practices từ:
7
+ Based on research and industry best practices from:
8
8
  - Academic papers (ACM, ResearchGate, arXiv)
9
9
  - Static analysis tools (NDepend, CppDepend, SonarQube)
10
10
  - Software engineering practices
@@ -12,22 +12,22 @@ Dựa trên research và industry best practices từ:
12
12
 
13
13
  ---
14
14
 
15
- ## 🎯 Các Phương Pháp Chính
15
+ ## 🎯 Main Methods
16
16
 
17
17
  ### 1. Traceability-Based Impact Analysis
18
18
 
19
- **Khái niệm:**
20
- Sử dụng links giữa requirements, specifications, design elements, tests để xác định phạm vi thay đổi.
19
+ **Concept:**
20
+ Use links between requirements, specifications, design elements, and tests to determine scope of changes.
21
21
 
22
- **Cách hoạt động:**
22
+ **How it works:**
23
23
  ```
24
24
  Requirement → Design → Code → Tests
25
25
  ↓ ↓ ↓ ↓
26
26
  Change → Impact → Affected → Test Cases
27
27
  ```
28
28
 
29
- **Ứng dụng trong Impact Analysis:**
30
- - Map code changes về requirements
29
+ **Application in Impact Analysis:**
30
+ - Map code changes to requirements
31
31
  - Identify affected user stories
32
32
  - Generate test scenarios từ requirements
33
33
 
@@ -53,10 +53,10 @@ Requirement → Design → Code → Tests
53
53
 
54
54
  ### 2. Dependency-Based Impact Analysis
55
55
 
56
- **Khái niệm:**
57
- Phân tích dependencies (imports, function calls, class usage) để tìm affected files.
56
+ **Concept:**
57
+ Analyze dependencies (imports, function calls, class usage) to find affected files.
58
58
 
59
- **Cách hoạt động:**
59
+ **How it works:**
60
60
 
61
61
  #### A. Call Graph Analysis
62
62
  ```
@@ -92,7 +92,7 @@ Module B imports Module C
92
92
  - **Madge** (JavaScript): Circular dependency detection
93
93
  - **jdeps** (Java): Package dependencies
94
94
 
95
- **Ứng dụng:**
95
+ **Application:**
96
96
  ```bash
97
97
  # Find all files importing authService
98
98
  grep -r "from.*authService" src/
@@ -108,10 +108,10 @@ madge --image graph.png src/
108
108
 
109
109
  ### 3. AST-Based Impact Analysis
110
110
 
111
- **Khái niệm:**
112
- Sử dụng Abstract Syntax Tree để phân tích code structure detect changes semantic level.
111
+ **Concept:**
112
+ Use Abstract Syntax Tree to analyze code structure and detect changes at semantic level.
113
113
 
114
- **Cách hoạt động:**
114
+ **How it works:**
115
115
  ```
116
116
  Source Code → Parser → AST → Analysis → Impact Report
117
117
  ```
@@ -147,9 +147,9 @@ function login(email, password, rememberMe) {
147
147
  - **Python ast module**: Python AST analysis
148
148
  - **Roslyn** (.NET): C# AST analysis
149
149
 
150
- **Ứng dụng:**
150
+ **Application:**
151
151
  ```javascript
152
- // Detect function signature changes
152
+ # Detect function signature changes
153
153
  const ast = parse(sourceCode);
154
154
  ast.body.forEach(node => {
155
155
  if (node.type === 'FunctionDeclaration') {
@@ -163,8 +163,8 @@ ast.body.forEach(node => {
163
163
 
164
164
  ### 4. Static Analysis-Based Impact
165
165
 
166
- **Khái niệm:**
167
- Analyze code without executing để detect issues, dependencies, potential impacts.
166
+ **Concept:**
167
+ Analyze code without executing to detect issues, dependencies, and potential impacts.
168
168
 
169
169
  **Techniques:**
170
170
 
@@ -244,10 +244,10 @@ interface User {
244
244
 
245
245
  ### 5. Model-Based Impact Analysis
246
246
 
247
- **Khái niệm:**
248
- Sử dụng models (UML, architecture diagrams) để predict impact trước khi code.
247
+ **Concept:**
248
+ Use models (UML, architecture diagrams) to predict impact before coding.
249
249
 
250
- **Cách hoạt động:**
250
+ **How it works:**
251
251
  ```
252
252
  Architecture Model → Component Dependencies → Impact Prediction
253
253
  ```
@@ -272,10 +272,10 @@ Architecture Model → Component Dependencies → Impact Prediction
272
272
 
273
273
  ### 6. Test-Based Impact Analysis
274
274
 
275
- **Khái niệm:**
276
- Sử dụng test coverage để identify affected tests features.
275
+ **Concept:**
276
+ Use test coverage to identify affected tests and features.
277
277
 
278
- **Cách hoạt động:**
278
+ **How it works:**
279
279
  ```
280
280
  Code Change → Test Coverage Map → Affected Tests → Affected Features
281
281
  ```
@@ -299,7 +299,7 @@ Code Change → Test Coverage Map → Affected Tests → Affected Features
299
299
  - **JaCoCo**: Java code coverage
300
300
  - **Istanbul**: JavaScript coverage
301
301
 
302
- **Ứng dụng:**
302
+ **Application:**
303
303
  ```bash
304
304
  # Run tests with coverage
305
305
  npm test -- --coverage
@@ -315,10 +315,10 @@ jest --coverage --coverageReporters=html
315
315
 
316
316
  ### 7. Behavior-Driven Impact Analysis
317
317
 
318
- **Khái niệm:**
319
- Map code changes về user behaviors scenarios (BDD approach).
318
+ **Concept:**
319
+ Map code changes to user behaviors and scenarios (BDD approach).
320
320
 
321
- **Cách hoạt động:**
321
+ **How it works:**
322
322
  ```
323
323
  Code Change → Feature Mapping → User Scenarios → Test Scenarios
324
324
  ```
@@ -367,8 +367,8 @@ describe('Biometric Login', () => {
367
367
 
368
368
  ### 8. Feature Mapping Techniques
369
369
 
370
- **Khái niệm:**
371
- Map code files về features user actions.
370
+ **Concept:**
371
+ Map code files to features and user actions.
372
372
 
373
373
  **Techniques:**
374
374
 
@@ -423,10 +423,10 @@ export function login(email: string, password: string) {
423
423
 
424
424
  ### 9. Machine Learning-Based Impact Analysis
425
425
 
426
- **Khái niệm:**
427
- Sử dụng ML models để predict impact dựa trên historical data.
426
+ **Concept:**
427
+ Use ML models to predict impact based on historical data.
428
428
 
429
- **Cách hoạt động:**
429
+ **How it works:**
430
430
  ```
431
431
  Historical Changes + Outcomes → ML Model → Predict Impact
432
432
  ```
@@ -547,7 +547,7 @@ Code Change → Feature Impact → User Action Impact → Test Scenarios
547
547
 
548
548
  ### 4. Prioritize by Risk
549
549
 
550
- Sử dụng risk scoring:
550
+ Use risk scoring:
551
551
 
552
552
  ```javascript
553
553
  const riskScore =
@@ -14,8 +14,8 @@ Document này cung cấp:
14
14
 
15
15
  ## 🎯 Technique #1: Dependency Analysis (MUST HAVE)
16
16
 
17
- ### Mục Đích
18
- Tìm tất cả files bị ảnh hưởng bởi code changes.
17
+ ### Purpose
18
+ Find all files affected by code changes.
19
19
 
20
20
  ### Tools & Commands
21
21
 
@@ -23,7 +23,7 @@ Tìm tất cả files bị ảnh hưởng bởi code changes.
23
23
 
24
24
  **1. Find Direct Imports**
25
25
  ```bash
26
- # Tìm files import module đã sửa
26
+ # Find files importing modified module
27
27
  grep -r "from.*authService" src/ --include="*.ts" --include="*.tsx"
28
28
  grep -r "import.*authService" src/ --include="*.ts" --include="*.tsx"
29
29
 
@@ -33,7 +33,7 @@ rg "from.*authService" src/ -t ts -t tsx
33
33
 
34
34
  **2. Find Function Calls**
35
35
  ```bash
36
- # Tìm files gọi function đã sửa
36
+ # Find files calling modified function
37
37
  grep -r "login\(" src/ --include="*.ts" --include="*.tsx"
38
38
 
39
39
  # Exclude test files
@@ -57,7 +57,7 @@ madge src/services/authService.ts
57
57
 
58
58
  **4. Find API Consumers**
59
59
  ```bash
60
- # Tìm frontend components gọi API
60
+ # Find frontend components calling API
61
61
  grep -r "fetch.*\/api\/auth" src/
62
62
  grep -r "axios.*\/api\/auth" src/
63
63
  grep -r "\/api\/auth" src/ --include="*.ts" --include="*.tsx"
@@ -67,7 +67,7 @@ grep -r "\/api\/auth" src/ --include="*.ts" --include="*.tsx"
67
67
 
68
68
  **Find Component Usage**
69
69
  ```bash
70
- # Tìm components sử dụng component đã sửa
70
+ # Find components using modified component
71
71
  grep -r "<LoginButton" src/ --include="*.tsx"
72
72
  grep -r "LoginButton" src/ --include="*.tsx" | grep "import"
73
73
  ```
@@ -111,8 +111,8 @@ grep -r "login(" . --include="*.py"
111
111
 
112
112
  ## 🎯 Technique #2: AST-Based Analysis (NICE TO HAVE)
113
113
 
114
- ### Mục Đích
115
- Phát hiện semantic changes (function signature, type changes, breaking changes).
114
+ ### Purpose
115
+ Detect semantic changes (function signature, type changes, breaking changes).
116
116
 
117
117
  ### Tools & Setup
118
118
 
@@ -222,8 +222,8 @@ diff /tmp/before.json /tmp/after.json
222
222
 
223
223
  ## 🎯 Technique #3: Static Analysis (NICE TO HAVE)
224
224
 
225
- ### Mục Đích
226
- Phát hiện code quality issues, security issues, potential bugs.
225
+ ### Purpose
226
+ Detect code quality issues, security issues, and potential bugs.
227
227
 
228
228
  ### Tools
229
229
 
@@ -284,8 +284,8 @@ sonar-scanner \
284
284
 
285
285
  ## 🎯 Technique #4: Test Coverage Analysis (SHOULD HAVE)
286
286
 
287
- ### Mục Đích
288
- Tìm tests bị ảnh hưởng và identify untested code.
287
+ ### Purpose
288
+ Find affected tests and identify untested code.
289
289
 
290
290
  ### Tools & Commands
291
291
 
@@ -370,8 +370,8 @@ pytest --collect-only | grep auth_service
370
370
 
371
371
  ## 🎯 Technique #5: Feature Mapping (MUST HAVE)
372
372
 
373
- ### Mục Đích
374
- Map code changes về features user actions.
373
+ ### Purpose
374
+ Map code changes to features and user actions.
375
375
 
376
376
  ### Implementation
377
377
 
@@ -478,8 +478,8 @@ function mapFeatures(changedFiles) {
478
478
 
479
479
  ## 🎯 Technique #6: Risk Scoring (SHOULD HAVE)
480
480
 
481
- ### Mục Đích
482
- Đánh giá mức độ risk của changes.
481
+ ### Purpose
482
+ Assess risk level of changes.
483
483
 
484
484
  ### Algorithm
485
485
 
@@ -1,6 +1,6 @@
1
1
  # Project Detection - Auto-Adapt Impact Analysis
2
2
 
3
- Hệ thống tự động detect adapt Impact Analysis cho nhiều loại projects.
3
+ System to automatically detect and adapt Impact Analysis for different project types.
4
4
 
5
5
  ## Project Type Detection
6
6
 
@@ -1,6 +1,6 @@
1
- # Report Template - Mẫu Báo Cáo Impact Analysis
1
+ # Report Template - Impact Analysis Report Template
2
2
 
3
- Template chuẩn cho báo cáo phân tích tác động và hướng dẫn test.
3
+ Standard template for impact analysis reports and test guidance.
4
4
 
5
5
  ## Full Report Template
6
6
 
@@ -1,15 +1,15 @@
1
1
  # Impact Analysis Scripts
2
2
 
3
- Helper scripts để thực hiện advanced impact analysis techniques.
3
+ Helper scripts for performing advanced impact analysis techniques.
4
4
 
5
5
  ## 📋 Overview
6
6
 
7
- Các scripts này implement industry techniques từ `references/industry-techniques.md`:
7
+ These scripts implement industry techniques from `references/industry-techniques.md`:
8
8
 
9
9
  1. **ast-analyze.js** - AST-based analysis (Technique #3)
10
10
  2. **find-dependencies.sh** - Dependency analysis (Technique #2)
11
11
  3. **calculate-risk.js** - Risk scoring (Technique #6)
12
- 4. **run-analysis.sh** - Master script chạy tất cả
12
+ 4. **run-analysis.sh** - Master script that runs all
13
13
 
14
14
  ## 🚀 Quick Start
15
15
 
@@ -0,0 +1,46 @@
1
+ ---
2
+ name: hapo:review
3
+ description: Review recent changes for correctness, security, regressions, and maintainability after hapo:code.
4
+ version: 1.0.0
5
+ argument-hint: [scope]
6
+ ---
7
+
8
+ # Hapo Review
9
+
10
+ Review recent code changes with the spec context in mind.
11
+
12
+ ## Usage
13
+
14
+ ```bash
15
+ /hapo:review
16
+ /hapo:review <scope>
17
+ ```
18
+
19
+ ## Load First
20
+
21
+ - `references/review-focus.md`
22
+ - recent diff or changed files
23
+ - relevant spec context when the changes came from `.specs/`
24
+
25
+ ## Execute
26
+
27
+ 1. Review recent changes or the requested scope.
28
+ 2. Prioritize:
29
+ - correctness
30
+ - security
31
+ - regressions
32
+ - maintainability
33
+ 3. Use the spec context when changes were produced from a spec workflow.
34
+ 4. Output findings by severity with concrete fixes.
35
+ 5. If there are no findings, say so clearly.
36
+
37
+ ## Rules
38
+
39
+ - Prefer concrete, actionable findings over vague style notes.
40
+ - Focus on code that changed.
41
+ - Call out missing tests when the change risk is non-trivial.
42
+
43
+ ## Related
44
+
45
+ - Command: `/review`
46
+ - Previous skills: `/hapo:code`, `/hapo:test`
@@ -0,0 +1,28 @@
1
+ # Review Focus
2
+
3
+ ## Review order
4
+
5
+ 1. correctness
6
+ 2. security
7
+ 3. regressions
8
+ 4. maintainability
9
+
10
+ ## Focus areas
11
+
12
+ - Does the change satisfy the approved spec task?
13
+ - Did the change introduce behavior outside the approved scope?
14
+ - Are edge cases or failure paths obviously missing?
15
+ - Are tests missing for non-trivial risk?
16
+
17
+ ## Good findings
18
+
19
+ - concrete
20
+ - reproducible
21
+ - tied to changed code
22
+ - includes a fix direction
23
+
24
+ ## Avoid
25
+
26
+ - vague style-only comments
27
+ - speculative refactors outside scope
28
+ - comments on unchanged code unless it creates risk
@@ -0,0 +1,66 @@
1
+ ---
2
+ name: hapo:spec-design
3
+ description: Create technical design from approved requirements. Use after hapo:spec-requirements in Claude Code.
4
+ version: 1.0.0
5
+ argument-hint: <feature-name> [-y]
6
+ ---
7
+
8
+ # Hapo Spec Design
9
+
10
+ Translate approved requirements into architecture, interfaces, research notes, and design decisions.
11
+
12
+ ## Usage
13
+
14
+ ```bash
15
+ /hapo:spec-design <feature-name>
16
+ ```
17
+
18
+ ## Load First
19
+
20
+ - `references/design-discovery.md`
21
+ - `.claude/skills/specs/templates/design.md`
22
+ - `.claude/skills/specs/templates/research.md`
23
+ - `.claude/skills/specs/rules/design-principles.md`
24
+
25
+ ## Execute
26
+
27
+ 1. Read `.specs/$ARGUMENTS/spec.json` first.
28
+ 2. Stop if requirements are missing or not ready.
29
+ 3. Read:
30
+ - `.specs/$ARGUMENTS/spec.json`
31
+ - `.specs/$ARGUMENTS/requirements.md`
32
+ - `.specs/$ARGUMENTS/design.md` when it already exists
33
+ - `.specs/$ARGUMENTS/research.md` when it exists
34
+ - `.specs/steering/` and `docs/` context when present
35
+ 4. Respect `scope_lock`. Design only for in-scope requirement IDs.
36
+ 5. Choose a discovery mode:
37
+ - minimal for small CRUD or UI-only changes
38
+ - light for extensions of existing systems
39
+ - full only for explicit integration, security, schema, or performance reasons
40
+ 6. Persist findings to `.specs/$ARGUMENTS/research.md` before finalizing the design.
41
+ 7. Generate `.specs/$ARGUMENTS/design.md` using the shared template.
42
+ 8. Add diagrams only when the design is genuinely multi-step or cross-boundary.
43
+ 9. Update `spec.json` with phase, timestamps, discovery mode, and validation recommendation.
44
+
45
+ ## Output
46
+
47
+ Return:
48
+ - design status and file path
49
+ - chosen discovery mode and reason
50
+ - 2-3 key findings that shaped the design
51
+ - any deferred or out-of-scope items
52
+ - next step: run `/spec-validate $ARGUMENTS` when validation is recommended, otherwise continue with `/hapo:spec-tasks $ARGUMENTS`
53
+
54
+ ## Rules
55
+
56
+ - Keep design focused on architecture and interfaces, not implementation code.
57
+ - Prefer light discovery unless a concrete trigger requires full discovery.
58
+ - Stop if requirements use invalid numeric IDs.
59
+ - If templates are missing, report the exact missing file.
60
+
61
+ ## Related
62
+
63
+ - Command: `/spec-design`
64
+ - Previous skill: `/hapo:spec-requirements`
65
+ - Validation bridge: `/spec-validate $ARGUMENTS`
66
+ - Next skill: `/hapo:spec-tasks $ARGUMENTS`
@@ -0,0 +1,46 @@
1
+ # Design Discovery
2
+
3
+ ## Goal
4
+
5
+ Pick the lightest discovery mode that still supports a solid design.
6
+
7
+ ## Modes
8
+
9
+ ### Minimal
10
+ Use for:
11
+ - small UI changes
12
+ - basic CRUD
13
+ - at most 2 clear integration points
14
+
15
+ ### Light
16
+ Use for:
17
+ - extensions to existing features
18
+ - moderate integration work
19
+ - pattern matching against current codebase
20
+
21
+ ### Full
22
+ Use only when there is a concrete trigger:
23
+ - external service integration
24
+ - auth or security boundaries
25
+ - schema or storage boundaries
26
+ - explicit performance constraints
27
+ - explicit user request for deep research
28
+
29
+ ## Default
30
+
31
+ If uncertain, choose **light**.
32
+
33
+ ## Discovery outputs
34
+
35
+ Capture only what affects the design:
36
+ - existing patterns to follow
37
+ - constraints from steering or docs
38
+ - interfaces and boundaries
39
+ - integration risks
40
+ - deferred out-of-scope findings
41
+
42
+ ## Guardrails
43
+
44
+ - Design only for in-scope requirement IDs.
45
+ - Do not open new domains without approval.
46
+ - Keep `research.md` short and decision-focused.
@@ -0,0 +1,61 @@
1
+ ---
2
+ name: hapo:spec-init
3
+ description: Initialize a new specification from a feature description. Use in Claude Code when starting spec-driven work.
4
+ version: 1.0.0
5
+ argument-hint: <feature-description>
6
+ ---
7
+
8
+ # Hapo Spec Init
9
+
10
+ Create the initial `.specs/<feature>/` structure from a concrete feature description.
11
+
12
+ ## Usage
13
+
14
+ ```bash
15
+ /hapo:spec-init <feature-description>
16
+ ```
17
+
18
+ ## When to Use
19
+
20
+ Use this when starting a new feature that should go through requirements, design, tasks, code, test, and review.
21
+
22
+ Do not use this for tiny fixes, vague requests, or work that already has a spec folder.
23
+
24
+ ## Execute
25
+
26
+ 1. Treat `$ARGUMENTS` as the feature description only.
27
+ 2. If the description is vague, too short, or missing concrete nouns, stop and ask the user 1-2 focused clarification questions.
28
+ 3. Check `.specs/` for slug conflicts with `Glob`.
29
+ 4. Read these installed templates first:
30
+ - `.claude/skills/specs/templates/init.json`
31
+ - `.claude/skills/specs/templates/requirements-init.md`
32
+ 5. Generate a kebab-case feature name from the description.
33
+ 6. If the slug already exists, append a numeric suffix.
34
+ 7. Create `.specs/<feature-name>/spec.json` and `.specs/<feature-name>/requirements.md`.
35
+ 8. Initialize `scope_lock` in `spec.json` with:
36
+ - `source`
37
+ - `in_scope`
38
+ - `out_of_scope`
39
+ - `expansion_policy: requires-user-approval`
40
+ 9. Do not generate requirements, design, or tasks in this step.
41
+
42
+ ## Output
43
+
44
+ Return:
45
+ - generated feature name
46
+ - short project summary
47
+ - created file paths
48
+ - next command: `/hapo:spec-requirements <feature-name>`
49
+
50
+ ## Rules
51
+
52
+ - Keep phase separation strict.
53
+ - Only initialize files in this step.
54
+ - Prefer the shared `specs` templates over ad-hoc structure.
55
+ - If templates are missing, stop and report the exact missing path.
56
+
57
+ ## Related
58
+
59
+ - Command: `/spec-init`
60
+ - Next skill: `/hapo:spec-requirements <feature-name>`
61
+ - Shared resources: `.claude/skills/specs/templates/`