From spec-test
Analyzes specifications to extract domain models, class designs, pure functions; generates test-first unit tests and appends structured markdown to existing Plan files.
npx claudepluginhub sean-sunagaku/claude-code-plugin --plugin spec-testThis skill is limited to using the following tools:
仕様書を受け取り、**テストファースト**でクラス設計と単体テストを設計し、**既存のPlanドキュメントに自動追記**するスキル。
Generates implementation design document from specification file by analyzing codebase, defining components, data models, APIs, and mapping to requirements. Phase 2 of Spec Kit workflow.
Applies Acme Corporation brand guidelines including colors, fonts, layouts, and messaging to generated PowerPoint, Excel, and PDF documents.
Guides strict Test-Driven Development (TDD): write failing tests first for features, bugfixes, refactors before any production code. Enforces red-green-refactor cycle.
Share bugs, ideas, or general feedback.
仕様書を受け取り、テストファーストでクラス設計と単体テストを設計し、既存のPlanドキュメントに自動追記するスキル。
このスキルが呼び出されたら、以下を自動で実行する:
引数で渡された仕様書(または直前の会話で提示された仕様)を分析し、以下を抽出:
分析結果をEditツールで既存Planファイルの末尾に追記する。
追記した内容のサマリーを報告。
以下のフォーマットでPlanファイルに追記する:
---
## 仕様駆動設計: <機能名>
### ドメインモデル
#### Entities
| Entity | 識別子 | 主要属性 | 振る舞い |
|--------|--------|---------|---------|
| <名前> | <ID> | <属性> | <メソッド> |
#### Value Objects
| VO | 属性 | 不変条件 |
|----|------|---------|
| <名前> | <属性> | <制約> |
#### Domain Events
| Event | トリガー | ペイロード |
|-------|---------|-----------|
| <名前> | <発火条件> | <データ> |
### クラス設計
#### 1. <ClassName>
**責任:** <単一責任を1文で>
| メソッド | 入力 | 出力 | 副作用 | 純粋? |
|---------|------|------|--------|-------|
| <名前> | <型> | <型> | <内容> | ✅/❌ |
**依存:** <インターフェース名>
### 純粋関数一覧 ⭐
| 関数 | カテゴリ | 入力 | 出力 | 場所 |
|------|---------|------|------|------|
| `<名前>` | <カテゴリ> | <型> | <型> | <ファイルパス> |
### 単体テスト設計 ⭐
#### 純粋関数テスト: `<関数名>`
| ID | カテゴリ | 入力 | 期待結果 | 説明 |
|----|---------|------|---------|------|
| EQ-01 | 同値 | <値> | <結果> | <説明> |
| BV-01 | 境界 | <値> | <結果> | <説明> |
| ERR-01 | エラー | <値> | <結果> | <説明> |
#### クラステスト: `<ClassName>`
| ID | メソッド | シナリオ | 事前条件 | 入力 | 期待結果 | モック |
|----|---------|---------|---------|------|---------|--------|
| C-01 | <メソッド> | <シナリオ> | <状態> | <値> | <結果> | <依存> |
**テスト観点:**
- 状態遷移: 初期状態 → メソッド実行 → 期待状態
- 不変条件: 常に満たすべき制約
- 境界条件: 状態の境界でのふるまい
- 異常系: 例外、エラーハンドリング
### 保守性チェック
#### SOLID原則
- [ ] S: 単一責任 - クラスの変更理由は1つか?
- [ ] O: 開放閉鎖 - 拡張に開き、修正に閉じているか?
- [ ] D: 依存性逆転 - 具象ではなく抽象に依存しているか?
#### テスタビリティ
- [ ] 依存は注入可能か?
- [ ] 副作用は分離されているか?
- [ ] 外部APIはインターフェース経由か?
### テストファースト実装順序
1. [ ] Layer 1: 純粋関数 + test
2. [ ] Layer 2: ドメインサービス + test
3. [ ] Layer 3: インフラ層
| カテゴリ | プレフィックス | シグネチャ |
|---|---|---|
| validation | validate*, isValid* | (input: T) => ValidationResult |
| format | format*, truncate*, strip* | (input: string) => string |
| parse | parse*, extract* | (input: string) => T | null |
| predicate | is*, should*, can*, has* | (input: T) => boolean |
| select | select*, choose*, pick* | (candidates: T[], criteria) => T |
| calculate | calculate*, compute*, count* | (inputs: T) => number |
| build | build*, create*, make* | (parts: P) => T |
scripts/analyze.sh で分析ワークフローやパターンを確認できる:
./scripts/analyze.sh --steps # 分析ステップを表示
./scripts/analyze.sh --patterns # 純粋関数パターンを表示
./scripts/analyze.sh --template # 追記テンプレートを表示
./scripts/analyze.sh --all # すべて表示
/spec-test <plan_file_path> <仕様の説明>
または仕様書を先に提示してから:
/spec-test <plan_file_path>