spec-runner 1.1.6 → 1.1.8
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/README.md +51 -80
- package/bin/spec-runner-installer.js +401 -0
- package/install.sh +1 -1
- package/package.json +7 -6
- package/spec-runner/templates/.claude/agents/code-reviewer.md +69 -0
- package/spec-runner/templates/.claude/agents/design-reviewer.md +65 -0
- package/spec-runner/templates/.claude/agents/test-runner.md +34 -0
- package/spec-runner/templates/.claude/rules/coding.md +106 -0
- package/spec-runner/templates/.claude/rules/design-docs.md +63 -0
- package/spec-runner/templates/.claude/skills/architecture-definition/SKILL.md +60 -0
- package/spec-runner/templates/.claude/skills/architecture-skill-development/SKILL.md +126 -0
- package/spec-runner/templates/.claude/skills/commit/SKILL.md +83 -0
- package/spec-runner/templates/.claude/skills/design-change/SKILL.md +94 -0
- package/spec-runner/templates/.claude/skills/design-change/references//345/275/261/351/237/277/347/257/204/345/233/262/343/203/201/343/202/247/343/203/203/343/202/257/343/203/252/343/202/271/343/203/210.md +66 -0
- package/spec-runner/templates/.claude/skills/design-change/templates/90_ADR/ADR/343/203/206/343/203/263/343/203/227/343/203/254/343/203/274/343/203/210.md +81 -0
- package/spec-runner/templates/.claude/skills/existing-project-to-docs/SKILL.md +57 -0
- package/spec-runner/templates/.claude/skills/harness-engineering/SKILL.md +100 -0
- package/spec-runner/templates/.claude/skills/plugin-development/SKILL.md +173 -0
- package/spec-runner/templates/.claude/skills/plugin-development/templates/01_/350/246/201/344/273/266/345/256/232/347/276/251//346/246/202/350/246/201/343/203/206/343/203/263/343/203/227/343/203/254/343/203/274/343/203/210.md +88 -0
- package/spec-runner/templates/.claude/skills/plugin-development/templates/02_/346/246/202/350/246/201/350/250/255/350/250/210/90_ADR/ADR/343/203/206/343/203/263/343/203/227/343/203/254/343/203/274/343/203/210.md +81 -0
- package/spec-runner/templates/.claude/skills/plugin-development/templates/02_/346/246/202/350/246/201/350/250/255/350/250/210//343/202/267/343/202/271/343/203/206/343/203/240/345/205/250/344/275/223/344/277/257/347/236/260/343/203/206/343/203/263/343/203/227/343/203/254/343/203/274/343/203/210.md +80 -0
- package/spec-runner/templates/.claude/skills/plugin-development/templates/02_/346/246/202/350/246/201/350/250/255/350/250/210//343/203/246/343/203/274/343/202/271/343/202/261/343/203/274/343/202/271/344/270/200/350/246/247/343/203/206/343/203/263/343/203/227/343/203/254/343/203/274/343/203/210.md +57 -0
- package/spec-runner/templates/.claude/skills/plugin-development/templates/03_/350/251/263/347/264/260/350/250/255/350/250/210/infrastructure/aws.md +53 -0
- package/spec-runner/templates/.claude/skills/plugin-development/templates/03_/350/251/263/347/264/260/350/250/255/350/250/210/infrastructure/database.md +54 -0
- package/spec-runner/templates/.claude/skills/plugin-development/templates/03_/350/251/263/347/264/260/350/250/255/350/250/210/infrastructure/schema.dbml +25 -0
- package/spec-runner/templates/.claude/skills/plugin-development/templates/03_/350/251/263/347/264/260/350/250/255/350/250/210/infrastructure/sequence//343/202/267/343/203/274/343/202/261/343/203/263/343/202/271/345/233/263/343/203/206/343/203/263/343/203/227/343/203/254/343/203/274/343/203/210.md +28 -0
- package/spec-runner/templates/.claude/skills/plugin-development/templates/03_/350/251/263/347/264/260/350/250/255/350/250/210/src/agents/{agent_name}/agent.md +56 -0
- package/spec-runner/templates/.claude/skills/plugin-development/templates/03_/350/251/263/347/264/260/350/250/255/350/250/210/src/agents/{agent_name}/config.md +47 -0
- package/spec-runner/templates/.claude/skills/plugin-development/templates/03_/350/251/263/347/264/260/350/250/255/350/250/210/src/agents/{agent_name}/domain.md +67 -0
- package/spec-runner/templates/.claude/skills/plugin-development/templates/03_/350/251/263/347/264/260/350/250/255/350/250/210/src/agents/{agent_name}/prompts.md +72 -0
- package/spec-runner/templates/.claude/skills/plugin-development/templates/03_/350/251/263/347/264/260/350/250/255/350/250/210/src/plugins/skills/{skill_name}/skill.md +53 -0
- package/spec-runner/templates/.claude/skills/plugin-development/templates/03_/350/251/263/347/264/260/350/250/255/350/250/210/src/plugins/tools/{tool_name}/tool.md +51 -0
- package/spec-runner/templates/.claude/skills/test-driven-development/SKILL.md +211 -0
- package/spec-runner/templates/.github/agents/code-reviewer.agent.md +69 -0
- package/spec-runner/templates/.github/agents/design-reviewer.agent.md +65 -0
- package/spec-runner/templates/.github/agents/test-runner.agent.md +34 -0
- package/spec-runner/templates/.github/instructions/coding.instructions.md +105 -0
- package/spec-runner/templates/.github/instructions/design-docs.instructions.md +62 -0
- package/spec-runner/templates/.github/skills/architecture-definition/SKILL.md +60 -0
- package/spec-runner/templates/.github/skills/architecture-skill-development/SKILL.md +126 -0
- package/spec-runner/templates/.github/skills/commit/SKILL.md +83 -0
- package/spec-runner/templates/.github/skills/design-change/SKILL.md +94 -0
- package/spec-runner/templates/.github/skills/design-change/references//345/275/261/351/237/277/347/257/204/345/233/262/343/203/201/343/202/247/343/203/203/343/202/257/343/203/252/343/202/271/343/203/210.md +66 -0
- package/spec-runner/templates/.github/skills/design-change/templates/90_ADR/ADR/343/203/206/343/203/263/343/203/227/343/203/254/343/203/274/343/203/210.md +81 -0
- package/spec-runner/templates/.github/skills/existing-project-to-docs/SKILL.md +57 -0
- package/spec-runner/templates/.github/skills/harness-engineering/SKILL.md +100 -0
- package/spec-runner/templates/.github/skills/plugin-development/SKILL.md +173 -0
- package/spec-runner/templates/.github/skills/plugin-development/templates/01_/350/246/201/344/273/266/345/256/232/347/276/251//346/246/202/350/246/201/343/203/206/343/203/263/343/203/227/343/203/254/343/203/274/343/203/210.md +88 -0
- package/spec-runner/templates/.github/skills/plugin-development/templates/02_/346/246/202/350/246/201/350/250/255/350/250/210/90_ADR/ADR/343/203/206/343/203/263/343/203/227/343/203/254/343/203/274/343/203/210.md +81 -0
- package/spec-runner/templates/.github/skills/plugin-development/templates/02_/346/246/202/350/246/201/350/250/255/350/250/210//343/202/267/343/202/271/343/203/206/343/203/240/345/205/250/344/275/223/344/277/257/347/236/260/343/203/206/343/203/263/343/203/227/343/203/254/343/203/274/343/203/210.md +80 -0
- package/spec-runner/templates/.github/skills/plugin-development/templates/02_/346/246/202/350/246/201/350/250/255/350/250/210//343/203/246/343/203/274/343/202/271/343/202/261/343/203/274/343/202/271/344/270/200/350/246/247/343/203/206/343/203/263/343/203/227/343/203/254/343/203/274/343/203/210.md +57 -0
- package/spec-runner/templates/.github/skills/plugin-development/templates/03_/350/251/263/347/264/260/350/250/255/350/250/210/infrastructure/aws.md +53 -0
- package/spec-runner/templates/.github/skills/plugin-development/templates/03_/350/251/263/347/264/260/350/250/255/350/250/210/infrastructure/database.md +54 -0
- package/spec-runner/templates/.github/skills/plugin-development/templates/03_/350/251/263/347/264/260/350/250/255/350/250/210/infrastructure/schema.dbml +25 -0
- package/spec-runner/templates/.github/skills/plugin-development/templates/03_/350/251/263/347/264/260/350/250/255/350/250/210/infrastructure/sequence//343/202/267/343/203/274/343/202/261/343/203/263/343/202/271/345/233/263/343/203/206/343/203/263/343/203/227/343/203/254/343/203/274/343/203/210.md +28 -0
- package/spec-runner/templates/.github/skills/plugin-development/templates/03_/350/251/263/347/264/260/350/250/255/350/250/210/src/agents/{agent_name}/agent.md +56 -0
- package/spec-runner/templates/.github/skills/plugin-development/templates/03_/350/251/263/347/264/260/350/250/255/350/250/210/src/agents/{agent_name}/config.md +47 -0
- package/spec-runner/templates/.github/skills/plugin-development/templates/03_/350/251/263/347/264/260/350/250/255/350/250/210/src/agents/{agent_name}/domain.md +67 -0
- package/spec-runner/templates/.github/skills/plugin-development/templates/03_/350/251/263/347/264/260/350/250/255/350/250/210/src/agents/{agent_name}/prompts.md +72 -0
- package/spec-runner/templates/.github/skills/plugin-development/templates/03_/350/251/263/347/264/260/350/250/255/350/250/210/src/plugins/skills/{skill_name}/skill.md +53 -0
- package/spec-runner/templates/.github/skills/plugin-development/templates/03_/350/251/263/347/264/260/350/250/255/350/250/210/src/plugins/tools/{tool_name}/tool.md +51 -0
- package/spec-runner/templates/.github/skills/test-driven-development/SKILL.md +211 -0
- package/bin/spec-runner.js +0 -270
- package/docs/flow.md +0 -72
- package/templates/.spec-runner/project.json.example +0 -27
- package/templates/.spec-runner/scripts/check.sh +0 -390
- package/templates/.spec-runner/scripts/spec-runner-core.sh +0 -287
- package/templates/.spec-runner/scripts/uc-next-start.sh +0 -161
- package/templates/.spec-runner/spec-runner.sh +0 -29
- package/templates/.spec-runner/steps/steps.json +0 -96
- package/templates/.spec-runner/steps//343/203/206/343/202/271/343/203/210/350/250/255/350/250/210.md +0 -58
- package/templates/.spec-runner/steps//343/203/211/343/203/241/343/202/244/343/203/263/350/250/255/350/250/210.md +0 -52
- package/templates/.spec-runner/steps//344/273/225/346/247/230/347/255/226/345/256/232.md +0 -210
- package/templates/.spec-runner/steps//345/210/206/346/236/220.md +0 -106
- package/templates/.spec-runner/steps//345/256/237/350/243/205.md +0 -80
- package/templates/.spec-runner/steps//345/256/237/350/243/205/350/250/210/347/224/273.md +0 -96
- package/templates/.spec-runner/steps//346/206/262/347/253/240.md +0 -95
- package/templates/.spec-runner/steps//346/233/226/346/230/247/343/201/225/350/247/243/346/266/210.md +0 -110
- package/templates/.spec-runner/templates/UC-N-MMDD-/345/210/244/346/226/255/350/250/230/351/214/262/343/203/206/343/203/263/343/203/227/343/203/254.md +0 -33
- package/templates/.spec-runner/templates/UC-N-/343/203/246/343/203/274/343/202/271/343/202/261/343/203/274/343/202/271/345/220/215.md +0 -26
- package/templates/.spec-runner/templates/phase-locks.json +0 -49
- package/templates/.spec-runner/templates//343/203/211/343/203/241/343/202/244/343/203/263/343/203/242/343/203/207/343/203/253.md +0 -21
- package/templates/.spec-runner/templates//343/203/246/343/203/223/343/202/255/343/202/277/343/202/271/350/250/200/350/252/236/350/276/236/346/233/270.md +0 -16
- package/templates/.spec-runner/templates//346/206/262/347/253/240.md +0 -51
- package/templates/.spec-runner/templates//351/233/206/347/264/204.md +0 -46
- package/templates/mkdocs-scaffold/docs/index.md +0 -32
- package/templates/mkdocs-scaffold/mkdocs.yml +0 -16
- package/templates/mkdocs-scaffold/requirements-docs.txt +0 -2
- package/templates/skills/uc-k1-work-card-init/SKILL.md +0 -76
- package/templates/skills/uc-k2-pre-commit-check/SKILL.md +0 -57
- package/templates/skills/uc-k3-spec-impl-diff-review/SKILL.md +0 -57
- package/templates/spec-runner-command.md +0 -47
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
---
|
|
2
|
+
spec_runner:
|
|
3
|
+
node_id: detail.src.agents.{agent_name}.config
|
|
4
|
+
kind: detailed_design
|
|
5
|
+
depends_on:
|
|
6
|
+
- overview.system_context
|
|
7
|
+
- detail.src.agents.{agent_name}.agent
|
|
8
|
+
maps_to:
|
|
9
|
+
- src/agents/{agent_name}/config.py
|
|
10
|
+
- tests/agents/{agent_name}/test_config.py
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# `src/agents/{agent_name}/config.py` 詳細設計
|
|
14
|
+
|
|
15
|
+
## LLM設定
|
|
16
|
+
|
|
17
|
+
| 項目 | 値 | 理由 |
|
|
18
|
+
|------|----|------|
|
|
19
|
+
| モデル | {モデル名} | {選定理由} |
|
|
20
|
+
| temperature | {値} | {理由} |
|
|
21
|
+
| max_tokens | {値} | {理由} |
|
|
22
|
+
|
|
23
|
+
## エージェント固有設定
|
|
24
|
+
|
|
25
|
+
| 設定項目 | 値 | 説明 |
|
|
26
|
+
|---------|----|------|
|
|
27
|
+
| **{設定名}** | {デフォルト値} | {説明} |
|
|
28
|
+
|
|
29
|
+
## タイムアウト / リトライ
|
|
30
|
+
|
|
31
|
+
| 処理 | 設定 | 理由 |
|
|
32
|
+
|------|------|------|
|
|
33
|
+
| LLM呼び出し | {秒または回数} | {理由} |
|
|
34
|
+
| 外部 API | {秒または回数} | {理由} |
|
|
35
|
+
|
|
36
|
+
## 環境別設定
|
|
37
|
+
|
|
38
|
+
| 環境 | 差分 |
|
|
39
|
+
|------|------|
|
|
40
|
+
| 開発 | {差分} |
|
|
41
|
+
| 本番 | {差分} |
|
|
42
|
+
|
|
43
|
+
## テスト観点
|
|
44
|
+
|
|
45
|
+
- 設定値の既定値
|
|
46
|
+
- 不正値の拒否
|
|
47
|
+
- 環境差分の取り扱い
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
---
|
|
2
|
+
spec_runner:
|
|
3
|
+
node_id: detail.src.agents.{agent_name}.domain
|
|
4
|
+
kind: detailed_design
|
|
5
|
+
depends_on:
|
|
6
|
+
- overview.system_context
|
|
7
|
+
- use_case.{use_case_slug}
|
|
8
|
+
maps_to:
|
|
9
|
+
- src/agents/{agent_name}/domain.py
|
|
10
|
+
- tests/agents/{agent_name}/test_domain.py
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# `src/agents/{agent_name}/domain.py` 詳細設計
|
|
14
|
+
|
|
15
|
+
## 概要
|
|
16
|
+
|
|
17
|
+
このエージェントが扱うビジネスロジックとデータモデルを定義する。
|
|
18
|
+
|
|
19
|
+
## エンティティ
|
|
20
|
+
|
|
21
|
+
### {日本語名}(`{ClassName}`)
|
|
22
|
+
|
|
23
|
+
{責務の説明}
|
|
24
|
+
|
|
25
|
+
| フィールド | 型 | 説明 |
|
|
26
|
+
|----------|----|------|
|
|
27
|
+
| {フィールド名} | {型} | {説明} |
|
|
28
|
+
|
|
29
|
+
**不変条件**
|
|
30
|
+
|
|
31
|
+
- {条件1}
|
|
32
|
+
- {条件2}
|
|
33
|
+
|
|
34
|
+
## 値オブジェクト
|
|
35
|
+
|
|
36
|
+
### {日本語名}(`{ClassName}`)
|
|
37
|
+
|
|
38
|
+
{責務の説明}
|
|
39
|
+
|
|
40
|
+
| フィールド | 型 | 説明 |
|
|
41
|
+
|----------|----|------|
|
|
42
|
+
| {フィールド名} | {型} | {説明} |
|
|
43
|
+
|
|
44
|
+
**バリデーション**
|
|
45
|
+
|
|
46
|
+
- {ルール1}
|
|
47
|
+
|
|
48
|
+
## ビジネスロジック
|
|
49
|
+
|
|
50
|
+
### {ロジック名}
|
|
51
|
+
|
|
52
|
+
1. {ステップ1}
|
|
53
|
+
2. {ステップ2}
|
|
54
|
+
3. {ステップ3}
|
|
55
|
+
|
|
56
|
+
## ビジネスルール
|
|
57
|
+
|
|
58
|
+
| 条件 | アクション |
|
|
59
|
+
|------|----------|
|
|
60
|
+
| {条件} | {アクション} |
|
|
61
|
+
|
|
62
|
+
## データ変換 / 境界
|
|
63
|
+
|
|
64
|
+
| 変換方向 | 入力 | 出力 | 概要 |
|
|
65
|
+
|---------|------|------|------|
|
|
66
|
+
| {外部} → 内部 | {外部形式} | {ドメインモデル} | {変換内容} |
|
|
67
|
+
| 内部 → {外部} | {ドメインモデル} | {外部形式} | {変換内容} |
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
---
|
|
2
|
+
spec_runner:
|
|
3
|
+
node_id: detail.src.agents.{agent_name}.prompts
|
|
4
|
+
kind: detailed_design
|
|
5
|
+
depends_on:
|
|
6
|
+
- overview.system_context
|
|
7
|
+
- detail.src.agents.{agent_name}.agent
|
|
8
|
+
maps_to:
|
|
9
|
+
- src/agents/{agent_name}/prompts.py
|
|
10
|
+
- tests/agents/{agent_name}/test_prompts.py
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# `src/agents/{agent_name}/prompts.py` 詳細設計
|
|
14
|
+
|
|
15
|
+
## システムプロンプト
|
|
16
|
+
|
|
17
|
+
### 役割定義
|
|
18
|
+
|
|
19
|
+
```text
|
|
20
|
+
あなたは{役割}です。
|
|
21
|
+
|
|
22
|
+
【責務】
|
|
23
|
+
- {責務1}
|
|
24
|
+
- {責務2}
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### 出力形式
|
|
28
|
+
|
|
29
|
+
```text
|
|
30
|
+
{出力形式の例}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## タスク別プロンプト
|
|
34
|
+
|
|
35
|
+
### タスク: {タスク名}
|
|
36
|
+
|
|
37
|
+
**用途**: {タスクの説明}
|
|
38
|
+
|
|
39
|
+
```text
|
|
40
|
+
{タスク固有の指示}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Few-shot 例
|
|
44
|
+
|
|
45
|
+
### 例1
|
|
46
|
+
|
|
47
|
+
入力:
|
|
48
|
+
|
|
49
|
+
```text
|
|
50
|
+
{入力例1}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
出力:
|
|
54
|
+
|
|
55
|
+
```text
|
|
56
|
+
{出力例1}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## ガードレール
|
|
60
|
+
|
|
61
|
+
| 項目 | 内容 |
|
|
62
|
+
|------|------|
|
|
63
|
+
| 禁止事項 | {禁止事項} |
|
|
64
|
+
| 失敗時の扱い | {扱い} |
|
|
65
|
+
| 再試行条件 | {条件} |
|
|
66
|
+
|
|
67
|
+
## プロンプト戦略
|
|
68
|
+
|
|
69
|
+
| 戦略 | 適用箇所 | 理由 |
|
|
70
|
+
|------|---------|------|
|
|
71
|
+
| 出力形式固定 | {適用箇所} | {理由} |
|
|
72
|
+
| Few-shot | {適用箇所} | {理由} |
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
---
|
|
2
|
+
spec_runner:
|
|
3
|
+
node_id: detail.src.plugins.skills.{skill_name}.skill
|
|
4
|
+
kind: detailed_design
|
|
5
|
+
depends_on:
|
|
6
|
+
- overview.system_context
|
|
7
|
+
maps_to:
|
|
8
|
+
- src/plugins/skills/{skill_name}/skill.py
|
|
9
|
+
- tests/plugins/skills/{skill_name}/test_skill.py
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# `src/plugins/skills/{skill_name}/skill.py` 詳細設計
|
|
13
|
+
|
|
14
|
+
## 概要
|
|
15
|
+
|
|
16
|
+
| 項目 | 内容 |
|
|
17
|
+
|------|------|
|
|
18
|
+
| スキル名 | {スキル名} |
|
|
19
|
+
| 責務 | {スキルが果たす役割} |
|
|
20
|
+
| 使用するエージェント | {エージェント名} |
|
|
21
|
+
| トリガー | {呼び出しタイミング} |
|
|
22
|
+
|
|
23
|
+
## 入出力
|
|
24
|
+
|
|
25
|
+
| 種別 | 名前 | 型 | 説明 |
|
|
26
|
+
|------|------|----|------|
|
|
27
|
+
| 入力 | {入力名} | {型} | {説明} |
|
|
28
|
+
| 出力 | {出力名} | {型} | {説明} |
|
|
29
|
+
|
|
30
|
+
## 判定ロジック
|
|
31
|
+
|
|
32
|
+
| 観点 | 確認内容 | 重要度 |
|
|
33
|
+
|------|---------|--------|
|
|
34
|
+
| **{観点名}** | {確認内容} | {高/中/低} |
|
|
35
|
+
|
|
36
|
+
## プロンプト
|
|
37
|
+
|
|
38
|
+
```text
|
|
39
|
+
あなたは{専門家の役割}です。
|
|
40
|
+
{タスクの説明}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## エラーケース
|
|
44
|
+
|
|
45
|
+
| エラーケース | 発生条件 | 対応方法 |
|
|
46
|
+
|------------|---------|---------|
|
|
47
|
+
| **{エラーケース}** | {発生条件} | {対応方法} |
|
|
48
|
+
|
|
49
|
+
## テスト観点
|
|
50
|
+
|
|
51
|
+
- 判定ロジックの正常系
|
|
52
|
+
- 閾値・境界条件
|
|
53
|
+
- 入力不足・異常値
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
---
|
|
2
|
+
spec_runner:
|
|
3
|
+
node_id: detail.src.plugins.tools.{tool_name}.tool
|
|
4
|
+
kind: detailed_design
|
|
5
|
+
depends_on:
|
|
6
|
+
- overview.system_context
|
|
7
|
+
maps_to:
|
|
8
|
+
- src/plugins/tools/{tool_name}/tool.py
|
|
9
|
+
- tests/plugins/tools/{tool_name}/test_tool.py
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# `src/plugins/tools/{tool_name}/tool.py` 詳細設計
|
|
13
|
+
|
|
14
|
+
## 概要
|
|
15
|
+
|
|
16
|
+
| 項目 | 内容 |
|
|
17
|
+
|------|------|
|
|
18
|
+
| ツール名 | {ツール名} |
|
|
19
|
+
| 責務 | {ツールが果たす役割} |
|
|
20
|
+
| 使用するエージェント | {エージェント名} |
|
|
21
|
+
| カテゴリ | {計算/検索/変換/その他} |
|
|
22
|
+
|
|
23
|
+
## 入力
|
|
24
|
+
|
|
25
|
+
| パラメータ名 | 型 | 必須 | 説明 | 制約 |
|
|
26
|
+
|------------|----|------|------|------|
|
|
27
|
+
| **{パラメータ名}** | {型} | {○/×} | {説明} | {制約条件} |
|
|
28
|
+
|
|
29
|
+
## 出力
|
|
30
|
+
|
|
31
|
+
| フィールド名 | 型 | 説明 |
|
|
32
|
+
|------------|----|------|
|
|
33
|
+
| **{フィールド名}** | {型} | {説明} |
|
|
34
|
+
|
|
35
|
+
## 処理内容
|
|
36
|
+
|
|
37
|
+
1. {処理ステップ1}
|
|
38
|
+
2. {処理ステップ2}
|
|
39
|
+
3. {処理ステップ3}
|
|
40
|
+
|
|
41
|
+
## エラーケース
|
|
42
|
+
|
|
43
|
+
| エラーケース | 発生条件 | 対応方法 |
|
|
44
|
+
|------------|---------|---------|
|
|
45
|
+
| **{エラーケース}** | {発生条件} | {対応方法} |
|
|
46
|
+
|
|
47
|
+
## テスト観点
|
|
48
|
+
|
|
49
|
+
- 正常系の入出力
|
|
50
|
+
- エラー時の戻り値または例外
|
|
51
|
+
- 外部依存の失敗時の扱い
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: test-driven-development
|
|
3
|
+
description: 新機能実装やバグ修正を行う際、実装コードを書く前に必ず使用する。
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# テスト駆動開発(TDD)
|
|
7
|
+
|
|
8
|
+
## 概要
|
|
9
|
+
|
|
10
|
+
テストを先に書く。失敗するのを確認する。通る最小のコードを書く。
|
|
11
|
+
|
|
12
|
+
**中核原則:** テストが失敗するのを見ていないなら、そのテストが正しいものを検証しているか分からない。
|
|
13
|
+
|
|
14
|
+
## いつ使うか
|
|
15
|
+
|
|
16
|
+
**常に:** 新機能・バグ修正・リファクタリング・振る舞い変更
|
|
17
|
+
|
|
18
|
+
**例外(ユーザーに確認する):** 使い捨てプロトタイプ・生成コード・設定ファイル
|
|
19
|
+
|
|
20
|
+
## 鉄の掟
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
失敗するテストなしに本番コードを書かない
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
テストより先にコードを書いたなら削除して最初からやり直す。
|
|
27
|
+
「参考として残す」も「テストを書きながら適応させる」も不可。
|
|
28
|
+
|
|
29
|
+
## テスト実行コマンド
|
|
30
|
+
|
|
31
|
+
> このスキルはテンプレートとして配布されます。
|
|
32
|
+
> `architecture-skill-development` を使ってプロジェクト固有のコマンドに書き換えてください。
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
# 全テスト(プロジェクトのテストコマンドに置き換える)
|
|
36
|
+
<your-test-command>
|
|
37
|
+
|
|
38
|
+
# 特定ファイル
|
|
39
|
+
<your-test-command> <test-file>
|
|
40
|
+
|
|
41
|
+
# カバレッジ計測
|
|
42
|
+
<your-test-command> --coverage
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Red-Green-Refactor
|
|
46
|
+
|
|
47
|
+
### RED - 失敗するテストを書く
|
|
48
|
+
|
|
49
|
+
起きてほしいことを示す、最小のテストを1つ書く。
|
|
50
|
+
|
|
51
|
+
```
|
|
52
|
+
// 例(言語・フレームワークはプロジェクトに合わせる)
|
|
53
|
+
test("ある入力に対して期待する出力を返す", () => {
|
|
54
|
+
// 準備 - テスト対象の入力データを用意する
|
|
55
|
+
const input = ...
|
|
56
|
+
|
|
57
|
+
// 実行 - テスト対象の関数を呼び出す
|
|
58
|
+
const result = targetFunction(input)
|
|
59
|
+
|
|
60
|
+
// 判定 - 期待する出力と一致するか確認する
|
|
61
|
+
expect(result).toBe(expectedOutput)
|
|
62
|
+
})
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
**要件:**
|
|
66
|
+
- 1つの振る舞い
|
|
67
|
+
- 明確なテスト名(振る舞いを説明する)
|
|
68
|
+
- 実コード中心(不可避な場合のみモック)
|
|
69
|
+
|
|
70
|
+
### Verify RED - 失敗するのを確認する
|
|
71
|
+
|
|
72
|
+
**必須。絶対に省略しない。**
|
|
73
|
+
|
|
74
|
+
`@test-runner` エージェントに委任して実行する。
|
|
75
|
+
|
|
76
|
+
- テストが**失敗する**(エラーではない)
|
|
77
|
+
- 失敗メッセージが期待通り
|
|
78
|
+
- **機能がないこと**が原因で失敗している(誤字等ではない)
|
|
79
|
+
|
|
80
|
+
テストが通る → 既存挙動をテストしている。テストを修正する。
|
|
81
|
+
テストがエラー → エラーを直して再実行し、「正しく失敗する」まで繰り返す。
|
|
82
|
+
|
|
83
|
+
### GREEN - 通す最小のコードを書く
|
|
84
|
+
|
|
85
|
+
テストを通すための最も単純なコードを書く。
|
|
86
|
+
|
|
87
|
+
テストにない機能を足さない。他の改善やリファクタもここではしない。
|
|
88
|
+
|
|
89
|
+
### Verify GREEN - 通るのを確認する
|
|
90
|
+
|
|
91
|
+
**必須。**
|
|
92
|
+
|
|
93
|
+
`@test-runner` エージェントに委任して実行する。
|
|
94
|
+
|
|
95
|
+
- テストが通る
|
|
96
|
+
- **他のテストも全て通る**
|
|
97
|
+
- 出力がクリーン(エラー、警告なし)
|
|
98
|
+
- **カバレッジの未カバー行を確認** — 新規コードが未カバーなら追加テストを書く
|
|
99
|
+
|
|
100
|
+
テストが落ちる → テストではなくコードを直す。
|
|
101
|
+
他のテストが落ちる → 直ちに修正する。
|
|
102
|
+
|
|
103
|
+
### REFACTOR - 整理する
|
|
104
|
+
|
|
105
|
+
Greenの後にのみ: 重複削除・命名改善・ヘルパ抽出。
|
|
106
|
+
テストは常にGreenを維持する。新しい挙動は追加しない。
|
|
107
|
+
|
|
108
|
+
### 繰り返す
|
|
109
|
+
|
|
110
|
+
次の機能のために、次の失敗するテストを書く。
|
|
111
|
+
|
|
112
|
+
## よいテスト
|
|
113
|
+
|
|
114
|
+
- **最小**: 1つの振る舞いだけ。「and」が入るなら分割する
|
|
115
|
+
- **明確**: テスト名が挙動を説明する
|
|
116
|
+
- **意図が見える**: 望ましいAPIの使い方が伝わる
|
|
117
|
+
|
|
118
|
+
## テストのコメント
|
|
119
|
+
|
|
120
|
+
テストコメントの規約は同梱のコーディング規約ファイルの「テストコメント規約」に従う。
|
|
121
|
+
GREEN / REFACTORフェーズで書く実装コードにもビジネスロジックの意図をコメントする。
|
|
122
|
+
|
|
123
|
+
## テスト構成
|
|
124
|
+
|
|
125
|
+
テストファイルは `src/` と同じディレクトリ構造を `tests/` に鏡写しにする。
|
|
126
|
+
|
|
127
|
+
## fixture / テストデータの活用
|
|
128
|
+
|
|
129
|
+
- テストごとに独立した状態を持つ
|
|
130
|
+
- テストデータ生成にはヘルパ関数を定義して一貫性を保つ
|
|
131
|
+
- 外部サービス(API・メール・ストレージ等)は必要な場合のみモックする
|
|
132
|
+
|
|
133
|
+
## モックのルール
|
|
134
|
+
|
|
135
|
+
モックは分離の手段であり、テスト対象ではない。
|
|
136
|
+
|
|
137
|
+
**モック前の自問:**
|
|
138
|
+
1. 「実メソッドにはどんな副作用があるか?」
|
|
139
|
+
2. 「このテストはその副作用に依存しているか?」
|
|
140
|
+
3. 依存しているなら → より低いレベル(実際に遅い/外部な操作)をモックする
|
|
141
|
+
|
|
142
|
+
**原則:**
|
|
143
|
+
- 実コンポーネントの**出力**をテストする。モックの呼び出し確認だけにアサートしない
|
|
144
|
+
- 本番クラスにテスト専用メソッドを追加しない → fixtureやテストユーティリティに置く
|
|
145
|
+
- テストデータはドメインモデルの全フィールドを含める
|
|
146
|
+
|
|
147
|
+
**赤信号(モックをやめて設計を見直す):**
|
|
148
|
+
- モック準備がテスト本体より長い
|
|
149
|
+
- モックを外すとテストが成立しない
|
|
150
|
+
- なぜモックが必要か説明できない
|
|
151
|
+
|
|
152
|
+
## なぜ順序が重要か
|
|
153
|
+
|
|
154
|
+
実装後のテストはすぐ通る。すぐ通ることは何も証明しない:
|
|
155
|
+
- 間違ったものをテストしているかもしれない
|
|
156
|
+
- 実装に引きずられて挙動ではなく実装をテストしがち
|
|
157
|
+
- バグを捕まえる力を見ていない
|
|
158
|
+
|
|
159
|
+
テストファーストは、テストが本当に何かを検証していることを「失敗」で証明する。
|
|
160
|
+
|
|
161
|
+
## よくある合理化と赤信号
|
|
162
|
+
|
|
163
|
+
| 兆候 | 問題 |
|
|
164
|
+
|------|------|
|
|
165
|
+
| 「簡単すぎてテスト不要」 | 簡単でも壊れる。テストは30秒 |
|
|
166
|
+
| 「あとでテストする」 | すぐ通るテストは何も証明しない |
|
|
167
|
+
| 「今回だけTDDを飛ばす」 | 合理化である。止めること |
|
|
168
|
+
| テスト前にコードを書いた | コードを削除し、TDDで最初からやり直す |
|
|
169
|
+
| テストが最初から通る | 既存挙動をテストしている。テストを修正する |
|
|
170
|
+
| なぜ失敗したか説明できない | テストが正しいか再検討する |
|
|
171
|
+
|
|
172
|
+
**どれか1つでも当てはまるなら: コードを削除し、TDDで最初からやり直す。**
|
|
173
|
+
|
|
174
|
+
## 完了時のレビュー
|
|
175
|
+
|
|
176
|
+
実装完了後、以下のエージェントでレビューする:
|
|
177
|
+
- `@code-reviewer` — コーディング規約への適合チェック
|
|
178
|
+
|
|
179
|
+
## 検証チェックリスト
|
|
180
|
+
|
|
181
|
+
完了宣言の前に:
|
|
182
|
+
|
|
183
|
+
- [ ] 新規関数/メソッドにテストがある
|
|
184
|
+
- [ ] 各テストは実装前に失敗するのを見た
|
|
185
|
+
- [ ] 期待通りの理由で失敗した(機能不足であり誤字ではない)
|
|
186
|
+
- [ ] 通す最小コードを書いた
|
|
187
|
+
- [ ] 全テストが通る
|
|
188
|
+
- [ ] 出力がクリーン(エラー、警告なし)
|
|
189
|
+
- [ ] カバレッジを確認し、新規コードの未カバー行がない
|
|
190
|
+
- [ ] 実コード中心(不可避な場合のみモック)
|
|
191
|
+
- [ ] エッジケースとエラーをカバーした
|
|
192
|
+
|
|
193
|
+
すべてにチェックできないならTDDを飛ばしている。やり直すこと。
|
|
194
|
+
|
|
195
|
+
## 詰まったとき
|
|
196
|
+
|
|
197
|
+
| 問題 | 解決 |
|
|
198
|
+
|------|------|
|
|
199
|
+
| どうテストすべきか分からない | 望むAPIを書き、まずアサーションを書く。ユーザーに相談する |
|
|
200
|
+
| テストが複雑すぎる | 設計が複雑すぎる。インターフェースを簡素化する |
|
|
201
|
+
| 何でもモック必須 | 結合が強すぎる。依存性注入を使う |
|
|
202
|
+
| セットアップが巨大 | fixtureやテストユーティリティに抽出する。それでも大きいなら設計を簡素化する |
|
|
203
|
+
|
|
204
|
+
## 最終ルール
|
|
205
|
+
|
|
206
|
+
```
|
|
207
|
+
本番コード → 先にテストが存在し、失敗している
|
|
208
|
+
それ以外 → TDDではない
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
ユーザーの許可なしに例外はない。
|