create-ai-project 1.16.2 → 1.17.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.
Files changed (123) hide show
  1. package/.claude/agents-en/acceptance-test-generator.md +4 -3
  2. package/.claude/agents-en/code-reviewer.md +2 -2
  3. package/.claude/agents-en/code-verifier.md +2 -2
  4. package/.claude/agents-en/design-sync.md +2 -2
  5. package/.claude/agents-en/document-reviewer.md +4 -4
  6. package/.claude/agents-en/integration-test-reviewer.md +2 -2
  7. package/.claude/agents-en/investigator.md +2 -2
  8. package/.claude/agents-en/prd-creator.md +4 -2
  9. package/.claude/agents-en/quality-fixer-frontend.md +7 -5
  10. package/.claude/agents-en/quality-fixer.md +3 -3
  11. package/.claude/agents-en/requirement-analyzer.md +2 -2
  12. package/.claude/agents-en/scope-discoverer.md +2 -2
  13. package/.claude/agents-en/skill-creator.md +2 -2
  14. package/.claude/agents-en/skill-reviewer.md +2 -2
  15. package/.claude/agents-en/solver.md +2 -2
  16. package/.claude/agents-en/task-decomposer.md +2 -2
  17. package/.claude/agents-en/task-executor-frontend.md +3 -3
  18. package/.claude/agents-en/task-executor.md +2 -2
  19. package/.claude/agents-en/technical-designer-frontend.md +17 -6
  20. package/.claude/agents-en/technical-designer.md +2 -2
  21. package/.claude/agents-en/ui-spec-designer.md +115 -0
  22. package/.claude/agents-en/verifier.md +2 -2
  23. package/.claude/agents-en/work-planner.md +2 -2
  24. package/.claude/agents-ja/acceptance-test-generator.md +4 -3
  25. package/.claude/agents-ja/code-reviewer.md +2 -2
  26. package/.claude/agents-ja/code-verifier.md +2 -2
  27. package/.claude/agents-ja/design-sync.md +2 -2
  28. package/.claude/agents-ja/document-reviewer.md +4 -4
  29. package/.claude/agents-ja/integration-test-reviewer.md +2 -2
  30. package/.claude/agents-ja/investigator.md +2 -2
  31. package/.claude/agents-ja/prd-creator.md +4 -2
  32. package/.claude/agents-ja/quality-fixer-frontend.md +7 -5
  33. package/.claude/agents-ja/quality-fixer.md +3 -3
  34. package/.claude/agents-ja/requirement-analyzer.md +2 -2
  35. package/.claude/agents-ja/scope-discoverer.md +2 -2
  36. package/.claude/agents-ja/skill-creator.md +2 -2
  37. package/.claude/agents-ja/skill-reviewer.md +2 -2
  38. package/.claude/agents-ja/solver.md +2 -2
  39. package/.claude/agents-ja/task-decomposer.md +2 -2
  40. package/.claude/agents-ja/task-executor-frontend.md +3 -3
  41. package/.claude/agents-ja/task-executor.md +2 -2
  42. package/.claude/agents-ja/technical-designer-frontend.md +17 -6
  43. package/.claude/agents-ja/technical-designer.md +2 -2
  44. package/.claude/agents-ja/ui-spec-designer.md +115 -0
  45. package/.claude/agents-ja/verifier.md +2 -2
  46. package/.claude/agents-ja/work-planner.md +2 -2
  47. package/.claude/commands-en/add-integration-tests.md +1 -1
  48. package/.claude/commands-en/build.md +55 -19
  49. package/.claude/commands-en/create-skill.md +1 -1
  50. package/.claude/commands-en/design.md +1 -1
  51. package/.claude/commands-en/diagnose.md +2 -2
  52. package/.claude/commands-en/front-build.md +40 -20
  53. package/.claude/commands-en/front-design.md +25 -8
  54. package/.claude/commands-en/front-plan.md +17 -9
  55. package/.claude/commands-en/front-review.md +2 -2
  56. package/.claude/commands-en/implement.md +15 -10
  57. package/.claude/commands-en/project-inject.md +1 -1
  58. package/.claude/commands-en/refine-skill.md +1 -1
  59. package/.claude/commands-en/reverse-engineer.md +3 -3
  60. package/.claude/commands-en/review.md +2 -2
  61. package/.claude/commands-en/sync-skills.md +1 -1
  62. package/.claude/commands-en/update-doc.md +2 -2
  63. package/.claude/commands-ja/add-integration-tests.md +1 -1
  64. package/.claude/commands-ja/build.md +56 -18
  65. package/.claude/commands-ja/create-skill.md +1 -1
  66. package/.claude/commands-ja/design.md +1 -1
  67. package/.claude/commands-ja/diagnose.md +2 -2
  68. package/.claude/commands-ja/front-build.md +41 -21
  69. package/.claude/commands-ja/front-design.md +26 -9
  70. package/.claude/commands-ja/front-plan.md +15 -7
  71. package/.claude/commands-ja/front-review.md +2 -2
  72. package/.claude/commands-ja/implement.md +15 -10
  73. package/.claude/commands-ja/project-inject.md +1 -1
  74. package/.claude/commands-ja/refine-skill.md +1 -1
  75. package/.claude/commands-ja/reverse-engineer.md +3 -3
  76. package/.claude/commands-ja/review.md +2 -2
  77. package/.claude/commands-ja/sync-skills.md +1 -1
  78. package/.claude/commands-ja/update-doc.md +2 -2
  79. package/.claude/skills-en/documentation-criteria/SKILL.md +37 -1
  80. package/.claude/skills-en/documentation-criteria/references/design-template.md +24 -0
  81. package/.claude/skills-en/documentation-criteria/references/prd-template.md +10 -0
  82. package/.claude/skills-en/documentation-criteria/references/ui-spec-template.md +145 -0
  83. package/.claude/skills-en/{frontend/technical-spec → frontend-technical-spec}/SKILL.md +5 -5
  84. package/.claude/skills-en/{frontend/typescript-rules → frontend-typescript-rules}/SKILL.md +1 -1
  85. package/.claude/skills-en/{frontend/typescript-testing → frontend-typescript-testing}/SKILL.md +9 -2
  86. package/.claude/skills-en/frontend-typescript-testing/references/e2e.md +185 -0
  87. package/.claude/skills-en/integration-e2e-testing/SKILL.md +4 -0
  88. package/.claude/skills-en/integration-e2e-testing/references/e2e-design.md +86 -0
  89. package/.claude/skills-en/subagents-orchestration-guide/SKILL.md +44 -22
  90. package/.claude/skills-en/task-analyzer/references/skills-index.yaml +15 -11
  91. package/.claude/skills-en/technical-spec/SKILL.md +5 -4
  92. package/.claude/skills-ja/documentation-criteria/SKILL.md +37 -1
  93. package/.claude/skills-ja/documentation-criteria/references/design-template.md +24 -0
  94. package/.claude/skills-ja/documentation-criteria/references/prd-template.md +10 -0
  95. package/.claude/skills-ja/documentation-criteria/references/ui-spec-template.md +145 -0
  96. package/.claude/skills-ja/{frontend/technical-spec → frontend-technical-spec}/SKILL.md +5 -5
  97. package/.claude/skills-ja/{frontend/typescript-rules → frontend-typescript-rules}/SKILL.md +1 -1
  98. package/.claude/skills-ja/{frontend/typescript-testing → frontend-typescript-testing}/SKILL.md +2 -2
  99. package/.claude/skills-ja/frontend-typescript-testing/references/e2e.md +185 -0
  100. package/.claude/skills-ja/integration-e2e-testing/SKILL.md +4 -0
  101. package/.claude/skills-ja/integration-e2e-testing/references/e2e-design.md +86 -0
  102. package/.claude/skills-ja/subagents-orchestration-guide/SKILL.md +44 -22
  103. package/.claude/skills-ja/task-analyzer/references/skills-index.yaml +15 -11
  104. package/.claude/skills-ja/technical-spec/SKILL.md +5 -4
  105. package/CHANGELOG.md +67 -0
  106. package/CLAUDE.en.md +2 -2
  107. package/CLAUDE.ja.md +2 -2
  108. package/CLAUDE.md +68 -86
  109. package/README.ja.md +10 -7
  110. package/README.md +10 -7
  111. package/bin/create-project.js +76 -75
  112. package/biome.json +5 -8
  113. package/package.json +11 -24
  114. package/scripts/post-setup.js +54 -57
  115. package/scripts/set-language.js +107 -112
  116. package/scripts/setup-project.js +97 -92
  117. package/scripts/show-coverage.js +36 -22
  118. package/scripts/update-project.js +205 -201
  119. package/scripts/utils.js +19 -21
  120. package/tsconfig.json +3 -3
  121. package/vitest.config.mjs +2 -2
  122. package/.tsprunerc +0 -11
  123. package/scripts/check-unused-exports.js +0 -69
