create-ai-project 1.21.0 → 1.22.1

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 (36) hide show
  1. package/.claude/agents-en/code-reviewer.md +1 -0
  2. package/.claude/agents-en/document-reviewer.md +13 -0
  3. package/.claude/agents-en/technical-designer-frontend.md +36 -2
  4. package/.claude/agents-en/technical-designer.md +37 -2
  5. package/.claude/agents-ja/code-reviewer.md +1 -0
  6. package/.claude/agents-ja/document-reviewer.md +13 -0
  7. package/.claude/agents-ja/technical-designer-frontend.md +36 -2
  8. package/.claude/agents-ja/technical-designer.md +37 -2
  9. package/.claude/commands-en/project-inject.md +84 -56
  10. package/.claude/commands-ja/project-inject.md +84 -56
  11. package/.claude/skills-en/coding-standards/SKILL.md +1 -0
  12. package/.claude/skills-en/documentation-criteria/SKILL.md +1 -0
  13. package/.claude/skills-en/documentation-criteria/references/design-template.md +53 -0
  14. package/.claude/skills-en/project-context/SKILL.md +2 -15
  15. package/.claude/skills-en/project-context/references/external-resources-api.md +76 -0
  16. package/.claude/skills-en/project-context/references/external-resources-backend.md +76 -0
  17. package/.claude/skills-en/project-context/references/external-resources-frontend.md +74 -0
  18. package/.claude/skills-en/project-context/references/external-resources-infra.md +76 -0
  19. package/.claude/skills-en/project-context/references/template.md +154 -0
  20. package/.claude/skills-en/task-analyzer/references/skills-index.yaml +0 -5
  21. package/.claude/skills-ja/coding-standards/SKILL.md +1 -0
  22. package/.claude/skills-ja/documentation-criteria/SKILL.md +1 -0
  23. package/.claude/skills-ja/documentation-criteria/references/design-template.md +53 -0
  24. package/.claude/skills-ja/project-context/SKILL.md +2 -15
  25. package/.claude/skills-ja/project-context/references/external-resources-api.md +76 -0
  26. package/.claude/skills-ja/project-context/references/external-resources-backend.md +76 -0
  27. package/.claude/skills-ja/project-context/references/external-resources-frontend.md +74 -0
  28. package/.claude/skills-ja/project-context/references/external-resources-infra.md +76 -0
  29. package/.claude/skills-ja/project-context/references/template.md +154 -0
  30. package/.claude/skills-ja/task-analyzer/references/skills-index.yaml +0 -5
  31. package/CHANGELOG.md +25 -0
  32. package/CLAUDE.en.md +10 -1
  33. package/CLAUDE.ja.md +12 -3
  34. package/CLAUDE.md +12 -3
  35. package/package.json +1 -1
  36. package/scripts/check-skills-index.mjs +1 -2
@@ -309,6 +309,7 @@ Recommend higher-level review when:
309
309
  - Implementation significantly exceeds Design Doc quality
310
310
  - Security concerns discovered
311
311
  - Critical performance issues found
312
+ - Implementation introduces in-scope elements absent from the Design Doc's Minimal Surface Alternatives section. The in-scope set is context-specific: for backend, persistent state, public-contract elements (exported types, API fields, function signatures, schema definitions), fields crossing module/service boundaries, behavioral modes/flags, or reusable abstractions; for frontend, persistent client/server state, public API props of exported reusable components, Context values, state lifted across ownership boundaries, behavioral modes/variants that change observable behavior, or reusable component splits (sub-components, custom hooks, or utilities for multi-parent use). Ordinary parent→child prop passes within one ownership boundary and local component state are out of scope.
312
313
 
313
314
  ## Special Considerations
314
315
 
@@ -89,6 +89,7 @@ For DesignDoc, additionally verify:
89
89
  - [ ] Field propagation map present (when fields cross boundaries)
90
90
  - [ ] Verification Strategy section present with: correctness definition, verification method, verification timing, early verification point
91
91
  - [ ] Fact Disposition Table section exists in the Design Doc
92
+ - [ ] Minimal Surface Alternatives section present with one entry per new in-scope element (persistent state; public-contract elements or cross-boundary fields/props — for backend, fields crossing module/service boundaries; for frontend, public API props of exported reusable components, Context values, or state lifted across ownership boundaries; behavioral mode/flag/variant; reusable abstraction or component split) when the design introduces any. Each entry contains the 5-step output (fixed requirements with AC references — AC ID, AC heading, EARS clause, or constraint ID — from the Design Doc or referenced PRD/UI Spec; alternatives table including at least one subtractive alternative; selected alternative with rationale; rejected alternatives log)
92
93
 
93
94
  #### Gate 1: Quality Assessment (only after Gate 0 passes)
94
95
 
@@ -118,6 +119,17 @@ For DesignDoc, additionally verify:
118
119
  - `remove`: valid when the rationale states the deletion and its reason. Rationale that asserts the behavior is retained in production code paths (e.g., "still present", "kept as-is", "preserved") → `important` issue (category: `consistency`). Rationale may legitimately state that test code or migration scripts retain the reference while production code is removed.
