musubix 3.6.0 → 3.7.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 (123) hide show
  1. package/.github/AGENTS.md +949 -0
  2. package/.github/prompts/sdd-change-apply.prompt.md +283 -0
  3. package/.github/prompts/sdd-change-archive.prompt.md +241 -0
  4. package/.github/prompts/sdd-change-init.prompt.md +269 -0
  5. package/.github/prompts/sdd-design.prompt.md +250 -0
  6. package/.github/prompts/sdd-implement.prompt.md +387 -0
  7. package/.github/prompts/sdd-requirements.prompt.md +193 -0
  8. package/.github/prompts/sdd-review.prompt.md +155 -0
  9. package/.github/prompts/sdd-security.prompt.md +228 -0
  10. package/.github/prompts/sdd-steering.prompt.md +269 -0
  11. package/.github/prompts/sdd-tasks.prompt.md +255 -0
  12. package/.github/prompts/sdd-test.prompt.md +230 -0
  13. package/.github/prompts/sdd-validate.prompt.md +304 -0
  14. package/.github/skills/build-fix/SKILL.md +124 -0
  15. package/.github/skills/checkpoint/SKILL.md +131 -0
  16. package/.github/skills/codemap/SKILL.md +120 -0
  17. package/.github/skills/codemap/templates/codemap-index.md +142 -0
  18. package/.github/skills/codemap/templates/package-codemap.md +160 -0
  19. package/.github/skills/context-optimizer/SKILL.md +109 -0
  20. package/.github/skills/context-optimizer/contexts/dev.md +40 -0
  21. package/.github/skills/context-optimizer/contexts/research.md +55 -0
  22. package/.github/skills/context-optimizer/contexts/review.md +49 -0
  23. package/.github/skills/e2e-runner/SKILL.md +145 -0
  24. package/.github/skills/eval-harness/SKILL.md +111 -0
  25. package/.github/skills/eval-harness/examples/capability-eval.md +158 -0
  26. package/.github/skills/eval-harness/examples/human-grader-template.md +326 -0
  27. package/.github/skills/eval-harness/examples/regression-eval.md +228 -0
  28. package/.github/skills/learning-hooks/SKILL.md +101 -0
  29. package/.github/skills/learning-hooks/templates/learned-skill-template.md +79 -0
  30. package/.github/skills/musubix-adr-generation/SKILL.md +74 -0
  31. package/.github/skills/musubix-best-practices/SKILL.md +85 -0
  32. package/.github/skills/musubix-c4-design/SKILL.md +86 -0
  33. package/.github/skills/musubix-code-generation/SKILL.md +90 -0
  34. package/.github/skills/musubix-domain-inference/SKILL.md +82 -0
  35. package/.github/skills/musubix-ears-validation/SKILL.md +74 -0
  36. package/.github/skills/musubix-sdd-workflow/SKILL.md +95 -0
  37. package/.github/skills/musubix-technical-writing/SKILL.md +108 -0
  38. package/.github/skills/musubix-test-generation/SKILL.md +88 -0
  39. package/.github/skills/musubix-traceability/SKILL.md +94 -0
  40. package/.github/skills/refactor-cleaner/SKILL.md +105 -0
  41. package/.github/skills/session-manager/SKILL.md +119 -0
  42. package/.github/skills/session-manager/scripts/session-end.sh +175 -0
  43. package/.github/skills/session-manager/scripts/session-start.sh +87 -0
  44. package/.github/skills/verification-loop/SKILL.md +111 -0
  45. package/.github/skills/verification-loop/scripts/verify.sh +305 -0
  46. package/AGENTS.md +333 -0
  47. package/LICENSE +21 -0
  48. package/README.ja.md +313 -0
  49. package/README.md +315 -50
  50. package/bin/musubix-mcp.js +15 -0
  51. package/bin/musubix.js +9 -1
  52. package/docs/API-REFERENCE.md +1425 -0
  53. package/docs/CODEMAPS/CODEMAP.md +1 -0
  54. package/docs/GITHUB-ACTIONS-NPM-SETUP.md +132 -0
  55. package/docs/INSTALL-GUIDE.ja.md +459 -0
  56. package/docs/INSTALL-GUIDE.md +459 -0
  57. package/docs/MIGRATION-v3.0.md +324 -0
  58. package/docs/MUSUBI-enhancement_roadmap_20260105.md +651 -0
  59. package/docs/MUSUBIX-v3.0-User-Guide.md +1357 -0
  60. package/docs/MUSUBIXv2.2.0-Manual-outline.md +136 -0
  61. package/docs/MUSUBIXv2.2.0-Manual.md +3123 -0
  62. package/docs/MUSUBIXv2.3.5-Refactering.md +1310 -0
  63. package/docs/MUSUBIv1.6.1-enhancement_roadmap_20260105.md +291 -0
  64. package/docs/MUSUBIv2.2.0-USERGUIDE.md +2079 -0
  65. package/docs/ROADMAP-v1.5.md +116 -0
  66. package/docs/SwarmCoding.md +1284 -0
  67. package/docs/Test-prompt.md +105 -0
  68. package/docs/USER-GUIDE-v1.8.0.md +2371 -0
  69. package/docs/USER-GUIDE.ja.md +2147 -0
  70. package/docs/USER-GUIDE.md +3022 -0
  71. package/docs/YATA-GLOBAL-GUIDE.ja.md +750 -0
  72. package/docs/YATA-GLOBAL-GUIDE.md +595 -0
  73. package/docs/YATA-LOCAL-GUIDE.ja.md +989 -0
  74. package/docs/YATA-LOCAL-GUIDE.md +730 -0
  75. package/docs/adr/0001-real-time-pattern-learning-architecture-for-v1-5-0.md +75 -0
  76. package/docs/adr/0002-pattern-sharing-protocol-for-cross-team-collaborat.md +79 -0
  77. package/docs/adr/0003-owl-2-rl-implementation-strategy-for-advanced-infe.md +90 -0
  78. package/docs/adr/ADR-v3.4.0-001-deep-research-architecture.md +217 -0
  79. package/docs/adr/ADR-v3.4.0-002-search-provider-selection.md +308 -0
  80. package/docs/adr/ADR-v3.4.0-003-lm-api-integration.md +475 -0
  81. package/docs/adr/ADR-v3.7.0-001-everything-claude-code-integration.md +102 -0
  82. package/docs/enterprise-knowledge-management.md +1737 -0
  83. package/docs/evolution-from-musubi-to-musubix.md +2170 -0
  84. package/docs/experiments/EXPERIMENT-ASSISTANT-AXIS-DRIFT-DETECTION.md +155 -0
  85. package/docs/getting-started-with-sdd.md +1602 -0
  86. package/docs/moodle-refactering-codegraph-musubix.md +391 -0
  87. package/docs/moodle-refactering-codegraph.md +278 -0
  88. package/docs/overview/MUSUBIX-CodeGraph.md +322 -0
  89. package/docs/overview/MUSUBIX-Core.md +671 -0
  90. package/docs/overview/MUSUBIX-Decisions.md +494 -0
  91. package/docs/overview/MUSUBIX-FormalVerify.md +566 -0
  92. package/docs/overview/MUSUBIX-Knowledge.md +1231 -0
  93. package/docs/overview/MUSUBIX-Learning.md +837 -0
  94. package/docs/overview/MUSUBIX-MCP-Server.md +535 -0
  95. package/docs/overview/MUSUBIX-Overview.md +264 -0
  96. package/docs/overview/MUSUBIX-Phase1-Complete.md +271 -0
  97. package/docs/overview/MUSUBIX-Phase2-Complete.md +310 -0
  98. package/docs/overview/MUSUBIX-Policy.md +477 -0
  99. package/docs/overview/MUSUBIX-Roadmap-v2.md +399 -0
  100. package/docs/overview/MUSUBIX-Security-Plan.md +939 -0
  101. package/docs/overview/MUSUBIX-Security-v2.1.md +668 -0
  102. package/docs/overview/MUSUBIX-Security.md +891 -0
  103. package/docs/overview/MUSUBIX-YATA.md +666 -0
  104. package/docs/overview/MUSUBIX-v2.2.0-Advanced-Learning.md +513 -0
  105. package/docs/overview/Neuro-SymbolicAI.md +159 -0
  106. package/docs/packages/knowledge.md +594 -0
  107. package/docs/qiita/musubix-v3.6.0-fastrender-insights.md +625 -0
  108. package/docs/qiita-linux-kernel-knowledge-graph.md +596 -0
  109. package/docs/qiita-musubix-assistant-axis.md +380 -0
  110. package/package.json +58 -52
  111. package/scripts/generate-quality-gate-report.ts +106 -0
  112. package/scripts/postinstall.js +94 -0
  113. package/scripts/register-release-knowledge.ts +127 -0
  114. package/steering/.musubi-version +1 -0
  115. package/steering/product.ja.md +572 -0
  116. package/steering/project.yml +66 -0
  117. package/steering/rules/constitution.md +491 -0
  118. package/steering/structure.ja.md +503 -0
  119. package/steering/tech.ja.md +208 -0
  120. package/dist/index.d.ts +0 -25
  121. package/dist/index.d.ts.map +0 -1
  122. package/dist/index.js +0 -74
  123. package/dist/index.js.map +0 -1
