create-ai-project 1.20.9 → 1.22.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 (62) hide show
  1. package/.claude/agents-en/acceptance-test-generator.md +112 -50
  2. package/.claude/agents-en/task-decomposer.md +40 -4
  3. package/.claude/agents-en/ui-spec-designer.md +2 -0
  4. package/.claude/agents-en/work-planner.md +98 -29
  5. package/.claude/agents-ja/acceptance-test-generator.md +113 -49
  6. package/.claude/agents-ja/task-decomposer.md +44 -8
  7. package/.claude/agents-ja/ui-spec-designer.md +2 -0
  8. package/.claude/agents-ja/work-planner.md +96 -29
  9. package/.claude/commands-en/add-integration-tests.md +8 -0
  10. package/.claude/commands-en/build.md +75 -23
  11. package/.claude/commands-en/front-build.md +56 -25
  12. package/.claude/commands-en/front-plan.md +7 -6
  13. package/.claude/commands-en/front-review.md +81 -19
  14. package/.claude/commands-en/implement.md +36 -5
  15. package/.claude/commands-en/plan.md +9 -8
  16. package/.claude/commands-en/prepare-implementation.md +191 -0
  17. package/.claude/commands-en/project-inject.md +84 -56
  18. package/.claude/commands-en/review.md +79 -20
  19. package/.claude/commands-ja/add-integration-tests.md +8 -0
  20. package/.claude/commands-ja/build.md +77 -25
  21. package/.claude/commands-ja/front-build.md +59 -28
  22. package/.claude/commands-ja/front-plan.md +8 -7
  23. package/.claude/commands-ja/front-review.md +81 -19
  24. package/.claude/commands-ja/implement.md +36 -5
  25. package/.claude/commands-ja/plan.md +10 -9
  26. package/.claude/commands-ja/prepare-implementation.md +191 -0
  27. package/.claude/commands-ja/project-inject.md +84 -56
  28. package/.claude/commands-ja/review.md +79 -20
  29. package/.claude/skills-en/documentation-criteria/references/plan-template.md +22 -0
  30. package/.claude/skills-en/documentation-criteria/references/ui-spec-template.md +2 -0
  31. package/.claude/skills-en/frontend-typescript-testing/references/e2e.md +81 -7
  32. package/.claude/skills-en/integration-e2e-testing/SKILL.md +48 -23
  33. package/.claude/skills-en/integration-e2e-testing/references/e2e-design.md +31 -13
  34. package/.claude/skills-en/project-context/SKILL.md +2 -15
  35. package/.claude/skills-en/project-context/references/external-resources-api.md +76 -0
  36. package/.claude/skills-en/project-context/references/external-resources-backend.md +76 -0
  37. package/.claude/skills-en/project-context/references/external-resources-frontend.md +74 -0
  38. package/.claude/skills-en/project-context/references/external-resources-infra.md +76 -0
  39. package/.claude/skills-en/project-context/references/template.md +154 -0
  40. package/.claude/skills-en/subagents-orchestration-guide/SKILL.md +36 -14
  41. package/.claude/skills-en/task-analyzer/references/skills-index.yaml +0 -5
  42. package/.claude/skills-ja/documentation-criteria/references/plan-template.md +22 -0
  43. package/.claude/skills-ja/documentation-criteria/references/ui-spec-template.md +2 -0
  44. package/.claude/skills-ja/frontend-typescript-testing/references/e2e.md +81 -7
  45. package/.claude/skills-ja/integration-e2e-testing/SKILL.md +48 -23
  46. package/.claude/skills-ja/integration-e2e-testing/references/e2e-design.md +31 -13
  47. package/.claude/skills-ja/project-context/SKILL.md +2 -15
  48. package/.claude/skills-ja/project-context/references/external-resources-api.md +76 -0
  49. package/.claude/skills-ja/project-context/references/external-resources-backend.md +76 -0
  50. package/.claude/skills-ja/project-context/references/external-resources-frontend.md +74 -0
  51. package/.claude/skills-ja/project-context/references/external-resources-infra.md +76 -0
  52. package/.claude/skills-ja/project-context/references/template.md +154 -0
  53. package/.claude/skills-ja/subagents-orchestration-guide/SKILL.md +36 -14
  54. package/.claude/skills-ja/task-analyzer/references/skills-index.yaml +0 -5
  55. package/.husky/pre-commit +1 -0
  56. package/CHANGELOG.md +55 -6
  57. package/README.ja.md +3 -2
  58. package/README.md +3 -2
  59. package/docs/guides/en/use-cases.md +18 -3
  60. package/docs/guides/ja/use-cases.md +18 -3
  61. package/package.json +2 -1
  62. package/scripts/check-skills-index.mjs +173 -0
@@ -0,0 +1,76 @@
1
+ # Infrastructure External Resource Axes
2
+
3
+ Hearing axes for deployment, environment configuration, or infrastructure-as-code work. `/project-inject` loads this file when the user selects the Infrastructure domain.
4
+
5
+ ## Axis 1: IaC Source
6
+
7
+ The canonical source of infrastructure definitions.
8
+
9
+ **AskUserQuestion choices**:
10
+ - Terraform configuration in the repository
11
+ - Pulumi or CDK code in the repository
12
+ - Kubernetes manifests / Helm charts in the repository
13
+ - Cloud-provider-native templates (e.g., CloudFormation, Bicep, Deployment Manager)
14
+ - Manual console configuration (no IaC)
15
+ - Not applicable
16
+
17
+ **Follow-up (when the axis is present)**: Capture two fields:
18
+ - **Location**: directory path.
19
+ - **Access method**: CI pipeline name when plan/apply runs automatically, or CLI command when an operator runs it manually.
20
+
21
+ ## Axis 2: Environment Configuration
22
+
23
+ How per-environment settings (development, staging, production) differ.
24
+
25
+ **AskUserQuestion choices**:
26
+ - Per-environment configuration files in the repository (e.g., `terraform/envs/`, `config/staging.yaml`)
27
+ - Environment variables managed by the deployment platform
28
+ - Workspace or stack abstraction in the IaC tool itself
29
+ - Single shared configuration (no per-environment differences)
30
+ - Not applicable
31
+
32
+ **Follow-up (when the axis is present)**: Capture two fields:
33
+ - **Location**: configuration file paths, platform setting names, or workspace identifiers where environment-specific values are stored.
34
+ - **Access method**: file read, platform console URL, or CLI command.
35
+
36
+ When multiple environments are tracked separately (development, staging, production), capture each as a separate entry per the multiple-instance rule in `template.md`, using the environment name as the disambiguating suffix.
37
+
38
+ ## Axis 3: Secrets in Infrastructure
39
+
40
+ How infrastructure code references secrets while keeping their values out of source control.
41
+
42
+ **AskUserQuestion choices**:
43
+ - Secrets sourced from a secret manager via IaC data lookup
44
+ - Secrets injected at apply time via environment variables
45
+ - Encrypted secret files committed alongside IaC
46
+ - No secrets in infrastructure
47
+ - Not applicable
48
+
49
+ **Follow-up (when the axis is present)**: Capture two fields:
50
+ - **Location**: secret manager service name or IaC data source identifier.
51
+ - **Access method**: data lookup syntax, environment variable name, or apply-time injection mechanism.
52
+
53
+ When the same secret store appears in the Backend domain, render this axis as a cross-axis reference back to that location (notation defined in `template.md`).
54
+
55
+ ## Axis 4: Deployment Trigger
56
+
57
+ How infrastructure and application changes reach environments.
58
+
59
+ **AskUserQuestion choices**:
60
+ - CI pipeline triggered on merge to a specific branch
61
+ - Manual approval step in CI
62
+ - Local apply by an operator
63
+ - Deployment platform's auto-deploy on push
64
+ - Not applicable
65
+
66
+ **Follow-up (when the axis is present)**: Capture two fields:
67
+ - **Location**: CI pipeline name or deployment platform identifier.
68
+ - **Access method**: branch / tag convention that triggers each environment, plus any required manual approval step.
69
+
70
+ ## Self-Declaration Phase
71
+
72
+ After the four structured axes, ask once: "Are there any other infrastructure external resources this project depends on beyond what the structured questions covered? List each in your next message, or reply 'none'."
73
+
74
+ Capture free-form answers under the "Additional Resources" subsection of the Infrastructure block. Run this phase even when every structured axis returned "Not applicable".
75
+
76
+ Examples of resources that surface only via self-declaration: state-storage backend for IaC tools, runbook documents for incident response, on-call rotation, observability dashboards, cost monitoring tools, compliance / audit logging targets.
@@ -0,0 +1,154 @@
1
+ # Project Context Section Catalog
2
+
3
+ This file is the section catalog used by `/project-inject`. Consumer agents load `SKILL.md` only; this file is loaded only during update operations.
4
+
5
+ ## Section Index
6
+
7
+ | Section | Inclusion Rule | Source of Hearing Questions |
8
+ |---------|----------------|-----------------------------|
9
+ | Project Overview | Always include | This file (below) |
10
+ | Domain Constraints | Include when at least one rule changes AI decisions | This file (below) |
11
+ | Development Phase | Include when phase materially changes AI behavior (e.g., suppresses test scaffolding for prototype) | This file (below) |
12
+ | Directory Conventions | Include when non-obvious file placement rules exist | This file (below) |
13
+ | External Resources | Include when the project depends on resources outside the repository (design source, schema source, secret store, IaC source, etc.) | `external-resources-{frontend,backend,api,infra}.md` (load only the domains relevant to the project) |
14
+
15
+ ## Section Definitions
16
+
17
+ ### Project Overview
18
+
19
+ **Inclusion**: Always.
20
+
21
+ **Hearing**:
22
+ - AskUserQuestion 1: "What does this project do? (1–2 sentences)"
23
+ - AskUserQuestion 2: "What domain does it belong to?" with concrete option examples drawn from common categories (e.g., developer tooling, fintech, healthcare, e-commerce, internal platform). Always include "Other".
24
+
25
+ **Output structure**:
26
+ ```markdown
27
+ ## Project Overview
28
+ - **What this project does**: <one to two sentences>
29
+ - **Domain**: <domain>
30
+ ```
31
+
32
+ ### Domain Constraints
33
+
34
+ **Inclusion**: Include when at least one constraint, if ignored, would cause a bug or compliance failure.
35
+
36
+ **Hearing**:
37
+ - AskUserQuestion: "Are there domain-specific rules that AI must follow when making decisions in this project?" Options: "Yes, I will list them" / "No, no domain constraints apply".
38
+ - When "Yes": for each rule (cap at 3), capture the rule statement plus a measurable check. Accept statements only when they evaluate as pass/fail; reframe subjective phrasings into measurable form (e.g., turn "be careful with PII" into "log output uses anonymized patient IDs").
39
+ - Adapt example phrasings to the domain captured in Project Overview (e.g., for fintech: "every monetary mutation appends an audit log entry"; for developer tooling: "generated code keeps lockfile commands invocable").
40
+
41
+ **Output structure** (omit the section entirely when zero constraints):
42
+ ```markdown
43
+ ## Domain Constraints
44
+ 1. <measurable rule 1>
45
+ 2. <measurable rule 2>
46
+ 3. <measurable rule 3>
47
+ ```
48
+
49
+ ### Development Phase
50
+
51
+ **Inclusion**: Include when phase materially changes AI behavior. Skip when behavior is identical across phases.
52
+
53
+ **Hearing**:
54
+ - AskUserQuestion: "Which phase is this project in?" Options: "Prototype", "Production", "In operation", "No meaningful difference between phases".
55
+ - When "No meaningful difference": omit the section.
56
+
57
+ **Output structure**:
58
+ ```markdown
59
+ ## Development Phase
60
+ - **Phase**: <Prototype | Production | In operation>
61
+ ```
62
+
63
+ ### Directory Conventions
64
+
65
+ **Inclusion**: Include when at least one file placement rule is non-obvious from the repository structure (i.e., a contributor reading the tree would guess wrong).
66
+
67
+ **Hearing**:
68
+ - AskUserQuestion: "Are there file placement rules that AI should follow?" Options: "Yes" / "No".
69
+ - When "Yes": capture each rule as a single line stating the trigger and the destination (e.g., "Temporary working files: place under `./tmp/` and remove on completion").
70
+
71
+ **Output structure** (omit the section entirely when zero rules):
72
+ ```markdown
73
+ ## Directory Conventions
74
+ - <rule 1>
75
+ - <rule 2>
76
+ ```
77
+
78
+ ### External Resources
79
+
80
+ **Inclusion**: Include the section when at least one selected domain has a present axis OR a non-empty self-declaration. Otherwise omit the section.
81
+
82
+ **Hearing routing**:
83
+ - AskUserQuestion: "Which external-resource domains apply to this project?" Multi-select options:
84
+ - Frontend (design source, design system, guidelines, visual verification environment)
85
+ - Backend (database schema, migration history, secret store, background jobs)
86
+ - API contract (schema source, mocks, authentication, schema change process)
87
+ - Infrastructure (IaC source, environment configuration, infrastructure secrets, deployment trigger)
88
+ - None apply
89
+ - For each selected domain, load the matching reference file using the slug map below and run its hearing protocol.
90
+
91
+ **Domain to file slug mapping**:
92
+ | Domain (user-facing label) | Reference file |
93
+ |---------------------------|----------------|
94
+ | Frontend | `external-resources-frontend.md` |
95
+ | Backend | `external-resources-backend.md` |
96
+ | API contract | `external-resources-api.md` |
97
+ | Infrastructure | `external-resources-infra.md` |
98
+
99
+ **Hearing protocol** (per domain reference): each reference defines structured axes plus a self-declaration phase. The structured phase asks one AskUserQuestion per axis, offering "Not applicable" as one explicit choice. The self-declaration phase always runs once, asking for free-form additions, regardless of how the structured choices landed.
100
+
101
+ **Per-axis output schema** (3 fields):
102
+ ```markdown
103
+ #### <Axis name>
104
+ - Source type: <verbatim text of the AskUserQuestion choice the user selected>
105
+ - Location: <URL | file path | service or package name>
106
+ - Access method: <WebFetch | file read | MCP server name | CLI command | manual procedure>
107
+ ```
108
+
109
+ **Axis output rules**:
110
+
111
+ 1. **Axis output is conditional on whether the schema can be filled.** Render the axis block when the user's choice points to an external resource with identifiable **Location** and **Access method** values. The following choices produce zero output lines for that axis:
112
+ - Listed absence-declaring choices: "Not applicable", "No <resource>", "No <resource> required", "No documented <resource>", "Ad-hoc <resource>", "Manual <process> (no <resource>)".
113
+ - Any other choice whose Location and Access method values resolve to blank.
114
+
115
+ 2. **Multiple instances within one axis** (e.g., primary and analytics databases, separate guideline files for CSS and accessibility) — repeat the axis block with a disambiguating suffix:
116
+ ```markdown
117
+ #### Database Schema Source — Primary
118
+ - Source type: Schema file in the repository
119
+ - Location: prisma/schema.prisma
120
+ - Access method: file read
121
+
122
+ #### Database Schema Source — Analytics
123
+ - Source type: Database MCP server that introspects a live database
124
+ - Location: bigquery-prod
125
+ - Access method: MCP server `bigquery`
126
+ ```
127
+
128
+ 3. **Cross-axis reference** (e.g., the same secret store appears under both Backend and Infrastructure) — the first occurrence carries the canonical fields; the second occurrence renders as a reference back to it:
129
+ ```markdown
130
+ #### Secrets in Infrastructure
131
+ - Source type: Secrets sourced from a secret manager via IaC data lookup
132
+ - Reference: same store as Backend > Secret Store
133
+ - Access method: <inherited; record only differences if any>
134
+ ```
135
+
136
+ **Domain block layout**:
137
+ ```markdown
138
+ ### <Domain>
139
+
140
+ <axis blocks in catalog order, each rendered per the rules above>
141
+
142
+ #### Additional Resources
143
+
144
+ <rendered only when self-declaration captured items; placed after the last present axis within the same domain>
145
+ - <free-form description from user>
146
+ ```
147
+
148
+ ## Output Assembly Rules
149
+
150
+ After hearing completes, the calling command (`/project-inject`) assembles the configured `SKILL.md` per the order it specifies. This file owns the per-section content shape (above) and these cross-section rules:
151
+
152
+ 1. Sections marked for omission produce zero output lines. The rebuilt body advances directly to the next included section.
153
+ 2. Domain blocks within External Resources appear in catalog order (Frontend → Backend → API contract → Infrastructure), regardless of the order in which the user selected them during hearing.
154
+ 3. The Vagueness rejection rule (defined in `/project-inject` Step 3) is a hearing-time filter applied to every `add` and `update` section. The captured rules that pass the filter are written through normal section output; the filter contributes zero output lines of its own.
@@ -126,6 +126,27 @@ I repeat this cycle for each task to ensure quality.
126
126
 
