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,191 @@
1
+ ---
2
+ description: Verify implementation readiness and resolve gaps before the build phase begins
3
+ ---
4
+
5
+ **Context**: Optional readiness phase between work-plan approval and the build/implement phase. Confirms the implementation will be observable from Phase 1 onward and resolves any gaps via Phase 0 tasks. Exits no-op when the readiness criteria already pass, so the recipe is safe to invoke unconditionally.
6
+
7
+ ## Orchestrator Definition
8
+
9
+ **Core Identity**: "I am an orchestrator." (see subagents-orchestration-guide skill)
10
+
11
+ **Execution Protocol**:
12
+ 1. **Delegate all work through Agent tool** — invoke sub-agents (task-executor / task-executor-frontend / quality-fixer / quality-fixer-frontend), pass deliverable paths between them, and report results
13
+ 2. **Self-contained scope**: When gaps are found, this recipe BOTH generates resolution tasks AND executes them through the standard 4-step cycle described in subagents-orchestration-guide "Standard Flow I Manage". Recipe completes only when readiness criteria pass or remaining gaps are escalated.
14
+ 3. **No-op exit**: When the readiness scan finds no failing criteria, generate no resolution tasks and exit immediately. The only file modifications in this branch are to the work plan itself — promoting the `Implementation Readiness:` header to `ready` and persisting the Readiness Report section. No code or test files are touched.
15
+
16
+ Work plan: $ARGUMENTS
17
+
18
+ ## When This Recipe Applies
19
+
20
+ Run before any build/implement phase when ANY of the following hold:
21
+ - Work plan was created from a Design Doc whose Verification Strategy references commands, files, functions, or endpoints not yet present in the codebase
22
+ - Work plan includes E2E test skeletons (seed data, auth fixture, environment variables, or external mocks may be unaddressed)
23
+ - Work plan touches UI components without a fixture entry or development route to render their visual states
24
+ - The team has not previously confirmed the local lane runs end-to-end for this feature area
25
+
26
+ When none of the above hold, the readiness scan in Step 2 will find zero failing criteria and the recipe exits no-op (see Context at the top of this command).
27
+
28
+ ## Readiness Criteria
29
+
30
+ Each criterion is a measurable check producing `pass`, `fail`, or `not_applicable` with cited evidence.
31
+
32
+ | ID | Criterion | Pass evidence |
33
+ |----|-----------|---------------|
34
+ | R1 | Verification Strategy references resolve | Every command, file path, function, endpoint, and test referenced in the work plan's Verification Strategy section either exists in the codebase (verified via Glob/Grep) or is the deliverable of a task already in this plan |
35
+ | R2 | E2E preconditions addressed | When E2E skeletons exist: every precondition mentioned in skeleton comments (seed data, auth fixture, env var, external mock) is present in the codebase or covered by a Phase 0 task in this plan |
36
+ | R3 | Phase 1 observability | The first implementation phase contains at least one task whose Operation Verification Methods can execute at task completion using only artifacts that exist before the task starts (existing code, prior Phase 0 task deliverables, or the task's own outputs) |
37
+ | R4 | UI rendering surface | When the plan implements UI components: a fixture entry, dev route, Storybook story, or equivalent rendering surface exists for the impacted components, OR a Phase 0 task adds one |
38
+ | R5 | Local lane procedure | The work plan or a referenced doc records the commands needed to start the system locally for manual verification (start commands, default ports, seed steps) |
39
+
40
+ R4 and R5 are evaluated only when their triggering signals appear in the work plan; otherwise mark `not_applicable`.
41
+
42
+ ## Pre-execution Prerequisites
43
+
44
+ ```bash
45
+ # Verify the work plan exists
46
+ ! ls -la docs/plans/*.md | grep -v template | tail -5
47
+ ```
48
+
49
+ **State check**:
50
+ - Work plan exists → Proceed to Step 1
51
+ - No work plan → Stop and report: "An approved work plan is required. Complete the upstream planning phase first, then re-invoke this recipe."
52
+
53
+ ## Execution Flow
54
+
55
+ ### Step 1: Load Inputs
56
+
57
+ Read the work plan path passed in `$ARGUMENTS`. Extract:
58
+ - Verification Strategy section (Correctness Proof Method + Early Verification Point)
59
+ - Quality Assurance Mechanisms table
60
+ - Design-to-Plan Traceability table
61
+ - Test skeleton references listed in the plan header
62
+ - Phase structure with each phase's tasks
63
+ - Referenced Design Doc(s) and UI Spec (when present)
64
+
65
+ ### Step 2: Readiness Scan
66
+
67
+ For each criterion R1–R5:
68
+ 1. Execute the scan defined in Readiness Criteria using Read / Glob / Grep
69
+ 2. Record the result: `pass` / `fail` / `not_applicable`
70
+ 3. Cite evidence: file:line for `pass`, the unresolved reference for `fail`, the missing trigger signal for `not_applicable`
71
+
72
+ Build the Readiness Report (see Output Format) regardless of outcome.
73
+
74
+ ### Step 3: No-op Check
75
+
76
+ When every applicable criterion is `pass` (zero `fail`):
77
+ - Append (or replace, if already present) a `## Implementation Readiness Report` section in the work plan immediately after the header block, using the same Readiness Report markdown defined in Output Format below
78
+ - Update the work plan header `Implementation Readiness:` line to `ready` (insert it after `Related Issue/PR:` if absent)
79
+ - Present the Readiness Report to the user
80
+ - Exit with `outcome: ready, gaps_resolved: 0`
81
+ - The work plan modifications above are the only file modifications in this branch
82
+
83
+ When one or more criteria are `fail` → proceed to Step 4.
84
+
85
+ ### Step 4: Plan Resolution Tasks
86
+
87
+ For each `fail` criterion:
88
+ 1. Determine the smallest concrete task that closes the gap (examples: "Add fixture entry for ComponentX covering loading/empty/error states", "Add seed script for E2E user fixtures", "Document local startup commands in docs/run/local.md")
89
+ 2. Decide the task's **layer** by matching every target file path against the markers below:
90
+ - **backend** when every target file path matches one of: `**/api/**`, `**/server/**`, `**/services/**`, `**/backend/**`, `**/handlers/**`, `**/repositories/**`
91
+ - **frontend** when every target file path matches one of: `**/components/**`, `**/pages/**`, `**/web/**`, `**/frontend/**`, `**/*.tsx`, `**/*.jsx`
92
+ - **prep-only** (typical prep targets that are language-/runtime-neutral — readiness setup rather than feature implementation) when every target file path matches one of: `docs/**`, `scripts/**`, `tests/fixtures/**`, `tests/e2e/data/**`, `tests/e2e/fixtures/**`, root-level config files (`*.json`, `*.yml`, `*.config.*`). Route to the **backend** executor / quality-fixer (`task-executor` + `quality-fixer`) since these tasks do not involve React-specific concerns
93
+ - **mixed** (target files span both backend and frontend markers, OR span feature markers and prep-only markers in a way that requires real implementation alongside readiness setup) → escalate to user; ask the user to split the gap into per-layer tasks
94
+ - **unrecognized** (any target file matches none of the markers above — e.g., a path under a non-standard top-level directory the project uses) → escalate to user; ask the user to either (a) decide which executor / quality-fixer should run the task, or (b) update the markers if the project uses different paths
95
+
96
+ Apply the rules in the order above. The first matching rule wins; "unrecognized" is the final fallback rather than a catch-all that defaults to backend.
97
+ 3. Create a Phase 0 task file at `docs/plans/tasks/{plan-name}-backend-task-prep-{NN}.md` (backend or prep-only) or `docs/plans/tasks/{plan-name}-frontend-task-prep-{NN}.md` (frontend) using the task template from documentation-criteria skill. The `-task-prep-` segment lets this recipe distinguish prep tasks from implementation tasks while keeping the existing `{plan-name}-{layer}-task-*` matcher used by other recipes. Prep-only tasks use the `-backend-task-prep-` filename so they route to the backend executor in Step 5
98
+ 4. Update the work plan to insert these tasks as Phase 0 (before Phase 1)
99
+
100
+ Present the proposed resolution task list to the user with AskUserQuestion. Proceed only after explicit approval — this is the single human gate inside this recipe.
101
+
102
+ ### Step 5: Execute Resolution Tasks
103
+
104
+ For each resolution task, run the 4-step cycle `task-executor → escalation check → quality-fixer → commit` (defined in subagents-orchestration-guide "Standard Flow I Manage", with layer routing per "Layer-Aware Agent Routing"):
105
+
106
+ 1. **Agent tool** — route by filename layer segment (matches the Layer-Aware Agent Routing table in the guide):
107
+ - `*-backend-task-prep-*` → `subagent_type: "task-executor"`
108
+ - `*-frontend-task-prep-*` → `subagent_type: "task-executor-frontend"`
109
+ - Filename without a recognized layer segment → escalate (the file should not exist; Step 4 prevents this)
110
+ 2. Check escalation per orchestration-guide
111
+ 3. **quality-fixer** — route by the same filename layer segment:
112
+ - `*-backend-task-prep-*` → `"quality-fixer"`
113
+ - `*-frontend-task-prep-*` → `"quality-fixer-frontend"`
114
+ 4. **Commit** when quality-fixer returns `approved`
115
+
116
+ Append the Scope Boundary block (below) to every subagent prompt.
117
+
118
+ ### Step 6: Re-scan, Persist Readiness Report, Update Header, Cleanup, Exit
119
+
120
+ 1. **Re-scan**: Re-run the Step 2 readiness scan after all resolution tasks are committed.
121
+
122
+ 2. **Persist Readiness Report into work plan body**: Append (or replace, if already present) a `## Implementation Readiness Report` section in the work plan immediately after the header block. Use the same Readiness Report markdown defined in Output Format below. Downstream build/implement recipes read this section when the header is `escalated` to surface remaining gaps to the user.
123
+
124
+ 3. **Update work plan header**: Locate the line `Implementation Readiness: pending` in the work plan and rewrite it based on the re-scan outcome:
125
+
126
+ | Re-scan result | New header value |
127
+ |----------------|------------------|
128
+ | All applicable criteria `pass` | `Implementation Readiness: ready` |
129
+ | One or more `fail` remain | `Implementation Readiness: escalated` |
130
+
131
+ If the line is absent (older work plan format), insert it after the `Related Issue/PR:` line.
132
+
133
+ 4. **Final Cleanup**: Delete every prep task file this recipe created for the current `{plan-name}` (`docs/plans/tasks/{plan-name}-backend-task-prep-*.md` and `docs/plans/tasks/{plan-name}-frontend-task-prep-*.md`) AND the phase-completion file generated for prep phases (`docs/plans/tasks/{plan-name}-phase0-completion.md` when present, since prep tasks live in Phase 0). Prep task files for other plans are out of scope — this recipe deletes only what it created for the current run. Their work is committed; `docs/plans/` is ephemeral working state and is not retained between recipe runs. The work plan itself is preserved for the downstream build/implement phase.
134
+
135
+ 5. **Exit**:
136
+
137
+ | Re-scan result | Action |
138
+ |----------------|--------|
139
+ | All applicable criteria `pass` | Exit with `outcome: ready, gaps_resolved: N` and final Readiness Report |
140
+ | One or more `fail` remain | Exit with `outcome: escalated` — present remaining failures to the user with the next-action recommendation. Treat the re-scan as the terminal evaluation; further resolution requires the user to re-invoke this recipe with updated inputs. |
141
+
142
+ ## Scope Boundary for Subagents
143
+
144
+ Append the following block to every subagent prompt invoked from this recipe:
145
+
146
+ ```
147
+ Scope boundary for subagents:
148
+ Operate within the task scope and referenced files in the prompt.
149
+ Use loaded skills to execute that scope.
150
+ Escalate when the required fix or investigation falls outside that scope.
151
+ ```
152
+
153
+ ## Output Format
154
+
155
+ Final report presented to the user at exit:
156
+
157
+ ```
158
+ ## Implementation Readiness Report
159
+
160
+ Work plan: [path]
161
+ Outcome: ready | escalated
162
+ Gaps resolved: [N]
163
+
164
+ ### Readiness Criteria
165
+
166
+ | ID | Result | Evidence |
167
+ |----|--------|----------|
168
+ | R1 | pass / fail / not_applicable | [file:line OR "missing: <unresolved reference>"] |
169
+ | R2 | ... | ... |
170
+ | R3 | ... | ... |
171
+ | R4 | ... | ... |
172
+ | R5 | ... | ... |
173
+
174
+ ### Resolution Tasks Executed (when gaps_resolved > 0)
175
+ - [task file path] — [one-line summary] — committed
176
+ - ...
177
+
178
+ ### Remaining Gaps (when outcome is escalated)
179
+ - [criterion ID]: [unresolved reference] — Next action: [recommendation]
180
+ ```
181
+
182
+ ## Completion Criteria
183
+
184
+ - [ ] Work plan loaded and Verification Strategy / E2E references / Phase structure extracted
185
+ - [ ] Readiness scan run with per-criterion result and evidence recorded
186
+ - [ ] No-op exit when all `pass`, OR resolution tasks generated, approved, and executed via the 4-step cycle
187
+ - [ ] Re-scan run after the last resolution task commits
188
+ - [ ] `## Implementation Readiness Report` section persisted into the work plan body
189
+ - [ ] Work plan header `Implementation Readiness:` line updated to `ready` or `escalated`
190
+ - [ ] Prep task files (and Phase 0 phase-completion file when generated) deleted from `docs/plans/tasks/`
191
+ - [ ] Final report presented to the user
@@ -1,86 +1,114 @@
1
1
  ---
2
- description: Inject project-specific context into project-context skill
2
+ description: Populate project-context skill via template-driven hearing
3
3
  ---
4
4
 
5
- **Command Context**: Collect project-specific prerequisites that improve AI execution accuracy and update project-context SKILL.md.
5
+ **Command Context**: `/project-inject` collects project-specific prerequisites that improve AI execution accuracy and writes them into the `project-context` skill. The hearing is template-driven: the section catalog lives in `references/template.md`, and new dimensions are added by editing that template.
6
6
 
7
7
  ## Why This Matters
8
8
 
9
- CLAUDE.md's Session Initialization reads `project-context` skill at the start of every session. The information collected here directly affects AI decision-making accuracy across all tasks.
9
+ CLAUDE.md's session initialization loads `project-context/SKILL.md` at the start of every session. Information collected here directly affects AI decision-making accuracy across all tasks. Keep the configured SKILL.md minimal — every line is paid in context budget per session.
10
10
 
11
- **Collect only what improves AI execution accuracy.**
11
+ ## Execution Flow
12
12
 
13
- ## Execution Process
13
+ Register all steps below using TaskCreate before starting Step 1, and update each task's status as you progress.
14
14
 
15
- Register the following steps with TaskCreate and proceed systematically.
15
+ ### Step 1: Load Inputs
16
16
 
17
- ### Step 1: Understand Current State
17
+ 1. Read `.claude/skills/project-context/SKILL.md` to learn the current state. Distinguish the two cases by the count of catalog section headings (`## Project Overview`, `## Domain Constraints`, `## Development Phase`, `## Directory Conventions`, `## External Resources`) present in the body:
18
+ - **Unconfigured** — the body has zero catalog section headings.
19
+ - **Configured** — the body has one or more catalog section headings.
20
+ 2. Read `.claude/skills/project-context/references/template.md` to obtain the section catalog.
18
21
 
19
- Read the current project-context skill and package.json:
20
- - `.claude/skills/project-context/SKILL.md`
21
- - `package.json` (name, description)
22
+ **Checkpoint**: You hold the section catalog from `template.md` and the configured-or-unconfigured state of `SKILL.md`.
22
23
 
23
- If project-context is already configured (no "Not configured" marker), confirm with user whether to overwrite or update.
24
+ ### Step 2: Build Section Plan
24
25
 
25
- ### Step 2: Collect Project Context
26
+ Produce a per-section plan (`add` / `keep` / `update` / `remove` / `skip`) covering every section in the catalog.
26
27
 
27
- Use AskUserQuestion to collect information in stages.
28
+ **Unconfigured case**:
29
+ - Project Overview: `add` (mandatory; the section's inclusion rule is "Always").
30
+ - For each remaining catalog section, AskUserQuestion: "Add the `<section name>` section?" Options: "Yes, add it" / "No, skip". Mark `add` or `skip` accordingly.
28
31
 
29
- **Round 1: Project essence**
30
- - What does this project do? (1-2 sentences)
31
- - What domain does it belong to? (e.g., fintech, healthcare, developer tools, e-commerce)
32
+ **Configured case**:
33
+ - For each currently populated section, AskUserQuestion: "Action for the existing `<section name>` section?" Options: "Keep as-is" (mark `keep`) / "Update — replace existing content" (mark `update`) / "Remove — drop from rebuilt SKILL.md" (mark `remove`).
34
+ - For each catalog section that is still empty in the existing SKILL.md, AskUserQuestion: "Add the `<section name>` section?" Options: "Yes, add it" (mark `add`) / "No, skip" (mark `skip`).
32
35
 
33
- **Round 2: Domain constraints** (based on Round 1 answers)
34
- - Are there domain-specific rules that AI must follow? Adapt examples to the domain from Round 1 (e.g., for fintech: "all mutations require audit logs"; for healthcare: "log output uses anonymized patient IDs").
35
- - Maximum 3 constraints. Only include what would cause bugs or compliance issues if AI ignores them.
36
+ **Checkpoint**: Every catalog section has exactly one disposition: `add`, `keep`, `update`, `remove`, or `skip`.
36
37
 
37
- **Round 3: Development context**
38
- - Development phase: Prototype / Production / In operation
39
- - Are there directory conventions or file placement rules AI should follow? (skip if none)
38
+ ### Step 3: Run Hearing per Section
40
39
 
41
- ### Step 3: Generate and Write
40
+ For each section marked `add` or `update`, run the hearing protocol that `template.md` defines for that section. The catalog specifies the AskUserQuestion text and choices, the inclusion rules, and the per-section output structure.
42
41
 
43
- From collected information, generate project-context SKILL.md following these principles:
42
+ **External Resources section**: follow the routing protocol in `template.md` § External Resources. That section owns the domain multi-select, the domain-to-file slug map, and the per-axis output schema; this command delegates to it.
44
43
 
45
- **Writing principles:**
46
- 1. AI-decidable: Use only measurable and verifiable criteria ("fast" → "within 5 seconds")
47
- 2. Eliminate ambiguity: Include specific numbers, conditions, examples
48
- 3. Positive form: "do this" rather than "don't do that"
49
- 4. Minimal: Only what affects AI execution accuracy
44
+ **Vagueness rejection** (applies to every `add` and `update` section): When a user-provided rule uses subjective phrasing (e.g., "be careful about performance"), follow up with: "How would AI verify this rule passes? Restate it as a measurable check, or reply 'drop' to omit." Keep rules that arrive in measurable form as-is; replace subjective ones with the user's restated version, or omit them when the user replies 'drop'.
50
45
 
51
- **Output targets** (update both):
52
- 1. `.claude/skills/project-context/SKILL.md` (active, read by Claude)
53
- 2. Corresponding `skills-{lang}/project-context/SKILL.md` (check `.claudelang` for current language)
46
+ **Checkpoint**: You hold captured content for every `add` and `update` section, plus the verbatim original content for every `keep` section.
54
47
 
55
- **Structure:**
56
- ```markdown
57
- ---
58
- name: project-context
59
- description: Provides project-specific prerequisites for AI execution accuracy. Use when checking project structure.
60
- ---
48
+ ### Step 4: Assemble and Write SKILL.md
49
+
50
+ Build the rebuilt SKILL.md by concatenating, in this order:
51
+
52
+ 1. Frontmatter write this canonical block exactly:
53
+ ```
54
+ ---
55
+ name: project-context
56
+ description: Provides project-specific prerequisites for AI execution accuracy — domain constraints, development phase, directory conventions, external resource access methods. Use when the session starts, when checking project structure, or when a task references domain rules or external resources outside the repository.
57
+ ---
58
+ ```
59
+ 2. `# Project Context` heading.
60
+ 3. Each section in catalog order (Project Overview → Domain Constraints → Development Phase → Directory Conventions → External Resources). The output contains only sections whose disposition is `add`, `keep`, or `update` AND that satisfy their inclusion rule; the body advances directly from one included section to the next.
61
+
62
+ Write the assembled content to `.claude/skills/project-context/SKILL.md`. This single path is the runtime canonical source read by Claude in every session.
63
+
64
+ ### Step 5: Verify
65
+
66
+ Apply each check below to the rebuilt `.claude/skills/project-context/SKILL.md`:
67
+
68
+ - [ ] Frontmatter matches the canonical block in Step 4 verbatim.
69
+ - [ ] Every section heading in the body is followed by captured content from the hearing (concrete values, lists, or sub-blocks).
70
+ - [ ] Every populated section's content matches the output structure that `template.md` defines for it.
71
+ - [ ] Every section in the body has disposition `add`, `keep`, or `update` AND satisfies its inclusion rule.
72
+ - [ ] Domain constraint statements are pass/fail checkable (e.g., "log entries use anonymized IDs" passes; "logs are clean" fails this check).
73
+ - [ ] Project Context content is limited to constraints, phases, conventions, and external resources. Technology stack details belong in the `technical-spec` skill; implementation principles belong in the `coding-standards` skill.
61
74
 
62
- # Project Context
75
+ When any check fails, report the failing check to the user with the specific line and propose either a re-hearing for the affected section or a manual edit. Re-run Step 5 after the fix.
63
76
 
64
- ## Project Overview
65
- - **What this project does**: [concise description]
66
- - **Domain**: [domain]
77
+ ### Step 6: Present Result
67
78
 
68
- ## Domain Constraints
69
- 1. [Measurable constraint that affects AI decisions]
70
- 2. [Verifiable requirement]
79
+ Show the rebuilt SKILL.md to the user, list the changes made (added / updated / removed / kept sections), and confirm completion.
71
80
 
72
- ## Development Phase
73
- - **Phase**: [current phase]
81
+ ## Output Examples
74
82
 
75
- ## Directory Conventions
76
- [File placement rules, or "No specific conventions" if none]
83
+ **Initial run on an unconfigured skill** (every section freshly captured):
84
+
85
+ ```
86
+ project-context configured:
87
+ - Sections kept: (none — first run)
88
+ - Sections updated: (none — first run)
89
+ - Sections added: Project Overview, Domain Constraints (2 rules captured), Development Phase, Directory Conventions (1 rule), External Resources (Backend domain — Database Schema Source, Secret Store)
90
+ - Sections removed: (none)
91
+ - File written: .claude/skills/project-context/SKILL.md
92
+ ```
93
+
94
+ **Light update on a configured skill** (one section edited, rest preserved):
95
+
96
+ ```
97
+ project-context updated:
98
+ - Sections kept: Project Overview, Development Phase, Directory Conventions
99
+ - Sections updated: Domain Constraints (3 rules captured)
100
+ - Sections added: (none)
101
+ - Sections removed: (none)
102
+ - File written: .claude/skills/project-context/SKILL.md
77
103
  ```
78
104
 
79
- ### Step 4: Verification
105
+ **Trim run** (an existing section removed, no new ones added):
80
106
 
81
- - [ ] Generated file contains no boilerplate placeholder text ("to be configured", etc.)
82
- - [ ] All domain constraints are measurable/verifiable (no vague statements)
83
- - [ ] No technology stack information included (that belongs in technical-spec skill)
84
- - [ ] No implementation principles included (that belongs in coding-standards skill)
85
- - [ ] Both output targets updated
86
- - [ ] Present result to user for confirmation
107
+ ```
108
+ project-context updated:
109
+ - Sections kept: Project Overview, Domain Constraints, Development Phase
110
+ - Sections updated: (none)
111
+ - Sections added: (none)
112
+ - Sections removed: Directory Conventions
113
+ - File written: .claude/skills/project-context/SKILL.md
114
+ ```
@@ -8,11 +8,10 @@ description: Design Doc compliance and security validation with optional auto-fi
8
8
 
9
9
  - Compliance validation → performed by code-reviewer
10
10
  - Security validation → performed by security-reviewer
11
- - Fix implementation → performed by task-executor
12
- - Quality checksperformed by quality-fixer
13
- - Re-validation → performed by code-reviewer / security-reviewer
11
+ - **Code-side fix path**: Fix implementation → task-executor; Quality checks → quality-fixer; Re-validation → code-reviewer / security-reviewer
12
+ - **Design-side update path**: DD revision technical-designer (update mode); DD review → document-reviewer; cross-DD consistency → design-sync (when multiple DDs exist); Re-validation → code-reviewer
14
13
 
15
- Orchestrator invokes sub-agents and passes structured JSON between them.
14
+ Orchestrator invokes sub-agents and passes structured JSON between them. The design-side path applies when the discrepancy reflects code that was correct but the Design Doc became stale, rather than code that violated the Design Doc.
16
15
 
17
16
  Design Doc (uses most recent if omitted): $ARGUMENTS
18
17
 
@@ -57,7 +56,24 @@ Invoke security-reviewer using Agent tool:
57
56
  - `approved` or `approved_with_notes` → Pass
58
57
  - `needs_revision` → Fail
59
58
 
60
- **Report both results independently using subagent output fields only** (do not add fields that are not in the subagent response):
59
+ **Report both results independently using subagent output fields only** (do not add fields that are not in the subagent response).
60
+
61
+ **Early exit (no findings to route)**: When code-reviewer's `verdict` is `pass` AND every entry in `acceptanceCriteria[]` has `status: "fulfilled"` AND `identifierMismatches[]` is empty AND `qualityFindings[]` is empty AND security-reviewer's `findings[]` is empty, skip Steps 5-10 and proceed directly to Step 11 — there is nothing to route. Present the clean result to the user.
62
+
63
+ Otherwise, before presenting to the user, the orchestrator computes a recommended route per finding using the rule below (this rule is internal — do not include it in the user-facing prompt). The rule keys off code-reviewer's existing structured fields only — interpretation of "DD intent" is intentionally avoided to prevent unstable inference:
64
+
65
+ | Finding source | Pattern detectable from existing fields | Recommended route |
66
+ |---------------|-----------------------------------------|-------------------|
67
+ | `acceptanceCriteria[]` with `status: "partially_fulfilled"` or `"unfulfilled"` | The cited `gap` indicates the code does not satisfy the AC — needs additional implementation | `c` (Code-side fix) |
68
+ | `acceptanceCriteria[]` with `status: "partially_fulfilled"` or `"unfulfilled"` | The cited `gap` indicates the AC text itself diverged from the implemented (and team-accepted) behavior — i.e., the DD's AC wording captured the wrong intent rather than the code missing requirements (verify by reading the AC and comparing against the cited `location`) | `d` (Design-side update — AC text outdated) |
69
+ | `identifierMismatches[]` | `codeValue` is a plausible rename of `designDocValue` (camelCase ↔ kebab-case ↔ snake_case, abbreviation expansion/contraction, semantic renaming where both names refer to the same concept) — verify by inspecting the cited `location` to confirm the code uses the new name consistently | `d` (Design-side update — DD likely outdated) |
70
+ | `identifierMismatches[]` | All other identifier mismatches (e.g., wrong type, wrong cardinality, missing entirely) | `c` (Code-side fix) |
71
+ | `qualityFindings[]` | All categories (`dd_violation`, `maintainability`, `reliability`, `coverage_gap`) | `c` (Code-side fix) |
72
+ | security-reviewer `findings[]` | All categories (`confirmed_risk`, `defense_gap`, `hardening`, `policy`) | `c` (Code-side fix) |
73
+
74
+ The user can override any recommendation per finding. AC items with `status: "fulfilled"` are not routed (no action needed).
75
+
76
+ Then present to the user (label each finding with its recommended route, grouped by route):
61
77
 
62
78
  ```
63
79
  Code Compliance: [complianceRate from code-reviewer]
@@ -65,30 +81,57 @@ Code Compliance: [complianceRate from code-reviewer]
65
81
  Identifier Match Rate: [identifierMatchRate from code-reviewer]
66
82
  Acceptance Criteria:
67
83
  - [fulfilled] [item] (confidence: [high/medium/low])
68
- - [partially_fulfilled] [item]: [gap] — [suggestion]
69
- - [unfulfilled] [item]: [gap] — [suggestion]
84
+ - [partially_fulfilled] [item]: [gap] — [suggestion] [recommended: c | d]
85
+ - [unfulfilled] [item]: [gap] — [suggestion] [recommended: c | d]
70
86
  Identifier Mismatches:
71
- - [identifier]: DD=[designDocValue] Code=[codeValue] at [location]
87
+ - [identifier]: DD=[designDocValue] Code=[codeValue] at [location] [recommended: c | d]
72
88
  Quality Findings:
73
- - [category] [location]: [description] — [rationale]
89
+ - [category] [location]: [description] — [rationale] [recommended: c]
74
90
 
75
91
  Security Review: [status from security-reviewer]
76
92
  Findings by category:
77
- - [confirmed_risk] [location]: [description] — [rationale]
78
- - [defense_gap] [location]: [description] — [rationale]
79
- - [hardening] [location]: [description] — [rationale]
80
- - [policy] [location]: [description] — [rationale]
93
+ - [confirmed_risk] [location]: [description] — [rationale] [recommended: c]
94
+ - [defense_gap] [location]: [description] — [rationale] [recommended: c]
95
+ - [hardening] [location]: [description] — [rationale] [recommended: c]
96
+ - [policy] [location]: [description] — [rationale] [recommended: c]
81
97
  Notes: [notes from security-reviewer, if present]
82
98
 
83
- Execute fixes? (y/n):
99
+ Resolve discrepancies — confirm or override the recommended route per finding:
100
+ c) Code-side fix — code violates Design Doc; modify code to match
101
+ d) Design-side update — code is correct; Design Doc is stale, revise it
102
+ s) Skip — accept current state without changes
84
103
  ```
85
104
 
86
- If both pass and user selects `n`: Skip Steps 5-10, proceed to Step 11.
105
+ Use AskUserQuestion. The default offer is **"accept all recommended routes"** — a single confirmation for the typical case where the orchestrator's recommendations are correct. When the user wants to override, collect per-finding c/d/s decisions instead. If the user selects `s` for everything: skip Steps 5-10, proceed to Step 11.
87
106
 
88
107
  ### 5. Load Task Template
89
108
 
90
109
  Read documentation-criteria skill to obtain the task file template (references/task-template.md) for Step 6.
91
110
 
111
+ ### 5d. Design-Side Update
112
+
113
+ Run this step only when the user routed at least one finding to `d`. When all routes are `c` or `s`, skip directly to Step 6.
114
+
115
+ 1. Invoke technical-designer in update mode using Agent tool:
116
+ - `subagent_type`: "technical-designer"
117
+ - `description`: "Design Doc update from review findings"
118
+ - `prompt`: "Update Design Doc at [path] in update mode. The implementation has diverged in the following ways that the team has decided to ratify in the design rather than in the code: [list of `d`-routed findings with codeLocation and designDocValue from $STEP_2_OUTPUT]. Reflect the current code behavior in the relevant sections and add a history entry."
119
+
120
+ 2. Invoke document-reviewer to verify the updated Design Doc:
121
+ - `subagent_type`: "document-reviewer"
122
+ - `description`: "Document review of updated Design Doc"
123
+ - `prompt`: "Review updated Design Doc at [path] for consistency and completeness."
124
+
125
+ 3. When multiple Design Docs exist (`ls docs/design/*.md | grep -v template | wc -l > 1`), invoke design-sync:
126
+ - `subagent_type`: "design-sync"
127
+ - `description`: "Cross-DD consistency check"
128
+ - `prompt`: "source_design: [updated DD path]. Detect conflicts across all Design Docs after the update."
129
+ - When `sync_status: conflicts_found`: present conflicts to the user; resolution requires re-invoking technical-designer for affected DDs.
130
+
131
+ 4. After Step 5d completes:
132
+ - If the user selected zero `c` routes (whether all `d`, all `s`, or a `d` + `s` mix with no `c`) → skip Steps 6-8, proceed to Step 9 for re-validation
133
+ - If the user selected both `d` and `c` → re-evaluate the `c`-routed findings against the updated DD and drop any that are now satisfied by the DD revision; then proceed to Step 6 with the remaining `c` findings
134
+
92
135
  ### 6. Create Task File
93
136
 
94
137
  Create task file at `docs/plans/tasks/review-fixes-YYYYMMDD.md`
@@ -113,7 +156,7 @@ Invoke quality-fixer using Agent tool:
113
156
  Invoke code-reviewer using Agent tool:
114
157
  - `subagent_type`: "code-reviewer"
115
158
  - `description`: "Re-validate compliance"
116
- - `prompt`: "Re-validate Design Doc compliance after fixes. Design Doc: [path]. Implementation files: [file list]. Prior compliance issues: $STEP_2_OUTPUT. Verify each prior issue is resolved."
159
+ - `prompt`: "Re-validate Design Doc compliance after fixes. Design Doc: [path]. Implementation files: [file list]. Prior compliance issues: $STEP_2_OUTPUT. Verify each prior issue is resolved (whether resolved code-side or design-side)."
117
160
 
118
161
  ### 10. Re-validate security-reviewer
119
162
 
@@ -122,7 +165,15 @@ Invoke security-reviewer using Agent tool (only if security fixes were applied):
122
165
  - `description`: "Re-validate security"
123
166
  - `prompt`: "Re-validate security after fixes. Prior findings: $STEP_3_OUTPUT. Design Doc: [path]. Implementation files: [file list]."
124
167
 
125
- ### 11. Final Report
168
+ ### 11. Final Cleanup and Report
169
+
170
+ Delete the review-fix task file this recipe created (if any). Its work is committed; `docs/plans/` is ephemeral working state and is not retained between recipe runs:
171
+
172
+ - Delete `docs/plans/tasks/review-fixes-YYYYMMDD.md` if it exists
173
+
174
+ If the file cannot be deleted (filesystem error), report the failure but do not block the final report.
175
+
176
+ Then present the final report:
126
177
 
127
178
  ```
128
179
  Code Compliance:
@@ -136,9 +187,11 @@ Security Review:
136
187
 
137
188
  Remaining issues:
138
189
  - [items requiring manual intervention]
190
+
191
+ Cleanup: review-fixes task file removed
139
192
  ```
140
193
 
141
- ## Auto-fixable Items
194
+ ## Auto-fixable Items (code-side path)
142
195
  - Simple unimplemented acceptance criteria
143
196
  - Error handling additions
144
197
  - Type definition fixes
@@ -148,10 +201,16 @@ Remaining issues:
148
201
  ## Non-fixable Items
149
202
  - Fundamental business logic changes
150
203
  - Architecture-level modifications
151
- - Design Doc deficiencies
152
204
  - Committed secrets (blocked → human intervention)
153
205
 
154
- **Scope**: Design Doc compliance validation, security review, and auto-fixes.
206
+ ## Design-Side Update Triggers
207
+ Discrepancies suitable for the design-side path (code is correct, DD became stale):
208
+ - Identifier renames where the new identifier reflects the team's current naming
209
+ - Behavioral changes that match the original requirement intent better than what the DD captured
210
+ - Component splits or merges where the new structure is sound and the DD documented the prior structure
211
+ - New ACs that the implementation already satisfies but the DD never enumerated
212
+
213
+ **Scope**: Design Doc compliance validation, security review, code-side auto-fixes, and design-side update routing.
155
214
 
156
215
  ## Scope Boundary for Subagents
157
216
 
@@ -168,6 +168,14 @@ quality-fixer レスポンスをチェック:
168
168
  quality-fixer から `approved` の場合:
169
169
  - Bash で適切なメッセージを付けてテストファイルをコミット
170
170
 
171
+ ### ステップ9: 最終クリーンアップ
172
+
173
+ すべてのタスクファイルが処理されコミットされた後、本レシピが作成したタスクファイルを削除する。作業内容はコミット済みで、`docs/plans/`はレシピ実行間で保持しない一時的な作業状態である:
174
+
175
+ - 本実行で作成された `docs/plans/tasks/integration-tests-backend-task-*.md` および `docs/plans/tasks/integration-tests-frontend-task-*.md` に該当するすべてのファイルを削除する
176
+
177
+ タスクファイルを削除できない場合(ファイルシステムエラー)、失敗を報告するが完了をブロックしない。
178
+
171
179
  ## サブエージェントのスコープ境界
172
180
 
173
181
  本レシピから呼び出すサブエージェントプロンプトの末尾に以下のブロックを必ず付与する: