musubix 1.1.5 → 1.1.7
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/AGENTS.md +88 -3
- package/package.json +1 -1
package/AGENTS.md
CHANGED
|
@@ -276,7 +276,92 @@ npx musubix codegen generate <design.md> --output src/
|
|
|
276
276
|
|
|
277
277
|
---
|
|
278
278
|
|
|
279
|
-
##
|
|
279
|
+
## � 学習済みベストプラクティス(v1.1.7 NEW!)
|
|
280
|
+
|
|
281
|
+
Project-07 Medical Clinic、Project-08 Property Rentalの実装から学習したパターンです。
|
|
282
|
+
|
|
283
|
+
### コードパターン
|
|
284
|
+
|
|
285
|
+
| ID | 名称 | 概要 | 信頼度 |
|
|
286
|
+
|----|------|------|--------|
|
|
287
|
+
| BP-CODE-001 | Entity Input DTO | エンティティ作成にInput DTOオブジェクトを使用 | 95% |
|
|
288
|
+
| BP-CODE-002 | Date-based ID Format | PREFIX-YYYYMMDD-NNN形式でIDを生成 | 90% |
|
|
289
|
+
| BP-CODE-003 | Value Objects | ドメイン概念にValue Objectを使用 | 90% |
|
|
290
|
+
|
|
291
|
+
**Entity Input DTO例**:
|
|
292
|
+
```typescript
|
|
293
|
+
// ✅ 推奨: Input DTOを使用
|
|
294
|
+
interface CreatePatientInput {
|
|
295
|
+
name: PersonName;
|
|
296
|
+
dateOfBirth: Date;
|
|
297
|
+
contact: ContactInfo;
|
|
298
|
+
}
|
|
299
|
+
function createPatient(input: CreatePatientInput): Patient { ... }
|
|
300
|
+
|
|
301
|
+
// ❌ 非推奨: 複数パラメータ
|
|
302
|
+
function createPatient(name: PersonName, dob: Date, contact: ContactInfo): Patient
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
### 設計パターン
|
|
306
|
+
|
|
307
|
+
| ID | 名称 | 概要 | 信頼度 |
|
|
308
|
+
|----|------|------|--------|
|
|
309
|
+
| BP-DESIGN-001 | Status Transition Map | 有効なステータス遷移をMapで定義 | 95% |
|
|
310
|
+
| BP-DESIGN-002 | Repository Async Pattern | 将来のDB移行に備えてasync化 | 85% |
|
|
311
|
+
| BP-DESIGN-003 | Service Layer with DI | リポジトリをDIしたService層 | 90% |
|
|
312
|
+
|
|
313
|
+
**Status Transition Map例**:
|
|
314
|
+
```typescript
|
|
315
|
+
const validStatusTransitions: Record<Status, Status[]> = {
|
|
316
|
+
draft: ['active'],
|
|
317
|
+
active: ['renewed', 'terminated', 'expired'],
|
|
318
|
+
renewed: [],
|
|
319
|
+
terminated: [],
|
|
320
|
+
expired: ['renewed'],
|
|
321
|
+
};
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
### テストパターン
|
|
325
|
+
|
|
326
|
+
| ID | 名称 | 概要 | 信頼度 |
|
|
327
|
+
|----|------|------|--------|
|
|
328
|
+
| BP-TEST-001 | Test Counter Reset | beforeEachでIDカウンターをリセット | 95% |
|
|
329
|
+
| BP-TEST-002 | Verify API Before Test | テスト前にAPIシグネチャを確認 | 80% |
|
|
330
|
+
| BP-TEST-003 | Vitest ESM Configuration | Vitest + TypeScript ESM構成 | 85% |
|
|
331
|
+
|
|
332
|
+
**Test Counter Reset例**:
|
|
333
|
+
```typescript
|
|
334
|
+
// Entity側でresetXxxCounter()を提供
|
|
335
|
+
export function resetPatientCounter(): void { patientCounter = 0; }
|
|
336
|
+
|
|
337
|
+
// テスト側でbeforeEachでリセット
|
|
338
|
+
beforeEach(() => {
|
|
339
|
+
resetPatientCounter();
|
|
340
|
+
resetAppointmentCounter();
|
|
341
|
+
});
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
### CLIでベストプラクティスを表示
|
|
345
|
+
|
|
346
|
+
```bash
|
|
347
|
+
# 全ベストプラクティス表示
|
|
348
|
+
npx musubix learn best-practices
|
|
349
|
+
|
|
350
|
+
# カテゴリ別フィルタ
|
|
351
|
+
npx musubix learn best-practices --category code
|
|
352
|
+
npx musubix learn best-practices --category design
|
|
353
|
+
npx musubix learn best-practices --category test
|
|
354
|
+
|
|
355
|
+
# 高信頼度パターンのみ
|
|
356
|
+
npx musubix learn best-practices --high-confidence
|
|
357
|
+
|
|
358
|
+
# Markdown出力
|
|
359
|
+
npx musubix learn best-practices --format markdown
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
---
|
|
363
|
+
|
|
364
|
+
## �📚 ドキュメント
|
|
280
365
|
|
|
281
366
|
| ドキュメント | 説明 |
|
|
282
367
|
|-------------|------|
|
|
@@ -314,6 +399,6 @@ npx musubix codegen generate <design.md> --output src/
|
|
|
314
399
|
---
|
|
315
400
|
|
|
316
401
|
**Agent**: GitHub Copilot / Claude
|
|
317
|
-
**Last Updated**: 2026-01-
|
|
318
|
-
**Version**: 1.1.
|
|
402
|
+
**Last Updated**: 2026-01-05
|
|
403
|
+
**Version**: 1.1.7
|
|
319
404
|
**Repository**: https://github.com/nahisaho/MUSUBIX
|