127
127
  ## Structured Response Specifications
128
128
 
129
+ All subagent invocation uses the **Agent tool** with:
130
+ - `subagent_type`: Agent name (e.g., "task-executor")
131
+ - `description`: Concise task description (3-5 words)
132
+ - `prompt`: Specific instructions including deliverable paths
133
+
134
+ ### Orchestrator's Permitted Tools
135
+
136
+ The orchestrator coordinates work using only the following tools:
137
+
138
+ | Tool | Purpose |
139
+ |------|---------|
140
+ | Agent | Invoke subagents |
141
+ | AskUserQuestion | User confirmations and questions |
142
+ | TaskCreate / TaskUpdate | Progress tracking |
143
+ | Bash | Shell operations (git commit, ls, verification commands) |
144
+ | Read | Deliverable documents for information bridging between subagents |
145
+
146
+ All implementation work (Edit, Write, MultiEdit) is performed by subagents, not the orchestrator.
147
+
148
+ ### Subagent Response Format
149
+
129
150
  Subagents respond in JSON format. Key fields for orchestrator decisions:
130
151
 
131
152
  | Agent | Key Fields | Decision Logic |
@@ -138,8 +159,8 @@ Subagents respond in JSON format. Key fields for orchestrator decisions:
138
159
  | document-reviewer | approvalReady (true/false) | Proceed to next step on true; request fixes on false |