@@ -100,7 +100,7 @@ skills:
100
100
 
101
101
  documentation-criteria:
102
102
  skill: "documentation-criteria"
103
- tags: [documentation, adr, prd, design-doc, work-plan, decision-matrix]
103
+ tags: [documentation, adr, prd, ui-spec, design-doc, work-plan, decision-matrix]
104
104
  typical-use: "Implementation start scale assessment, document creation decisions, ADR/PRD/Design Doc/work plan creation criteria"
105
105
  size: medium
106
106
  key-references:
@@ -138,14 +138,16 @@ skills:
138
138
 
139
139
  integration-e2e-testing:
140
140
  skill: "integration-e2e-testing"
141
- tags: [testing, integration-test, e2e-test, property-based-testing, fast-check, test-skeleton, test-review, quality]
142
- typical-use: "Integration and E2E test skeleton generation, test implementation, test review, Property-Based Test implementation"
141
+ tags: [testing, integration-test, e2e-test, property-based-testing, fast-check, test-skeleton, test-review, quality, playwright]
142
+ typical-use: "Integration and E2E test skeleton generation, test implementation, test review, Property-Based Test implementation, E2E test design"
143
143
  size: small
144
144
  key-references:
145
145
  - "fast-check - Property-based testing for TypeScript"
146
146
  - "Node.js Testing Best Practices - Yoni Goldberg"
