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.
- package/.github/AGENTS.md +242 -0
- package/.github/prompts/sdd-change-apply.prompt.md +283 -0
- package/.github/prompts/sdd-change-archive.prompt.md +241 -0
- package/.github/prompts/sdd-change-init.prompt.md +269 -0
- package/.github/prompts/sdd-design.prompt.md +250 -0
- package/.github/prompts/sdd-implement.prompt.md +387 -0
- package/.github/prompts/sdd-requirements.prompt.md +193 -0
- package/.github/prompts/sdd-review.prompt.md +155 -0
- package/.github/prompts/sdd-security.prompt.md +228 -0
- package/.github/prompts/sdd-steering.prompt.md +269 -0
- package/.github/prompts/sdd-tasks.prompt.md +255 -0
- package/.github/prompts/sdd-test.prompt.md +230 -0
- package/.github/prompts/sdd-validate.prompt.md +304 -0
- package/.github/skills/musubix-adr-generation/SKILL.md +209 -0
- package/.github/skills/musubix-best-practices/SKILL.md +315 -0
- package/.github/skills/musubix-c4-design/SKILL.md +162 -0
- package/.github/skills/musubix-code-generation/SKILL.md +229 -0
- package/.github/skills/musubix-domain-inference/SKILL.md +196 -0
- package/.github/skills/musubix-ears-validation/SKILL.md +161 -0
- package/.github/skills/musubix-sdd-workflow/SKILL.md +210 -0
- package/.github/skills/musubix-technical-writing/SKILL.md +444 -0
- package/.github/skills/musubix-test-generation/SKILL.md +212 -0
- package/.github/skills/musubix-traceability/SKILL.md +141 -0
- package/AGENTS.md +772 -0
- package/LICENSE +21 -0
- package/README.ja.md +302 -0
- package/README.md +310 -44
- package/bin/musubix-mcp.js +15 -0
- package/bin/musubix.js +9 -1
- package/docs/API-REFERENCE.md +1425 -0
- package/docs/GITHUB-ACTIONS-NPM-SETUP.md +132 -0
- package/docs/INSTALL-GUIDE.ja.md +459 -0
- package/docs/INSTALL-GUIDE.md +459 -0
- package/docs/MUSUBI-enhancement_roadmap_20260105.md +651 -0
- package/docs/MUSUBIXv2.2.0-Manual-outline.md +136 -0
- package/docs/MUSUBIXv2.2.0-Manual.md +3123 -0
- package/docs/MUSUBIXv2.3.5-Refactering.md +1310 -0
- package/docs/MUSUBIv1.6.1-enhancement_roadmap_20260105.md +291 -0
- package/docs/MUSUBIv2.2.0-USERGUIDE.md +2079 -0
- package/docs/ROADMAP-v1.5.md +116 -0
- package/docs/SwarmCoding.md +1284 -0
- package/docs/Test-prompt.md +105 -0
- package/docs/USER-GUIDE-v1.8.0.md +2371 -0
- package/docs/USER-GUIDE.ja.md +2147 -0
- package/docs/USER-GUIDE.md +2847 -0
- package/docs/adr/0001-real-time-pattern-learning-architecture-for-v1-5-0.md +75 -0
- package/docs/adr/0002-pattern-sharing-protocol-for-cross-team-collaborat.md +79 -0
- package/docs/adr/0003-owl-2-rl-implementation-strategy-for-advanced-infe.md +90 -0
- package/docs/evolution-from-musubi-to-musubix.md +2170 -0
- package/docs/getting-started-with-sdd.md +1602 -0
- package/docs/moodle-refactering-codegraph-musubix.md +391 -0
- package/docs/moodle-refactering-codegraph.md +278 -0
- package/docs/overview/MUSUBIX-CodeGraph.md +322 -0
- package/docs/overview/MUSUBIX-Core.md +671 -0
- package/docs/overview/MUSUBIX-FormalVerify.md +566 -0
- package/docs/overview/MUSUBIX-Learning.md +837 -0
- package/docs/overview/MUSUBIX-MCP-Server.md +535 -0
- package/docs/overview/MUSUBIX-Overview.md +264 -0
- package/docs/overview/MUSUBIX-Phase1-Complete.md +271 -0
- package/docs/overview/MUSUBIX-Phase2-Complete.md +310 -0
- package/docs/overview/MUSUBIX-Roadmap-v2.md +399 -0
- package/docs/overview/MUSUBIX-Security-Plan.md +939 -0
- package/docs/overview/MUSUBIX-Security-v2.1.md +668 -0
- package/docs/overview/MUSUBIX-Security.md +891 -0
- package/docs/overview/MUSUBIX-YATA.md +666 -0
- package/docs/overview/MUSUBIX-v2.2.0-Advanced-Learning.md +513 -0
- package/docs/overview/Neuro-SymbolicAI.md +159 -0
- package/package.json +72 -51
- package/scripts/generate-quality-gate-report.ts +106 -0
- package/scripts/postinstall.js +94 -0
- package/steering/.musubi-version +1 -0
- package/steering/product.ja.md +572 -0
- package/steering/project.yml +66 -0
- package/steering/rules/constitution.md +412 -0
- package/steering/structure.ja.md +503 -0
- package/steering/tech.ja.md +208 -0
- package/dist/index.d.ts +0 -26
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -75
- package/dist/index.js.map +0 -1
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: musubix-code-generation
|
|
3
|
+
description: Guide for generating code from design specifications using MUSUBIX. Use this when asked to generate code, implement features, or create components following design documents.
|
|
4
|
+
license: MIT
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# MUSUBIX Code Generation Skill
|
|
8
|
+
|
|
9
|
+
This skill guides you through generating code from design specifications following MUSUBIX methodology.
|
|
10
|
+
|
|
11
|
+
## Prerequisites
|
|
12
|
+
|
|
13
|
+
Before generating code:
|
|
14
|
+
|
|
15
|
+
1. Verify design document exists (`DES-*`)
|
|
16
|
+
2. Verify requirements are traceable (`REQ-*`)
|
|
17
|
+
3. Check `steering/tech.ja.md` for technology stack
|
|
18
|
+
|
|
19
|
+
## Supported Languages
|
|
20
|
+
|
|
21
|
+
| Language | Extension | Features |
|
|
22
|
+
|----------|-----------|----------|
|
|
23
|
+
| TypeScript | `.ts` | Full support with types |
|
|
24
|
+
| JavaScript | `.js` | ES6+ modules |
|
|
25
|
+
| Python | `.py` | Type hints support |
|
|
26
|
+
| Java | `.java` | Interface/Class generation |
|
|
27
|
+
| Go | `.go` | Struct/Interface generation |
|
|
28
|
+
| Rust | `.rs` | Trait/Struct generation |
|
|
29
|
+
| C# | `.cs` | Interface/Class generation |
|
|
30
|
+
|
|
31
|
+
## Code Generation Workflow
|
|
32
|
+
|
|
33
|
+
### Step 1: Read Design Document
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
# Generate code from design
|
|
37
|
+
npx musubix codegen generate <design-file>
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Step 2: Generate with Traceability
|
|
41
|
+
|
|
42
|
+
Always include requirement references:
|
|
43
|
+
|
|
44
|
+
```typescript
|
|
45
|
+
/**
|
|
46
|
+
* UserService - Handles user operations
|
|
47
|
+
*
|
|
48
|
+
* @see REQ-INT-001 - Neuro-Symbolic Integration
|
|
49
|
+
* @see DES-INT-001 - Integration Layer Design
|
|
50
|
+
*/
|
|
51
|
+
export class UserService {
|
|
52
|
+
// Implementation
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Step 3: Follow Test-First (Article III)
|
|
57
|
+
|
|
58
|
+
1. **Write test first**:
|
|
59
|
+
```typescript
|
|
60
|
+
describe('UserService', () => {
|
|
61
|
+
it('should create user', async () => {
|
|
62
|
+
const service = new UserService();
|
|
63
|
+
const user = await service.create({ name: 'Test' });
|
|
64
|
+
expect(user.id).toBeDefined();
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
2. **Implement minimal code**:
|
|
70
|
+
```typescript
|
|
71
|
+
export class UserService {
|
|
72
|
+
async create(data: CreateUserDto): Promise<User> {
|
|
73
|
+
return { id: generateId(), ...data };
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
3. **Refactor**
|
|
79
|
+
|
|
80
|
+
## Design Pattern Templates
|
|
81
|
+
|
|
82
|
+
### Singleton Pattern
|
|
83
|
+
```typescript
|
|
84
|
+
/**
|
|
85
|
+
* @see REQ-DES-001 - Pattern Detection
|
|
86
|
+
* @pattern Singleton
|
|
87
|
+
*/
|
|
88
|
+
export class ConfigManager {
|
|
89
|
+
private static instance: ConfigManager;
|
|
90
|
+
|
|
91
|
+
private constructor() {}
|
|
92
|
+
|
|
93
|
+
static getInstance(): ConfigManager {
|
|
94
|
+
if (!ConfigManager.instance) {
|
|
95
|
+
ConfigManager.instance = new ConfigManager();
|
|
96
|
+
}
|
|
97
|
+
return ConfigManager.instance;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Factory Pattern
|
|
103
|
+
```typescript
|
|
104
|
+
/**
|
|
105
|
+
* @see REQ-DES-001 - Pattern Detection
|
|
106
|
+
* @pattern Factory
|
|
107
|
+
*/
|
|
108
|
+
export interface ServiceFactory {
|
|
109
|
+
create(type: string): Service;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export class DefaultServiceFactory implements ServiceFactory {
|
|
113
|
+
create(type: string): Service {
|
|
114
|
+
switch (type) {
|
|
115
|
+
case 'auth': return new AuthService();
|
|
116
|
+
case 'user': return new UserService();
|
|
117
|
+
default: throw new Error(`Unknown service: ${type}`);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### Repository Pattern
|
|
124
|
+
```typescript
|
|
125
|
+
/**
|
|
126
|
+
* @see REQ-COD-001 - Code Generation
|
|
127
|
+
* @pattern Repository
|
|
128
|
+
*/
|
|
129
|
+
export interface Repository<T> {
|
|
130
|
+
findById(id: string): Promise<T | null>;
|
|
131
|
+
findAll(): Promise<T[]>;
|
|
132
|
+
save(entity: T): Promise<T>;
|
|
133
|
+
delete(id: string): Promise<void>;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export class UserRepository implements Repository<User> {
|
|
137
|
+
async findById(id: string): Promise<User | null> {
|
|
138
|
+
// Implementation
|
|
139
|
+
}
|
|
140
|
+
// ... other methods
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## CLI Commands
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
# Generate code from design
|
|
148
|
+
npx musubix codegen generate <design-file>
|
|
149
|
+
|
|
150
|
+
# Analyze existing code
|
|
151
|
+
npx musubix codegen analyze <file>
|
|
152
|
+
|
|
153
|
+
# Security scan
|
|
154
|
+
npx musubix codegen security <path>
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
## Quality Checks (Article IX)
|
|
158
|
+
|
|
159
|
+
Before committing code:
|
|
160
|
+
|
|
161
|
+
- [ ] **Type Safety**: No `any` types (TypeScript)
|
|
162
|
+
- [ ] **Traceability**: All classes/functions have `@see` references
|
|
163
|
+
- [ ] **Tests**: Test coverage ≥ 80%
|
|
164
|
+
- [ ] **Linting**: `npm run lint` passes
|
|
165
|
+
- [ ] **Build**: `npm run build` succeeds
|
|
166
|
+
|
|
167
|
+
## Neuro-Symbolic Integration (REQ-INT-002)
|
|
168
|
+
|
|
169
|
+
When generating code that involves decision-making:
|
|
170
|
+
|
|
171
|
+
```typescript
|
|
172
|
+
/**
|
|
173
|
+
* @see REQ-INT-002 - Confidence Evaluation
|
|
174
|
+
*/
|
|
175
|
+
async function integrateResults(
|
|
176
|
+
neuralResult: NeuralResult,
|
|
177
|
+
symbolicResult: SymbolicResult
|
|
178
|
+
): Promise<FinalResult> {
|
|
179
|
+
// Decision rules from REQ-INT-002
|
|
180
|
+
if (symbolicResult.status === 'invalid') {
|
|
181
|
+
return rejectNeural(neuralResult);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
if (neuralResult.confidence >= 0.8) {
|
|
185
|
+
return adoptNeural(neuralResult);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
return prioritizeSymbolic(symbolicResult);
|
|
189
|
+
}
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
## File Structure Convention
|
|
193
|
+
|
|
194
|
+
```
|
|
195
|
+
packages/
|
|
196
|
+
├── core/
|
|
197
|
+
│ └── src/
|
|
198
|
+
│ ├── [feature]/
|
|
199
|
+
│ │ ├── index.ts # Public exports
|
|
200
|
+
│ │ ├── [feature].ts # Main implementation
|
|
201
|
+
│ │ ├── types.ts # Type definitions
|
|
202
|
+
│ │ └── __tests__/ # Tests
|
|
203
|
+
│ └── index.ts # Package exports
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
## Error Handling Pattern
|
|
207
|
+
|
|
208
|
+
```typescript
|
|
209
|
+
/**
|
|
210
|
+
* @see REQ-ERR-001 - Graceful Degradation
|
|
211
|
+
*/
|
|
212
|
+
export class MuSubixError extends Error {
|
|
213
|
+
constructor(
|
|
214
|
+
message: string,
|
|
215
|
+
public code: string,
|
|
216
|
+
public recoverable: boolean = true
|
|
217
|
+
) {
|
|
218
|
+
super(message);
|
|
219
|
+
this.name = 'MuSubixError';
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
// Usage
|
|
224
|
+
throw new MuSubixError(
|
|
225
|
+
'Failed to connect to YATA',
|
|
226
|
+
'YATA_CONNECTION_ERROR',
|
|
227
|
+
true // Can retry
|
|
228
|
+
);
|
|
229
|
+
```
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: musubix-domain-inference
|
|
3
|
+
description: Guide for automatic domain detection and component inference. Use this when asked to identify the domain of a project and get recommended components for that domain.
|
|
4
|
+
license: MIT
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# MUSUBIX Domain Inference Skill
|
|
8
|
+
|
|
9
|
+
This skill guides you through automatic domain detection and component recommendations.
|
|
10
|
+
|
|
11
|
+
## Overview
|
|
12
|
+
|
|
13
|
+
MUSUBIX supports **62 domains** with **224 predefined components**. The domain inference system automatically:
|
|
14
|
+
|
|
15
|
+
1. Detects project domain from requirements/descriptions
|
|
16
|
+
2. Recommends optimal components for that domain
|
|
17
|
+
3. Suggests architecture patterns
|
|
18
|
+
|
|
19
|
+
## Supported Domains (62)
|
|
20
|
+
|
|
21
|
+
### Business (8)
|
|
22
|
+
| Domain | Description | Key Components |
|
|
23
|
+
|--------|-------------|----------------|
|
|
24
|
+
| ecommerce | EC・通販 | CartService, ProductCatalog, OrderProcessor |
|
|
25
|
+
| finance | 金融 | AccountService, TransactionManager, LedgerService |
|
|
26
|
+
| crm | 顧客管理 | CustomerService, LeadManager, OpportunityTracker |
|
|
27
|
+
| hr | 人事 | EmployeeService, PayrollCalculator, AttendanceTracker |
|
|
28
|
+
| marketing | マーケティング | CampaignManager, AudienceSegmenter, AnalyticsService |
|
|
29
|
+
| inventory | 在庫管理 | StockManager, ReorderService, WarehouseController |
|
|
30
|
+
| payment | 決済 | PaymentGateway, RefundProcessor, InvoiceGenerator |
|
|
31
|
+
| subscription | サブスク | PlanManager, BillingService, RenewalProcessor |
|
|
32
|
+
|
|
33
|
+
### Healthcare (3)
|
|
34
|
+
| Domain | Description | Key Components |
|
|
35
|
+
|--------|-------------|----------------|
|
|
36
|
+
| healthcare | ヘルスケア | PatientService, DiagnosticService, AppointmentManager |
|
|
37
|
+
| pharmacy | 薬局 | PrescriptionManager, MedicineInventory, DosageCalculator |
|
|
38
|
+
| veterinary | 動物病院 | PetService, VetScheduleService, VaccinationTracker |
|
|
39
|
+
|
|
40
|
+
### Service (20+)
|
|
41
|
+
| Domain | Description | Key Components |
|
|
42
|
+
|--------|-------------|----------------|
|
|
43
|
+
| booking | 予約 | ReservationService, SlotManager, AvailabilityChecker |
|
|
44
|
+
| hotel | ホテル | RoomService, CheckInManager, HousekeepingScheduler |
|
|
45
|
+
| restaurant | 飲食店 | MenuManager, TableService, KitchenOrderSystem |
|
|
46
|
+
| gym | フィットネス | MembershipService, ClassScheduler, TrainerAssignment |
|
|
47
|
+
| delivery | 配送 | DeliveryService, RouteOptimizer, TrackingManager |
|
|
48
|
+
| parking | 駐車場 | SpaceManager, EntryExitController, FeeCalculator |
|
|
49
|
+
|
|
50
|
+
### Technology (8)
|
|
51
|
+
| Domain | Description | Key Components |
|
|
52
|
+
|--------|-------------|----------------|
|
|
53
|
+
| iot | IoT | DeviceManager, TelemetryProcessor, AlertService |
|
|
54
|
+
| security | セキュリティ | AuthService, PermissionManager, AuditLogger |
|
|
55
|
+
| ai | AI | ModelService, InferenceEngine, TrainingPipeline |
|
|
56
|
+
| analytics | 分析 | ReportGenerator, MetricsCollector, DashboardService |
|
|
57
|
+
|
|
58
|
+
## Domain Detection
|
|
59
|
+
|
|
60
|
+
### Automatic Detection
|
|
61
|
+
|
|
62
|
+
MUSUBIX analyzes text for domain keywords:
|
|
63
|
+
|
|
64
|
+
```typescript
|
|
65
|
+
import { domainDetector } from '@nahisaho/musubix-core';
|
|
66
|
+
|
|
67
|
+
const result = domainDetector.detect(`
|
|
68
|
+
ペットの予約管理システムを作りたい。
|
|
69
|
+
獣医師のスケジュール管理と、ワクチン接種記録も必要。
|
|
70
|
+
`);
|
|
71
|
+
|
|
72
|
+
// Result:
|
|
73
|
+
// {
|
|
74
|
+
// primaryDomain: { id: 'veterinary', name: 'Veterinary', nameJa: '動物病院' },
|
|
75
|
+
// confidence: 0.92,
|
|
76
|
+
// matchedKeywords: ['ペット', '獣医', 'ワクチン', '予約'],
|
|
77
|
+
// suggestedComponents: ['PetService', 'ReservationService', 'VetScheduleService']
|
|
78
|
+
// }
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### CLI Usage
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
# Analyze requirements file
|
|
85
|
+
npx musubix design patterns --detect-domain storage/specs/REQ-001.md
|
|
86
|
+
|
|
87
|
+
# Get component recommendations
|
|
88
|
+
npx musubix design generate storage/specs/REQ-001.md --infer-components
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Component Inference
|
|
92
|
+
|
|
93
|
+
### Domain-Specific Components
|
|
94
|
+
|
|
95
|
+
Each domain has predefined components with:
|
|
96
|
+
- **Type**: Service, Repository, Controller, Factory, etc.
|
|
97
|
+
- **Layer**: Presentation, Application, Domain, Infrastructure
|
|
98
|
+
- **Dependencies**: Required collaborators
|
|
99
|
+
- **Patterns**: Recommended design patterns
|
|
100
|
+
- **Methods**: Domain-specific operations
|
|
101
|
+
|
|
102
|
+
### Example: Veterinary Domain
|
|
103
|
+
|
|
104
|
+
```typescript
|
|
105
|
+
const veterinaryComponents = [
|
|
106
|
+
{
|
|
107
|
+
name: 'PetService',
|
|
108
|
+
type: 'service',
|
|
109
|
+
layer: 'application',
|
|
110
|
+
description: 'ペット管理のビジネスロジック',
|
|
111
|
+
dependencies: ['PetRepository', 'PetHistoryRepository'],
|
|
112
|
+
patterns: ['Service'],
|
|
113
|
+
methods: [
|
|
114
|
+
{ name: 'register', returnType: 'Promise<Pet>' },
|
|
115
|
+
{ name: 'update', returnType: 'Promise<Pet>' },
|
|
116
|
+
{ name: 'getByOwner', returnType: 'Promise<Pet[]>' },
|
|
117
|
+
{ name: 'getHistory', returnType: 'Promise<PetHistory[]>' },
|
|
118
|
+
]
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
name: 'ReservationService',
|
|
122
|
+
type: 'service',
|
|
123
|
+
layer: 'application',
|
|
124
|
+
methods: [
|
|
125
|
+
{ name: 'create', returnType: 'Promise<Reservation>' },
|
|
126
|
+
{ name: 'confirm', returnType: 'Promise<Reservation>' },
|
|
127
|
+
{ name: 'cancel', returnType: 'Promise<Reservation>' },
|
|
128
|
+
{ name: 'getAvailableSlots', returnType: 'Promise<TimeSlot[]>' },
|
|
129
|
+
]
|
|
130
|
+
},
|
|
131
|
+
// ...more components
|
|
132
|
+
];
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## Architecture Recommendations
|
|
136
|
+
|
|
137
|
+
Based on domain, MUSUBIX recommends:
|
|
138
|
+
|
|
139
|
+
| Domain Category | Architecture Style | Scaling Strategy |
|
|
140
|
+
|-----------------|-------------------|------------------|
|
|
141
|
+
| Business | Layered + DDD | Vertical with caching |
|
|
142
|
+
| Technology | Microservices | Horizontal scaling |
|
|
143
|
+
| Healthcare | Layered + Audit | Vertical with compliance |
|
|
144
|
+
| Service | Layered | Vertical with caching |
|
|
145
|
+
|
|
146
|
+
## Multi-Domain Projects
|
|
147
|
+
|
|
148
|
+
For projects spanning multiple domains:
|
|
149
|
+
|
|
150
|
+
```typescript
|
|
151
|
+
const result = domainDetector.detect(`
|
|
152
|
+
ECサイトで商品を販売し、配送追跡も行いたい。
|
|
153
|
+
在庫管理とサブスクリプション機能も必要。
|
|
154
|
+
`);
|
|
155
|
+
|
|
156
|
+
// Result:
|
|
157
|
+
// {
|
|
158
|
+
// primaryDomain: { id: 'ecommerce' },
|
|
159
|
+
// secondaryDomains: [
|
|
160
|
+
// { id: 'delivery' },
|
|
161
|
+
// { id: 'inventory' },
|
|
162
|
+
// { id: 'subscription' }
|
|
163
|
+
// ]
|
|
164
|
+
// }
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
## Using in Design Documents
|
|
168
|
+
|
|
169
|
+
```markdown
|
|
170
|
+
# DES-SHOP-001: ECサイト設計
|
|
171
|
+
|
|
172
|
+
## ドメイン分析
|
|
173
|
+
- **主ドメイン**: ecommerce
|
|
174
|
+
- **副ドメイン**: inventory, payment, delivery
|
|
175
|
+
|
|
176
|
+
## 推奨コンポーネント
|
|
177
|
+
|
|
178
|
+
### ecommerce ドメイン
|
|
179
|
+
| コンポーネント | 種別 | 責務 |
|
|
180
|
+
|---------------|------|------|
|
|
181
|
+
| CartService | Service | カート管理 |
|
|
182
|
+
| ProductCatalog | Service | 商品カタログ |
|
|
183
|
+
| OrderProcessor | Service | 注文処理 |
|
|
184
|
+
|
|
185
|
+
### inventory ドメイン
|
|
186
|
+
| コンポーネント | 種別 | 責務 |
|
|
187
|
+
|---------------|------|------|
|
|
188
|
+
| StockManager | Service | 在庫管理 |
|
|
189
|
+
| ReorderService | Service | 発注管理 |
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
## Related Skills
|
|
193
|
+
|
|
194
|
+
- `musubix-c4-design` - Create architecture with inferred components
|
|
195
|
+
- `musubix-code-generation` - Generate code for components
|
|
196
|
+
- `musubix-sdd-workflow` - Full workflow with domain awareness
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: musubix-ears-validation
|
|
3
|
+
description: Guide for validating and creating EARS-format requirements. Use this when asked to write requirements, validate requirement syntax, or convert natural language to EARS format.
|
|
4
|
+
license: MIT
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# MUSUBIX EARS Validation Skill
|
|
8
|
+
|
|
9
|
+
This skill helps you create and validate requirements using EARS (Easy Approach to Requirements Syntax) format.
|
|
10
|
+
|
|
11
|
+
## EARS Pattern Reference
|
|
12
|
+
|
|
13
|
+
### 1. Ubiquitous Pattern
|
|
14
|
+
**Use for**: Requirements that must always be satisfied.
|
|
15
|
+
|
|
16
|
+
**Syntax**:
|
|
17
|
+
```
|
|
18
|
+
THE [system name] SHALL [requirement]
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
**Example**:
|
|
22
|
+
```markdown
|
|
23
|
+
THE AuthService SHALL authenticate users with valid credentials.
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### 2. Event-Driven Pattern
|
|
27
|
+
**Use for**: Requirements triggered by specific events.
|
|
28
|
+
|
|
29
|
+
**Syntax**:
|
|
30
|
+
```
|
|
31
|
+
WHEN [trigger event], THE [system name] SHALL [response]
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
**Example**:
|
|
35
|
+
```markdown
|
|
36
|
+
WHEN a user submits login credentials, THE AuthService SHALL validate the credentials within 2 seconds.
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### 3. State-Driven Pattern
|
|
40
|
+
**Use for**: Requirements that apply while in a specific state.
|
|
41
|
+
|
|
42
|
+
**Syntax**:
|
|
43
|
+
```
|
|
44
|
+
WHILE [system state], THE [system name] SHALL [behavior]
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
**Example**:
|
|
48
|
+
```markdown
|
|
49
|
+
WHILE the system is in maintenance mode, THE API SHALL return 503 Service Unavailable.
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### 4. Unwanted Behavior Pattern
|
|
53
|
+
**Use for**: Behaviors that must be prevented.
|
|
54
|
+
|
|
55
|
+
**Syntax**:
|
|
56
|
+
```
|
|
57
|
+
THE [system name] SHALL NOT [unwanted behavior]
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
**Example**:
|
|
61
|
+
```markdown
|
|
62
|
+
THE AuthService SHALL NOT store passwords in plain text.
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### 5. Optional Pattern
|
|
66
|
+
**Use for**: Conditional requirements.
|
|
67
|
+
|
|
68
|
+
**Syntax**:
|
|
69
|
+
```
|
|
70
|
+
IF [condition], THEN THE [system name] SHALL [response]
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
**Example**:
|
|
74
|
+
```markdown
|
|
75
|
+
IF two-factor authentication is enabled, THEN THE AuthService SHALL require a verification code.
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Validation Checklist
|
|
79
|
+
|
|
80
|
+
When validating EARS requirements, check:
|
|
81
|
+
|
|
82
|
+
- [ ] **Pattern Compliance**: Does it follow one of the 5 EARS patterns?
|
|
83
|
+
- [ ] **System Name**: Is the system/component clearly identified?
|
|
84
|
+
- [ ] **SHALL Keyword**: Is "SHALL" used for mandatory requirements?
|
|
85
|
+
- [ ] **Measurable**: Is the requirement testable and measurable?
|
|
86
|
+
- [ ] **Atomic**: Does it describe a single requirement?
|
|
87
|
+
- [ ] **No Ambiguity**: Is the language clear and unambiguous?
|
|
88
|
+
|
|
89
|
+
## CLI Commands
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
# Validate EARS syntax
|
|
93
|
+
npx musubix requirements validate <file>
|
|
94
|
+
|
|
95
|
+
# Convert natural language to EARS
|
|
96
|
+
npx musubix requirements analyze <file>
|
|
97
|
+
|
|
98
|
+
# Map to ontology
|
|
99
|
+
npx musubix requirements map <file>
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## Conversion Examples
|
|
103
|
+
|
|
104
|
+
### Natural Language → EARS
|
|
105
|
+
|
|
106
|
+
**Input**: "Users should be able to login"
|
|
107
|
+
|
|
108
|
+
**Output**:
|
|
109
|
+
```markdown
|
|
110
|
+
THE AuthenticationModule SHALL authenticate users with valid credentials.
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
**Input**: "Show error when password is wrong"
|
|
114
|
+
|
|
115
|
+
**Output**:
|
|
116
|
+
```markdown
|
|
117
|
+
WHEN invalid credentials are provided, THE AuthenticationModule SHALL display an error message.
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
**Input**: "Don't allow SQL injection"
|
|
121
|
+
|
|
122
|
+
**Output**:
|
|
123
|
+
```markdown
|
|
124
|
+
THE InputValidator SHALL NOT accept input containing SQL injection patterns.
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
## Priority Levels
|
|
128
|
+
|
|
129
|
+
| Priority | Description | Usage |
|
|
130
|
+
|----------|-------------|-------|
|
|
131
|
+
| **P0** | 必須 (Must Have) | Release blocker |
|
|
132
|
+
| **P1** | 重要 (Should Have) | Implement if possible |
|
|
133
|
+
| **P2** | 任意 (Nice to Have) | Time permitting |
|
|
134
|
+
|
|
135
|
+
## Requirement Document Template
|
|
136
|
+
|
|
137
|
+
```markdown
|
|
138
|
+
### REQ-[CATEGORY]-[NUMBER]: [Title]
|
|
139
|
+
|
|
140
|
+
**種別**: [UBIQUITOUS|EVENT-DRIVEN|STATE-DRIVEN|UNWANTED|OPTIONAL]
|
|
141
|
+
**優先度**: [P0|P1|P2]
|
|
142
|
+
|
|
143
|
+
**要件**:
|
|
144
|
+
[EARS形式の要件文]
|
|
145
|
+
|
|
146
|
+
**検証方法**: [Unit Test|Integration Test|E2E Test|Manual]
|
|
147
|
+
**受入基準**:
|
|
148
|
+
- [ ] Criterion 1
|
|
149
|
+
- [ ] Criterion 2
|
|
150
|
+
|
|
151
|
+
**トレーサビリティ**: DES-XXX, TEST-XXX
|
|
152
|
+
**憲法準拠**: Article IV (EARS Format)
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
## Common Mistakes to Avoid
|
|
156
|
+
|
|
157
|
+
1. ❌ Using "should" instead of "SHALL"
|
|
158
|
+
2. ❌ Combining multiple requirements in one statement
|
|
159
|
+
3. ❌ Vague or unmeasurable criteria
|
|
160
|
+
4. ❌ Missing system name
|
|
161
|
+
5. ❌ Using implementation details in requirements
|