create-ai-project 1.11.2 → 1.12.0
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/.claude/agents/acceptance-test-generator.md +179 -245
- package/.claude/agents/code-reviewer.md +3 -9
- package/.claude/agents/design-sync.md +221 -0
- package/.claude/agents/document-reviewer.md +15 -10
- package/.claude/agents/integration-test-reviewer.md +192 -0
- package/.claude/agents/prd-creator.md +10 -6
- package/.claude/agents/quality-fixer-frontend.md +324 -0
- package/.claude/agents/quality-fixer.md +48 -62
- package/.claude/agents/requirement-analyzer.md +8 -8
- package/.claude/agents/rule-advisor.md +84 -103
- package/.claude/agents/task-decomposer.md +21 -27
- package/.claude/agents/task-executor-frontend.md +264 -0
- package/.claude/agents/task-executor.md +4 -16
- package/.claude/agents/technical-designer-frontend.md +444 -0
- package/.claude/agents/technical-designer.md +52 -27
- package/.claude/agents/work-planner.md +41 -14
- package/.claude/agents-en/acceptance-test-generator.md +13 -13
- package/.claude/agents-en/code-reviewer.md +8 -10
- package/.claude/agents-en/design-sync.md +6 -5
- package/.claude/agents-en/document-reviewer.md +8 -7
- package/.claude/agents-en/integration-test-reviewer.md +5 -4
- package/.claude/agents-en/prd-creator.md +7 -6
- package/.claude/agents-en/quality-fixer-frontend.md +3 -14
- package/.claude/agents-en/quality-fixer.md +9 -20
- package/.claude/agents-en/requirement-analyzer.md +8 -7
- package/.claude/agents-en/rule-advisor.md +57 -128
- package/.claude/agents-en/task-decomposer.md +4 -10
- package/.claude/agents-en/task-executor-frontend.md +4 -16
- package/.claude/agents-en/task-executor.md +5 -16
- package/.claude/agents-en/technical-designer-frontend.md +17 -15
- package/.claude/agents-en/technical-designer.md +13 -15
- package/.claude/agents-en/work-planner.md +9 -14
- package/.claude/agents-ja/acceptance-test-generator.md +9 -15
- package/.claude/agents-ja/code-reviewer.md +3 -11
- package/.claude/agents-ja/design-sync.md +2 -6
- package/.claude/agents-ja/document-reviewer.md +4 -9
- package/.claude/agents-ja/integration-test-reviewer.md +2 -5
- package/.claude/agents-ja/prd-creator.md +3 -7
- package/.claude/agents-ja/quality-fixer-frontend.md +2 -13
- package/.claude/agents-ja/quality-fixer.md +7 -18
- package/.claude/agents-ja/requirement-analyzer.md +5 -8
- package/.claude/agents-ja/rule-advisor.md +57 -128
- package/.claude/agents-ja/task-decomposer.md +4 -10
- package/.claude/agents-ja/task-executor-frontend.md +3 -15
- package/.claude/agents-ja/task-executor.md +3 -17
- package/.claude/agents-ja/technical-designer-frontend.md +17 -15
- package/.claude/agents-ja/technical-designer.md +13 -15
- package/.claude/agents-ja/work-planner.md +9 -14
- package/.claude/commands/build.md +7 -10
- package/.claude/commands/design.md +15 -5
- package/.claude/commands/front-build.md +103 -0
- package/.claude/commands/front-design.md +42 -0
- package/.claude/commands/front-plan.md +40 -0
- package/.claude/commands/implement.md +23 -29
- package/.claude/commands/plan.md +4 -4
- package/.claude/commands/project-inject.md +4 -4
- package/.claude/{commands-ja/refine-rule.md → commands/refine-skill.md} +25 -25
- package/.claude/{commands-ja/sync-rules.md → commands/sync-skills.md} +28 -28
- package/.claude/commands/task.md +1 -1
- package/.claude/commands-en/build.md +2 -2
- package/.claude/commands-en/design.md +1 -1
- package/.claude/commands-en/implement.md +8 -8
- package/.claude/commands-en/plan.md +3 -3
- package/.claude/commands-en/project-inject.md +4 -4
- package/.claude/commands-en/{refine-rule.md → refine-skill.md} +47 -48
- package/.claude/commands-en/{sync-rules.md → sync-skills.md} +29 -29
- package/.claude/commands-ja/build.md +2 -2
- package/.claude/commands-ja/design.md +1 -1
- package/.claude/commands-ja/implement.md +8 -8
- package/.claude/commands-ja/plan.md +3 -3
- package/.claude/commands-ja/project-inject.md +4 -4
- package/.claude/{commands/refine-rule.md → commands-ja/refine-skill.md} +25 -25
- package/.claude/{commands/sync-rules.md → commands-ja/sync-skills.md} +28 -28
- package/.claude/settings.local.json +21 -1
- package/{docs/rules/ai-development-guide.md → .claude/skills/coding-standards/SKILL.md} +94 -108
- package/{docs/rules/documentation-criteria.md → .claude/skills/documentation-criteria/SKILL.md} +19 -6
- package/.claude/skills/documentation-criteria/references/adr-template.md +64 -0
- package/.claude/skills/documentation-criteria/references/design-template.md +242 -0
- package/.claude/skills/documentation-criteria/references/plan-template.md +130 -0
- package/.claude/skills/documentation-criteria/references/prd-template.md +109 -0
- package/.claude/skills/frontend/technical-spec/SKILL.md +147 -0
- package/.claude/skills/frontend/typescript-rules/SKILL.md +315 -0
- package/.claude/skills/frontend/typescript-testing/SKILL.md +212 -0
- package/{docs/rules-ja/architecture/implementation-approach.md → .claude/skills/implementation-approach/SKILL.md} +10 -5
- package/.claude/skills/integration-e2e-testing/SKILL.md +146 -0
- package/{docs/rules-ja/project-context.md → .claude/skills/project-context/SKILL.md} +7 -3
- package/.claude/skills/subagents-orchestration-guide/SKILL.md +212 -0
- package/.claude/skills/task-analyzer/SKILL.md +142 -0
- package/.claude/skills/task-analyzer/references/skills-index.yaml +211 -0
- package/.claude/skills/technical-spec/SKILL.md +86 -0
- package/{docs/rules/typescript.md → .claude/skills/typescript-rules/SKILL.md} +22 -67
- package/.claude/skills/typescript-testing/SKILL.md +155 -0
- package/{docs/rules-en/coding-standards.md → .claude/skills-en/coding-standards/SKILL.md} +21 -108
- package/{docs/rules-en/documentation-criteria.md → .claude/skills-en/documentation-criteria/SKILL.md} +40 -42
- package/{docs/adr/template-en.md → .claude/skills-en/documentation-criteria/references/adr-template.md} +1 -1
- package/{docs/design/template-en.md → .claude/skills-en/documentation-criteria/references/design-template.md} +11 -31
- package/{docs/plans/template-en.md → .claude/skills-en/documentation-criteria/references/plan-template.md} +4 -4
- package/{docs/prd/template-en.md → .claude/skills-en/documentation-criteria/references/prd-template.md} +1 -1
- package/{docs/rules-en/frontend/technical-spec.md → .claude/skills-en/frontend/technical-spec/SKILL.md} +17 -13
- package/{docs/rules-en/frontend/typescript.md → .claude/skills-en/frontend/typescript-rules/SKILL.md} +17 -12
- package/{docs/rules-en/frontend/typescript-testing.md → .claude/skills-en/frontend/typescript-testing/SKILL.md} +11 -6
- package/{docs/rules-en/architecture/implementation-approach.md → .claude/skills-en/implementation-approach/SKILL.md} +7 -2
- package/{docs/rules-en/integration-e2e-testing.md → .claude/skills-en/integration-e2e-testing/SKILL.md} +15 -18
- package/{docs/rules-en/project-context.md → .claude/skills-en/project-context/SKILL.md} +7 -3
- package/.claude/skills-en/subagents-orchestration-guide/SKILL.md +224 -0
- package/.claude/skills-en/task-analyzer/SKILL.md +131 -0
- package/{docs/rules-en/rules-index.yaml → .claude/skills-en/task-analyzer/references/skills-index.yaml} +34 -20
- package/{docs/rules-en/technical-spec.md → .claude/skills-en/technical-spec/SKILL.md} +6 -6
- package/{docs/rules-en/typescript.md → .claude/skills-en/typescript-rules/SKILL.md} +15 -10
- package/{docs/rules-en/typescript-testing.md → .claude/skills-en/typescript-testing/SKILL.md} +10 -4
- package/{docs/rules-ja/coding-standards.md → .claude/skills-ja/coding-standards/SKILL.md} +12 -99
- package/{docs/rules-ja/documentation-criteria.md → .claude/skills-ja/documentation-criteria/SKILL.md} +18 -5
- package/.claude/skills-ja/documentation-criteria/references/adr-template.md +64 -0
- package/.claude/skills-ja/documentation-criteria/references/design-template.md +261 -0
- package/{docs/plans/template-ja.md → .claude/skills-ja/documentation-criteria/references/plan-template.md} +38 -38
- package/{docs/prd/template-ja.md → .claude/skills-ja/documentation-criteria/references/prd-template.md} +33 -33
- package/{docs/rules-ja/frontend/technical-spec.md → .claude/skills-ja/frontend/technical-spec/SKILL.md} +13 -9
- package/.claude/skills-ja/frontend/typescript-rules/SKILL.md +315 -0
- package/{docs/rules-ja/frontend/typescript-testing.md → .claude/skills-ja/frontend/typescript-testing/SKILL.md} +93 -5
- package/{docs/rules/architecture/implementation-approach.md → .claude/skills-ja/implementation-approach/SKILL.md} +10 -5
- package/{docs/rules-ja/integration-e2e-testing.md → .claude/skills-ja/integration-e2e-testing/SKILL.md} +5 -8
- package/{docs/rules/project-context.md → .claude/skills-ja/project-context/SKILL.md} +7 -3
- package/.claude/skills-ja/subagents-orchestration-guide/SKILL.md +212 -0
- package/.claude/skills-ja/task-analyzer/SKILL.md +131 -0
- package/{docs/rules-ja/rules-index.yaml → .claude/skills-ja/task-analyzer/references/skills-index.yaml} +34 -19
- package/{docs/rules-ja/technical-spec.md → .claude/skills-ja/technical-spec/SKILL.md} +6 -6
- package/{docs/rules-ja/typescript.md → .claude/skills-ja/typescript-rules/SKILL.md} +16 -11
- package/{docs/rules-ja/typescript-testing.md → .claude/skills-ja/typescript-testing/SKILL.md} +11 -5
- package/CLAUDE.en.md +6 -6
- package/CLAUDE.ja.md +6 -6
- package/CLAUDE.md +19 -28
- package/README.ja.md +39 -10
- package/README.md +39 -10
- package/package.json +1 -1
- package/scripts/set-language.js +35 -53
- package/scripts/setup-project.js +4 -1
- package/docs/adr/template-ja.md +0 -64
- package/docs/design/template-ja.md +0 -285
- package/docs/guides/en/sub-agents.md +0 -343
- package/docs/guides/ja/sub-agents.md +0 -343
- package/docs/guides/sub-agents.md +0 -306
- package/docs/plans/20250123-integration-test-improvement.md +0 -993
- package/docs/rules/rules-index.yaml +0 -137
- package/docs/rules/technical-spec.md +0 -47
- package/docs/rules/typescript-testing.md +0 -188
- package/docs/rules-ja/frontend/typescript.md +0 -131
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
# スキルメタデータインデックス
|
|
2
|
+
# rule-advisorがタスク分析に基づいて適切なスキルを選択するために使用
|
|
3
|
+
|
|
4
|
+
skills:
|
|
5
|
+
coding-standards:
|
|
6
|
+
skill: "coding-standards"
|
|
7
|
+
tags: [anti-patterns, technical-judgment, debugging, rule-of-three, implementation, type-safety, refactoring, code-reading, best-practices, impact-analysis, unused-code, code-deletion, testing, tdd]
|
|
8
|
+
typical-use: "全ドメイン共通の技術的判断基準、アンチパターン検出、デバッグ手法、実装時のベストプラクティス、影響範囲調査、未使用コード削除、テスト設計原則"
|
|
9
|
+
size: large
|
|
10
|
+
key-references:
|
|
11
|
+
- "Rule of Three - Martin Fowler"
|
|
12
|
+
- "5 Whys - トヨタ生産方式"
|
|
13
|
+
- "DRY原則 - The Pragmatic Programmer"
|
|
14
|
+
- "単一責任原則(SRP) - Clean Code"
|
|
15
|
+
- "YAGNI原則 - Extreme Programming"
|
|
16
|
+
- "Avoiding fallback in distributed systems - AWS Builders' Library"
|
|
17
|
+
- "Test-Driven Development - Kent Beck"
|
|
18
|
+
- "Red-Green-Refactor - Kent Beck"
|
|
19
|
+
- "AAAパターン - Arrange-Act-Assert"
|
|
20
|
+
sections:
|
|
21
|
+
- "技術的アンチパターン(赤信号パターン)"
|
|
22
|
+
- "基本原則"
|
|
23
|
+
- "コメント記述ルール"
|
|
24
|
+
- "エラーハンドリングの基本原則"
|
|
25
|
+
- "Rule of Three - コード重複の判断基準"
|
|
26
|
+
- "よくある失敗パターンと回避方法"
|
|
27
|
+
- "デバッグ手法"
|
|
28
|
+
- "型安全性の基礎"
|
|
29
|
+
- "リファクタリング手法"
|
|
30
|
+
- "技術的判断が必要な場面"
|
|
31
|
+
- "継続的改善のマインドセット"
|
|
32
|
+
- "実装作業の完全性担保"
|
|
33
|
+
- "Red-Green-Refactorプロセス(テストファースト開発)"
|
|
34
|
+
- "テスト設計原則"
|
|
35
|
+
- "テストヘルパーの活用ルール"
|
|
36
|
+
- "テストの粒度原則"
|
|
37
|
+
- "継続性テストの範囲"
|
|
38
|
+
|
|
39
|
+
typescript-rules:
|
|
40
|
+
skill: "typescript-rules"
|
|
41
|
+
tags: [implementation, type-safety, async, coding-style, functional-programming, dependency-injection, backend]
|
|
42
|
+
typical-use: "バックエンドTypeScriptコードの作成・修正、クラス使用判断、DI実装"
|
|
43
|
+
size: small
|
|
44
|
+
key-references:
|
|
45
|
+
- "Dependency Injection - Martin Fowler"
|
|
46
|
+
sections:
|
|
47
|
+
- "Backend実装における型安全性"
|
|
48
|
+
- "コーディング規約"
|
|
49
|
+
- "エラーハンドリング"
|
|
50
|
+
- "パフォーマンス最適化"
|
|
51
|
+
|
|
52
|
+
typescript-testing:
|
|
53
|
+
skill: "typescript-testing"
|
|
54
|
+
tags: [quality, testing, coverage, vitest, backend, implementation]
|
|
55
|
+
typical-use: "バックエンドテスト作成、Vitest設定、70%カバレッジ要件、テスト品質基準"
|
|
56
|
+
size: small
|
|
57
|
+
key-references:
|
|
58
|
+
- "Vitest公式ドキュメント"
|
|
59
|
+
sections:
|
|
60
|
+
- "テストフレームワーク"
|
|
61
|
+
- "テストの基本方針"
|
|
62
|
+
- "テストの実装規約"
|
|
63
|
+
- "テスト品質基準"
|
|
64
|
+
- "モックの型安全性"
|
|
65
|
+
- "Vitestの基本例"
|
|
66
|
+
|
|
67
|
+
technical-spec:
|
|
68
|
+
skill: "technical-spec"
|
|
69
|
+
tags: [architecture, design, documentation, environment, data-flow, implementation, quality-commands, testing, build]
|
|
70
|
+
typical-use: "技術設計、環境設定、ドキュメント作成プロセス、実装方針決定、品質チェックコマンド、ビルドとテスト実行"
|
|
71
|
+
size: medium
|
|
72
|
+
key-references:
|
|
73
|
+
- "ADRフォーマット - Michael Nygard"
|
|
74
|
+
- "単一データソース原則 - Single Source of Truth"
|
|
75
|
+
sections:
|
|
76
|
+
- "技術スタックの基本方針"
|
|
77
|
+
- "環境変数管理とセキュリティ"
|
|
78
|
+
- "アーキテクチャ設計"
|
|
79
|
+
- "パターン適用の一貫性"
|
|
80
|
+
- "データフロー統一原則"
|
|
81
|
+
- "ビルドとテスト"
|
|
82
|
+
|
|
83
|
+
project-context:
|
|
84
|
+
skill: "project-context"
|
|
85
|
+
tags: [context, project-specific, implementation]
|
|
86
|
+
typical-use: "プロジェクト固有情報、実装原則の理解"
|
|
87
|
+
size: small
|
|
88
|
+
key-references:
|
|
89
|
+
- "プロジェクト固有(経験則)"
|
|
90
|
+
sections:
|
|
91
|
+
- "基本設定"
|
|
92
|
+
- "実装原則"
|
|
93
|
+
- "カスタマイズガイド"
|
|
94
|
+
|
|
95
|
+
documentation-criteria:
|
|
96
|
+
skill: "documentation-criteria"
|
|
97
|
+
tags: [documentation, decision-making, adr, prd, design-doc, planning, process]
|
|
98
|
+
typical-use: "実装開始時の規模判定、ドキュメント作成判定、ADR/PRD/Design Doc/作業計画書の作成基準"
|
|
99
|
+
size: medium
|
|
100
|
+
key-references:
|
|
101
|
+
- "ADR手法 - Michael Nygard"
|
|
102
|
+
- "Design Doc文化 - Google Engineering Practices"
|
|
103
|
+
- "Single Source of Truth"
|
|
104
|
+
sections:
|
|
105
|
+
- "作成判定マトリクス"
|
|
106
|
+
- "ADR作成条件(いずれか該当で必須)"
|
|
107
|
+
- "各ドキュメントの詳細定義"
|
|
108
|
+
- "作成プロセス"
|
|
109
|
+
- "保存場所"
|
|
110
|
+
- "ADRステータス"
|
|
111
|
+
- "AI自動化ルール"
|
|
112
|
+
- "図表作成要件"
|
|
113
|
+
- "共通ADRとの関係性"
|
|
114
|
+
|
|
115
|
+
implementation-approach:
|
|
116
|
+
skill: "implementation-approach"
|
|
117
|
+
tags: [architecture, implementation, task-decomposition, strategy-patterns, strangler-pattern, facade-pattern, design, planning, confirmation-levels]
|
|
118
|
+
typical-use: "実装戦略の選択、タスク分解、設計判断、大規模変更の計画"
|
|
119
|
+
size: medium
|
|
120
|
+
key-references:
|
|
121
|
+
- "Strangler Fig Pattern - Martin Fowler"
|
|
122
|
+
- "Feature Slicing - Martin Fowler"
|
|
123
|
+
- "Walking Skeleton - Alistair Cockburn"
|
|
124
|
+
- "Facade Pattern - Gang of Four"
|
|
125
|
+
sections:
|
|
126
|
+
- "メタ認知的戦略選択プロセス"
|
|
127
|
+
- "確認レベル定義"
|
|
128
|
+
- "統合ポイントの定義"
|
|
129
|
+
- "アンチパターン"
|
|
130
|
+
- "メタ認知的実行のための指針"
|
|
131
|
+
|
|
132
|
+
integration-e2e-testing:
|
|
133
|
+
skill: "integration-e2e-testing"
|
|
134
|
+
tags: [testing, integration-test, e2e-test, property-based-testing, fast-check, test-skeleton, test-review, quality]
|
|
135
|
+
typical-use: "統合テスト・E2Eテストのスケルトン生成、テスト実装、テストレビュー、Property-Based Test実装"
|
|
136
|
+
size: small
|
|
137
|
+
key-references:
|
|
138
|
+
- "fast-check - Property-based testing for TypeScript"
|
|
139
|
+
- "Node.js Testing Best Practices - Yoni Goldberg"
|
|
140
|
+
- "Property-Based Testing - 2025 Practices"
|
|
141
|
+
sections:
|
|
142
|
+
- "テスト種別と上限"
|
|
143
|
+
- "振る舞い優先の原則"
|
|
144
|
+
- "スケルトン仕様"
|
|
145
|
+
- "実装ルール"
|
|
146
|
+
- "レビュー基準"
|
|
147
|
+
|
|
148
|
+
subagents-orchestration-guide:
|
|
149
|
+
skill: "subagents-orchestration-guide"
|
|
150
|
+
tags: [orchestration, subagents, workflow, scale-determination, document-requirements, autonomous-execution]
|
|
151
|
+
typical-use: "サブエージェントのワークフロー調整、規模判定、ドキュメント要件"
|
|
152
|
+
size: medium
|
|
153
|
+
key-references:
|
|
154
|
+
- "ワークフロー調整パターン"
|
|
155
|
+
- "エージェント連携パターン"
|
|
156
|
+
sections:
|
|
157
|
+
- "規模判定"
|
|
158
|
+
- "ドキュメント要件"
|
|
159
|
+
- "停止ポイント"
|
|
160
|
+
- "自律実行モード"
|
|
161
|
+
|
|
162
|
+
# フロントエンド固有スキル
|
|
163
|
+
frontend/typescript-rules:
|
|
164
|
+
skill: "frontend/typescript-rules"
|
|
165
|
+
tags: [frontend, react, implementation, type-safety, props-driven, hooks, component-design, vite, error-boundary]
|
|
166
|
+
typical-use: "React/Viteでのフロントエンド開発、コンポーネント設計、Props設計、環境変数管理"
|
|
167
|
+
size: small
|
|
168
|
+
key-references:
|
|
169
|
+
- "React公式ドキュメント - Function Components"
|
|
170
|
+
- "Props-driven開発 - React Patterns"
|
|
171
|
+
sections:
|
|
172
|
+
- "フロントエンド固有のアンチパターン"
|
|
173
|
+
- "Frontend実装における型安全性"
|
|
174
|
+
- "コーディング規約"
|
|
175
|
+
- "エラーハンドリング"
|
|
176
|
+
- "パフォーマンス最適化"
|
|
177
|
+
|
|
178
|
+
frontend/typescript-testing:
|
|
179
|
+
skill: "frontend/typescript-testing"
|
|
180
|
+
tags: [frontend, react, quality, testing, coverage, vitest, react-testing-library, msw, component-testing, implementation]
|
|
181
|
+
typical-use: "Reactコンポーネントのテスト作成、React Testing Library、MSW、60%カバレッジ要件、Co-location"
|
|
182
|
+
size: small
|
|
183
|
+
key-references:
|
|
184
|
+
- "React Testing Library - Kent C. Dodds"
|
|
185
|
+
- "MSW (Mock Service Worker) - API Mocking"
|
|
186
|
+
- "ADR-0002 Co-location原則"
|
|
187
|
+
sections:
|
|
188
|
+
- "テストフレームワーク"
|
|
189
|
+
- "テストの基本方針"
|
|
190
|
+
- "テストの実装規約"
|
|
191
|
+
- "モックの型安全性の徹底"
|
|
192
|
+
- "React Testing Libraryの基本例"
|
|
193
|
+
|
|
194
|
+
frontend/technical-spec:
|
|
195
|
+
skill: "frontend/technical-spec"
|
|
196
|
+
tags: [frontend, react, architecture, design, documentation, environment, data-flow, implementation, vite, security, client-side, state-management, context-api, hooks, lighthouse, bundle-size, non-functional-requirements]
|
|
197
|
+
typical-use: "フロントエンド技術設計、環境変数管理(Vite)、セキュリティ制約、アーキテクチャ設計、状態管理パターン、実装方針決定、非機能要件の確認"
|
|
198
|
+
size: medium
|
|
199
|
+
key-references:
|
|
200
|
+
- "Vite公式ドキュメント - Environment Variables"
|
|
201
|
+
- "React公式ドキュメント - State Management"
|
|
202
|
+
- "Single Source of Truth - データフロー原則"
|
|
203
|
+
- "Immutable Update Patterns - React"
|
|
204
|
+
- "Lighthouse - Google Web Performance"
|
|
205
|
+
- "Web.dev - Performance Best Practices"
|
|
206
|
+
sections:
|
|
207
|
+
- "技術スタックの基本方針"
|
|
208
|
+
- "環境変数管理とセキュリティ"
|
|
209
|
+
- "アーキテクチャ設計"
|
|
210
|
+
- "データフロー統一原則"
|
|
211
|
+
- "ビルドとテスト"
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: technical-spec
|
|
3
|
+
description: 環境変数管理、アーキテクチャ設計、ビルド・テストコマンドを含む技術設計ルール。
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# 技術設計ルール
|
|
7
|
+
|
|
8
|
+
## 技術スタックの基本方針
|
|
9
|
+
TypeScriptをベースとしたアプリケーション実装。アーキテクチャパターンはプロジェクトの要件と規模に応じて選択すること。
|
|
10
|
+
|
|
11
|
+
## 環境変数管理とセキュリティ
|
|
12
|
+
|
|
13
|
+
### 環境変数管理
|
|
14
|
+
- 環境変数は一元管理し、型安全性を確保する仕組みを構築すること
|
|
15
|
+
- `process.env` の直接参照は避け、設定管理層を通じて取得すること
|
|
16
|
+
- デフォルト値の設定や必須チェックを適切に実装すること
|
|
17
|
+
|
|
18
|
+
### セキュリティ
|
|
19
|
+
- `.env`ファイルはGitに含めない
|
|
20
|
+
- APIキーやシークレットは必ず環境変数として管理
|
|
21
|
+
- 機密情報のログ出力は禁止
|
|
22
|
+
- エラーメッセージに機密情報を含めない
|
|
23
|
+
|
|
24
|
+
## アーキテクチャ設計
|
|
25
|
+
|
|
26
|
+
### アーキテクチャ設計の原則
|
|
27
|
+
プロジェクトごとに適切なアーキテクチャを選択し、明確に定義すること:
|
|
28
|
+
|
|
29
|
+
- **責務の分離**: 各層やモジュールの責務を明確に定義し、境界を守ること
|
|
30
|
+
|
|
31
|
+
## データフロー統一原則
|
|
32
|
+
|
|
33
|
+
#### 基本原則
|
|
34
|
+
1. **単一データソース**: 同じ情報は1箇所にのみ保存する
|
|
35
|
+
2. **構造化データ優先**: JSON文字列ではなくパース済みオブジェクトを使用
|
|
36
|
+
3. **明確な責務分離**: 各層の責務を明確に定義
|
|
37
|
+
|
|
38
|
+
#### データフローのベストプラクティス
|
|
39
|
+
- **入力時点での検証**: データは入力層で検証し、型安全な形で内部に渡す
|
|
40
|
+
- **変換の一元化**: データ変換ロジックは専用のユーティリティに集約
|
|
41
|
+
- **ログの構造化**: データフローの各段階で構造化ログを出力
|
|
42
|
+
|
|
43
|
+
## ビルドとテスト
|
|
44
|
+
package.jsonの`packageManager`フィールドに応じた実行コマンドを使用すること。
|
|
45
|
+
|
|
46
|
+
### ビルドコマンド
|
|
47
|
+
- `build` - TypeScriptビルド
|
|
48
|
+
- `type-check` - 型チェック(emit なし)
|
|
49
|
+
|
|
50
|
+
### テストコマンド
|
|
51
|
+
- `test` - テスト実行
|
|
52
|
+
- `test:coverage` - カバレッジ測定
|
|
53
|
+
- `test:coverage:fresh` - カバレッジ測定(キャッシュクリア)
|
|
54
|
+
- `test:safe` - 安全なテスト実行(自動クリーンアップ付き)
|
|
55
|
+
- `cleanup:processes` - Vitestプロセスのクリーンアップ
|
|
56
|
+
|
|
57
|
+
### 品質チェック要件
|
|
58
|
+
|
|
59
|
+
品質チェックは実装完了時に必須:
|
|
60
|
+
|
|
61
|
+
**Phase 1-3: コード品質チェック**
|
|
62
|
+
- `check` - Biome(lint + format)
|
|
63
|
+
- `check:unused` - 未使用エクスポートの検出
|
|
64
|
+
- `check:deps` - 循環依存の検出
|
|
65
|
+
- `build` - TypeScriptビルド
|
|
66
|
+
|
|
67
|
+
**Phase 4: テスト**
|
|
68
|
+
- `test` - テスト実行
|
|
69
|
+
|
|
70
|
+
**Phase 5: コード品質再検証**
|
|
71
|
+
- `check:code` - コード品質の再検証(Phase 4でのテスト修正による副作用を清掃)
|
|
72
|
+
|
|
73
|
+
### 補助コマンド
|
|
74
|
+
- `check:all` - 全体統合チェック(check:code + test)※手動一括確認用
|
|
75
|
+
- `open coverage/index.html` - カバレッジレポート確認
|
|
76
|
+
- `format` - フォーマット修正
|
|
77
|
+
- `lint:fix` - Lint修正
|
|
78
|
+
|
|
79
|
+
### トラブルシューティング
|
|
80
|
+
- **ポート使用中エラー**: `cleanup:processes` スクリプトを実行
|
|
81
|
+
- **キャッシュ問題**: `test:coverage:fresh` スクリプトを実行
|
|
82
|
+
- **依存関係エラー**: 依存関係のクリーンインストールを実行
|
|
83
|
+
|
|
84
|
+
### カバレッジ要件
|
|
85
|
+
- **必須**: ユニットテストカバレッジは70%以上
|
|
86
|
+
- **メトリクス**: Statements、Branches、Functions、Lines
|
|
@@ -1,67 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
✅ **積極的なリファクタリング** - 技術的負債を防ぎ、健全性を維持
|
|
6
|
-
❌ **使われない「念のため」のコード** - YAGNI原則(Kent Beck)に反する
|
|
7
|
-
|
|
8
|
-
## コメント記述ルール
|
|
9
|
-
- **機能説明重視**: コードが「何をするか」を記述
|
|
10
|
-
- **履歴情報禁止**: 開発履歴は記載しない
|
|
11
|
-
- **タイムレス**: いつ読んでも有効な内容のみ記述
|
|
12
|
-
- **簡潔性**: 必要最小限の説明にとどめる
|
|
13
|
-
|
|
14
|
-
## 型安全性
|
|
15
|
-
|
|
16
|
-
**絶対ルール**: any型は完全禁止。型チェックが無効化され、実行時エラーの温床となる。
|
|
17
|
-
|
|
18
|
-
**any型の代替手段(優先順位順)**
|
|
19
|
-
1. **unknown型 + 型ガード**: 外部入力の検証に使用
|
|
20
|
-
2. **ジェネリクス**: 型の柔軟性が必要な場合
|
|
21
|
-
3. **ユニオン型・インターセクション型**: 複数の型の組み合わせ
|
|
22
|
-
4. **型アサーション(最終手段)**: 型が確実な場合のみ
|
|
23
|
-
|
|
24
|
-
**型ガードの実装パターン**
|
|
25
|
-
```typescript
|
|
26
|
-
function isUser(value: unknown): value is User {
|
|
27
|
-
return typeof value === 'object' && value !== null && 'id' in value && 'name' in value
|
|
28
|
-
}
|
|
29
|
-
```
|
|
1
|
+
---
|
|
2
|
+
name: typescript-rules
|
|
3
|
+
description: 型安全性とエラーハンドリングのためのTypeScript開発ルール。TypeScriptコード実装や型定義レビュー時に使用。
|
|
4
|
+
---
|
|
30
5
|
|
|
31
|
-
|
|
32
|
-
- **satisfies演算子**: `const config = { port: 3000 } satisfies Config` - 型推論維持
|
|
33
|
-
- **const assertion**: `const ROUTES = { HOME: '/' } as const satisfies Routes` - 不変かつ型安全
|
|
34
|
-
- **ブランド型**: `type UserId = string & { __brand: 'UserId' }` - 意味を区別
|
|
35
|
-
- **テンプレートリテラル型**: `type Endpoint = \`\${HttpMethod} \${Route}\`` - 文字列パターンを型で表現
|
|
6
|
+
# TypeScript 開発ルール
|
|
36
7
|
|
|
37
|
-
|
|
38
|
-
- API通信: レスポンスは必ず`unknown`で受け、型ガードで検証
|
|
39
|
-
- フォーム入力: 外部入力は`unknown`、バリデーション後に型確定
|
|
40
|
-
- レガシー統合: `window as unknown as LegacyWindow`のように段階的アサーション
|
|
41
|
-
- テストコード: モックも必ず型定義、`Partial<T>`や`vi.fn<[Args], Return>()`活用
|
|
8
|
+
## Backend実装における型安全性
|
|
42
9
|
|
|
43
10
|
**データフローでの型安全性**
|
|
44
11
|
入力層(`unknown`) → 型ガード → ビジネス層(型保証) → 出力層(シリアライズ)
|
|
45
12
|
|
|
46
|
-
|
|
47
|
-
-
|
|
48
|
-
-
|
|
49
|
-
-
|
|
50
|
-
-
|
|
51
|
-
- **外部API型の扱い**: 制約を緩和し、実態に合わせて定義(内部では適切に変換)
|
|
13
|
+
**Backend固有の型シナリオ**:
|
|
14
|
+
- **API通信**: レスポンスは必ず`unknown`で受け、型ガードで検証
|
|
15
|
+
- **フォーム入力**: 外部入力は`unknown`、バリデーション後に型確定
|
|
16
|
+
- **レガシー統合**: `window as unknown as LegacyWindow`のように段階的アサーション
|
|
17
|
+
- **テストコード**: モックも必ず型定義、`Partial<T>`や`vi.fn<[Args], Return>()`活用
|
|
52
18
|
|
|
53
19
|
## コーディング規約
|
|
54
20
|
|
|
55
21
|
**クラス使用の判断基準**
|
|
56
22
|
- **推奨:関数とinterfaceでの実装**
|
|
57
23
|
- 背景: テスタビリティと関数合成の柔軟性が向上
|
|
58
|
-
- **クラス使用を許可**:
|
|
24
|
+
- **クラス使用を許可**:
|
|
59
25
|
- フレームワーク要求時(NestJSのController/Service、TypeORMのEntity等)
|
|
60
26
|
- カスタムエラークラス定義時
|
|
61
27
|
- 状態とビジネスロジックが密結合している場合(例: ShoppingCart、Session、StateMachine)
|
|
62
28
|
- **判断基準**: 「このデータは振る舞いを持つか?」がYesならクラス検討
|
|
63
29
|
```typescript
|
|
64
|
-
//
|
|
30
|
+
// 関数とinterface
|
|
65
31
|
interface UserService { create(data: UserData): User }
|
|
66
32
|
const userService: UserService = { create: (data) => {...} }
|
|
67
33
|
```
|
|
@@ -69,14 +35,14 @@ function isUser(value: unknown): value is User {
|
|
|
69
35
|
**関数設計**
|
|
70
36
|
- **引数は0-2個まで**: 3個以上はオブジェクト化
|
|
71
37
|
```typescript
|
|
72
|
-
//
|
|
38
|
+
// オブジェクト引数
|
|
73
39
|
function createUser({ name, email, role }: CreateUserParams) {}
|
|
74
40
|
```
|
|
75
41
|
|
|
76
42
|
**依存性注入**
|
|
77
43
|
- **外部依存は引数で注入**: テスト可能性とモジュール性確保
|
|
78
44
|
```typescript
|
|
79
|
-
//
|
|
45
|
+
// 依存性を引数で受け取る
|
|
80
46
|
function createService(repository: Repository) { return {...} }
|
|
81
47
|
```
|
|
82
48
|
|
|
@@ -91,10 +57,10 @@ function isUser(value: unknown): value is User {
|
|
|
91
57
|
- インポートは絶対パス(`src/`)
|
|
92
58
|
|
|
93
59
|
**クリーンコード原則**
|
|
94
|
-
-
|
|
95
|
-
-
|
|
96
|
-
-
|
|
97
|
-
-
|
|
60
|
+
- 使用されていないコードは即座に削除
|
|
61
|
+
- デバッグ用`console.log()`は削除
|
|
62
|
+
- コメントアウトされたコード禁止(バージョン管理で履歴管理)
|
|
63
|
+
- コメントは「なぜ」を説明(「何」ではなく)
|
|
98
64
|
|
|
99
65
|
## エラーハンドリング
|
|
100
66
|
|
|
@@ -102,12 +68,12 @@ function isUser(value: unknown): value is User {
|
|
|
102
68
|
|
|
103
69
|
**Fail-Fast原則**: エラー時は速やかに失敗させ、不正な状態での処理継続を防ぐ
|
|
104
70
|
```typescript
|
|
105
|
-
//
|
|
71
|
+
// 禁止: 無条件フォールバック
|
|
106
72
|
catch (error) {
|
|
107
73
|
return defaultValue // エラーを隠蔽
|
|
108
74
|
}
|
|
109
75
|
|
|
110
|
-
//
|
|
76
|
+
// 必須: 明示的な失敗
|
|
111
77
|
catch (error) {
|
|
112
78
|
logger.error('処理失敗', error)
|
|
113
79
|
throw error // 上位層で適切に処理
|
|
@@ -149,18 +115,7 @@ export class AppError extends Error {
|
|
|
149
115
|
- すべてのasync/awaitでtry-catch使用
|
|
150
116
|
- エラーは必ずログと再スロー
|
|
151
117
|
|
|
152
|
-
## リファクタリング手法
|
|
153
|
-
|
|
154
|
-
**基本方針**
|
|
155
|
-
- 小さなステップ: 段階的改善により、常に動作する状態を維持
|
|
156
|
-
- 安全な変更: 一度に変更する範囲を最小限に抑制
|
|
157
|
-
- 動作保証: 既存の動作を変えないことを確認しながら進める
|
|
158
|
-
|
|
159
|
-
**実施手順**: 現状把握 → 段階的変更 → 動作確認 → 最終検証
|
|
160
|
-
|
|
161
|
-
**優先順位**: 重複コード削除 > 長大な関数分割 > 複雑な条件分岐簡素化 > 型安全性向上
|
|
162
|
-
|
|
163
118
|
## パフォーマンス最適化
|
|
164
119
|
|
|
165
120
|
- ストリーミング処理: 大きなデータセットはストリームで処理
|
|
166
|
-
- メモリリーク防止: 不要なオブジェクトは明示的に解放
|
|
121
|
+
- メモリリーク防止: 不要なオブジェクトは明示的に解放
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: typescript-testing
|
|
3
|
+
description: Vitestを使用したTypeScriptテストルール。カバレッジ要件、テスト設計原則、品質基準を含む。
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# TypeScript テストルール
|
|
7
|
+
|
|
8
|
+
## テストフレームワーク
|
|
9
|
+
|
|
10
|
+
- **Vitest**: このプロジェクトではVitestを使用
|
|
11
|
+
- テストのインポート: `import { describe, it, expect, beforeEach, vi } from 'vitest'`
|
|
12
|
+
- モックの作成: `vi.mock()` を使用
|
|
13
|
+
|
|
14
|
+
## テストの基本方針
|
|
15
|
+
|
|
16
|
+
### 品質要件
|
|
17
|
+
- **カバレッジ**: 単体テストのカバレッジは70%以上を必須
|
|
18
|
+
- **独立性**: 各テストは他のテストに依存せず実行可能
|
|
19
|
+
- **再現性**: テストは環境に依存せず、常に同じ結果を返す
|
|
20
|
+
- **可読性**: テストコードも製品コードと同様の品質を維持
|
|
21
|
+
|
|
22
|
+
### カバレッジ要件
|
|
23
|
+
**必須**: 単体テストのカバレッジは70%以上
|
|
24
|
+
**指標**: Statements(文)、Branches(分岐)、Functions(関数)、Lines(行)
|
|
25
|
+
|
|
26
|
+
### テストの種類と範囲
|
|
27
|
+
1. **単体テスト(Unit Tests)**
|
|
28
|
+
- 個々の関数やクラスの動作を検証
|
|
29
|
+
- 外部依存はすべてモック化
|
|
30
|
+
- 最も数が多く、細かい粒度で実施
|
|
31
|
+
|
|
32
|
+
2. **統合テスト(Integration Tests)**
|
|
33
|
+
- 複数のコンポーネントの連携を検証
|
|
34
|
+
- 実際の依存関係を使用(DBやAPI等)
|
|
35
|
+
- 主要な機能フローの検証
|
|
36
|
+
|
|
37
|
+
3. **E2Eテストでの機能横断検証**
|
|
38
|
+
- 新機能追加時、既存機能への影響を必ず検証
|
|
39
|
+
- Design Docの「統合ポイントマップ」で影響度「高」「中」の箇所をカバー
|
|
40
|
+
- 検証パターン: 既存機能動作 → 新機能有効化 → 既存機能の継続性確認
|
|
41
|
+
- 判定基準: レスポンス内容の変化なし、処理時間5秒以内
|
|
42
|
+
- CI/CDでの自動実行を前提とした設計
|
|
43
|
+
|
|
44
|
+
## テストの実装規約
|
|
45
|
+
|
|
46
|
+
### ディレクトリ構造
|
|
47
|
+
```
|
|
48
|
+
src/
|
|
49
|
+
└── application/
|
|
50
|
+
└── services/
|
|
51
|
+
├── __tests__/
|
|
52
|
+
│ ├── service.test.ts # 単体テスト
|
|
53
|
+
│ └── service.int.test.ts # 統合テスト
|
|
54
|
+
└── service.ts
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### 命名規則
|
|
58
|
+
- テストファイル: `{対象ファイル名}.test.ts`
|
|
59
|
+
- 統合テストファイル: `{対象ファイル名}.int.test.ts`
|
|
60
|
+
- テストスイート: 対象の機能や状況を説明する名前
|
|
61
|
+
- テストケース: 期待される動作を説明する名前
|
|
62
|
+
|
|
63
|
+
### テストコードの品質ルール
|
|
64
|
+
|
|
65
|
+
**推奨: すべてのテストを常に有効に保つ**
|
|
66
|
+
- メリット: テストスイートの完全性を保証
|
|
67
|
+
- 実践: 問題があるテストは修正して有効化
|
|
68
|
+
|
|
69
|
+
**避けるべき: test.skip()やコメントアウト**
|
|
70
|
+
- 理由: テストの穴が生まれ、品質チェックが不完全になる
|
|
71
|
+
- 対処: 不要なテストは完全に削除する
|
|
72
|
+
|
|
73
|
+
## テスト品質基準
|
|
74
|
+
|
|
75
|
+
### 境界値・異常系の網羅
|
|
76
|
+
正常系に加え、境界値と異常系を含める。
|
|
77
|
+
```typescript
|
|
78
|
+
it('returns 0 for empty array', () => expect(calc([])).toBe(0))
|
|
79
|
+
it('throws on negative price', () => expect(() => calc([{price: -1}])).toThrow())
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### 期待値の直接記述
|
|
83
|
+
期待値はリテラルで記述。実装ロジックを再現しない。
|
|
84
|
+
**有効なテスト**: 期待値 ≠ モック戻り値(実装による変換・処理がある)
|
|
85
|
+
```typescript
|
|
86
|
+
expect(calcTax(100)).toBe(10) // not: 100 * TAX_RATE
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### 結果ベースの検証
|
|
90
|
+
呼び出し順序・回数ではなく結果を検証。
|
|
91
|
+
```typescript
|
|
92
|
+
expect(mock).toHaveBeenCalledWith('a') // not: toHaveBeenNthCalledWith
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### 意味あるアサーション
|
|
96
|
+
各テストに最低1つの検証を含める。
|
|
97
|
+
```typescript
|
|
98
|
+
it('creates user', async () => {
|
|
99
|
+
const user = await createUser({name: 'test'})
|
|
100
|
+
expect(user.id).toBeDefined()
|
|
101
|
+
})
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### 適切なモック範囲
|
|
105
|
+
直接依存の外部I/Oのみモック。間接依存は実物使用。
|
|
106
|
+
```typescript
|
|
107
|
+
vi.mock('./database') // 外部I/Oのみ
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### Property-based Testing(fast-check)
|
|
111
|
+
不変条件やプロパティを検証する場合はfast-checkを使用。
|
|
112
|
+
```typescript
|
|
113
|
+
import fc from 'fast-check'
|
|
114
|
+
|
|
115
|
+
it('reverses twice equals original', () => {
|
|
116
|
+
fc.assert(fc.property(fc.array(fc.integer()), (arr) => {
|
|
117
|
+
return JSON.stringify(arr.reverse().reverse()) === JSON.stringify(arr)
|
|
118
|
+
}))
|
|
119
|
+
})
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
**使用条件**: Design DocのACにProperty注釈が付与されている場合に使用。
|
|
123
|
+
|
|
124
|
+
## モックの型安全性
|
|
125
|
+
|
|
126
|
+
### 必要最小限の型定義
|
|
127
|
+
```typescript
|
|
128
|
+
// 必要な部分のみ
|
|
129
|
+
type TestRepo = Pick<Repository, 'find' | 'save'>
|
|
130
|
+
const mock: TestRepo = { find: vi.fn(), save: vi.fn() }
|
|
131
|
+
|
|
132
|
+
// やむを得ない場合のみ、理由明記
|
|
133
|
+
const sdkMock = {
|
|
134
|
+
call: vi.fn()
|
|
135
|
+
} as unknown as ExternalSDK // 外部SDKの複雑な型のため
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## Vitestの基本例
|
|
139
|
+
|
|
140
|
+
```typescript
|
|
141
|
+
import { describe, it, expect, vi } from 'vitest'
|
|
142
|
+
|
|
143
|
+
vi.mock('./userService', () => ({
|
|
144
|
+
getUserById: vi.fn(),
|
|
145
|
+
updateUser: vi.fn()
|
|
146
|
+
}))
|
|
147
|
+
|
|
148
|
+
describe('ComponentName', () => {
|
|
149
|
+
it('should follow AAA pattern', () => {
|
|
150
|
+
const input = 'test'
|
|
151
|
+
const result = someFunction(input)
|
|
152
|
+
expect(result).toBe('expected')
|
|
153
|
+
})
|
|
154
|
+
})
|
|
155
|
+
```
|