139
160
  | design-sync | sync_status (NO_CONFLICTS/CONFLICTS_FOUND) | On CONFLICTS_FOUND: present conflicts to user before proceeding |
140
161
  | integration-test-reviewer | status (approved/needs_revision/blocked), requiredFixes | On needs_revision: re-invoke the routed executor in Fix Mode with the same task_file and requiredFixes[] |
141
- | security-reviewer | status (approved/approved_with_notes/needs_revision/blocked), findings, notes, requiredFixes | On needs_revision: create a consolidated fix task file with affected files in Target Files, then invoke executor in Fix Mode with that task_file and requiredFixes[] (see build/implement recipes) |
142
- | acceptance-test-generator | status, generatedFiles (integration: path\|null, e2e: path\|null), budgetUsage, e2eAbsenceReason (null when E2E emitted, otherwise: no_multi_step_journey\|below_threshold_user_confirmed) | Verify files exist, pass to work-planner with absence reason |
162
+ | security-reviewer | status (approved/approved_with_notes/needs_revision/blocked), findings, notes, requiredFixes | On needs_revision: create a consolidated fix task file with the affected file paths from `requiredFixes[].location` populated into Target Files, then invoke the routed executor in Fix Mode with that task_file and the `requiredFixes[]` array, then quality-fixer, then re-invoke security-reviewer to verify resolution. On blocked: escalate to user with the blocking findings — fix is not within the agent layer's authority |
163
+ | acceptance-test-generator | status, generatedFiles.{integration,fixtureE2e,serviceE2e} (path\|null per lane), budgetUsage per lane, e2eAbsenceReason per E2E lane (null when emitted; reason enum is owned by acceptance-test-generator and integration-e2e-testing skill) | Verify each non-null file path exists, pass per-lane paths and absence reasons to work-planner |
143
164
 
144
165
  ### quality-fixer Blocked Handling
145
166
 
@@ -191,6 +212,15 @@ According to scale determination:
191
212
 
192
213
  Note: At Small scale the implementation step still runs through task-executor with the standard 4-step cycle (`task-executor → escalation judgment → quality-fixer → commit`). Direct orchestrator edits are not used.
193
214
 
215
+ ### Implementation Readiness Marker
216
+
217
+ For Medium / Large scale, after Batch approval the work plan carries an `Implementation Readiness:` header (work-planner emits `pending`; promotion to `ready` or `escalated` is an external orchestration concern). The marker takes one of three values:
218
+ - `pending` — initial state set by work-planner
219
+ - `ready` — readiness verification has completed with no remaining gaps; safe to start the task execution cycle
220
+ - `escalated` — readiness verification has completed but residual gaps require user judgment before execution
221
+
222
+ External orchestration owns both the producer that promotes the marker beyond `pending` and the consumer that reads it before invoking task-executor. This guide does not invoke any orchestrator above the agent layer; agents read/write the marker only when explicitly asked.
223
+
194
224
  ## Cross-Layer Orchestration
195
225
 
196
226
  When requirement-analyzer determines the feature spans multiple layers (backend + frontend) via `crossLayerScope`, the following extensions apply. Step numbers below follow the large-scale flow. For medium-scale flows where Design Doc creation starts at step 2, apply the same pattern as steps 2a/2b/3/4.
@@ -325,21 +355,13 @@ Two additional rules:
325
355
 
326
356
  #### *1 acceptance-test-generator → work-planner
327
357
 
328
- **Pass to acceptance-test-generator**:
329
- - Design Doc: [path]
330
- - UI Spec: [path] (if exists)
358
+ **Pass to acceptance-test-generator**: Design Doc path; UI Spec path (if exists).
331
359
 
332
- **Orchestrator verification items**:
333
- - Verify `generatedFiles.integration` is a valid path (when not null) and the file exists
334
- - Verify `generatedFiles.e2e` is a valid path (when not null) and the file exists
335
- - When `generatedFiles.e2e` is null, verify `e2eAbsenceReason` is present — this is intentional absence, not an error
360
+ **Orchestrator verification**: Every non-null `generatedFiles.<lane>` path exists on disk. For each null lane, `e2eAbsenceReason.<lane>` is present — this is intentional absence, not an error.
336
361
 
337
- **Pass to work-planner**:
338
- - Integration test file: [path] (create and execute simultaneously with each phase implementation)
339
- - E2E test file: [path] or null (execute only in final phase, when provided)
340
- - E2E absence reason: [reason] (when E2E is null — pass this so work-planner can skip E2E Gap Check for intentional absence)
362
+ **Pass to work-planner**: integration / fixture-e2e / service-integration-e2e file paths (or null per lane), per-lane absence reasons, plus timing guidance — integration tests are created alongside each phase implementation, fixture-e2e tests are created alongside the UI feature phase, service-integration-e2e tests are executed only in the final phase.
341
363
 
342
- **On error**: Escalate to user if integration file generation failed unexpectedly (status != completed). E2E being null with a valid absence reason is not an error.
364
+ **On error**: Escalate to user when status != completed and integration file generation failed unexpectedly. A null E2E lane with a valid absence reason is not an error.
343
365
  3. **ADR Status Management**: Update ADR status after user decision (Accepted/Rejected)
344
366
 
345
367
  ## Important Constraints
