musubix 2.3.7 → 2.4.1

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 (80) hide show
  1. package/.github/AGENTS.md +242 -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/musubix-adr-generation/SKILL.md +209 -0
  15. package/.github/skills/musubix-best-practices/SKILL.md +315 -0
  16. package/.github/skills/musubix-c4-design/SKILL.md +162 -0
  17. package/.github/skills/musubix-code-generation/SKILL.md +229 -0
  18. package/.github/skills/musubix-domain-inference/SKILL.md +196 -0
  19. package/.github/skills/musubix-ears-validation/SKILL.md +161 -0
  20. package/.github/skills/musubix-sdd-workflow/SKILL.md +210 -0
  21. package/.github/skills/musubix-technical-writing/SKILL.md +444 -0
  22. package/.github/skills/musubix-test-generation/SKILL.md +212 -0
  23. package/.github/skills/musubix-traceability/SKILL.md +141 -0
  24. package/AGENTS.md +772 -0
  25. package/LICENSE +21 -0
  26. package/README.ja.md +302 -0
  27. package/README.md +310 -44
  28. package/bin/musubix-mcp.js +15 -0
  29. package/bin/musubix.js +9 -1
  30. package/docs/API-REFERENCE.md +1425 -0
  31. package/docs/GITHUB-ACTIONS-NPM-SETUP.md +132 -0
  32. package/docs/INSTALL-GUIDE.ja.md +459 -0
  33. package/docs/INSTALL-GUIDE.md +459 -0
  34. package/docs/MUSUBI-enhancement_roadmap_20260105.md +651 -0
  35. package/docs/MUSUBIXv2.2.0-Manual-outline.md +136 -0
  36. package/docs/MUSUBIXv2.2.0-Manual.md +3123 -0
  37. package/docs/MUSUBIXv2.3.5-Refactering.md +1310 -0
  38. package/docs/MUSUBIv1.6.1-enhancement_roadmap_20260105.md +291 -0
  39. package/docs/MUSUBIv2.2.0-USERGUIDE.md +2079 -0
  40. package/docs/ROADMAP-v1.5.md +116 -0
  41. package/docs/SwarmCoding.md +1284 -0
  42. package/docs/Test-prompt.md +105 -0
  43. package/docs/USER-GUIDE-v1.8.0.md +2371 -0
  44. package/docs/USER-GUIDE.ja.md +2147 -0
  45. package/docs/USER-GUIDE.md +2847 -0
  46. package/docs/adr/0001-real-time-pattern-learning-architecture-for-v1-5-0.md +75 -0
  47. package/docs/adr/0002-pattern-sharing-protocol-for-cross-team-collaborat.md +79 -0
  48. package/docs/adr/0003-owl-2-rl-implementation-strategy-for-advanced-infe.md +90 -0
  49. package/docs/evolution-from-musubi-to-musubix.md +2170 -0
  50. package/docs/getting-started-with-sdd.md +1602 -0
  51. package/docs/moodle-refactering-codegraph-musubix.md +391 -0
  52. package/docs/moodle-refactering-codegraph.md +278 -0
  53. package/docs/overview/MUSUBIX-CodeGraph.md +322 -0
  54. package/docs/overview/MUSUBIX-Core.md +671 -0
  55. package/docs/overview/MUSUBIX-FormalVerify.md +566 -0
  56. package/docs/overview/MUSUBIX-Learning.md +837 -0
  57. package/docs/overview/MUSUBIX-MCP-Server.md +535 -0
  58. package/docs/overview/MUSUBIX-Overview.md +264 -0
  59. package/docs/overview/MUSUBIX-Phase1-Complete.md +271 -0
  60. package/docs/overview/MUSUBIX-Phase2-Complete.md +310 -0
  61. package/docs/overview/MUSUBIX-Roadmap-v2.md +399 -0
  62. package/docs/overview/MUSUBIX-Security-Plan.md +939 -0
  63. package/docs/overview/MUSUBIX-Security-v2.1.md +668 -0
  64. package/docs/overview/MUSUBIX-Security.md +891 -0
  65. package/docs/overview/MUSUBIX-YATA.md +666 -0
  66. package/docs/overview/MUSUBIX-v2.2.0-Advanced-Learning.md +513 -0
  67. package/docs/overview/Neuro-SymbolicAI.md +159 -0
  68. package/package.json +72 -51
  69. package/scripts/generate-quality-gate-report.ts +106 -0
  70. package/scripts/postinstall.js +94 -0
  71. package/steering/.musubi-version +1 -0
  72. package/steering/product.ja.md +572 -0
  73. package/steering/project.yml +66 -0
  74. package/steering/rules/constitution.md +412 -0
  75. package/steering/structure.ja.md +503 -0
  76. package/steering/tech.ja.md +208 -0
  77. package/dist/index.d.ts +0 -26
  78. package/dist/index.d.ts.map +0 -1
  79. package/dist/index.js +0 -75
  80. package/dist/index.js.map +0 -1