@@ -0,0 +1,228 @@
1
+ # Regression Eval Examples
2
+
3
+ ## Example 1: User Service Regression
4
+
5
+ ```markdown
6
+ [REGRESSION EVAL: user-service]
7
+
8
+ Baseline: abc1234 (v3.6.0 release)
9
+ Date: 2026-01-25
10
+
11
+ Tests:
12
+ - user.create.test.ts: PASS
13
+ - user.update.test.ts: PASS
14
+ - user.delete.test.ts: FAIL
15
+ - user.search.test.ts: PASS
16
+ - user.auth.test.ts: PASS
17
+
18
+ Result: 4/5 passed (previously 5/5)
19
+
20
+ Regression Detected: Yes
21
+
22
+ Failed Test Details:
23
+ - user.delete.test.ts:
24
+ - Error: "ValidationError: Cannot delete user with active sessions"
25
+ - Line: 45
26
+ - Expected: 204 No Content
27
+ - Actual: 400 Bad Request
28
+
29
+ Root Cause:
30
+ - 新しいバリデーションルールが追加され、アクティブセッションを持つユーザーの削除が禁止された
31
+
32
+ Resolution:
33
+ - [ ] テストを更新して新しい挙動を反映
34
+ - [ ] または、バリデーションルールの見直し
35
+
36
+ Notes:
37
+ - この変更は意図的なセキュリティ強化
38
+ - テストケースの更新が必要
39
+ ```
40
+
41
+ ---
42
+
43
+ ## Example 2: API Endpoint Regression
44
+
45
+ ```markdown
46
+ [REGRESSION EVAL: api-endpoints]
47
+
48
+ Baseline: def5678 (v3.5.0 release)
49
+ Date: 2026-01-25
50
+
51
+ Tests:
52
+ - api.auth.test.ts: PASS
53
+ - api.users.test.ts: PASS
54
+ - api.products.test.ts: PASS
55
+ - api.orders.test.ts: PASS
56
+ - api.payments.test.ts: PASS
57
+
58
+ Result: 5/5 passed (previously 5/5)
59
+
60
+ Regression Detected: No
61
+
62
+ Performance Comparison:
63
+ | Endpoint | Baseline | Current | Change |
64
+ |---------------|----------|---------|--------|
65
+ | GET /users | 45ms | 42ms | -6.7% |
66
+ | POST /orders | 120ms | 115ms | -4.2% |
67
+ | GET /products | 30ms | 28ms | -6.7% |
68
+
69
+ Notes:
70
+ - パフォーマンスの改善を確認
71
+ - 機能的な回帰なし
72
+ ```
73
+
74
+ ---
75
+
76
+ ## Example 3: Database Migration Regression
77
+
78
+ ```markdown
79
+ [REGRESSION EVAL: database-schema]
80
+
81
+ Baseline: ghi9012 (pre-migration)
82
+ Date: 2026-01-25
83
+
84
+ Tests:
85
+ - migration.up.test.ts: PASS
86
+ - migration.down.test.ts: PASS
87
+ - schema.integrity.test.ts: FAIL
88
+ - data.consistency.test.ts: PASS
89
+ - index.performance.test.ts: PASS
90
+
91
+ Result: 4/5 passed (previously 5/5)
92
+
93
+ Regression Detected: Yes
94
+
95
+ Failed Test Details:
96
+ - schema.integrity.test.ts:
97
+ - Error: "Foreign key constraint violation"
98
+ - Table: orders
99
+ - Constraint: fk_orders_users
100
+ - Reason: 孤立したorder レコードが存在
101
+
102
+ Root Cause:
103
+ - マイグレーション前に外部キー制約がなかったため、不整合データが存在
104
+ - マイグレーションで制約を追加したことで検出
105
+
106
+ Resolution:
107
+ - [x] 不整合データのクリーンアップスクリプトを実行
108
+ - [x] 制約を段階的に適用(まずソフト制約、その後ハード制約)
109
+ - [ ] データ検証の自動化テストを追加
110
+
111
+ Notes:
112
+ - 本番環境適用前にデータクリーンアップが必須
113
+ ```
114
+
115
+ ---
116
+
117
+ ## Example 4: Frontend Component Regression
118
+
119
+ ```markdown
120
+ [REGRESSION EVAL: ui-components]
121
+
122
+ Baseline: jkl3456 (design-system-v2)
123
+ Date: 2026-01-25
124
+
125
+ Tests:
126
+ - button.visual.test.ts: PASS
127
+ - input.visual.test.ts: PASS
128
+ - modal.visual.test.ts: FAIL
129
+ - table.visual.test.ts: PASS
130
+ - form.visual.test.ts: PASS
131
+ - navigation.visual.test.ts: PASS
132
+
133
+ Result: 5/6 passed (previously 6/6)
134
+
135
+ Regression Detected: Yes
136
+
137
+ Failed Test Details:
138
+ - modal.visual.test.ts:
139
+ - Error: "Visual diff exceeded threshold (15% vs 5% allowed)"
140
+ - Screenshot: .reports/screenshots/modal-diff.png
141
+ - Affected area: Close button position
142
+
143
+ Root Cause:
144
+ - Flexboxのalign-items変更によりボタン位置が変化
145
+
146
+ Resolution:
147
+ - [ ] CSSの修正
148
+ - [ ] または、ベースライン画像の更新(意図的変更の場合)
149
+
150
+ Notes:
151
+ - デザインチームに確認が必要
152
+ ```
153
+
154
+ ---
155
+
156
+ ## Example 5: Security Regression
157
+
158
+ ```markdown
159
+ [REGRESSION EVAL: security-scan]
160
+
161
+ Baseline: mno7890 (security-audit-q4)
162
+ Date: 2026-01-25
163
+
164
+ Tests:
165
+ - auth.security.test.ts: PASS
166
+ - xss.prevention.test.ts: PASS
167
+ - csrf.protection.test.ts: PASS
168
+ - sql.injection.test.ts: PASS
169
+ - dependency.audit.test.ts: FAIL
170
+
171
+ Result: 4/5 passed (previously 5/5)
172
+
173
+ Regression Detected: Yes
174
+
175
+ Failed Test Details:
176
+ - dependency.audit.test.ts:
177
+ - Error: "2 high severity vulnerabilities found"
178
+ - Packages:
179
+ 1. lodash@4.17.20 → CVE-2021-23337 (Prototype Pollution)
180
+ 2. axios@0.21.0 → CVE-2021-3749 (ReDoS)
181
+
182
+ Resolution:
183
+ - [x] lodash を 4.17.21 に更新
184
+ - [x] axios を 0.21.4 に更新
185
+ - [x] npm audit を再実行して確認
186
+
187
+ Notes:
188
+ - 依存関係の自動更新を検討
189
+ - Dependabotの設定を確認
190
+ ```
191
+
192
+ ---
193
+
194
+ ## Template for New Regression Eval
195
+
196
+ ```markdown
197
+ [REGRESSION EVAL: <feature-name>]
198
+
199
+ Baseline: <Git SHA または チェックポイント名> (<説明>)
200
+ Date: YYYY-MM-DD
201
+
202
+ Tests:
203
+ - <test-file-1>: <PASS|FAIL>
204
+ - <test-file-2>: <PASS|FAIL>
205
+ - <test-file-3>: <PASS|FAIL>
206
+ - <test-file-4>: <PASS|FAIL>
207
+
208
+ Result: X/Y passed (previously Y/Y)
209
+
210
+ Regression Detected: <Yes|No>
211
+
212
+ Failed Test Details (if any):
213
+ - <test-file>:
214
+ - Error: "<エラーメッセージ>"
215
+ - Line: <行番号>
216
+ - Expected: <期待値>
217
+ - Actual: <実際の値>
218
+
219
+ Root Cause:
220
+ - <回帰の原因分析>
221
+
222
+ Resolution:
223
+ - [ ] <解決策1>
224
+ - [ ] <解決策2>
225
+
226
+ Notes:
227
+ - <追加の注記>
228
+ ```
@@ -0,0 +1,101 @@
1
+ ---
2
+ name: learning-hooks
3
+ description: セッションから再利用可能なパターンを自動抽出し、学習済みスキルとして保存。
4
+ license: MIT
5
+ version: 1.1.0
6
+ triggers:
7
+ - セッション終了(10メッセージ以上)
8
+ - エラー解決後
9
+ - ユーザー修正後
10
+ ---
11
+
12
+ # Learning Hooks
13
+
14
+ > **要約**: セッションから再利用可能なパターンを自動抽出し、次回以降に活用。
15
+
16
+ ## 🔄 トリガーと即時アクション
17
+
18
+ ### パターン抽出 (REQ-LH-001)
19
+
20
+ **WHEN** セッション終了時(条件: メッセージ10件以上 AND 15分以上)
21
+ **DO** 以下のパターンを抽出
22
+
23
+ | タイプ | 説明 | 抽出条件 |
24
+ |--------|------|---------|
25
+ | `error_resolution` | エラー解決 | エラー→修正→解消の流れ |
26
+ | `user_corrections` | ユーザー修正 | AI提案を修正→承認 |
27
+ | `workarounds` | 回避策 | ライブラリ既知問題への対処 |
28
+ | `debugging_techniques` | デバッグ技法 | 問題調査・解決手法 |
29
+ | `project_specific` | プロジェクト固有 | アーキテクチャ、命名規則 |
30
+
31
+ ### 抽出フロー
32
+
33
+ ```
34
+ セッション終了 → 条件チェック → 会話分析 → パターン候補 → 信頼度計算(≥0.7) → 保存
35
+ ```
36
+
37
+ ---
38
+
39
+ ## 📁 Learned Skills Storage (REQ-LH-002)
40
+
41
+ **保存先**: `~/.musubix/skills/learned/<pattern-name>/SKILL.md`
42
+
43
+ **フォーマット**:
44
+ ```markdown
45
+ # [パターン名]
46
+
47
+ **Extracted:** [日付]
48
+ **Context:** [適用条件]
49
+ **Confidence:** [信頼度]
50
+
51
+ ## Problem
52
+ [解決する問題]
53
+
54
+ ## Solution
55
+ [パターン/技法/回避策]
56
+
57
+ ## Example
58
+ [コード例]
59
+
60
+ ## When to Use
61
+ [トリガー条件]
62
+ ```
63
+
64
+ ---
65
+
66
+ ## 🚫 Pattern Ignore List (REQ-LH-003)
67
+
68
+ **抽出しない**:
69
+ - 単純なタイポ修正
70
+ - 一時的な問題の修正
71
+ - 外部API障害への対応
72
+
73
+ ---
74
+
75
+ ## 💡 抽出例
76
+
77
+ ### error_resolution
78
+ ```markdown
79
+ # TypeScript TS2322 型不一致の解決
80
+
81
+ **Problem:** `Type 'string' is not assignable to type 'number'`
82
+ **Solution:** 明示的な型変換 `Number(value)` または型ガード追加
83
+ **When:** TS2322エラーが発生し、型変換が必要な場合
84
+ ```
85
+
86
+ ### workaround
87
+ ```markdown
88
+ # Vitest ESMモード設定
89
+
90
+ **Problem:** ESMモジュールでVitestが動作しない
91
+ **Solution:** `vitest.config.ts`に`deps.inline: [...]`を追加
92
+ **When:** ESMパッケージをテストする際
93
+ ```
94
+
95
+ ---
96
+
97
+ ## トレーサビリティ
98
+
99
+ - REQ-LH-001: Continuous Learning Evaluation
100
+ - REQ-LH-002: Learned Skills Storage
101
+ - REQ-LH-003: Pattern Ignore List
@@ -0,0 +1,79 @@
1
+ # Learned Skill Template
2
+
3
+ 学習されたスキルのテンプレートです。
4
+
5
+ ---
6
+
7
+ # [Descriptive Pattern Name]
8
+
9
+ **Extracted:** [Date: YYYY-MM-DD]
10
+ **Source:** [Session ID or Project]
11
+ **Context:** [When this applies]
12
+ **Confidence:** [0.0-1.0]
13
+ **Category:** [error_resolution|user_corrections|workarounds|debugging_techniques|project_specific]
14
+
15
+ ---
16
+
17
+ ## Problem
18
+
19
+ [What problem this solves]
20
+
21
+ - 発生条件
22
+ - エラーメッセージ(該当する場合)
23
+ - 影響範囲
24
+
25
+ ---
26
+
27
+ ## Solution
28
+
29
+ [The pattern/technique/workaround]
30
+
31
+ ### 手順
32
+
33
+ 1. ステップ1
34
+ 2. ステップ2
35
+ 3. ステップ3
36
+
37
+ ### 注意点
38
+
39
+ - 注意点1
40
+ - 注意点2
41
+
42
+ ---
43
+
44
+ ## Example
45
+
46
+ ```typescript
47
+ // コード例(該当する場合)
48
+ ```
49
+
50
+ ---
51
+
52
+ ## When to Use
53
+
54
+ [Trigger conditions]
55
+
56
+ - トリガー1
57
+ - トリガー2
58
+ - トリガー3
59
+
60
+ ---
61
+
62
+ ## Related Patterns
63
+
64
+ - [関連パターン1]
65
+ - [関連パターン2]
66
+
67
+ ---
68
+
69
+ ## Metadata
70
+
71
+ ```yaml
72
+ extracted_from: session-2026-01-25
73
+ usage_count: 0
74
+ last_used: null
75
+ success_rate: null
76
+ tags:
77
+ - tag1
78
+ - tag2
79
+ ```
@@ -0,0 +1,74 @@
1
+ ---
2
+ name: musubix-adr-generation
3
+ description: Architecture Decision Records作成ガイド。技術選定・設計判断のドキュメント化に使用。
4
+ license: MIT
5
+ ---
6
+
7
+ # ADR Generation Skill
8
+
9
+ **Article VIII - Decision Records**に基づきADRを作成。
10
+
11
+ ## WHEN → DO
12
+
13
+ | WHEN | DO |
14
+ |------|-----|
15
+ | 技術選定を記録したい | Technology Selection ADRを作成 |
16
+ | 設計パターンを決定 | Architecture Pattern ADRを作成 |
17
+ | トレードオフを文書化 | 選択肢の比較表を作成 |
18
+
19
+ ## ADR Template
20
+
21
+ ```markdown
22
+ # ADR-[NUMBER]: [Decision Title]
23
+
24
+ ## ステータス
25
+ [Proposed | Accepted | Deprecated | Superseded by ADR-XXX]
26
+
27
+ ## コンテキスト
28
+ [決定の背景・動機]
29
+
30
+ ## 決定
31
+ [採用する解決策]
32
+
33
+ ## 選択肢
34
+
35
+ ### Option 1: [Name]
36
+ | メリット | デメリット |
37
+ |---------|-----------|
38
+ | [Advantage] | [Disadvantage] |
39
+
40
+ ## 結果
41
+ [この決定による影響]
42
+
43
+ ## トレーサビリティ
44
+ - 関連要件: REQ-XXX-NNN
45
+ - 関連設計: DES-XXX-NNN
46
+ ```
47
+
48
+ ## 典型的ADRトピック
49
+
50
+ | カテゴリ | 例 | 決定ポイント |
51
+ |---------|-----|-------------|
52
+ | **言語選定** | TypeScript vs Go | 型安全性, エコシステム, 学習曲線 |
53
+ | **アーキテクチャ** | Layered vs Hexagonal | チームスキル, 複雑度, テスト容易性 |
54
+ | **DB選定** | PostgreSQL vs MongoDB | ACID要件, スキーマ柔軟性 |
55
+ | **認証方式** | JWT vs Session | ステートレス要件, セキュリティ |
56
+
57
+ ## CLI
58
+
59
+ ```bash
60
+ npx musubix design adr <decision> # ADR生成
61
+ ```
62
+
63
+ ## 出力例
64
+
65
+ ```
66
+ ┌─────────────────────────────────────────┐
67
+ │ ADR Generated │
68
+ ├─────────────────────────────────────────┤
69
+ │ ID: ADR-001 │
70
+ │ Title: Use TypeScript for Backend │
71
+ │ Status: Proposed │
72
+ │ Path: docs/adr/ADR-001.md │
73
+ └─────────────────────────────────────────┘
74
+ ```
@@ -0,0 +1,85 @@
1
+ ---
2
+ name: musubix-best-practices
3
+ description: MUSUBIX学習済み17ベストプラクティスガイド。コード・設計・テストパターンの適用に使用。
4
+ license: MIT
5
+ ---
6
+
7
+ # Best Practices Skill
8
+
9
+ 14以上のプロジェクトから学習した17のベストプラクティス。
10
+
11
+ ## Code Patterns (5)
12
+
13
+ | ID | パターン | 概要 |
14
+ |----|---------|------|
15
+ | BP-CODE-001 | Entity Input DTO | 複数パラメータ→DTOオブジェクト |
16
+ | BP-CODE-002 | Date-based ID | `PREFIX-YYYYMMDD-NNN`形式 |
17
+ | BP-CODE-003 | Value Objects | ドメイン概念にVO使用 |
18
+ | BP-CODE-004 | Function-based VO | interface + factory関数(classは非推奨) |
19
+ | BP-CODE-005 | Result Type | `Result<T, E>`で失敗を表現 |
20
+
21
+ ### BP-CODE-004: Function-based VO
22
+
23
+ ```typescript
24
+ // ✅ 推奨
25
+ interface Price { readonly amount: number; readonly currency: 'JPY'; }
26
+ function createPrice(amount: number): Result<Price, ValidationError> {
27
+ if (amount < 100) return err(new ValidationError('...'));
28
+ return ok({ amount, currency: 'JPY' });
29
+ }
30
+
31
+ // ❌ 非推奨: class-based
32
+ ```
33
+
34
+ ## Design Patterns (7)
35
+
36
+ | ID | パターン | 概要 |
37
+ |----|---------|------|
38
+ | BP-DESIGN-001 | Status Transition Map | `Record<Status, Status[]>`で遷移定義 |
39
+ | BP-DESIGN-002 | Repository Async | 将来DB移行に備えてasync化 |
40
+ | BP-DESIGN-003 | Service Layer DI | リポジトリをDI |
41
+ | BP-DESIGN-004 | Optimistic Locking | versionフィールドで同時編集検出 |
42
+ | BP-DESIGN-005 | AuditService | データ変更の監査ログ |
43
+ | BP-DESIGN-006 | Entity Counter Reset | テスト用resetXxxCounter() |
44
+ | BP-DESIGN-007 | Expiry Time Logic | expiresAtで有効期限管理 |
45
+
46
+ ### BP-DESIGN-001: Status Transition Map
47
+
48
+ ```typescript
49
+ const validTransitions: Record<Status, Status[]> = {
50
+ draft: ['active', 'cancelled'],
51
+ active: ['completed', 'cancelled'],
52
+ completed: [], cancelled: [],
53
+ };
54
+ ```
55
+
56
+ ## Test Patterns (5)
57
+
58
+ | ID | パターン | 概要 |
59
+ |----|---------|------|
60
+ | BP-TEST-001 | Counter Reset | beforeEachでIDカウンターリセット |
61
+ | BP-TEST-002 | Verify API | テスト前にAPIシグネチャ確認 |
62
+ | BP-TEST-003 | Vitest ESM | Vitest + TypeScript ESM構成 |
63
+ | BP-TEST-004 | Result Type Test | isOk()/isErr()で両ケーステスト |
64
+ | BP-TEST-005 | Status Transition | 有効・無効遷移を網羅テスト |
65
+
66
+ ## CLI
67
+
68
+ ```bash
69
+ npx musubix learn best-practices # 全パターン表示
70
+ npx musubix learn best-practices --category code
71
+ npx musubix learn best-practices --high-confidence
72
+ ```
73
+
74
+ ## 出力例
75
+
76
+ ```
77
+ ┌────────────────────────────────────────────────┐
78
+ │ Best Practices Applied │
79
+ ├────────────────────────────────────────────────┤
80
+ │ Code Patterns: 5 applied │
81
+ │ Design Patterns: 7 applied │
82
+ │ Test Patterns: 5 applied │
83
+ │ Confidence: 95% average │
84
+ └────────────────────────────────────────────────┘
85
+ ```
@@ -0,0 +1,86 @@
1
+ ---
2
+ name: musubix-c4-design
3
+ description: C4モデル設計ドキュメント作成ガイド。アーキテクチャ図・コンポーネント設計に使用。
4
+ license: MIT
5
+ ---
6
+
7
+ # C4 Design Skill
8
+
9
+ C4モデル4レベルでアーキテクチャを構造化。
10
+
11
+ ## C4 Levels
12
+
13
+ | Level | 名称 | 内容 |
14
+ |-------|------|------|
15
+ | **1** | Context | システム境界・外部アクター |
16
+ | **2** | Container | 技術選択・デプロイ単位 |
17
+ | **3** | Component | コンテナ内部構造 |
18
+ | **4** | Code | 実装詳細(任意) |
19
+
20
+ ## WHEN → DO
21
+
22
+ | WHEN | DO |
23
+ |------|-----|
24
+ | 設計開始前 | `storage/specs/`のREQ-*を確認 |
25
+ | 新規システム設計 | Context→Container→Componentの順で作成 |
26
+ | コンポーネント追加 | Component Levelを更新 |
27
+
28
+ ## Design Template
29
+
30
+ ```markdown
31
+ # DES-[CATEGORY]-[NUMBER]: [Title]
32
+
33
+ ## メタデータ
34
+ - 作成日: YYYY-MM-DD
35
+ - トレーサビリティ: REQ-XXX-NNN
36
+
37
+ ## 1. Context Level
38
+ | アクター | 説明 | インタラクション |
39
+ |---------|------|-----------------|
40
+ | User | システム利用者 | Web UI経由 |
41
+
42
+ ## 2. Container Level
43
+ | コンテナ | 技術 | 責務 |
44
+ |---------|------|------|
45
+ | Web App | React | UI提供 |
46
+ | API | Node.js | ビジネスロジック |
47
+ | DB | PostgreSQL | データ永続化 |
48
+
49
+ ## 3. Component Level
50
+ | コンポーネント | 種別 | 責務 | 依存先 |
51
+ |---------------|------|------|--------|
52
+ | XxxService | Service | ビジネスロジック | XxxRepository |
53
+ | XxxRepository | Repository | データアクセス | Database |
54
+ ```
55
+
56
+ ## Design Patterns
57
+
58
+ | パターン | 用途 | 適用場面 |
59
+ |---------|------|---------|
60
+ | Repository | データアクセス抽象化 | DB操作 |
61
+ | Service | ビジネスロジック集約 | ユースケース |
62
+ | Factory | オブジェクト生成 | 複雑な生成 |
63
+ | Strategy | アルゴリズム切替 | 認証・計算方式 |
64
+
65
+ ## CLI
66
+
67
+ ```bash
68
+ npx musubix design generate <file> # 設計生成
69
+ npx musubix design patterns <context> # パターン検出
70
+ npx musubix design c4 <file> # C4ダイアグラム
71
+ npx musubix design traceability # REQ↔DES検証
72
+ ```
73
+
74
+ ## 出力例
75
+
76
+ ```
77
+ ┌─────────────────────────────────────────┐
78
+ │ C4 Design Generated │
79
+ ├─────────────────────────────────────────┤
80
+ │ Design ID: DES-SHOP-001 │
81
+ │ Containers: 3 (Web, API, DB) │
82
+ │ Components: 8 (Services, Repos) │
83
+ │ Patterns: Repository, Service │
84
+ │ Traceability: REQ-SHOP-001 │
85
+ └─────────────────────────────────────────┘
86
+ ```