@@ -95,11 +95,6 @@ skills:
95
95
  size: small
96
96
  key-references:
97
97
  - "Project-specific (empirical)"
98
- sections:
99
- - "Project Overview"
100
- - "Domain Constraints"
101
- - "Development Phase"
102
- - "Directory Conventions"
103
98
 
104
99
  documentation-criteria:
105
100
  skill: "documentation-criteria"
@@ -4,6 +4,8 @@
4
4
  種別: feature|fix|refactor
5
5
  想定影響範囲: Xファイル
6
6
  関連Issue/PR: #XXX(該当する場合)
7
+ <!-- 下記の行はmedium / large規模のみ — small規模はこのplan-templateではなくtask-templateを使用する。値の行は末尾コメントを付けず、下流のパーサがbare statusの抽出(pending | ready | escalated)を行えるように保つこと。 -->
8
+ Implementation Readiness: pending
7
9
 
8
10
  ## 関連ドキュメント
9
11
  - 設計書:
@@ -46,6 +48,26 @@ Design Docの各技術要件をカバーするタスクへのマッピング。
46
48
 
47
49
  **ギャップステータス値**: `covered`(タスクあり)、`gap`(タスクなし — 備考に理由必須、計画承認前にユーザー確認が必要)
48
50
 
51
+ ## UI Specコンポーネント → タスクマッピング
52
+
53
+ 入力にUI Specが含まれる場合のみ本セクションを記載する。UI Specに記述された各コンポーネントを実装するタスクへのマッピング。task-decomposerはこの表を読み込み、対応するUI Specセクションを各タスクのInvestigation Targetsに伝播させる。UI Specがない場合は本セクションを省略する。
54
+
55
+ | UI Specコンポーネント(セクション見出し) | カバーする状態 | カバーするタスク | ギャップステータス | 備考 |
56
+ |---|---|---|---|---|
57
+ | [UI Specの見出しを完全一致で記載。例: "§ コンポーネント: AlertCard"] | [default / loading / empty / error / partial — 実装が満たすべき状態を列挙] | [Phase X タスクY] | covered | |
58
+
59
+ **参照キーのルール**: 列1のコンポーネント識別子はUI Specのセクション見出し(完全一致)。ui-spec-designerが見出しの一意性を保証するため、この参照は1つのセクションに一意に解決する。
60
+
61
+ **ギャップステータス値**: `covered`(タスクあり)、`gap`(タスクなし — 備考に理由必須、計画承認前にユーザー確認が必要)
62
+
63
+ ## Connection Map
64
+
65
+ 実装が複数のパッケージ、サービス、またはプロセス境界をまたがる場合のみ本セクションを記載する。各境界を文書化することで、task-decomposerは境界の文脈を両側の実装タスクに伝播できる。実装が単一パッケージ内に収まる場合は本セクションを省略する。
66
+
67
+ | 境界 | オーナー(左側) | オーナー(右側) | 期待されるシグナル | カバーするタスク |
68
+ |---|---|---|---|---|
69
+ | [例: "web client → API gateway"] | [リクエスト側のモジュール/パッケージ] | [レスポンス側のモジュール/パッケージ] | [境界の動作を裏付ける観測可能な証拠 — 例: "ContractAに一致するスキーマでHTTP 200"、"tableBに行が挿入される"、"topicCにメッセージが発行される"] | [Phase X 各側のタスクY] |
70
+
49
71
  ## 目的
50
72
  [なぜこの変更が必要か、何を解決するか]
51
73
 
@@ -59,6 +59,8 @@ PRDの受入条件をプロトタイプの参照先にマッピング。プロ
59
59
 
60
60
  ### コンポーネント: [ComponentName]
61
61
 
62
+ > コンポーネント見出しの一意性: すべての`コンポーネント: [ComponentName]`見出しはUI Spec内で一意でなければならない。work-plannerとtask-decomposerは見出しテキストの完全一致でコンポーネントを参照するため、重複した名前や言い換えがあると実装タスクへの伝播が破綻する。
63
+
62
64
  #### 状態×表示マトリクス
63
65
 
64
66
  | 状態 | デフォルト | ローディング | Empty | エラー | 部分表示 |
@@ -1,5 +1,16 @@
1
1
  # PlaywrightによるE2Eテスト実装
2
2
 
3
+ ## レーン選択
4
+
5
+ 本ワークフローのE2Eテストは2つのレーンに分割される(integration-e2e-testingスキル参照):
6
+
7
+ | レーン | バックエンド構成 | 使用するパターン |
8
+ |------|---------------|----------------|
9
+ | **fixture-e2e** | `page.route()` またはフィクスチャローダーでモック化、ライブサービスなし | ページオブジェクトパターン、Locator戦略、アサーション、後述の **フィクスチャベースのバックエンド** セクション |
10
+ | **service-integration-e2e** | 実サービスを伴うローカルスタックでライブ実行 | 上記の全パターンに加えて、アプリケーションのログインフローに対する実認証Fixture と seed済みのテストデータ |
11
+
12
+ スケルトンの `@lane:` アノテーションがテストの所属レーンを宣言する。これに合わせて実装パターンを選択する。
13
+
3
14
  ## テストフレームワーク
4
15
  - **Playwright Test**: `@playwright/test`
5
16
  - テストインポート: `import { test, expect } from '@playwright/test'`
@@ -10,18 +21,23 @@
10
21
  ```
11
22
  tests/
12
23
  └── e2e/
13
- ├── pages/ # ページオブジェクト
24
+ ├── pages/ # ページオブジェクト(レーン間で共通)
14
25
  │ ├── login.page.ts
15
26
  │ └── dashboard.page.ts
16
- ├── fixtures/ # テストFixture
27
+ ├── fixtures/ # テストFixture(auth、seed)
17
28
  │ └── auth.fixture.ts
18
- └── *.e2e.test.ts # テストファイル
29
+ ├── data/ # fixture-e2e用の静的フィクスチャデータ
30
+ │ └── *.fixture.json
31
+ ├── *.fixture-e2e.test.ts # fixture-e2eテストファイル
32
+ └── *.service-e2e.test.ts # service-integration-e2eテストファイル
19
33
  ```