147
147
  - "Property-Based Testing - 2025 Practices"
148
+ - "references/e2e-design.md - E2E test design principles"
148
149
  sections:
150
+ - "References"
149
151
  - "Test Types and Limits"
150
152
  - "Behavior-First Principle"
151
153
  - "Skeleton Specification"
@@ -190,8 +192,8 @@ skills:
190
192
  - "References"
191
193
 
192
194
  # Frontend-specific Skills
193
- frontend/typescript-rules:
194
- skill: "frontend/typescript-rules"
195
+ frontend-typescript-rules:
196
+ skill: "frontend-typescript-rules"
195
197
  tags: [frontend, react, implementation, type-safety, function-components, props-driven, async, refactoring, coding-style]
196
198
  typical-use: "React component creation, Props type definitions, frontend TypeScript development"
197
199
  size: small
@@ -208,10 +210,10 @@ skills:
208
210
  - "Error Handling"
209
211
  - "Performance Optimization"
210
212
 
211
- frontend/typescript-testing:
212
- skill: "frontend/typescript-testing"
213
- tags: [frontend, react, quality, testing, tdd, coverage, vitest, react-testing-library, msw, implementation]
214
- typical-use: "React component testing, React Testing Library tests, MSW API mocking, frontend test creation"
213
+ frontend-typescript-testing:
214
+ skill: "frontend-typescript-testing"
215
+ tags: [frontend, react, quality, testing, tdd, coverage, vitest, react-testing-library, msw, implementation, playwright, e2e]
216
+ typical-use: "React component testing, React Testing Library tests, MSW API mocking, frontend test creation, Playwright E2E testing"
215
217
  size: small
216
218
  key-references:
217
219
  - "React Testing Library - Kent C. Dodds"
@@ -219,15 +221,17 @@ skills:
219
221
  - "Test-Driven Development - Kent Beck"
220
222
  - "Red-Green-Refactor - Kent Beck"
221
223
  - "User-Observable Behavior Testing - Testing Library"
224
+ - "references/e2e.md - Playwright E2E patterns"
222
225
  sections:
226
+ - "References"
223
227
  - "Test Framework"
224
228
  - "Basic Testing Policy"
225
229
  - "Test Implementation Conventions"
226
230
  - "Mock Type Safety Enforcement"
227
231
  - "Basic React Testing Library Example"
228
232
 
229
- frontend/technical-spec:
230
- skill: "frontend/technical-spec"
233
+ frontend-technical-spec:
234
+ skill: "frontend-technical-spec"
231
235
  tags: [frontend, react, vite, architecture, design, environment, data-flow, implementation, performance]
232
236
  typical-use: "React technical design, Vite configuration, frontend environment setup, component architecture decisions"
233
237
  size: medium
@@ -59,10 +59,11 @@ Use the appropriate run command based on the `packageManager` field in package.j
59
59
  Quality checks are mandatory upon implementation completion:
60
60
 
61
61
  **Phase 1-3: Code Quality Checks**
62
- - `check` - Biome (lint + format)
63
- - `check:unused` - Detect unused exports
64
- - `check:deps` - Detect circular dependencies
65
- - `build` - TypeScript build
62
+ - Auto-detect and execute the following from package.json scripts:
63
+ - lint + format check
64
+ - Detect unused exports
65
+ - Detect circular dependencies
66
+ - TypeScript build
66
67
 
67
68
  **Phase 4: Tests**
68
69
  - `test` - Test execution
@@ -9,7 +9,8 @@ description: PRD、ADR、Design Doc、作業計画書の作成を支援。テン
9
9
 
10
10
  | 条件 | 必要ドキュメント | 作成順序 |
11
11
  |-----|--------------|---------|
12
- | 新機能追加 | PRD → [ADR] → Design Doc → 作業計画書 | PRD承認後 |
12
+ | 新機能追加(バックエンド) | PRD → [ADR] → Design Doc → 作業計画書 | PRD承認後 |
13
+ | 新機能追加(フロントエンド/フルスタック) | PRD → **UI Spec** → [ADR] → Design Doc → 作業計画書 | Design Doc前にUI Spec |
13
14
  | ADR条件該当(下記参照) | ADR → Design Doc → 作業計画書 | 即座に開始 |
14
15
  | 6ファイル以上 | ADR → Design Doc → 作業計画書(必須) | 即座に開始 |
15
16
  | 3-5ファイル | Design Doc → 作業計画書(推奨) | 即座に開始 |