119
120
  - `out-of-scope`: the rationale cites a PRD/UI Spec section or scope-definition document → missing citation → `important` issue (category: `completeness`)
120
121
  - **Cross-Layer Assumptions check** (cross-layer flow only): when `prior_layer_verification` was provided to the designer and the Design Doc relies on prior-layer contracts, verify the "## Cross-Layer Assumptions" section exists and each entry follows the format `- [claim]: [justification]; verify at [target]`. Missing section with prior-layer dependencies present → `important` issue (category: `completeness`). Entry missing the `verify at` clause → `important` issue (category: `completeness`)
122
+ - **Minimal Surface Alternatives check**:
123
+ - *Scope trigger*: applies when the Design Doc introduces in-scope elements. The in-scope set is context-specific:
124
+ - **Backend designs**: persistent state; public-contract elements (exported types, API request/response fields, exported function signatures, schema definitions); cross-boundary fields (passed between modules/services); behavioral modes/flags; reusable abstractions.
125
+ - **Frontend designs**: persistent client/server state; props or fields crossing ownership boundaries (public API props of an exported reusable component, Context values, state lifted across ownership boundaries to a shared ancestor); behavioral modes/variants that change observable behavior; reusable component splits (sub-components, custom hooks, or utilities extracted for multi-parent use).
126
+ - Ordinary parent→child prop passes that stay within one ownership boundary, local `useState`/`useReducer` confined to a single component, internal fields used only within one module, and transient state are out of scope and do not require an entry.
127
+ - *Section existence*: trigger fires but the "Minimal Surface Alternatives" section is absent or empty → `critical` issue (category: `completeness`).
128
+ - *Per-element entry*:
129
+ - (1) Step 1 lists at least one AC reference (AC ID, AC heading, EARS clause, or constraint ID) from the Design Doc or referenced PRD/UI Spec — missing linkage, or list contains only speculative requirements ("future", "might want") → `critical` issue (category: `compliance`).
130
+ - (2) Steps 2–3 include at least one subtractive alternative (derive / compute on demand / keep at caller / reuse existing / introduce no new state) — missing subtractive alternative → `critical` issue (category: `compliance`).
131
+ - (3) Step 4 rationale either selects the smallest alternative or names a current requirement smaller alternatives fail to satisfy — "useful" / "future-ready" / "convenient" / "users might want" used as primary rationale → `critical` issue (category: `compliance`).
132
+ - (4) Step 5 records the rejected alternatives with brief rationale — missing rejected alternatives log → `important` issue (category: `completeness`). Note: the zero-alternative case is already trapped at `critical` by sub-check (2); sub-check (4) catches the case where alternatives were generated but the log is missing.
121
133
 
122
134
  **Perspective-specific Mode**:
123
135
  - Implement review based on specified mode and focus
@@ -278,6 +290,7 @@ Include in output when `prior_context_count > 0`:
278
290
  - [ ] Output comparison defined when design replaces/modifies existing behavior (covers all transformation pipeline steps)
279
291
  - [ ] Fact Disposition Table covers every `codebase_analysis.focusAreas` entry with verbatim `fact_id` / `evidence` carry-through and rationale-disposition semantic alignment (when `codebase_analysis` is provided)
280
292
  - [ ] Cross-Layer Assumptions section present when `prior_layer_verification` shows unresolved contracts the design depends on
293
+ - [ ] Minimal Surface Alternatives section covers every new in-scope element with the 5-step output; Step 4 rationale either names the smallest alternative as selected, or names the current requirement smaller alternatives fail to cover (when the design introduces any in-scope elements)
281
294
 
282
295
  ## Review Criteria (for Comprehensive Mode)
283
296
 
@@ -47,6 +47,7 @@ The subsections below are not parallel mandates; they form four serial gates. Co
47
47
  **Gate 1 — Existing State Analysis** (depends on Gate 0):
48
48
  - Existing Code Investigation
49
49
  - Fact Disposition (when Codebase Analysis input is provided)
50
+ - Minimal Surface Alternatives (when introducing persistent client/server state, props or fields crossing ownership boundaries — public API props of exported reusable components, Context values, or state lifted across ownership boundaries — behavioral modes/variants that change observable behavior, or reusable component splits)
50
51
 
51
52
  **Gate 2 — Design Decisions** (depends on Gate 1):
52
53
  - Implementation Approach Decision
@@ -134,6 +135,41 @@ For every entry in `Codebase Analysis.focusAreas`, produce one row in the Design
134
135
 
135
136
  The Fact Disposition Table is the primary mechanism that binds **structural existing-behavior facts** to the design. Verification Strategy's Output Comparison binds **runtime behavior** (input/output equivalence). Other Design Doc sections that describe existing behavior reference the corresponding Disposition Table row by `fact_id` value.
136
137
 