20
34
 
21
35
  ### 命名規則
22
- - テストファイル: `{FeatureName}.e2e.test.ts`
36
+ - fixture-e2eファイル: `{FeatureName}.fixture-e2e.test.ts`
37
+ - service-integration-e2eファイル: `{FeatureName}.service-e2e.test.ts`
23
38
  - ページオブジェクト: `{PageName}.page.ts`
24
39
  - Fixture: `{Purpose}.fixture.ts`
40
+ - 静的フィクスチャデータ: `{scenario}.fixture.json`
25
41
 
26
42
  ## ページオブジェクトパターン
27
43
 
@@ -102,6 +118,59 @@ export const test = base.extend<{ authenticatedPage: Page }>({
102
118
  })
103
119
  ```
104
120
 
121
+ ## フィクスチャベースのバックエンド(fixture-e2e)
122
+
123
+ fixture-e2eテストは決定論的フィクスチャに対して実ブラウザを動かす — ライブバックエンドなし、DBなし、外部サービスなし。ネットワークをフェイクするには以下のパターンのいずれかを使用する:
124
+
125
+ ### パターンA: page.route() による傍受
126
+
127
+ ```typescript
128
+ import { test, expect } from '@playwright/test'
129
+ import cardsFixture from './data/cards.fixture.json'
130
+
131
+ test('Dismissしてからのundoでカードが復元される', async ({ page }) => {
132
+ // Arrange: 全てのバックエンド呼び出しを決定論的レスポンスで傍受
133
+ await page.route('**/api/cards', async (route) => {
134
+ await route.fulfill({ json: cardsFixture })
135
+ })
136
+ await page.route('**/api/cards/*/dismiss', async (route) => {
137
+ await route.fulfill({ status: 204 })
138
+ })
139
+
140
+ await page.goto('/cards')
141
+ await page.getByRole('button', { name: 'Dismiss' }).first().click()
142
+ await page.getByRole('button', { name: 'Undo' }).click()
143
+
144
+ await expect(page.getByText(cardsFixture[0].title)).toBeVisible()
145
+ })
146
+ ```
147
+
148
+ ### パターンB: フィクスチャローダーの注入
149
+
150
+ ```typescript
151
+ // data/cards-with-dismiss.fixture.json — テストと一緒にコミット
152
+ // ルートヘルパーまたはアプリレベルのテストモード経由でロード
153
+ ```
154
+
155
+ **fixture-e2e の原則**:
156
+ - バックエンドはフェイクされ、稼働していない。これらのテストの実行に `npm run start:backend` は不要
157
+ - フィクスチャはリポジトリ内(`tests/e2e/data/`)にバージョン管理される。マシンを越えて決定論的なテストになる
158
+ - 認証が必要な場合もフェイクする(`page.context().addCookies()` でテストCookieをセット、またはfixtureモードのバイパスを使用)
159
+ - 外部インフラのプロビジョニングなしにCIで実行可能
160
+
161
+ ## E2E環境前提条件(service-integration-e2e のみ)
162
+
163
+ service-integration-e2eテストは実データ状態を持つ起動済みアプリケーションを必要とする。fixture-e2eと異なり、環境セットアップはテスト実装スコープの一部である。
164
+
165
+ service-integration-e2eテストがパスする前に確認すべき項目:
166
+ - [ ] アプリケーションが起動しており`baseURL`でアクセス可能
167
+ - [ ] データベースに必要な seed data がある(テストユーザー、必要なレコード)
168
+ - [ ] テストクレデンシャルで実認証フローが動作する
169
+ - [ ] 環境変数が設定されている(`E2E_*` プレフィックス)
170
+ - [ ] 外部サービスが利用可能、またはスタブされている
171
+
172
+ 作業計画書に環境セットアップ用の専用タスク(Phase 0)が含まれる場合、それに従う。計画にセットアップタスクがない場合、テスト実装タスク自体の中で不足する前提条件に対処するか、検証を fixture-e2e に移せないか検討する。
173
+
105
174
  ## Locator戦略
106
175
 
107
176
  アクセシブルなLocatorを以下の優先順位で使用:
@@ -168,13 +237,14 @@ test.describe('レスポンシブナビゲーション', () => {
168
237
 
169
238
  ## スケルトンコメント形式
170
239
 
171
- E2Eテストスケルトンは統合テストと同じアノテーション形式に従う:
240
+ E2Eテストスケルトンは統合テストと同じアノテーション形式に従う。レーンを宣言する `@lane:` アノテーションを必ず付与する(上記「レーン選択」参照):
172
241
 
173
242
  ```typescript
174
243
  // AC: [元の受入条件テキスト]
175
244
  // Behavior: [ユーザーアクション] → [システムレスポンス] → [観測可能な結果]
176
- // @category: e2e
177
- // @dependency: full-system
245
+ // @category: fixture-e2e | service-integration-e2e
246
+ // @lane: fixture-e2e | service-integration-e2e
247
+ // @dependency: full-ui (mocked backend) | full-system
178
248
  // @complexity: high
179
249
  // ROI: [スコア]