@@ -79,6 +80,37 @@ description: PRD、ADR、Design Doc、作業計画書の作成を支援。テン
79
80
  - 具体的なコード例(→Design Doc)
80
81
  - 担当者の割り当て(→作業計画書)
81
82
 
83
+ ### UI Spec
84
+
85
+ **目的**: フロントエンド機能のUI構造、画面遷移、コンポーネント分解、インタラクション設計を定義
86
+
87
+ **含むもの**:
88
+ - 画面リストと遷移条件
89
+ - 状態×表示マトリクスを含むコンポーネント分解(default/loading/empty/error/partial)
90
+ - PRD受入条件にリンクしたインタラクション定義(EARS形式)
91
+ - プロトタイプ管理(コードベースのプロトタイプは添付扱い、正式な仕様ではない)
92
+ - PRDから画面/コンポーネントへのACトレーサビリティ
93
+ - 既存コンポーネント再利用マップとデザイントークン
94
+ - ビジュアル受入条件(AC)(ゴールデンステート、レイアウト制約)
95
+ - アクセシビリティ要件(キーボード、スクリーンリーダー、コントラスト)
96
+
97
+ **含まないもの**:
98
+ - 技術実装詳細(→ Design Doc)
99
+ - APIコントラクトとデータレイヤー設計(→ Design Doc)
100
+ - テスト実装(→ Design Docのテスト戦略)
101
+ - 実装スケジュール(→ 作業計画書)
102
+
103
+ **必須構造要素**:
104
+ - 状態×表示マトリクスとインタラクション表を含むコンポーネントが1つ以上
105
+ - PRD ACを画面/状態にマッピングするACトレーサビリティ表
106
+ - 遷移条件付きの画面リスト
107
+ - 既存コンポーネント再利用マップ(再利用/拡張/新規の判定)
108
+
109
+ **プロトタイプコードの取り扱い**:
110
+ - ユーザー提供のプロトタイプコードは`docs/ui-spec/assets/{feature-name}/`に配置
111
+ - プロトタイプはUI Specの添付であり、正式な仕様ではない
112
+ - UI Spec + Design Docが正式な仕様
113
+
82
114
  ### Design Document
83
115
 
84
116
  **目的**: 技術的実装方法を詳細定義
@@ -159,6 +191,8 @@ description: PRD、ADR、Design Doc、作業計画書の作成を支援。テン
159
191
  |------------|-----|---------|------------|
160
192
  | PRD | `docs/prd/` | `[機能名]-prd.md` | `prd-template.md` |
161
193
  | ADR | `docs/adr/` | `ADR-[4桁]-[タイトル].md` | `adr-template.md` |
194
+ | UI Spec | `docs/ui-spec/` | `[機能名]-ui-spec.md` | `ui-spec-template.md` |
195
+ | UI Specアセット | `docs/ui-spec/assets/{feature-name}/` | プロトタイプコードファイル | - |
162
196
  | Design Doc | `docs/design/` | `[機能名]-design.md` | `design-template.md` |
163
197
  | 作業計画書 | `docs/plans/` | `YYYYMMDD-{type}-{description}.md` | `plan-template.md` |
164
198
  | タスクファイル | `docs/plans/tasks/` | `{plan-name}-task-{number}.md` | `task-template.md` |
@@ -181,6 +215,7 @@ description: PRD、ADR、Design Doc、作業計画書の作成を支援。テン
181
215
  |------------|---------|-----|
182
216
  | PRD | ユーザージャーニー図、スコープ境界図 | ユーザー体験と範囲の明確化 |
183
217
  | ADR | 選択肢比較図(必要時) | トレードオフの視覚化 |
218
+ | UI Spec | 画面遷移図、コンポーネントツリー図 | 画面フローとコンポーネント構造の明確化 |
184
219
  | Design Doc | アーキテクチャ図、データフロー図 | 技術構造の理解 |
185
220
  | 作業計画書 | フェーズ構成図、タスク依存関係図 | 実装順序の明確化 |
186
221
 
@@ -198,3 +233,4 @@ description: PRD、ADR、Design Doc、作業計画書の作成を支援。テン
198
233
  - [作業計画書テンプレート](references/plan-template.md)
199
234
  - [ADRテンプレート](references/adr-template.md)
200
235
  - [タスクファイルテンプレート](references/task-template.md)
236
+ - [UI Specテンプレート](references/ui-spec-template.md)
@@ -4,6 +4,10 @@
4
4
 
5
5
  [この機能の目的と概要を2-3文で説明]
6
6
 
7
+ ### 参照UI Spec(フロントエンド機能を含む場合)
8
+ - UI Specパス: [docs/ui-spec/xxx-ui-spec.md]
9
+ - コンポーネント構造と状態設計はUI Specから継承
10
+
7
11
  ## 設計サマリー(メタ)
8
12
 