@@ -0,0 +1,209 @@
1
+ ---
2
+ name: musubix-adr-generation
3
+ description: Guide for creating Architecture Decision Records (ADRs). Use this when asked to document architecture decisions, technology choices, or design trade-offs.
4
+ license: MIT
5
+ ---
6
+
7
+ # MUSUBIX ADR Generation Skill
8
+
9
+ This skill guides you through creating Architecture Decision Records following **Article VIII - Decision Records**.
10
+
11
+ ## Overview
12
+
13
+ An **ADR (Architecture Decision Record)** documents significant architectural decisions with their context and consequences.
14
+
15
+ ## ADR Template
16
+
17
+ ```markdown
18
+ # ADR-[NUMBER]: [Decision Title]
19
+
20
+ ## ステータス
21
+ [Proposed | Accepted | Deprecated | Superseded by ADR-XXX]
22
+
23
+ ## コンテキスト
24
+ [What is the issue that we're seeing that is motivating this decision?]
25
+
26
+ ## 決定
27
+ [What is the change that we're proposing and/or doing?]
28
+
29
+ ## 選択肢
30
+
31
+ ### Option 1: [Name]
32
+ **メリット:**
33
+ - [Advantage 1]
34
+ - [Advantage 2]
35
+
36
+ **デメリット:**
37
+ - [Disadvantage 1]
38
+ - [Disadvantage 2]
39
+
40
+ ### Option 2: [Name]
41
+ **メリット:**
42
+ - [Advantage 1]
43
+
44
+ **デメリット:**
45
+ - [Disadvantage 1]
46
+
47
+ ## 結果
48
+ [What becomes easier or more difficult to do because of this change?]
49
+
50
+ ## トレーサビリティ
51
+ - 関連要件: REQ-XXX-NNN
52
+ - 関連設計: DES-XXX-NNN
53
+ ```
54
+
55
+ ## Common ADR Topics
56
+
57
+ ### 1. Technology Selection
58
+
59
+ ```markdown
60
+ # ADR-001: Use TypeScript for Backend
61
+
62
+ ## コンテキスト
63
+ We need to choose a programming language for the backend API.
64
+
65
+ ## 決定
66
+ We will use TypeScript with Node.js.
67
+
68
+ ## 選択肢
69
+
70
+ ### Option 1: TypeScript + Node.js
71
+ **メリット:**
72
+ - Type safety reduces runtime errors
73
+ - Same language as frontend (code sharing)
74
+ - Large ecosystem (npm)
75
+ - Strong async/await support
76
+
77
+ **デメリット:**
78
+ - Slower than compiled languages
79
+ - Type definitions not always available
80
+
81
+ ### Option 2: Go
82
+ **メリット:**
83
+ - High performance
84
+ - Strong concurrency support
85
+
86
+ **デメリット:**
87
+ - Different language from frontend
88
+ - Smaller ecosystem for web
89
+
90
+ ## 結果
91
+ - Frontend/backend code sharing enabled
92
+ - Need to maintain TypeScript configuration
93
+ - Team can use consistent tooling
94
+ ```
95
+
96
+ ### 2. Architecture Pattern
97
+
98
+ ```markdown
99
+ # ADR-002: Layered Architecture with DDD
100
+
101
+ ## コンテキスト
102
+ We need to define the overall architecture pattern.
103
+
104
+ ## 決定
105
+ We will use Layered Architecture with Domain-Driven Design principles.
106
+
107
+ ## 選択肢
108
+
109
+ ### Option 1: Layered Architecture
110
+ - Presentation → Application → Domain → Infrastructure
111
+
112
+ ### Option 2: Hexagonal Architecture
113
+ - Ports and Adapters pattern
114
+
115
+ ## 結果
116
+ - Clear separation of concerns
117
+ - Domain logic isolated from infrastructure
118
+ - Easier testing with dependency injection
119
+ ```
120
+
121
+ ### 3. Database Selection
122
+
123
+ ```markdown
124
+ # ADR-003: Use PostgreSQL for Primary Database
125
+
126
+ ## コンテキスト
127
+ We need a primary data store for the application.
128
+
129
+ ## 決定
130
+ PostgreSQL will be our primary database.
131
+
132
+ ## 選択肢
133
+
134
+ ### Option 1: PostgreSQL
135
+ **メリット:**
136
+ - ACID compliance
137
+ - JSON support
138
+ - Strong ecosystem
139
+ - Free and open source
140
+
141
+ ### Option 2: MongoDB
142
+ **メリット:**
143
+ - Schema flexibility
144
+ - Horizontal scaling
145
+
146
+ **デメリット:**
147
+ - Eventual consistency concerns
148
+ - Complex transactions
149
+
150
+ ## 結果
151
+ - Reliable transactional data storage
152
+ - Need to manage schema migrations
153
+ - Can use JSON columns for flexibility
154
+ ```
155
+
156
+ ## CLI Commands
157
+
158
+ ```bash
159
+ # Generate ADR from decision description
160
+ npx musubix design adr "Use React for frontend"
161
+
162
+ # List all ADRs
163
+ ls storage/design/adr/
164
+
165
+ # Generate ADR interactively
166
+ npx musubix design adr --interactive
167
+ ```
168
+
169
+ ## ADR Numbering
170
+
171
+ ADRs are numbered sequentially:
172
+ - ADR-001, ADR-002, ADR-003...
173
+
174
+ Never renumber existing ADRs. If an ADR is superseded, mark it as such and reference the new ADR.
175
+
176
+ ## Storage Location
177
+
178
+ ```
179
+ storage/design/adr/
180
+ ├── ADR-001-typescript-backend.md
181
+ ├── ADR-002-layered-architecture.md
182
+ ├── ADR-003-postgresql-database.md
183
+ └── index.md # ADR index
184
+ ```
185
+
186
+ ## ADR Index Template
187
+
188
+ ```markdown
189
+ # Architecture Decision Records
190
+
191
+ | ADR | Title | Status | Date |
192
+ |-----|-------|--------|------|
193
+ | [ADR-001](./ADR-001-typescript-backend.md) | Use TypeScript for Backend | Accepted | 2026-01-04 |
194
+ | [ADR-002](./ADR-002-layered-architecture.md) | Layered Architecture | Accepted | 2026-01-04 |
195
+ ```
196
+
197
+ ## When to Write an ADR
198
+
199
+ - Technology selection (language, framework, database)
200
+ - Architecture patterns (layered, hexagonal, microservices)
201
+ - External integrations (APIs, services)
202
+ - Security decisions (authentication, authorization)
203
+ - Performance trade-offs (caching, scaling)
204
+
205
+ ## Related Skills
206
+
207
+ - `musubix-c4-design` - Architecture diagrams
208
+ - `musubix-sdd-workflow` - Full development workflow
209
+ - `musubix-traceability` - Link ADRs to requirements
@@ -0,0 +1,315 @@
1
+ ---
2
+ name: musubix-best-practices
3
+ description: Guide for applying MUSUBIX's 17 learned best practices. Use this when asked about coding patterns, design patterns, or testing patterns that MUSUBIX recommends.
4
+ license: MIT
5
+ ---
6
+
7
+ # MUSUBIX Best Practices Skill
8
+
9
+ This skill guides you through applying the 17 best practices learned from MUSUBIX virtual projects.
10
+
11
+ ## Overview
12
+
13
+ MUSUBIX has learned these best practices from implementing 14+ virtual projects. Apply them consistently for high-quality code.
14
+
15
+ ## Code Patterns (5)
16
+
17
+ ### BP-CODE-001: Entity Input DTO
18
+
19
+ Use Input DTO objects for entity creation instead of multiple parameters.
20
+
21
+ ```typescript
22
+ // ✅ Recommended: Input DTO
23
+ interface CreatePetInput {
24
+ name: string;
25
+ species: string;
26
+ ownerId: string;
27
+ }
28
+
29
+ function createPet(input: CreatePetInput): Pet {
30
+ return new Pet(input);
31
+ }
32
+
33
+ // ❌ Avoid: Multiple parameters
34
+ function createPet(name: string, species: string, ownerId: string): Pet {
35
+ // Hard to extend, easy to mix up parameter order
36
+ }
37
+ ```
38
+
39
+ ### BP-CODE-002: Date-based ID Format
40
+
41
+ Generate IDs with PREFIX-YYYYMMDD-NNN format for sortability.
42
+
43
+ ```typescript
44
+ // ✅ Recommended: Date-based ID
45
+ const id = `PET-20260104-001`; // Sortable, traceable
46
+
47
+ // ❌ Avoid: UUID only
48
+ const id = crypto.randomUUID(); // Not human-readable
49
+ ```
50
+
51
+ ### BP-CODE-003: Value Objects
52
+
53
+ Use Value Objects for domain concepts.
54
+
55
+ ```typescript
56
+ // ✅ Recommended: Value Object
57
+ interface Price {
58
+ readonly amount: number;
59
+ readonly currency: 'JPY';
60
+ }
61
+
62
+ // ❌ Avoid: Primitive types
63
+ const price: number = 1000; // No currency context
64
+ ```
65
+
66
+ ### BP-CODE-004: Function-based Value Objects
67
+
68
+ Use interface + factory function instead of classes for Value Objects.
69
+
70
+ ```typescript
71
+ // ✅ Recommended: Interface + Factory Function
72
+ interface Price {
73
+ readonly amount: number;
74
+ readonly currency: 'JPY';
75
+ }
76
+
77
+ function createPrice(amount: number): Result<Price, ValidationError> {
78
+ if (amount < 100 || amount > 1_000_000) {
79
+ return err(new ValidationError('Price must be between 100 and 1,000,000 JPY'));
80
+ }
81
+ return ok({ amount, currency: 'JPY' });
82
+ }
83
+
84
+ // ❌ Avoid: Class-based (doesn't work well with TypeScript structural typing)
85
+ class Price {
86
+ private constructor(readonly amount: number) {}
87
+ static create(amount: number): Price { ... }
88
+ }
89
+ ```
90
+
91
+ ### BP-CODE-005: Result Type
92
+
93
+ Use Result<T, E> for operations that can fail.
94
+
95
+ ```typescript
96
+ // ✅ Recommended: Result type
97
+ type Result<T, E> = { ok: true; value: T } | { ok: false; error: E };
98
+
99
+ function divide(a: number, b: number): Result<number, Error> {
100
+ if (b === 0) return { ok: false, error: new Error('Division by zero') };
101
+ return { ok: true, value: a / b };
102
+ }
103
+
104
+ // ❌ Avoid: Throwing exceptions for expected errors
105
+ function divide(a: number, b: number): number {
106
+ if (b === 0) throw new Error('Division by zero');
107
+ return a / b;
108
+ }
109
+ ```
110
+
111
+ ## Design Patterns (7)
112
+
113
+ ### BP-DESIGN-001: Status Transition Map
114
+
115
+ Define valid status transitions in a Map.
116
+
117
+ ```typescript
118
+ // ✅ Recommended: Transition map
119
+ const validTransitions: Record<Status, Status[]> = {
120
+ draft: ['active', 'cancelled'],
121
+ active: ['completed', 'cancelled'],
122
+ completed: [],
123
+ cancelled: [],
124
+ };
125
+
126
+ function canTransition(from: Status, to: Status): boolean {
127
+ return validTransitions[from].includes(to);
128
+ }
129
+ ```
130
+
131
+ ### BP-DESIGN-002: Repository Async Pattern
132
+
133
+ Make repositories async for future DB migration.
134
+
135
+ ```typescript
136
+ // ✅ Recommended: Async repository
137
+ interface PetRepository {
138
+ findById(id: PetId): Promise<Pet | null>;
139
+ save(pet: Pet): Promise<void>;
140
+ }
141
+
142
+ // ❌ Avoid: Sync repository (hard to migrate later)
143
+ interface PetRepository {
144
+ findById(id: PetId): Pet | null;
145
+ }
146
+ ```
147
+
148
+ ### BP-DESIGN-003: Service Layer with DI
149
+
150
+ Use dependency injection for services.
151
+
152
+ ```typescript
153
+ // ✅ Recommended: Constructor DI
154
+ class PetService {
155
+ constructor(
156
+ private readonly petRepository: PetRepository,
157
+ private readonly auditService: AuditService
158
+ ) {}
159
+ }
160
+ ```
161
+
162
+ ### BP-DESIGN-004: Optimistic Locking
163
+
164
+ Use version field for concurrent edit detection.
165
+
166
+ ```typescript
167
+ // ✅ Recommended: Version field
168
+ interface Entity {
169
+ id: string;
170
+ version: number;
171
+ updatedAt: Date;
172
+ }
173
+
174
+ function update(entity: Entity, currentVersion: number): Result<Entity, ConcurrencyError> {
175
+ if (entity.version !== currentVersion) {
176
+ return err(new ConcurrencyError('Entity was modified'));
177
+ }
178
+ return ok({ ...entity, version: entity.version + 1 });
179
+ }
180
+ ```
181
+
182
+ ### BP-DESIGN-005: AuditService
183
+
184
+ Record data changes in audit logs.
185
+
186
+ ```typescript
187
+ // ✅ Recommended: Audit logging
188
+ interface AuditEntry {
189
+ id: string;
190
+ entityType: string;
191
+ entityId: string;
192
+ action: 'CREATE' | 'UPDATE' | 'DELETE';
193
+ changes: object;
194
+ userId: string;
195
+ timestamp: Date;
196
+ }
197
+ ```
198
+
199
+ ### BP-DESIGN-006: Entity Counter Reset
200
+
201
+ Provide reset functions for test isolation.
202
+
203
+ ```typescript
204
+ // ✅ Recommended: Resettable counter
205
+ let petCounter = 0;
206
+
207
+ export function generatePetId(): string {
208
+ return `PET-${Date.now()}-${++petCounter}`;
209
+ }
210
+
211
+ export function resetPetCounter(): void {
212
+ petCounter = 0; // For tests
213
+ }
214
+ ```
215
+
216
+ ### BP-DESIGN-007: Expiry Time Logic
217
+
218
+ Use expiresAt field for time-limited entities.
219
+
220
+ ```typescript
221
+ // ✅ Recommended: Explicit expiry
222
+ interface Reservation {
223
+ id: string;
224
+ createdAt: Date;
225
+ expiresAt: Date; // Explicit expiry time
226
+ }
227
+
228
+ function isExpired(reservation: Reservation): boolean {
229
+ return new Date() > reservation.expiresAt;
230
+ }
231
+ ```
232
+
233
+ ## Test Patterns (5)
234
+
235
+ ### BP-TEST-001: Test Counter Reset
236
+
237
+ Reset ID counters in beforeEach.
238
+
239
+ ```typescript
240
+ beforeEach(() => {
241
+ resetPetCounter();
242
+ resetReservationCounter();
243
+ });
244
+ ```
245
+
246
+ ### BP-TEST-002: Verify API Before Test
247
+
248
+ Check method signatures before writing tests.
249
+
250
+ ### BP-TEST-003: Vitest ESM Configuration
251
+
252
+ Use proper ESM setup for Vitest.
253
+
254
+ ```typescript
255
+ // vitest.config.ts
256
+ export default defineConfig({
257
+ test: {
258
+ globals: true,
259
+ environment: 'node',
260
+ },
261
+ });
262
+ ```
263
+
264
+ ### BP-TEST-004: Result Type Test Pattern
265
+
266
+ Test both success and error cases.
267
+
268
+ ```typescript
269
+ it('should succeed with valid input', () => {
270
+ const result = createPrice(1000);
271
+ expect(result.isOk()).toBe(true);
272
+ });
273
+
274
+ it('should fail with invalid input', () => {
275
+ const result = createPrice(-1);
276
+ expect(result.isErr()).toBe(true);
277
+ });
278
+ ```
279
+
280
+ ### BP-TEST-005: Status Transition Testing
281
+
282
+ Test all valid and invalid transitions.
283
+
284
+ ```typescript
285
+ describe('status transitions', () => {
286
+ it.each([
287
+ ['draft', 'active', true],
288
+ ['draft', 'completed', false],
289
+ ['active', 'completed', true],
290
+ ])('%s -> %s should be %s', (from, to, valid) => {
291
+ expect(canTransition(from, to)).toBe(valid);
292
+ });
293
+ });
294
+ ```
295
+
296
+ ## CLI Commands
297
+
298
+ ```bash
299
+ # Show all best practices
300
+ npx musubix learn best-practices
301
+
302
+ # Filter by category
303
+ npx musubix learn best-practices --category code
304
+ npx musubix learn best-practices --category design
305
+ npx musubix learn best-practices --category test
306
+
307
+ # High confidence only
308
+ npx musubix learn best-practices --high-confidence
309
+ ```
310
+
311
+ ## Related Skills
312
+
313
+ - `musubix-code-generation` - Apply patterns in code
314
+ - `musubix-test-generation` - Apply test patterns
315
+ - `musubix-sdd-workflow` - Full workflow with patterns
@@ -0,0 +1,162 @@
1
+ ---
2
+ name: musubix-c4-design
3
+ description: Guide for creating C4 model design documents. Use this when asked to create architecture designs, system context diagrams, container diagrams, or component diagrams following the C4 model methodology.
4
+ license: MIT
5
+ ---
6
+
7
+ # MUSUBIX C4 Design Skill
8
+
9
+ This skill guides you through creating C4 model architecture designs for MUSUBIX projects.
10
+
11
+ ## Overview
12
+
13
+ The C4 model provides four levels of abstraction for describing software architecture:
14
+
15
+ 1. **Context** - System boundaries and external actors
16
+ 2. **Container** - Technology choices and deployable units
17
+ 3. **Component** - Internal structure of containers
18
+ 4. **Code** - Implementation details (optional)
19
+
20
+ ## Prerequisites
21
+
22
+ Before creating designs:
23
+
24
+ 1. Read requirements from `storage/specs/` (REQ-* files)
25
+ 2. Check `steering/structure.ja.md` for architecture guidelines
26
+ 3. Review `steering/tech.ja.md` for technology constraints
27
+
28
+ ## Design Document Template
29
+
30
+ ```markdown
31
+ # DES-[CATEGORY]-[NUMBER]: [Design Title]
32
+
33
+ ## メタデータ
34
+ - **作成日**: YYYY-MM-DD
35
+ - **トレーサビリティ**: REQ-XXX-NNN
36
+
37
+ ## 1. Context Level
38
+
39
+ ### システムコンテキスト図
40
+ [External actors and systems that interact with our system]
41
+
42
+ ### 外部アクター
43
+ | アクター | 説明 | インタラクション |
44
+ |---------|------|-----------------|
45
+ | User | システム利用者 | Web UI経由でアクセス |
46
+
47
+ ## 2. Container Level
48
+
49
+ ### コンテナ構成
50
+ | コンテナ | 技術 | 責務 |
51
+ |---------|------|------|
52
+ | Web App | React/Next.js | UI提供 |
53
+ | API Server | Node.js/Express | ビジネスロジック |
54
+ | Database | PostgreSQL | データ永続化 |
55
+
56
+ ### コンテナ間通信
57
+ [Describe how containers communicate]
58
+
59
+ ## 3. Component Level
60
+
61
+ ### [Container Name] コンポーネント
62
+
63
+ | コンポーネント | 種別 | 責務 | 依存先 |
64
+ |---------------|------|------|--------|
65
+ | XxxService | Service | ビジネスロジック | XxxRepository |
66
+ | XxxRepository | Repository | データアクセス | Database |
67
+ | XxxController | Controller | リクエスト処理 | XxxService |
68
+
69
+ ## 4. 設計パターン
70
+
71
+ ### 適用パターン
72
+ | パターン | 適用箇所 | 理由 |
73
+ |---------|---------|------|
74
+ | Repository | データアクセス層 | 永続化の抽象化 |
75
+ | Service | ビジネス層 | ロジックの集約 |
76
+ | Factory | オブジェクト生成 | 生成ロジックの分離 |
77
+
78
+ ## 5. 非機能要件への対応
79
+
80
+ ### セキュリティ
81
+ - 認証: [方式]
82
+ - 認可: [方式]
83
+ - データ保護: [方式]
84
+
85
+ ### スケーラビリティ
86
+ - [スケーリング戦略]
87
+
88
+ ### 可用性
89
+ - [可用性設計]
90
+ ```
91
+
92
+ ## C4 Diagram Syntax (Mermaid)
93
+
94
+ ### Context Diagram
95
+ ```mermaid
96
+ flowchart TB
97
+ subgraph External["外部システム"]
98
+ User[ユーザー]
99
+ ExtAPI[外部API]
100
+ end
101
+
102
+ subgraph System["対象システム"]
103
+ App[アプリケーション]
104
+ end
105
+
106
+ User --> App
107
+ App --> ExtAPI
108
+ ```
109
+
110
+ ### Container Diagram
111
+ ```mermaid
112
+ flowchart TB
113
+ subgraph Containers["コンテナ構成"]
114
+ Web[Web App<br/>React]
115
+ API[API Server<br/>Node.js]
116
+ DB[(Database<br/>PostgreSQL)]
117
+ end
118
+
119
+ Web --> API
120
+ API --> DB
121
+ ```
122
+
123
+ ### Component Diagram
124
+ ```mermaid
125
+ flowchart TB
126
+ subgraph APIServer["API Server"]
127
+ Controller[Controller]
128
+ Service[Service]
129
+ Repository[Repository]
130
+ end
131
+
132
+ Controller --> Service
133
+ Service --> Repository
134
+ ```
135
+
136
+ ## Design Patterns Reference
137
+
138
+ | パターン | 用途 | 適用場面 |
139
+ |---------|------|---------|
140
+ | **Repository** | データアクセス抽象化 | DB操作 |
141
+ | **Service** | ビジネスロジック集約 | ユースケース実装 |
142
+ | **Factory** | オブジェクト生成 | 複雑な生成ロジック |
143
+ | **Strategy** | アルゴリズム切替 | 認証方式、計算方式 |
144
+ | **Observer** | イベント通知 | 状態変更の伝播 |
145
+ | **Decorator** | 機能追加 | ログ、キャッシュ |
146
+
147
+ ## Domain-Specific Components
148
+
149
+ Use `npx musubix design generate` to get domain-specific component recommendations for 62 domains.
150
+
151
+ ## Output Location
152
+
153
+ Save design documents to:
154
+ ```
155
+ storage/design/DES-[CATEGORY]-[NUMBER].md
156
+ ```
157
+
158
+ ## Related Skills
159
+
160
+ - `musubix-ears-validation` - Requirements validation
161
+ - `musubix-code-generation` - Generate code from design
162
+ - `musubix-adr-generation` - Document architecture decisions