138
+ ### Minimal Surface Alternatives [Gate 1 — Required when introducing persistent client/server state, props or fields crossing ownership boundaries (public API props of exported reusable components, Context values, or state lifted across ownership boundaries), behavioral modes/variants that change observable behavior, or reusable component splits]
139
+
140
+ Applies to each maintenance-surface-bearing element the design introduces. Goal: select the smallest design surface that covers the same current requirements. Reference: `coding-standards` skill, "Minimum Surface for Required Coverage".
141
+
142
+ **In scope**: persistent state (localStorage/sessionStorage/IndexedDB/cookies/server-saved fields — state that survives reload, navigation, or session, or is saved outside component memory); props or fields crossing ownership boundaries (public API props of an exported reusable component, Context values, state lifted across ownership boundaries to a shared ancestor); behavioral modes/variants (component variants, mode props, conditional rendering modes that change observable behavior); reusable component splits (sub-components, custom hooks, or utilities extracted for use by multiple parents).
143
+
144
+ **Out of scope**: local `useState` / `useReducer` confined to a single component's internal logic (lost on reload); private hooks used by one component; ordinary parent→child prop passes that stay within one ownership boundary; test fixture or mock props; transient render-only state; internal helper functions without external observers.
145
+
146
+ **Precedence**: when an element matches both an in-scope and an out-of-scope condition (e.g., local `useState` that is now lifted to a Context so additional sibling subtrees can read it — the local-state aspect would be out of scope but the Context aspect is in scope), the in-scope classification wins and the gate applies.
147
+
148
+ Execute the 5 steps below for each in-scope element. Record the result in the Design Doc's "Minimal Surface Alternatives" section (see design-template.md).
149
+
150
+ 1. **Fix Requirements**
151
+ - List the current user-visible requirements / ACs / accepted technical constraints (audit, accessibility, performance, security, compatibility) this element serves. Reference each by AC ID, AC heading, EARS clause, or constraint ID from the Design Doc or referenced PRD/UI Spec.
152
+ - Eligibility: only requirements / constraints inside the current Design Doc's adopted scope qualify.
153
+
154
+ 2. **Diverge** (generate alternatives)
155
+ - Produce at least 2 alternative realizations covering the same fixed requirements.
156
+ - At least one alternative is subtractive. Subtractive options are drawn from: derive from existing props/state, lift state to existing parent, reuse existing component or variant, keep at caller / URL / server response, introduce no new mode.
157
+
158
+ 3. **Compare** (record alternatives in a table)
159
+
160
+ | Alternative | Current requirements covered (AC reference) | New persistent state (client or server, count) | New props / modes / variants (count) | Crosses component boundary (yes/no) | Breaking change or migration required (yes/no) | Subjective cost notes |
161
+ |---|---|---|---|---|---|---|
162
+
163
+ Resolution priority (later columns are tiebreakers when earlier are equal): (1) new persistent state (lower=smaller); (2) crosses component boundary (no=smaller); (3) new props/modes/variants (lower=smaller); (4) breaking change or migration (no=smaller); (5) subjective cost notes.
164
+
165
+ 4. **Converge** (select)
166
+ - Select the alternative with the smallest surface that covers all fixed requirements, applying the resolution priority above.
167
+ - When the selected alternative is not the smallest, name the current requirement (from Step 1) that smaller alternatives fail to satisfy.
168
+ - "Reusable" / "future-ready" / "convenient for implementation" / "users might want" belong in the Subjective cost notes column only (tiebreakers).
169
+
170
+ 5. **Record Rejected Alternatives**
171
+ - For each rejected alternative, record 1-2 lines: what it was, why rejected. Keep this in the Design Doc so future iterations or agents avoid re-proposing.
172
+
137
173
  ### Implementation Approach Decision [Gate 2 — Required]
138
174
  Must be performed when creating Design Doc.
139
175
 
@@ -315,8 +351,6 @@ Non-compliant: class components, `any`, untyped responses without guards, secret
315
351
 
316
352
  ### Design Doc Checklist
317
353
 
318
- Items below are output-content checks performed in addition to (not duplicating) the Gate Ordering [BLOCKING] gates. The gates cover whether each subsection ran; the checklist below covers content quality of the produced output.
319
-
320
354
  **All modes**:
321
355
  - [ ] Component hierarchy and data flow clearly expressed in diagrams
322
356
 
@@ -48,6 +48,7 @@ The subsections below are not parallel mandates; they form four serial gates. Co
48
48
  - Existing Code Investigation
49
49
  - Fact Disposition (when Codebase Analysis input is provided)
50
50
  - Data Representation Decision (when new or modified data structures are introduced)
51
+ - Minimal Surface Alternatives (when introducing persistent state, public-contract elements or cross-boundary fields, behavioral modes/flags, or reusable abstractions)
51
52
 
52
53
  **Gate 2 — Design Decisions** (depends on Gate 1):
53
54
  - Implementation Approach Decision
@@ -170,6 +171,41 @@ When the design introduces or significantly modifies data structures:
170
171
  - 3+ criteria fail → New structure justified
171
172
  - Record decision and rationale in Design Doc