180
250
  test('AC1: [説明]', async ({ page }) => {
@@ -183,3 +253,7 @@ test('AC1: [説明]', async ({ page }) => {
183
253
  // Assert: [検証の説明]
184
254
  })
185
255
  ```
256
+
257
+ **レーン別の `@dependency` 選択**:
258
+ - `fixture-e2e` → `@dependency: full-ui (mocked backend)`(ライブサービスなし、`page.route()` またはフィクスチャローダーでネットワークを傍受)
259
+ - `service-integration-e2e` → `@dependency: full-system`(起動済みのローカルスタックが必要)
@@ -12,10 +12,17 @@ description: 統合テストとE2Eテストを設計。モック境界と振る
12
12
 
13
13
  ## テスト種別と上限
14
14
 
15
- | 種別 | 目的 | ファイル形式 | 上限 |
16
- |------|------|-------------|------|
17
- | 統合テスト | コンポーネント間連携検証 | `*.int.test.ts` | 機能あたり3件 |
18
- | E2Eテスト | クリティカルユーザージャーニー検証 | `*.e2e.test.ts` | 機能あたり1-2件 |
15
+ | テスト種別 | 目的 | スコープ | 外部依存 | ファイル形式 | 機能あたり上限 | 実装タイミング |
16
+ |-----------|------|---------|---------|-------------|--------------|--------------|
17
+ | 統合 | in-processでのコンポーネント間連携を検証 | システムの部分的な統合(in-processモジュール、UIコンポーネントの場合はReact/TSではRTL+MSW) | モック または in-process | `*.int.test.ts` | 最大3件 | 実装と並行して作成 |
18
+ | fixture-e2e | 決定論的フィクスチャを用いてブラウザ上でUIの振る舞いを検証 | UIフロー全体(モックバックエンド/フィクスチャ駆動の状態) | モック/フィクスチャのみ — ライブサービスなし | `*.fixture-e2e.test.ts` | 最大3件 | UI機能と並行して作成 |
19
+ | service-integration-e2e | 起動済みのローカルスタックに対してクリティカルユーザージャーニーを検証 | サービスをまたいだシステム全体 | ローカルの実サービスまたはスタブ | `*.service-e2e.test.ts` | 最大1-2件 | 最終フェーズでのみ実行 |
20
+
21
+ **レーン選択(E2Eのみ)**:
22
+ - ユーザー向けUIジャーニーのデフォルトレーンは **fixture-e2e** — 決定論的フィクスチャに対して実ブラウザを動かし、ユニット/統合テストでは捕捉できないバグ(ボタンが動作しない、状態が更新されない、ナビゲーションが壊れる等)を検出でき、インフラ準備なしにCIで実行可能
23
+ - **service-integration-e2e** は、ジャーニーの正しさが安全にフェイクできない実サービス間の挙動(データ永続化、トランザクション整合性、外部サービスのコントラクト)に依存する場合のみ追加
24
+
25
+ 2つのE2Eレーンの予算は独立して計上される — あるジャーニーに fixture-e2e があっても service-integration-e2e の予算は消費されず、その逆も同様。
19
26
 
20
27
  **クリティカルユーザージャーニー**: 収益影響・法的要件・大多数のユーザーが日常的に利用する機能
21
28
 
@@ -44,13 +51,19 @@ description: 統合テストとE2Eテストを設計。モック境界と振る
44
51
  // AC: "[受入条件原文]"
45
52
  // ROI: [0-100] | ビジネス価値: [0-10] | 頻度: [0-10]
46
53
  // 振る舞い: [トリガー] → [処理] → [観測可能な結果]
47
- // @category: core-functionality | integration | edge-case | ux | e2e
48
- // @dependency: none | [コンポーネント名] | full-system
54
+ // @category: core-functionality | integration | edge-case | ux | fixture-e2e | service-integration-e2e
55
+ // @lane: integration | fixture-e2e | service-integration-e2e
56
+ // @dependency: none | [コンポーネント名] | full-ui (mocked backend) | full-system
49
57
  // @complexity: low | medium | high
50
58
  // @real-dependency: [コンポーネント名](任意、テスト境界で非モックセットアップが指定された場合)
51
59
  it.todo('[AC番号]: [テスト名]')
52
60
  ```
53
61
 
62
+ **`@lane` 選択ルール**:
63
+ - `integration` — in-processでのコンポーネント間連携、ブラウザを使用しない(例: React/TSではRTL+MSW、その他言語でも in-process のモジュール/ハンドラ統合)
64
+ - `fixture-e2e` — モックバックエンド/フィクスチャ駆動の状態に対するブラウザレベルのUI検証。`@dependency` は通常 `full-ui (mocked backend)`
65
+ - `service-integration-e2e` — 起動済みローカルサービスまたはスタブに対するブラウザレベルまたはエンドツーエンドの検証。`@dependency` は `full-system`
66
+
54
67
  ### Property注釈
55
68
 
56
69
  ```typescript
@@ -73,17 +86,14 @@ it.todo('[AC番号]-property: [不変条件記述]')
73
86
 
74
87
  ### ユーザー向け vs サービス内部の分類
75
88
 
76
- マルチステップジャーニーはE2E予算判断のためにさらに分類される:
89
+ マルチステップジャーニーは予約スロット適用判定のために分類される:
77
90
 
78
- | 分類 | 条件 | E2E予約スロット | 例 |
91
+ | 分類 | 条件 | 予約スロット適用 | 例 |
79
92
  |------|------|----------------|-----|
80
- | **ユーザー向け** | 人間のユーザーが直接ステップをトリガーし結果を観察する(UI、CLI、または直接的なAPIインタラクション経由) | 対象 | Web購入フロー、CLIセットアップウィザード、モバイルオンボーディング |
81
- | **サービス内部** | バックエンドサービスがユーザーの直接操作なしにステップをトリガーする | 予約スロット対象外 | 非同期ジョブパイプライン、サービス間saga、スケジュールバッチ処理 |
93
+ | **ユーザー向け** | 人間のユーザーが直接ステップをトリガーし結果を観察する(UI、CLI、または直接的なAPIインタラクション経由) | 対象 — デフォルトで **fixture-e2e** の予約スロットに割り当て。ジャーニーの正しさが実サービス間の挙動に依存する場合のみ service-integration-e2e の予約スロットを追加 | Web購入フロー、CLIセットアップウィザード、モバイルオンボーディング |
94
+ | **サービス内部** | バックエンドサービスがユーザーの直接操作なしにステップをトリガーする | 予約スロット対象外 — 統合テストを使用。フルシステム検証が妥当な場合は通常のROI > 50パスを通じた service-integration-e2e は引き続き有効 | 非同期ジョブパイプライン、サービス間saga、スケジュールバッチ処理 |
82
95
 
83
- **この分類のスコープ**:
84
- - **E2E予約スロット**: ユーザー向けジャーニーのみが対象。サービス内部ジャーニーは予約スロットから除外される。
85
- - **通常のROI > 50パス**: ユーザー向け・サービス内部の両方が追加E2Eスロット(最大1件)をROI実績で競う。この分類はこのパスに影響しない。
86
- - **E2Eギャップチェック**: ユーザー向けジャーニーのみがgap警告をトリガーする。サービス内部ジャーニーはトリガーしない。
96
+ この分類は予約スロットルールおよびE2Eギャップチェックに適用される。それ以外の選定はレーンごとのROIルール(後述)に従う。
87
97
 
88
98
  ### ROI計算
89
99
 
@@ -95,20 +105,29 @@ ROI Scoreは**同一テスト種別内での優先順位付け**に使用する
95
105
 
96
106
  ROI Scoreが高い = 同一テスト種別内での優先度が高い。正規化やキャッピングは適用しない — 生のスコアをそのままランキングに使用する。重複排除は候補自体を除外する別のステップであり、スコアは変更しない。
97
107
 
98
- #### E2EのROI閾値
108
+ #### レーン別ROI閾値
99
109
 
100
- E2Eテストは所有コストが高い(作成・実行・保守それぞれが統合テストの3〜10倍)。予約スロット(ユーザー向けマルチステップジャーニー)を超える追加E2Eスロットには **ROI Score > 50** が必要。
110
+ 2つのE2Eレーンは所有コストが大きく異なるため、独立した閾値を使用する。
111
+
112
+ | レーン | ROI閾値 | 理由 |
113
+ |------|---------|------|
114
+ | fixture-e2e | ROI ≥ 20(予約スロット以外) | ハーネスが整備されていればコストは統合テストと同等。少数のテストで十分な場合に MAX 3 を低シグナルなテストで埋めてしまうことを避けるためのフロア(基準点) |
115
+ | service-integration-e2e | ROI > 50(予約スロット以外) | 作成・実行・保守コストが統合テストの3〜10倍。他の方法では価値を立証できないジャーニーのみに使用 |
116
+
117
+ 予約スロットのルールはレーンごとに適用され、閾値を上書きする(予約された候補はROIスコアに関わらず出力される)。予約スロット以外でフロアを下回る候補は出力されず、予算は意図的に未消化のまま残し、低価値なテストで埋めない。
101
118
 
102
119
  #### ROI計算例
103
120
 
104
121
  | シナリオ | BV | Freq | Legal | Defect | ROI Score | テスト種別 | 選択結果 |
105
122
  |----------|----|------|-------|--------|-----------|-----------|---------|
106
- | コア決済フロー | 10 | 9 | true | 9 | 109 | E2E | 選択(予約スロット: ユーザー向けマルチステップジャーニー) |
107
- | 決済エラー処理 | 8 | 3 | false | 7 | 31 | E2E | 閾値未満(31 < 50)、不選択 |
108
- | プロフィール保存フロー | 7 | 6 | false | 6 | 48 | E2E | 閾値未満(48 < 50)、不選択 |
123
+ | コア決済UIフロー | 10 | 9 | true | 9 | 109 | fixture-e2e | 選択(予約スロット: ユーザー向けマルチステップジャーニー、フィクスチャによるブラウザ検証) |
124
+ | 実決済サービスへのコア決済 | 10 | 9 | true | 9 | 109 | service-integration-e2e | 選択(実サービスでの正しさ。ROI閾値超過) |
125
+ | Dismissボタンによる UI 状態更新 | 6 | 7 | false | 8 | 50 | fixture-e2e | 選択(fixture-e2e 予算3件中ランク2位) |
126
+ | 決済エラーメッセージ表示(UI) | 5 | 4 | false | 7 | 27 | fixture-e2e | 選択(fixture-e2e 予算3件中ランク3位) |
127
+ | 任意フィルタ切替 | 3 | 4 | false | 2 | 14 | fixture-e2e | 不選択(ランク4位、予算上限到達) |
128
+ | 実プロバイダへの決済リトライ | 8 | 3 | false | 7 | 31 | service-integration-e2e | ROI閾値未満(31 < 50)、不選択 |
109
129
  | DB永続化チェック | 8 | 8 | false | 8 | 72 | 統合 | 選択(3件中ランク1位) |
110
- | エラーメッセージ表示 | 5 | 3 | false | 4 | 19 | 統合 | 選択(3件中ランク2位) |
111
- | 任意フィルタ切替 | 3 | 4 | false | 2 | 14 | 統合 | 不選択(ランク4位、上限到達) |
130
+ | 純粋なデータ変換 | 5 | 3 | false | 4 | 19 | 統合 | 選択(3件中ランク2位) |
112
131
 
113
132
  ## 実装ルール
114
133
 
@@ -170,8 +189,14 @@ it('AC2-property: モデル名は常にgemini-3-pro-image-preview', () => {
170
189
 
171
190
  ### E2Eテストの実行条件
172
191
 
173
- - 全コンポーネント実装完了後に実行
174
- - モック禁止(`@dependency: full-system`)
192
+ **fixture-e2e**:
193
+ - UI機能の実装フェーズと並行して実行(最後に先送りしない)
194
+ - モックバックエンド/フィクスチャ駆動の状態を使用(`@dependency: full-ui (mocked backend)`)。ライブサービス不要
195
+ - インフラ準備なしにCIで実行可能
196
+
197
+ **service-integration-e2e**:
198
+ - 全コンポーネント実装完了かつローカルスタック起動後、最終フェーズでのみ実行
199
+ - ローカルの実サービスまたはサービススタブを使用 — 検証対象コンポーネントに対して in-process モックは使用しない(`@dependency: full-system`)
175
200
 
176
201
  ## レビュー基準
177
202