| name | musubix-code-generation |
| description | 設計仕様からコード生成ガイド。実装・機能作成に使用。 |
| license | MIT |
Code Generation Skill
設計ドキュメントからコードを生成し、トレーサビリティを維持。
Supported Languages
| 言語 | 拡張子 | サポート機能 |
|---|
| TypeScript | .ts | フル型サポート |
| JavaScript | .js | ES6+ modules |
| Python | .py | 型ヒント |
| Java/Go/Rust/C# | 各種 | Interface/Struct生成 |
WHEN → DO
| WHEN | DO |
|---|
| コード生成前 | DES-*とREQ-*の存在確認 |
| 実装開始 | テスト先行(Article III) |
| コード作成 | @see タグでトレーサビリティ追加 |
Traceability Comment
export class UserService { ... }
Design Pattern Templates
| パターン | 用途 |
|---|
| Singleton | グローバルインスタンス管理 |
| Factory | 型に応じたオブジェクト生成 |
| Repository | データアクセス抽象化 |
Repository Pattern
export interface Repository<T> {
findById(id: string): Promise<T | null>;
save(entity: T): Promise<T>;
delete(id: string): Promise<void>;
}
CLI
npx musubix codegen generate <design-file>
npx musubix codegen generate <file> --full-skeleton
npx musubix codegen generate <file> --with-tests
npx musubix codegen status <spec>
npx musubix codegen status <spec> --enum
npx musubix codegen analyze <file>
npx musubix codegen security <path>
Quality Checks (Article IX)
出力例
┌─────────────────────────────────────────┐
│ Code Generated │
├─────────────────────────────────────────┤
│ Source: DES-AUTH-001 │
│ Files: 4 generated │
│ Patterns: Repository, Service │
│ Coverage: @see tags added │
│ Tests: test stubs generated │
└─────────────────────────────────────────┘