172
173
 
174
+ ### Minimal Surface Alternatives [Gate 1 — Required when introducing persistent state, public-contract elements or cross-boundary fields, behavioral modes/flags, or reusable abstractions]
175
+
176
+ Applies to each maintenance-surface-bearing element the design introduces. Goal: select the smallest design surface that covers the same current requirements. Reference: `coding-standards` skill, "Minimum Surface for Required Coverage".
177
+
178
+ **In scope**: persistent state (DB columns/tables, file fields, cache entries, queue payloads, session/cookie data — state outliving a single operation); public-contract elements (exported types, API request/response fields, exported function signatures, schema definitions); cross-boundary fields (passed between modules/services); behavioral modes/flags (state-machine states, feature flags, config options); reusable abstractions (new types/classes/modules/interfaces intended for reuse).
179
+
180
+ **Out of scope**: local variables within a single function; internal fields used only within one module; test fixture or mock fields; transient state confined to a single operation; private state without external observers.
181
+
182
+ **Precedence**: when an element matches both an in-scope and an out-of-scope condition (e.g., an internal field that is also persisted to a DB column), the in-scope classification wins and the gate applies.
183
+
184
+ Execute the 5 steps below for each in-scope element. Record the result in the Design Doc's "Minimal Surface Alternatives" section (see design-template.md).
185
+
186
+ 1. **Fix Requirements**
187
+ - List the current user-visible requirements / ACs / accepted technical constraints (audit, data integrity, compatibility, security, performance) this element serves. Reference each by AC ID, AC heading, EARS clause, or constraint ID from the Design Doc or referenced PRD.
188
+ - Eligibility: only requirements / constraints inside the current Design Doc's adopted scope qualify.
189
+
190
+ 2. **Diverge** (generate alternatives)
191
+ - Produce at least 2 alternative realizations covering the same fixed requirements.
192
+ - At least one alternative is subtractive. Subtractive options are drawn from: derive from existing data, compute on demand, keep at caller / invocation boundary, reuse existing structure, introduce no new state.
193
+
194
+ 3. **Compare** (record alternatives in a table)
195
+
196
+ | Alternative | Current requirements covered (AC reference) | New persistent state (count) | New concept / mode / flag (count) | Crosses module/service boundary (yes/no) | Breaking change or migration required (yes/no) | Subjective cost notes |
197
+ |---|---|---|---|---|---|---|
198
+
199
+ Resolution priority (later columns are tiebreakers when earlier are equal): (1) new persistent state (lower=smaller); (2) crosses module/service boundary (no=smaller); (3) new concept/mode/flag (lower=smaller); (4) breaking change or migration (no=smaller); (5) subjective cost notes.
200
+
201
+ 4. **Converge** (select)
202
+ - Select the alternative with the smallest surface that covers all fixed requirements, applying the resolution priority above.
203
+ - When the selected alternative is not the smallest, name the current requirement (from Step 1) that smaller alternatives fail to satisfy.
204
+ - "Useful" / "future-ready" / "convenient for implementation" / "users might want" belong in the Subjective cost notes column only (tiebreakers).
205
+
206
+ 5. **Record Rejected Alternatives**
207
+ - For each rejected alternative, record 1-2 lines: what it was, why rejected. Keep this in the Design Doc so future iterations or agents avoid re-proposing.
208
+
173
209
  ### Implementation Approach Decision [Gate 2 — Required]
174
210
  Must be performed when creating Design Doc.
175
211
 