9
13
  ```yaml
@@ -196,6 +200,26 @@ unknowns:
196
200
  - [常に成立しなければならない条件]
197
201
  - [有効な状態遷移の制約]
198
202
 
203
+ ### UIエラー状態設計(フロントエンド機能を含む場合)
204
+
205
+ | コンポーネント/画面 | Loading | Empty | Error | Partial |
206
+ |-------------------|---------|-------|-------|---------|
207
+ | [コンポーネント名] | [スケルトン/スピナー] | [Empty状態 + CTA] | [エラーメッセージ + リトライ] | [キャッシュ表示 + バナー] |
208
+
209
+ ### クライアント状態設計(フロントエンド機能を含む場合)
210
+
211
+ | 状態カテゴリ | 状態 | 管理方法 | 同期戦略 |
212
+ |------------|------|---------|---------|
213
+ | サーバー状態 | [取得データ] | [キャッシュライブラリ/カスタムフック] | [ポーリング/WebSocket/手動更新] |
214
+ | UIローカル状態 | [モーダル開閉、タブ選択] | [useState/useReducer] | - |
215
+ | 一時状態 | [フォーム入力、下書き] | [useState/フォームライブラリ] | [自動保存/手動保存] |
216
+
217
+ ### UIアクション - APIコントラクトマッピング(フロントエンド機能を含む場合)
218
+
219
+ | UIアクション | APIエンドポイント | リクエスト | レスポンス | エラーコントラクト |
220
+ |------------|----------------|-----------|----------|-----------------|
221
+ | [ボタンクリック/フォーム送信] | [POST /api/xxx] | [リクエストボディフィールド] | [レスポンスフィールド] | [エラーコードとUI処理] |
222
+
199
223
  ### エラーハンドリング
200
224
 
201
225
  [エラーの種類とその処理方法]
@@ -60,6 +60,12 @@
60
60
  ### スケーラビリティ
61
61
  - [将来のスケーリングに関する考慮事項]
62
62
 
63
+ ### アクセシビリティ(UI機能を含む場合)
64
+ - 準拠基準: [デフォルト: WCAG 2.1 AA(組織基準があればそれを使用)]
65
+ - 対象支援技術: [スクリーンリーダー、キーボード操作、音声制御等]
66
+ - プラットフォーム要件: [例: アプリストア審査要件]
67
+ - 既知の制約: [例: 外部ライブラリの制限]
68
+
63
69
  ## 成功基準
64
70
 
65
71
  ### 定量的指標
@@ -71,6 +77,10 @@
71
77
  1. [ユーザー体験の指標1]
72
78
  2. [ユーザー体験の指標2]
73
79
 
80
+ ### UI品質指標(UI機能を含む場合)
81
+ 1. [主要操作完了率 / エラー回復率 / リトライ成功率]
82
+ 2. [アクセシビリティ監査目標スコア]
83
+
74
84
  ## 技術的考慮事項
75
85
 
76
86
  ### 依存関係
@@ -0,0 +1,145 @@
1
+ # [機能名] UI仕様書
2
+
3
+ ## 概要
4
+
5
+ [このUI仕様書の目的とスコープを2-3文で説明]
6
+
7
+ ### 対象PRD
8
+ - PRDパス: [docs/prd/xxx-prd.md | "N/A — requirement-analyzerの出力に基づく"]
9
+ - 機能スコープ: [このUI SpecがカバーするPRD要件 | 分析済み要件の概要]
10
+
11
+ ### 設計ソース
12
+ | ソース | パス | バージョン |
13
+ |--------|------|-----------|
14
+ | プロトタイプコード | [docs/ui-spec/assets/xxx/] | [コミットSHA / タグ] |
15
+
16
+ ## プロトタイプ管理
17
+
18
+ プロトタイプコードはこのUI Specの**添付資料**です。正式な仕様は常にこのドキュメント + Design Docです。
19
+
20
+ - **添付パス**: [docs/ui-spec/assets/{feature-name}/]
21
+ - **バージョン識別**: [コミットSHA / タグ]
22
+ - **準拠前提**: [例: デザインシステム準拠、コンポーネントライブラリ使用]
23
+ - **正式な仕様との関係**: プロトタイプとこの仕様の差異がある場合、このドキュメントを優先。プロトタイプは視覚的・動作的な参考資料としてのみ機能。
24
+
25
+ ## ACトレーサビリティ(プロトタイプ)
26
+
27
+ PRDの受入条件をプロトタイプの参照先にマッピング。プロトタイプが提供されていない場合はこのセクションを省略。
28
+
29
+ | AC ID | AC概要 | 画面 / 状態 | プロトタイプ参照先(要素ID / パス) | 採用判定 |
30
+ |-------|--------|------------|----------------------------------|---------|
31
+ | AC-01 | [EARS AC概要] | [画面名 / 状態名] | [要素またはファイルの参照先] | 採用 / 不採用 / 保留 |
32
+
33
+ ## 画面リストと遷移
34
+
35
+ ### 画面リスト
36
+
37
+ | 画面ID | 画面名 | 説明 | 入場条件 |
38
+ |--------|-------|------|---------|
39
+ | S-01 | [画面名] | [目的] | [ユーザーがこの画面に到達する方法] |
40
+
41
+ ### 遷移条件
42
+
43
+ | 遷移元 | 遷移先 | トリガー | ガード条件 |
44
+ |--------|-------|---------|-----------|
45
+ | S-01 | S-02 | [ユーザーアクション] | [前提条件(ある場合)] |
46
+
47
+ ## コンポーネント分解
48
+
49
+ ### コンポーネントツリー
50
+
51
+ ```
52
+ [ページ/画面]
53
+ +-- [コンテナコンポーネント]
54
+ | +-- [プレゼンテーショナルコンポーネントA]
55
+ | +-- [プレゼンテーショナルコンポーネントB]
56
+ +-- [コンテナコンポーネント]
57
+ +-- [プレゼンテーショナルコンポーネントC]
58
+ ```
59
+
60
+ ### コンポーネント: [ComponentName]
61
+
62
+ #### 状態×表示マトリクス
63
+
64
+ | 状態 | デフォルト | ローディング | Empty | エラー | 部分表示 |
65
+ |------|----------|------------|-------|-------|---------|
66
+ | 表示 | [通常表示] | [スケルトン / スピナー] | [Empty状態 + CTA] | [エラーメッセージ + 回復アクション] | [キャッシュ / 部分表示] |
67
+
68
+ #### インタラクション定義
69
+
70
+ | AC ID | EARS条件 | ユーザーアクション | システムレスポンス | 状態遷移 | エラーハンドリング |
71
+ |-------|---------|-----------------|------------------|---------|-----------------|
72
+ | AC-01 | When [トリガー] | [クリック / 入力 / 等] | [期待される動作] | [遷移元状態 → 遷移先状態] | [リトライ / リセット / フォールバック] |
73
+
74
+ ### コンポーネント: [ComponentName2]
75
+
76
+ [各コンポーネントについて状態×表示マトリクスとインタラクション定義を繰り返す]
77
+
78
+ ## デザイントークンとコンポーネントマップ
79
+
80
+ ### 環境制約
81
+ - 対象ブラウザ: [例: Chrome 120+, Safari 17+]
82
+ - レスポンシブBreakpoint: [例: 768px, 1024px, 1280px]
83
+ - テーマ対応: [例: ライト/ダーク、システム設定に追従]
84
+
85
+ ### 既存コンポーネント再利用マップ
86
+
87
+ | UI要素 | 判定 | 既存コンポーネント | 備考 |
88
+ |--------|------|------------------|------|
89
+ | [ボタン] | 再利用 | [components/ui/Button] | [修正不要] |
90
+ | [データテーブル] | 拡張 | [components/ui/Table] | [ソート機能を追加] |
91
+ | [機能カード] | 新規 | - | [類似コンポーネントなし] |
92
+
93
+ ### デザイントークン
94
+
95
+ | トークン | 値 | 用途 |
96
+ |---------|-----|------|
97
+ | [color-primary] | [値] | [プライマリアクション] |
98
+ | [spacing-md] | [値] | [コンポーネント間隔] |
99
+
100
+ ## ビジュアル受入条件
101
+
102
+ ### ゴールデンステート
103
+ 受入基準となる主要なビジュアル状態を定義:
104
+
105
+ 1. **[状態名]**: [視覚的に確認すべき内容の説明]
106
+ 2. **[状態名]**: [説明]
107
+
108
+ ### レイアウト制約
109
+ - [最小/最大の幅・高さ制約]
110
+ - [コンポーネント間のスペーシングルール]
111
+ - [オーバーフロー時の挙動]
112
+
113
+ ## アクセシビリティ要件
114
+
115
+ ### キーボードナビゲーション
116
+
117
+ | コンポーネント | タブ順序 | キーバインド | 挙動 |
118
+ |-------------|---------|------------|------|
119
+ | [コンポーネント] | [順序番号] | [Enter / Space / Arrow] | [期待される動作] |
120
+
121
+ ### スクリーンリーダー
122
+
123
+ | コンポーネント | ロール | アクセシブル名 | ライブリージョン |
124
+ |-------------|--------|-------------|---------------|
125
+ | [コンポーネント] | [ARIAロール] | [aria-label / aria-labelledby] | [polite / assertive / none] |
126
+
127
+ ### コントラスト要件
128
+
129
+ | 要素 | 前景色 | 背景色 | 目標比率 |
130
+ |------|-------|-------|---------|
131
+ | [テキスト要素] | [色] | [色] | [通常テキスト4.5:1 / 大テキスト3:1] |
132
+
133
+ ## 未確定事項
134
+
135
+ | ID | 説明 | 担当者 | 期限 |
136
+ |----|------|-------|------|
137
+ | TBD-01 | [未解決の質問や決定事項] | [解決担当者] | [目標日] |
138
+
139
+ *すべてのTBDには担当者と期限が必要。Design Doc作成前に解決すること。*
140
+
141
+ ## 更新履歴
142
+
143
+ | 日付 | バージョン | 変更内容 | 作成者 |
144
+ |------|-----------|---------|-------|
145
+ | YYYY-MM-DD | 1.0 | 初版作成 | [名前] |
@@ -1,5 +1,5 @@
1
1
  ---
2
- name: frontend/technical-spec
2
+ name: frontend-technical-spec
3
3
  description: フロントエンドの環境変数、コンポーネント設計、データフローを定義。React環境設定時に使用。
4
4
  ---
5
5
 
@@ -109,10 +109,10 @@ async function fetchUser(id: string): Promise<User> {
109
109
  package.jsonの`packageManager`フィールドに応じた実行コマンドを使用すること。
110
110
 
111
111
  ### ビルドコマンド
112
- - `dev` - 開発サーバー
113
- - `build` - 本番ビルド
114
- - `preview` - 本番ビルドのプレビュー
115
- - `type-check` - 型チェック(出力なし)
112
+ - package.jsonから以下に該当するスクリプトを自動検出して実行:
113
+ - 開発サーバー
114
+ - 本番ビルド
115
+ - 型チェック(出力なし)
116
116
 
117
117
  ### テストコマンド
118
118
  - `test` - テスト実行
@@ -1,5 +1,5 @@
1
1
  ---
2
- name: frontend/typescript-rules
2
+ name: frontend-typescript-rules
3
3
  description: React/TypeScriptの型安全性、コンポーネント設計、状態管理ルールを適用。Reactコンポーネント実装時に使用。
4
4
  ---
5
5
 
@@ -1,6 +1,6 @@
1
1
  ---
2
- name: frontend/typescript-testing
3
- description: React Testing LibraryMSWでテストを設計。コンポーネントテストパターンを適用。
2
+ name: frontend-typescript-testing
3
+ description: React Testing LibraryMSW、Playwright E2Eでテストを設計。コンポーネントテストとE2Eテストパターンを適用。
4
4
  ---
5
5
 
6
6
  # TypeScript テストルール(フロントエンド)
@@ -0,0 +1,185 @@
1
+ # PlaywrightによるE2Eテスト実装
2
+
3
+ ## テストフレームワーク
4
+ - **Playwright Test**: `@playwright/test`
5
+ - テストインポート: `import { test, expect } from '@playwright/test'`
6
+
7
+ ## テスト構成
8
+
9
+ ### ディレクトリ構成
10
+ ```
11
+ tests/
12
+ └── e2e/
13
+ ├── pages/ # ページオブジェクト
14
+ │ ├── login.page.ts
15
+ │ └── dashboard.page.ts
16
+ ├── fixtures/ # テストFixture
17
+ │ └── auth.fixture.ts
18
+ └── *.e2e.test.ts # テストファイル
19
+ ```
20
+
21
+ ### 命名規則
22
+ - テストファイル: `{FeatureName}.e2e.test.ts`
23
+ - ページオブジェクト: `{PageName}.page.ts`
24
+ - Fixture: `{Purpose}.fixture.ts`
25
+
26
+ ## ページオブジェクトパターン
27
+
28
+ 再利用性と保守性のためにページ操作をカプセル化:
29
+
30
+ ```typescript
31
+ import { type Page, type Locator } from '@playwright/test'
32
+
33
+ export class LoginPage {
34
+ readonly emailInput: Locator
35
+ readonly passwordInput: Locator
36
+ readonly submitButton: Locator
37
+
38
+ constructor(private page: Page) {
39
+ this.emailInput = page.getByLabel('Email')
40
+ this.passwordInput = page.getByLabel('Password')
41
+ this.submitButton = page.getByRole('button', { name: 'Sign in' })
42
+ }
43
+
44
+ async login(email: string, password: string) {
45
+ await this.emailInput.fill(email)
46
+ await this.passwordInput.fill(password)
47
+ await this.submitButton.click()
48
+ }
49
+ }
50
+ ```
51
+
52
+ ## テストパターン
53
+
54
+ ### 基本テスト
55
+ ```typescript
56
+ import { test, expect } from '@playwright/test'
57
+
58
+ test('ログイン後にダッシュボードに遷移できる', async ({ page }) => {
59
+ // Arrange
60
+ await page.goto('/login')
61
+
62
+ // Act
63
+ await page.getByLabel('Email').fill('user@example.com')
64
+ await page.getByLabel('Password').fill('password')
65
+ await page.getByRole('button', { name: 'Sign in' }).click()
66
+
67
+ // Assert
68
+ await expect(page).toHaveURL('/dashboard')
69
+ await expect(page.getByRole('heading', { name: 'Dashboard' })).toBeVisible()
70
+ })
71
+ ```
72
+
73
+ ### ページオブジェクト使用
74
+ ```typescript
75
+ import { test, expect } from '@playwright/test'
76
+ import { LoginPage } from './pages/login.page'
77
+ import { DashboardPage } from './pages/dashboard.page'
78
+
79
+ test('購入フローを完了できる', async ({ page }) => {
80
+ const loginPage = new LoginPage(page)
81
+ const dashboardPage = new DashboardPage(page)
82
+
83
+ await page.goto('/login')
84
+ await loginPage.login('user@example.com', 'password')
85
+ await expect(dashboardPage.heading).toBeVisible()
86
+ })
87
+ ```
88
+
89
+ ### 認証Fixture
90
+ ```typescript
91
+ import { test as base } from '@playwright/test'
92
+
93
+ export const test = base.extend<{ authenticatedPage: Page }>({
94
+ authenticatedPage: async ({ page }, use) => {
95
+ await page.goto('/login')
96
+ await page.getByLabel('Email').fill('user@example.com')
97
+ await page.getByLabel('Password').fill('password')
98
+ await page.getByRole('button', { name: 'Sign in' }).click()
99
+ await page.waitForURL('/dashboard')
100
+ await use(page)
101
+ },
102
+ })
103
+ ```
104
+
105
+ ## Locator戦略
106
+
107
+ アクセシブルなLocatorを以下の優先順位で使用:
108
+ 1. `page.getByRole()` — アクセシビリティに最適
109
+ 2. `page.getByLabel()` — フォーム要素
110
+ 3. `page.getByText()` — 表示テキスト
111
+ 4. `page.getByTestId()` — 最終手段
112
+
113
+ ```typescript
114
+ // 推奨
115
+ await page.getByRole('button', { name: 'Submit' }).click()
116
+
117
+ // 非推奨
118
+ await page.locator('#submit-btn').click()
119
+ await page.locator('.btn-primary').click()
120
+ ```
121
+
122
+ ## Assertion
123
+
124
+ ```typescript
125
+ // 表示確認
126
+ await expect(page.getByText('Success')).toBeVisible()
127
+ await expect(page.getByText('Error')).not.toBeVisible()
128
+
129
+ // ナビゲーション
130
+ await expect(page).toHaveURL('/dashboard')
131
+ await expect(page).toHaveTitle('Dashboard')
132
+
133
+ // 要素状態
134
+ await expect(page.getByRole('button')).toBeEnabled()
135
+ await expect(page.getByRole('button')).toBeDisabled()
136
+
137
+ // コンテンツ
138
+ await expect(page.getByRole('heading')).toHaveText('Welcome')
139
+ ```
140
+
141
+ ## Viewportテスト
142
+
143
+ UI Specでレスポンシブ動作が定義されている場合:
144
+
145
+ ```typescript
146
+ test.describe('レスポンシブナビゲーション', () => {
147
+ test('モバイルでハンバーガーメニューを表示', async ({ page }) => {
148
+ await page.setViewportSize({ width: 375, height: 667 })
149
+ await page.goto('/')
150
+ await expect(page.getByRole('button', { name: 'Menu' })).toBeVisible()
151
+ await expect(page.getByRole('navigation')).not.toBeVisible()
152
+ })
153
+
154
+ test('デスクトップでフルナビゲーションを表示', async ({ page }) => {
155
+ await page.setViewportSize({ width: 1280, height: 720 })
156
+ await page.goto('/')
157
+ await expect(page.getByRole('navigation')).toBeVisible()
158
+ })
159
+ })
160
+ ```
161
+
162
+ ## テスト分離
163
+
164
+ - 各テストはクリーンなブラウザコンテキストから開始
165
+ - テスト間で状態を共有しない
166
+ - 共通セットアップ(認証、ナビゲーション)には`beforeEach`を使用
167
+ - セットアップステップではテスト内ナビゲーションより`page.goto()`を優先
168
+
169
+ ## スケルトンコメント形式
170
+
171
+ E2Eテストスケルトンは統合テストと同じアノテーション形式に従う:
172
+
173
+ ```typescript
174
+ // AC: [元の受入条件テキスト]
175
+ // Behavior: [ユーザーアクション] → [システムレスポンス] → [観測可能な結果]
176
+ // @category: e2e
177
+ // @dependency: full-system
178
+ // @complexity: high
179
+ // ROI: [スコア]
180
+ test('AC1: [説明]', async ({ page }) => {
181
+ // Arrange: [セットアップの説明]
182
+ // Act: [操作の説明]
183
+ // Assert: [検証の説明]
184
+ })
185
+ ```
@@ -5,6 +5,10 @@ description: 統合テストとE2Eテストを設計。モック境界と振る
5
5
 
6
6
  # 統合テスト・E2Eテスト設計・実装ルール
7
7
 
8
+ ## References
9
+
10
+ - **[references/e2e-design.md](references/e2e-design.md)** — E2Eテスト設計原則(候補ソース、選定基準、UI Specからのマッピング)
11
+
8
12
  ## テスト種別と上限
9
13
 
10
14
  | 種別 | 目的 | ファイル形式 | 上限 |