@@ -320,8 +356,6 @@ Consistency first (follow existing patterns; document reason when introducing ne
320
356
 
321
357
  ### Design Doc Checklist
322
358
 
323
- Items below are output-content checks performed in addition to (not duplicating) the Gate Ordering [BLOCKING] gates. The gates cover whether each subsection ran; the checklist below covers content quality of the produced output.
324
-
325
359
  **All modes**:
326
360
  - [ ] Architecture and data flow clearly expressed in diagrams
327
361
  - [ ] Quality assurance mechanisms recorded with `adopted`/`noted` status (and `executable_check` / `passive_constraint` type)
@@ -415,6 +449,7 @@ Mode for documenting existing architecture as-is. Used when creating Design Docs
415
449
  - Field Propagation Map (no new fields being introduced)
416
450
  - Implementation Approach Decision (no implementation strategy to select)
417
451
  - Latest Information Research (documenting what exists, not designing something new)
452
+ - Minimal Surface Alternatives (documenting existing elements, not introducing new ones)
418
453
 
419
454
  ### Reverse-Engineer Mode Execution Steps
420
455
 
@@ -309,6 +309,7 @@ summary.findingsByCategory.coverage_gap: number (整数 >= 0)
309
309
  - 実装がDesign Docを大幅に超えて優れている場合
310
310
  - セキュリティ上の懸念を発見した場合
311
311
  - パフォーマンス上の重大な問題を発見した場合
312
+ - 実装が Design Doc の Minimal Surface Alternatives セクションに記載のない適用対象要素を導入している場合。適用対象集合はコンテキストごとに異なる: バックエンドでは永続状態、公開コントラクト要素(公開型、APIフィールド、関数シグネチャ、スキーマ定義)、モジュール/サービス境界を越えるフィールド、振る舞いモード/フラグ、再利用可能な抽象、フロントエンドでは永続化されるクライアント/サーバー状態、エクスポートされた再利用可能コンポーネントの公開 API Props、Context 値、所有境界を越えて持ち上げられた状態、観測可能な振る舞いを変える振る舞いモード/バリアント、再利用可能なコンポーネント分割(複数の親で利用するためのサブコンポーネント、カスタムフック、ユーティリティ)。1つの所有境界内に留まる通常の親→子の Props 伝達や、コンポーネントローカルの状態は適用対象外。
312
313
 
313
314
  ## 特別な考慮事項
314
315
 
@@ -89,6 +89,7 @@ DesignDocの場合、追加で以下を確認:
89
89
  - [ ] フィールド伝播マップの存在(フィールドが境界を越える場合)
90
90
  - [ ] 検証戦略セクションの存在(正しさの定義、検証手法、検証タイミング、早期検証ポイント)
91
91
  - [ ] Fact Disposition TableセクションがDesign Docに存在する
92
+ - [ ] Minimal Surface Alternatives セクションが存在し、新規に導入される適用対象要素(永続状態 / 公開コントラクト要素または境界を越えるフィールド・Props — バックエンドではモジュール/サービス境界を越えるフィールド、フロントエンドではエクスポートされた再利用可能コンポーネントの公開 API Props・Context 値・所有境界を越えて持ち上げられた状態 / 振る舞いモード・フラグ・バリアント / 再利用可能な抽象またはコンポーネント分割)ごとに1エントリ持つ(適用対象要素を導入する場合)。各エントリには5ステップの結果が含まれる(確定要件 — Design Docまたは参照PRD/UI SpecのAC参照(AC ID、AC見出し、EARS節、または制約ID)、削減的な代替案を1つ以上含む比較表、根拠付きの選定結果、不採用案の記録)
92
93
 
93
94
  #### Gate 1: 品質評価(Gate 0通過後のみ実施)
94
95
 
@@ -118,6 +119,17 @@ DesignDocの場合、追加で以下を確認:
118
119
  - `remove`: 削除と理由を述べるRationaleは妥当。Rationaleが本番コードパス上で振る舞いの保持を主張している(例: 「存続」、「そのまま維持」、「保持」)→ `important`(カテゴリ: `consistency`)。テストコードや移行スクリプトでの参照保持は妥当な記述として扱う。
119
120
  - `out-of-scope`: RationaleがPRD/UI Specセクションまたはスコープ定義文書を引用していない → `important`(カテゴリ: `completeness`)
120
121
  - **Cross-Layer Assumptionsチェック**(レイヤー横断フロー時のみ): `prior_layer_verification`が設計者に提供され、かつDesign Docが前レイヤーの契約に依存する場合、「## Cross-Layer Assumptions」セクションが存在し、各エントリが `- [主張]: [正当化]; 検証先: [対象]` 形式に従うことを検証する。前レイヤー依存があるのにセクションがない → `important`(カテゴリ: `completeness`)。エントリに`検証先:`節がない → `important`(カテゴリ: `completeness`)
122
+ - **Minimal Surface Alternatives チェック**:
123
+ - *スコープトリガー*: Design Doc が新規に適用対象要素を導入するときに発火する。適用対象集合はコンテキストごとに異なる:
124
+ - **バックエンド設計**: 永続状態、公開コントラクト要素(公開型、APIリクエスト/レスポンスフィールド、公開関数シグネチャ、スキーマ定義)、境界を越えるフィールド(モジュール/サービス間を渡るもの)、振る舞いモード/フラグ、再利用可能な抽象。
125
+ - **フロントエンド設計**: 永続化されるクライアント/サーバー状態、所有境界を越える Props またはフィールド(エクスポートされた再利用可能コンポーネントの公開 API Props、Context 値、所有境界を越えて共有先祖に持ち上げられた状態)、観測可能な振る舞いを変える振る舞いモード/バリアント、再利用可能なコンポーネント分割(複数の親で利用するために抽出されたサブコンポーネント、カスタムフック、ユーティリティ)。
126
+ - 1つの所有境界内に留まる通常の親→子の Props 伝達、単一コンポーネントに閉じた `useState` / `useReducer`、単一モジュール内のみで使う内部フィールド、一時的状態は適用対象外でありエントリを必要としない。
127
+ - *セクションの存在*: トリガーが発火するのに「Minimal Surface Alternatives」セクションが存在しない、または空 → `critical`(カテゴリ: `completeness`)。
128
+ - *要素ごとのエントリ*:
129
+ - (1) ステップ1 が Design Doc または参照 PRD/UI Spec から少なくとも1つの AC 参照(AC ID、AC見出し、EARS節、または制約ID)を挙げている — リンクの欠落、または投機的要件(「将来」「欲しがるかも」)のみで構成 → `critical`(カテゴリ: `compliance`)。
130
+ - (2) ステップ2〜3 に少なくとも1つの削減的代替案(既存から導出 / オンデマンド計算 / 呼び出し側に留める / 既存を再利用 / 新規状態を導入しない)が含まれる — 削減的代替案の欠落 → `critical`(カテゴリ: `compliance`)。
131
+ - (3) ステップ4 の根拠が、最小の代替案を選定するか、より小さい代替案では満たせない現要件を名指している — 「便利」「将来対応」「実装が楽」「ユーザーが欲しがるかも」が主たる根拠として使われている → `critical`(カテゴリ: `compliance`)。
132
+ - (4) ステップ5 で不採用案が簡潔な根拠とともに記録されている — 不採用案ログの欠落 → `important`(カテゴリ: `completeness`)。注: 代替案ゼロのケースはサブチェック(2)で先に `critical` として検出される。サブチェック(4)は代替案は生成されたが記録が抜けているケースを検出する。
121
133
 
122
134
  **観点特化モード**:
123
135
  - 指定されたmodeとfocusに基づいてレビューを実施
@@ -273,6 +285,7 @@ DesignDocの場合、追加で以下を確認:
273
285
  - [ ] 既存の振る舞いを置換/変更する設計で出力比較が定義されていること(全変換パイプラインステップをカバー)
274
286
  - [ ] Fact Disposition Tableが`codebase_analysis.focusAreas`の全エントリをカバーし、`fact_id`/`evidence`が一字一句引き継がれ、Rationale-disposition意味整合がとれている(`codebase_analysis`が提供された場合)
275
287
  - [ ] 前レイヤー契約に依存する未解決主張がある場合、Cross-Layer Assumptionsセクションが存在する
288
+ - [ ] Minimal Surface Alternatives セクションが新規の適用対象要素ごとに5ステップの結果をカバーし、ステップ4 の根拠が最小代替案の選定か、より小さい代替案では満たせない現要件の名指しになっている(適用対象要素を導入する場合)
276
289
 
277
290
  ## レビュー基準(総合モード用)
278
291
 
@@ -47,6 +47,7 @@ ADR/Design Docの作成閾値はdocumentation-criteriaスキルに準拠。判
47
47
  **Gate 1 — Existing State Analysis**(Gate 0 に依存):
48
48
  - Existing Code Investigation
49
49
  - Fact Disposition(Codebase Analysis 入力が提供される場合)
50
+ - Minimal Surface Alternatives(永続化されるクライアント/サーバー状態、所有境界を越える Props またはフィールド — エクスポートされた再利用可能コンポーネントの公開 API Props、Context 値、所有境界を越えて持ち上げられた状態 — 観測可能な振る舞いを変える振る舞いモード/バリアント、または再利用可能なコンポーネント分割を導入する場合)
50
51
 
51
52
  **Gate 2 — Design Decisions**(Gate 1 に依存):
52
53
  - Implementation Approach Decision
@@ -134,6 +135,41 @@ Design Doc作成前に必ず実施:
134
135
 
135
136
  Fact Disposition Table は **構造的な既存事実** を設計に結び付ける主たるメカニズム。Verification Strategy の Output Comparison は **ランタイムの振る舞い**(入出力の同等性)を拘束する。Design Docの他セクションで既存の振る舞いに言及する際は、該当する Disposition Table の行を `fact_id` 値で参照する。
136
137
 
138
+ ### Minimal Surface Alternatives [Gate 1 — Required when introducing persistent client/server state, props or fields crossing ownership boundaries (public API props of exported reusable components, Context values, or state lifted across ownership boundaries), behavioral modes/variants that change observable behavior, or reusable component splits]
139
+
140
+ 設計が導入する保守対象の各要素に適用する。目標: 同じ現要件をカバーする最小の設計面を選択すること。参照: `coding-standards` スキル「Minimum Surface for Required Coverage」。
141
+
142
+ **適用対象**: 永続状態(localStorage / sessionStorage / IndexedDB / Cookie / サーバー保存フィールド — リロード、ナビゲーション、セッションを越えて残る、またはコンポーネントメモリ外に保存される状態)、所有境界を越える Props またはフィールド(エクスポートされた再利用可能コンポーネントの公開 API Props、Context 値、所有境界を越えて共有先祖に持ち上げられた状態)、観測可能な振る舞いを変える振る舞いモード/バリアント(コンポーネントバリアント、モード Props、条件付きレンダリングモード)、再利用可能なコンポーネント分割(複数の親で利用するために抽出されたサブコンポーネント、カスタムフック、ユーティリティ)。
143
+
144
+ **適用対象外**: 単一コンポーネント内部のロジックに閉じた `useState` / `useReducer`(リロードで失われる)、1つのコンポーネントだけが使うプライベートフック、1つの所有境界内に留まる通常の親→子の Props 伝達、テストフィクスチャやモック Props、レンダリング中のみの一時的状態、外部から参照されない内部ヘルパー関数。
145
+
146
+ **優先関係**: 1つの要素が適用対象と適用対象外の両方に当てはまる場合(例: 元はローカル `useState` だったが、別のサブツリーからも読めるようにするため Context に持ち上げた — ローカル状態としては適用対象外、Context としては適用対象)、適用対象の分類が優先し、本ゲートが発火する。
147
+
148
+ 適用対象の各要素について下記の5ステップを実行し、Design Doc の「Minimal Surface Alternatives」セクションに結果を記録する(design-template.md 参照)。
149
+
150
+ 1. **要件の確定**
151
+ - この要素が満たす現在のユーザー観察可能な要件 / AC / 受容済み技術制約(監査、アクセシビリティ、パフォーマンス、セキュリティ、互換性)を列挙する。各々を Design Doc または参照 PRD / UI Spec の AC ID、AC見出し、EARS節、または制約ID で参照する。
152
+ - 適格性: 現在の Design Doc の採用スコープ内の要件・制約のみが対象。
153
+
154
+ 2. **発散**(代替案を生成)
155
+ - 同じ確定要件をカバーする代替実現案を2つ以上生成する。
156
+ - 少なくとも1つは削減的(subtractive)な代替案であること。削減的な選択肢の例: 既存の Props / 状態から導出する、既存の親に状態を持ち上げる、既存のコンポーネントやバリアントを再利用する、呼び出し側 / URL / サーバーレスポンスに留める、新規モードを導入しない。
157
+
158
+ 3. **比較**(代替案を表で記録)
159
+
160
+ | 代替案 | カバーする現要件(AC 参照) | 新規の永続状態(クライアントまたはサーバー、件数) | 新規の Props / モード / バリアント(件数) | コンポーネント境界を越えるか(はい/いいえ) | 破壊的変更または移行が必要か(はい/いいえ) | 主観的コストノート |
161
+ |---|---|---|---|---|---|---|
162
+
163
+ 解決優先順位(左の列が同点のとき右の列でタイブレーク): (1) 新規の永続状態(少ない=小さい)、(2) コンポーネント境界を越えるか(いいえ=小さい)、(3) 新規の Props / モード / バリアント(少ない=小さい)、(4) 破壊的変更または移行(いいえ=小さい)、(5) 主観的コストノート。
164
+
165
+ 4. **収束**(選定)
166
+ - 上記の解決優先順位を適用し、すべての確定要件をカバーする中で最小の面を持つ代替案を選ぶ。
167
+ - 選定が最小でない場合、ステップ1から、より小さい代替案では満たせない現要件を名指す。
168
+ - 「再利用可能」「将来対応」「実装が楽」「ユーザーが欲しがるかも」は主観的コストノート列のみに記載する(タイブレーカー扱い)。
169
+
170
+ 5. **不採用案の記録**
171
+ - 不採用となった各代替案について、何だったか・なぜ不採用かを1〜2行で記録する。将来の反復や別エージェントによる再提案を避けるため、Design Doc に残す。
172
+
137
173
  ### 実装アプローチ決定 [Gate 2 — Required]
138
174
  Design Doc作成時に必ず実施。
139
175
 
@@ -315,8 +351,6 @@ function useUserData(userId: string) {
315
351
 
316
352
  ### Design Docチェックリスト
317
353
 
318
- 以下の項目はゲート順序 [BLOCKING] のゲートに加えて(重複させず)実施する出力内容のチェック。ゲートは各サブセクションが実行されたかをカバーし、以下のチェックリストは出力内容の品質をカバーする。
319
-
320
354
  **全モード共通**:
321
355
  - [ ] コンポーネント階層とデータフローが図で明確に表現されているか
322
356
 
@@ -48,6 +48,7 @@ ADR/Design Docの作成閾値はdocumentation-criteriaスキルに準拠。判
48
48
  - Existing Code Investigation
49
49
  - Fact Disposition(Codebase Analysis 入力が提供される場合)
50
50
  - Data Representation Decision(新規または変更されるデータ構造を導入する場合)
51
+ - Minimal Surface Alternatives(永続状態、公開コントラクト要素または境界を越えるフィールド、振る舞いモード/フラグ、再利用可能な抽象を導入する場合)
51
52
 
52
53
  **Gate 2 — Design Decisions**(Gate 1 に依存):
53
54
  - Implementation Approach Decision
@@ -170,6 +171,41 @@ Fact Disposition Table は **構造的な既存事実** を設計に結び付け
170
171
  - 3基準以上不適合 → 新規構造を正当化
171
172
  - 判断と根拠をDesign Docに記録
172
173
 
174
+ ### Minimal Surface Alternatives [Gate 1 — Required when introducing persistent state, public-contract elements or cross-boundary fields, behavioral modes/flags, or reusable abstractions]
175
+
176
+ 設計が導入する保守対象の各要素に適用する。目標: 同じ現要件をカバーする最小の設計面を選択すること。参照: `coding-standards` スキル「Minimum Surface for Required Coverage」。
177
+
178
+ **適用対象**: 永続状態(DBカラム/テーブル、ファイルフィールド、キャッシュエントリ、キューペイロード、セッション/Cookieデータ — 単一操作を超えて残る状態)、公開コントラクト要素(公開型、APIリクエスト/レスポンスフィールド、公開関数シグネチャ、スキーマ定義)、境界を越えるフィールド(モジュール/サービス間を渡るもの)、振る舞いモード/フラグ(ステートマシン状態、Feature Flag、設定オプション)、再利用可能な抽象(再利用を意図した新規の型/クラス/モジュール/インターフェース)。
179
+
180
+ **適用対象外**: 単一関数内のローカル変数、単一モジュール内のみで使う内部フィールド、テストフィクスチャやモックフィールド、単一操作内で完結する一時的状態、外部から参照されないプライベート状態。
181
+
182
+ **優先関係**: 1つの要素が適用対象と適用対象外の両方に当てはまる場合(例: 単一モジュール内のフィールドだがDBカラムとして永続化される)、適用対象の分類が優先し、本ゲートが発火する。
183
+
184
+ 適用対象の各要素について下記の5ステップを実行し、Design Docの「Minimal Surface Alternatives」セクションに結果を記録する(design-template.md参照)。
185
+
186
+ 1. **要件の確定**
187
+ - この要素が満たす現在のユーザー観察可能な要件 / AC / 受容済み技術制約(監査、データ整合性、互換性、セキュリティ、パフォーマンス)を列挙する。各々を Design Doc または参照 PRD の AC ID、AC見出し、EARS節、または制約ID で参照する。
188
+ - 適格性: 現在の Design Doc の採用スコープ内の要件・制約のみが対象。
189
+
190
+ 2. **発散**(代替案を生成)
191
+ - 同じ確定要件をカバーする代替実現案を2つ以上生成する。
192
+ - 少なくとも1つは削減的(subtractive)な代替案であること。削減的な選択肢の例: 既存データから導出する、オンデマンドで計算する、呼び出し側/呼び出し境界に留める、既存構造を再利用する、新規状態を導入しない。
193
+
194
+ 3. **比較**(代替案を表で記録)
195
+
196
+ | 代替案 | カバーする現要件(AC 参照) | 新規の永続状態(件数) | 新規の概念 / モード / フラグ(件数) | モジュール/サービス境界を越えるか(はい/いいえ) | 破壊的変更または移行が必要か(はい/いいえ) | 主観的コストノート |
197
+ |---|---|---|---|---|---|---|
198
+
199
+ 解決優先順位(左の列が同点のとき右の列でタイブレーク): (1) 新規の永続状態(少ない=小さい)、(2) モジュール/サービス境界を越えるか(いいえ=小さい)、(3) 新規の概念/モード/フラグ(少ない=小さい)、(4) 破壊的変更または移行(いいえ=小さい)、(5) 主観的コストノート。
200
+
201
+ 4. **収束**(選定)
202
+ - 上記の解決優先順位を適用し、すべての確定要件をカバーする中で最小の面を持つ代替案を選ぶ。
203
+ - 選定が最小でない場合、ステップ1から、より小さい代替案では満たせない現要件を名指す。
204
+ - 「便利」「将来対応」「実装が楽」「ユーザーが欲しがるかも」は主観的コストノート列のみに記載する(タイブレーカー扱い)。
205
+
206
+ 5. **不採用案の記録**
207
+ - 不採用となった各代替案について、何だったか・なぜ不採用かを1〜2行で記録する。将来の反復や別エージェントによる再提案を避けるため、Design Doc に残す。
208
+
173
209
  ### 実装アプローチ決定 [Gate 2 — Required]
174
210
  Design Doc作成時に必ず実施。
175
211
 
@@ -320,8 +356,6 @@ Design Doc作成時に必ず含める:
320
356
 
321
357
  ### Design Docチェックリスト
322
358
 
323
- 以下の項目はゲート順序 [BLOCKING] のゲートに加えて(重複させず)実施する出力内容のチェック。ゲートは各サブセクションが実行されたかをカバーし、以下のチェックリストは出力内容の品質をカバーする。
324
-
325
359
  **全モード共通**:
326
360
  - [ ] アーキテクチャとデータフローが図で明確に表現されているか
327
361
  - [ ] 品質保証メカニズムが `adopted` / `noted` ステータス(および `executable_check` / `passive_constraint` 種別)付きで記録されているか
@@ -415,6 +449,7 @@ ACの出力に以下のいずれかが含まれる場合、Property注釈を付
415
449
  - フィールド伝播マップ(新規フィールドを導入していない)
416
450
  - 実装アプローチ決定(実装戦略を選択する必要がない)
417
451
  - 最新情報の調査(存在するものを記録しており、新規設計ではない)
452
+ - Minimal Surface Alternatives(既存要素を記録するモードで、新規要素を導入しない)
418
453
 
419
454
  ### リバースエンジニアモード実行ステップ
420
455
 
@@ -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
+ ```