phasegate 0.183.0 → 0.212.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 (100) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/README.ja.md +52 -15
  3. package/README.md +39 -11
  4. package/docs/ADR/030-injection-threat-model-and-trust-root.md +145 -0
  5. package/docs/guide/hooks-integration.md +50 -1
  6. package/docs/guide/installation.md +1 -1
  7. package/docs/guide/quick-vs-full-mode.md +1 -1
  8. package/docs/guide/skills-overview.md +17 -17
  9. package/package.json +1 -1
  10. package/scripts/harness/agent-integration/presentation/phasegate-status-context.ts +131 -63
  11. package/scripts/harness/agent-integration/presentation/session-start-hook.ts +31 -4
  12. package/scripts/harness/agent-integration/presentation/spotlight.ts +65 -0
  13. package/scripts/harness/biome-ast-engine/infrastructure/parsers/comment-density-parser.ts +51 -10
  14. package/scripts/harness/ci-governance/application/dto/pin-integrity-input.ts +8 -0
  15. package/scripts/harness/ci-governance/application/dto/pin-integrity-output.ts +9 -0
  16. package/scripts/harness/ci-governance/application/dto/verify-integrity-input.ts +7 -0
  17. package/scripts/harness/ci-governance/application/dto/verify-integrity-output.ts +10 -0
  18. package/scripts/harness/ci-governance/application/usecases/pin-integrity-usecase.ts +60 -0
  19. package/scripts/harness/ci-governance/application/usecases/verify-integrity-usecase.ts +46 -0
  20. package/scripts/harness/ci-governance/composition-root.ts +68 -65
  21. package/scripts/harness/ci-governance/domain/ports/integrity-manifest-repository-port.ts +14 -0
  22. package/scripts/harness/ci-governance/domain/ports/sha256-hasher-port.ts +10 -0
  23. package/scripts/harness/ci-governance/domain/services/integrity-checker.ts +42 -0
  24. package/scripts/harness/ci-governance/domain/value-objects/integrity-drift.ts +16 -0
  25. package/scripts/harness/ci-governance/domain/value-objects/integrity-manifest.ts +49 -0
  26. package/scripts/harness/ci-governance/domain/value-objects/integrity-target.ts +40 -0
  27. package/scripts/harness/ci-governance/infrastructure/adapters/adr-foundation-existence-adapter.ts +26 -2
  28. package/scripts/harness/ci-governance/infrastructure/adapters/file-system-sha256-hasher-adapter.ts +17 -0
  29. package/scripts/harness/ci-governance/infrastructure/adapters/harness-api-command-existence-adapter.ts +8 -1
  30. package/scripts/harness/ci-governance/infrastructure/adapters/integrity-manifest-json-repository-adapter.ts +83 -0
  31. package/scripts/harness/ci-governance/presentation/handlers/integrity-handler.ts +76 -0
  32. package/scripts/harness/config-foundation/application/mappers/validator-system-config-mapper.ts +53 -28
  33. package/scripts/harness/harness-api/domain/value-objects/ci-check-result.ts +33 -8
  34. package/scripts/harness/harness-api/domain/value-objects/known-harness-commands.ts +90 -0
  35. package/scripts/harness/installation/application/bundled-skill-selection.ts +2 -5
  36. package/scripts/harness/main.ts +257 -105
  37. package/scripts/harness/phase-dependency-model/domain/ports/story-reflection-file-system-port.ts +2 -0
  38. package/scripts/harness/phase-dependency-model/domain/services/story-reflection-checker.ts +8 -0
  39. package/scripts/harness/phase-dependency-model/infrastructure/filesystem/file-system-story-reflection-adapter.ts +137 -2
  40. package/scripts/harness/quick-mode/domain/services/quick-mode-judgment-engine.ts +44 -40
  41. package/scripts/harness/setup/skill-deployer.ts +8 -10
  42. package/scripts/harness/skill-quality/domain/services/skill-structure-validator.ts +13 -2
  43. package/scripts/harness/skill-quality/domain/types/skill-kind.ts +6 -0
  44. package/scripts/harness/skill-quality/domain/value-objects/skill-structure.ts +24 -8
  45. package/scripts/harness/validator-system/application/use-cases/run-l2-validators-usecase.ts +82 -49
  46. package/scripts/harness/validator-system/application/use-cases/run-l3-validators-usecase.ts +87 -58
  47. package/scripts/harness/validator-system/composition-root.ts +141 -99
  48. package/scripts/harness/validator-system/domain/ports/coverage-attestation-gating-policy-port.ts +14 -0
  49. package/scripts/harness/validator-system/domain/ports/injection-scan-policy-port.ts +14 -0
  50. package/scripts/harness/validator-system/domain/services/coverage-attestation-gating-service.ts +56 -0
  51. package/scripts/harness/validator-system/domain/services/injection-pattern-scan-service.ts +118 -0
  52. package/scripts/harness/validator-system/domain/value-objects/coverage-gating-report.ts +67 -0
  53. package/scripts/harness/validator-system/domain/value-objects/injection-scan-report.ts +55 -0
  54. package/scripts/harness/validator-system/domain/value-objects/validator-id.ts +35 -31
  55. package/scripts/harness/validator-system/infrastructure/adapters/adr-foundation-reference-adapter.ts +13 -7
  56. package/scripts/harness/validator-system/infrastructure/adapters/file-system-coverage-attestation-gating-adapter.ts +87 -0
  57. package/scripts/harness/validator-system/infrastructure/adapters/file-system-injection-scan-adapter.ts +82 -0
  58. package/skills/README.md +1 -1
  59. package/skills/cascade-updater/SKILL.md +3 -3
  60. package/skills/codebase-mapper/SKILL.md +6 -6
  61. package/skills/codex-delegator/SKILL.md +4 -3
  62. package/skills/codex-delegator/references/prompt-patterns.md +3 -3
  63. package/skills/codex-delegator/references/review-dimensions.md +1 -1
  64. package/skills/consistency-checker/SKILL.md +1 -1
  65. package/skills/consistency-checker/references//343/203/201/343/202/247/343/203/203/343/202/257/343/203/252/343/202/271/343/203/210.md +1 -1
  66. package/skills/doc-health-checker/SKILL.md +148 -0
  67. package/skills/domain-designer/SKILL.md +4 -2
  68. package/skills/engineering-perspective/SKILL.md +1 -0
  69. package/skills/environment-designer/SKILL.md +8 -6
  70. package/skills/implementation-readiness-checker/SKILL.md +2 -1
  71. package/skills/it-test-designer/SKILL.md +10 -8
  72. package/skills/it-test-logic-designer/SKILL.md +11 -9
  73. package/skills/it-test-logic-designer/references/repository-test-patterns.md +8 -1
  74. package/skills/logical-designer/SKILL.md +5 -3
  75. package/skills/mock-designer/SKILL.md +10 -6
  76. package/skills/phasegate-config-doctor/SKILL.md +3 -2
  77. package/skills/phasegate-toolkit-guide/SKILL.md +1 -0
  78. package/skills/quick-implementor/SKILL.md +1 -1
  79. package/skills/release-publisher/SKILL.md +101 -0
  80. package/skills/scenario-test-designer/SKILL.md +27 -14
  81. package/skills/scenario-test-logic-designer/SKILL.md +10 -8
  82. package/skills/scenario-test-logic-designer/references/msw-patterns.md +3 -1
  83. package/skills/scenario-test-logic-designer/references/playwright-patterns.md +3 -1
  84. package/skills/skill-creator/SKILL.md +75 -332
  85. package/skills/story-implementor/SKILL.md +54 -0
  86. package/skills/story-mapper/SKILL.md +8 -4
  87. package/skills/story-writer/SKILL.md +14 -5
  88. package/skills/test-coverage-checker/SKILL.md +4 -6
  89. package/skills/uiux-designer/SKILL.md +4 -2
  90. package/skills/uiux-designer/references/uiux-design-template.md +4 -4
  91. package/skills/unit-designer/SKILL.md +11 -7
  92. package/skills/unit-test-designer/SKILL.md +25 -11
  93. package/skills/unit-test-logic-designer/SKILL.md +10 -8
  94. package/skills/unit-test-logic-designer/references/test-patterns.md +7 -1
  95. package/skills/doc-freshness-checker/SKILL.md +0 -140
  96. package/skills/implementation-planner/SKILL.md +0 -167
  97. package/skills/implementation-planner/references/document-structure.md +0 -116
  98. package/skills/implementation-planner/references/plan-template.md +0 -177
  99. package/skills/implementation-planner/references/workflow.md +0 -164
  100. package/skills/pointer-validator/SKILL.md +0 -104
@@ -1,6 +1,7 @@
1
1
  ---
2
2
  name: skill-creator
3
- description: Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
3
+ kind: advisory
4
+ description: phasegate バンドルのスキルを新規作成・改訂するための著者向けガイド。phasegate 固有の frontmatter 契約・正規見出し(skill-structure バリデータ)・モデル委任レンダリング・カタログ登録・日本語規約を扱う。スキルを追加/編集する際に使用する。
4
5
  model: opus
5
6
  languages: [typescript]
6
7
  ---
@@ -9,366 +10,108 @@ languages: [typescript]
9
10
 
10
11
  ## Purpose
11
12
 
12
- This skill provides guidance for creating effective skills.
13
+ phasegate バンドル(`skills/` ディレクトリ)に含まれるスキルを新規作成・改訂するための著者向けガイド。
13
14
 
14
- ## About Skills
15
+ > **スコープ注記**: 本スキルは **phasegate 自身のスキル束を編集する** ための内部ガイドである。Anthropic 汎用の skill-creator(`.skill` zip 配布・`name`/`description` のみの frontmatter)とは配信モデルも規約も異なる。phasegate のスキルは npm パッケージ `phasegate` に同梱され、`npx phasegate init` / `install` / `reconcile` がプロジェクトの `skills/` 配下へ本文を配置し、有効なエージェント(`.claude/skills/` / `.codex/skills/`)へ公開する。zip パッケージングは行わない。
15
16
 
16
- Skills are modular, self-contained packages that extend Codex's capabilities by providing
17
- specialized knowledge, workflows, and tools. Think of them as "onboarding guides" for specific
18
- domains or tasks—they transform Codex from a general-purpose agent into a specialized agent
19
- equipped with procedural knowledge that no model can fully possess.
17
+ 汎用の skill-creator から引き継ぐ普遍的な設計原則(後述の「引き継ぐ汎用原則」)は有効だが、frontmatter・見出し・配信・言語規約については本ガイドの phasegate 規約が優先される。
20
18
 
21
- ### What Skills Provide
19
+ ## phasegate スキルの配信モデル
22
20
 
23
- 1. Specialized workflows - Multi-step procedures for specific domains
24
- 2. Tool integrations - Instructions for working with specific file formats or APIs
25
- 3. Domain expertise - Company-specific knowledge, schemas, business logic
26
- 4. Bundled resources - Scripts, references, and assets for complex and repetitive tasks
21
+ - **配布**: スキルは `skills/{skill-name}/SKILL.md` として npm パッケージに同梱される。consumer プロジェクトの `node_modules/phasegate/skills/` から `phasegate install` / `reconcile` がコピー配置する。
22
+ - **自ホストのパス前提を作らない**: consumer では phasegate 自リポジトリのパスは存在しない。`docs/principles/...` 等を参照する場合は必ず**二段ルックアップ**を記述する(後述)。
23
+ - **モデル委任レンダリング**: `renderSkillForModelDelegation`(`scripts/harness/setup/skill-deployer.ts`)が、consumer `modelRouting.delegation` 設定に応じて配置時に SKILL.md を書き換える。委任 `"none"` consumer 向けには以下が**厳密な文字列置換**で行われる:
24
+ - `model:` / `review:` frontmatter 行を削除
25
+ - 定型委任文とロール名(下記「結合文字列」)をメインセッション実行の表現へ置換
27
26
 
28
- ## Core Principles
27
+ したがって新規スキルは、Phase 2 の委任文・ロール表現を既存 29 スキルと**バイト単位で同一**の定型文で書くこと。独自の言い回しにするとレンダラーが検出できず、委任 `"none"` consumer で不整合が残る。
29
28
 
30
- ### Concise is Key
29
+ ### 結合文字列(バイト単位で保持する定型文)
31
30
 
32
- The context window is a public good. Skills share the context window with everything else Codex needs: system prompt, conversation history, other Skills' metadata, and the actual user request.
31
+ 3 フェーズスキルの本文では以下を一字一句そのまま使う(レンダラーが exact-match で置換する):
33
32
 
34
- **Default assumption: Codex is already very smart.** Only add context Codex doesn't already have. Challenge each piece of information: "Does Codex really need this explanation?" and "Does this paragraph justify its token cost?"
33
+ - Phase 2 定義行: `委任先モデルに委任して成果物を生成する(\`npx phasegate delegate-sonnet\` 経由)`
34
+ - ロール表現: `Opus が`(Phase 1/3 の主体)
35
+ - `委任先モデル` / `\`npx phasegate delegate-sonnet\`` の各出現
35
36
 
36
- Prefer concise examples over verbose explanations.
37
+ これらを言い換えたり、句読点・バッククォート・全角括弧を変えてはならない。
37
38
 
38
- ### Set Appropriate Degrees of Freedom
39
+ ## frontmatter 契約
39
40
 
40
- Match the level of specificity to the task's fragility and variability:
41
+ phasegate のスキル frontmatter `name` / `description` に加えて、他 29 スキルで使われる以下のフィールドを持つ:
41
42
 
42
- **High freedom (text-based instructions)**: Use when multiple approaches are valid, decisions depend on context, or heuristics guide the approach.
43
+ | フィールド | 用途 | |
44
+ |-----------|------|-----|
45
+ | `name` | スキル名(ディレクトリ名と一致) | `unit-designer` |
46
+ | `description` | トリガー用の簡潔な説明(何を・いつ使うか) | 下記参照 |
47
+ | `model` | 実行モデル(委任先) | `sonnet` / `opus` |
48
+ | `review` | レビュー担当モデル(3 フェーズスキルで使用) | `opus` |
49
+ | `languages` | 対象言語(1 件以上の配列) | `[typescript]` |
50
+ | `kind` | 構造種別(advisory のみ明示。省略時は lifecycle) | `advisory` |
43
51
 
44
- **Medium freedom (pseudocode or scripts with parameters)**: Use when a preferred pattern exists, some variation is acceptable, or configuration affects behavior.
52
+ - `model:` / `review:` は委任 `"none"` consumer 向けレンダリングで**削除される**(前述)。委任前提のロール表現も同時に書き換わるため、両者は連動している。
53
+ - `languages:` は skill-structure バリデータが `languageMetadata` セクションとして検出する(値が非空の配列であること)。空配列や欠落は構造 FAIL になる。
54
+ - `description` はトリガーの主機構。何をするか+いつ使うかを含める。「いつ使うか」を本文に書いても本文はトリガー後にしか読まれないため無意味。
45
55
 
46
- **Low freedom (specific scripts, few parameters)**: Use when operations are fragile and error-prone, consistency is critical, or a specific sequence must be followed.
56
+ ## 正規見出し(skill-structure バリデータ)への適合
47
57
 
48
- Think of Codex as exploring a path: a narrow bridge with cliffs needs specific guardrails (low freedom), while an open field allows many routes (high freedom).
58
+ 新規スキルは skill-structure バリデータ(`scripts/harness/skill-quality/domain/services/skill-structure-validator.ts`)に**必ず合格**する。バリデータはスキルの **kind** ごとに必須セクションを決める:
49
59
 
50
- ### Anatomy of a Skill
60
+ - **lifecycle**(既定・23 スキル): `frontmatter` / `languageMetadata` / `purpose` / `inputs` / `outputs` / `prerequisites` / `executionFlow` の 7 セクションを全保有すること。
61
+ - **advisory**(allowlist の 7 スキル。本スキル含む): `frontmatter` / `languageMetadata` / `purpose` の 3 セクションのみ必須。
51
62
 
52
- Every skill consists of a required SKILL.md file and optional bundled resources:
63
+ ### セクション名 見出しの対応(sectionMap)
53
64
 
54
- ```
55
- skill-name/
56
- ├── SKILL.md (required)
57
- │ ├── YAML frontmatter metadata (required)
58
- │ │ ├── name: (required)
59
- │ │ └── description: (required)
60
- │ └── Markdown instructions (required)
61
- └── Bundled Resources (optional)
62
- ├── scripts/ - Executable code (Python/Bash/etc.)
63
- ├── references/ - Documentation intended to be loaded into context as needed
64
- └── assets/ - Files used in output (templates, icons, fonts, etc.)
65
- ```
65
+ バリデータは見出しテキストの **先頭一致(startsWith・小文字化後)** でセクションを認識する。使用可能な見出しプレフィックス:
66
66
 
67
- #### SKILL.md (required)
67
+ | セクション | 認識される見出し(いずれか) |
68
+ |-----------|--------------------------|
69
+ | `purpose` | `Purpose` / `目的` |
70
+ | `inputs` | `Inputs` / `入力` / `必須インプット` / `任意インプット` / `推奨インプット` |
71
+ | `outputs` | `Outputs` / `出力` / `出力ファイル` |
72
+ | `prerequisites` | `Prerequisites` / `前提条件` / `前提条件チェック` |
73
+ | `executionFlow` | `executionFlow` / `実行フロー` / `⚠️ 2フェーズ実行ルール` / `⚠️ 3フェーズ実行ルール` |
68
74
 
69
- Every SKILL.md consists of:
75
+ `frontmatter` は先頭が `---` で始まること、`languageMetadata` は frontmatter 内の非空 `languages:` で検出される。見出しは接尾辞(例: `(plan)`)を付けても先頭一致するが、**上表のプレフィックスを崩さないこと**。
70
76
 
71
- - **Frontmatter** (YAML): Contains `name` and `description` fields. These are the only fields that Codex reads to determine when the skill gets used, thus it is very important to be clear and comprehensive in describing what the skill is, and when it should be used.
72
- - **Body** (Markdown): Instructions and guidance for using the skill. Only loaded AFTER the skill triggers (if at all).
77
+ ### kind の登録場所(allowlist / taxonomy)
73
78
 
74
- #### Bundled Resources (optional)
79
+ - kind 型と必須セクションの定義: `scripts/harness/skill-quality/domain/types/skill-kind.ts` と `.../value-objects/skill-structure.ts`。
80
+ - **advisory allowlist の pin**: `scripts/harness/__tests__/integration/skill-quality/skill-corpus-conformance.test.ts` の `ADVISORY_SKILLS` 配列。ここに列挙された 7 件だけが `kind: advisory` を宣言でき、8 件目の自己宣言はテストが fail する。**advisory を増やす場合はこのテストの allowlist を意図的に更新すること**(lifecycle 要求の回避を防ぐ pin)。lifecycle スキルを追加する場合は allowlist 変更不要だが、7 セクションを全て満たす必要がある。
75
81
 
76
- ##### Scripts (`scripts/`)
82
+ ## カタログ登録(新規スキル追加時に必須)
77
83
 
78
- Executable code (Python/Bash/etc.) for tasks that require deterministic reliability or are repeatedly rewritten.
84
+ 新規スキルは SKILL.md を書くだけでは配信されない。以下のカタログ・件数 pin を必ず更新する:
79
85
 
80
- - **When to include**: When the same code is being rewritten repeatedly or deterministic reliability is needed
81
- - **Example**: `scripts/rotate_pdf.py` for PDF rotation tasks
82
- - **Benefits**: Token efficient, deterministic, may be executed without loading into context
83
- - **Note**: Scripts may still need to be read by Codex for patching or environment-specific adjustments
86
+ 1. `scripts/harness/setup/skill-deployer.ts` `SKILL_CATEGORIES`(`core` / `aidlc` / `utility` / `guidance` のいずれかに追加)。ここに載らないスキルは `getSkillsForSet` の配信対象にならない。
87
+ 2. `scripts/harness/installation/application/bundled-skill-selection.ts`(インストール時の選択ロジック)。
88
+ 3. 件数 pin: `skills/README.md`("30 skills" の記述)・`docs/guide/skills-overview.md`("30 skills")。スキル総数を変えたら両方を同期更新する。
89
+ 4. advisory を追加する場合は前述の `skill-corpus-conformance.test.ts` `ADVISORY_SKILLS` と、テスト内の件数期待値(`skills.length` / lifecycle・advisory の内訳)も更新する。
84
90
 
85
- ##### References (`references/`)
91
+ > なお `scripts/harness/` 配下のソース(`skill-deployer.ts` / `bundled-skill-selection.ts` 等)の変更はフェーズゲート対象であり、`quick-implementor` / `story-implementor` スキル経由で行う(CLAUDE.md 参照)。スキル本文(`skills/**` の docs)編集はゲート緩和対象。
86
92
 
87
- Documentation and reference material intended to be loaded as needed into context to inform Codex's process and thinking.
93
+ ## 著者ルール(phasegate リポジトリ規約)
88
94
 
89
- - **When to include**: For documentation that Codex should reference while working
90
- - **Examples**: `references/finance.md` for financial schemas, `references/mnda.md` for company NDA template, `references/policies.md` for company policies, `references/api_docs.md` for API specifications
91
- - **Use cases**: Database schemas, API documentation, domain knowledge, company policies, detailed workflow guides
92
- - **Benefits**: Keeps SKILL.md lean, loaded only when Codex determines it's needed
93
- - **Best practice**: If files are large (>10k words), include grep search patterns in SKILL.md
94
- - **Avoid duplication**: Information should live in either SKILL.md or references files, not both. Prefer references files for detailed information unless it's truly core to the skill—this keeps SKILL.md lean while making information discoverable without hogging the context window. Keep only essential procedural instructions and workflow guidance in SKILL.md; move detailed reference material, schemas, and examples to references files.
95
+ - **本文は日本語**: SKILL.md 本文の説明散文は日本語で書く(他 29 スキルに合わせる)。見出しプレフィックスは上表の許容形(英/日どちらでも先頭一致すればよい)。
96
+ - **3 フェーズ実行パターン**(成果物を生成する AIDLC 系スキルに適用): Phase 1(計画・Opus が承認を得る)→ Phase 2(委任先モデルに委任して成果物を生成する(`npx phasegate delegate-sonnet` 経由))→ Phase 3(Opus が成果物を検証し直接修正する)。見出しは `## ⚠️ 3フェーズ実行ルール` を使うと `executionFlow` として認識される。純粋な助言/検査系(advisory)ではこのパターンは不要。
97
+ - **`references/` サブディレクトリ**: 詳細テンプレート・schema・ドメイン知識は `skills/{skill-name}/references/*.md` に切り出し、SKILL.md からは「いつ読むか」を明記して参照する(progressive disclosure)。
98
+ - **`docs/principles` 参照の二段ルックアップ**: consumer では phasegate 自リポジトリのパスが無いため、原則文書を参照する際は既存スキルと同じ定型で書く: 「consumer プロジェクトでは `node_modules/phasegate/docs/principles/...`、phasegate 自リポジトリでは `docs/principles/...` を参照する」。
99
+ - **自ホストのパス前提を作らない**: 出力先や設計文書パスは `phasegate.config.json` `paths` consumer が上書きできる旨を注記する(既定値であることを明示)。
100
+ - **テスト規約への言及**: スキルが生成/検査するテストは Vitest・AAA パターン・日本語テストケース名・kebab-case ファイル名・ドメイン層モック禁止(`docs/principles/testing-rules.md`)に従う旨を、該当スキルでは案内する。
95
101
 
96
- ##### Assets (`assets/`)
102
+ ## 引き継ぐ汎用原則(phasegate でも有効)
97
103
 
98
- Files not intended to be loaded into context, but rather used within the output Codex produces.
104
+ - **Progressive disclosure(段階的開示)**: SKILL.md 本文は必須の手順・ワークフローに絞り、詳細は `references/` へ。本文は簡潔に保つ(目安 500 行未満)。参照は SKILL.md から一段の深さに留める。
105
+ - **簡潔な description でトリガー精度を上げる**: description に「何を・いつ」を凝縮する。冗長な本文説明よりトリガー語彙を優先。
106
+ - **`scripts/` で決定的処理を固定**: 毎回書き直す/決定的信頼性が要るコードは `skills/{skill-name}/scripts/` に置く(トークン効率・再現性)。※本スキル同梱の `scripts/*.py`(`init_skill.py` 等)は Anthropic 汎用版由来のヘルパーであり、phasegate の frontmatter 契約・カタログ登録は補わない。phasegate スキルの雛形は既存 lifecycle/advisory スキルの SKILL.md をコピーして作るのが確実。zip パッケージング(`package_skill.py`)は phasegate の npm 配信では使用しない。
107
+ - **適切な自由度**: 手順が壊れやすい/一貫性が重要な箇所は具体的な手順(低自由度)、判断が文脈依存な箇所はテキスト指示(高自由度)で書き分ける。
99
108
 
100
- - **When to include**: When the skill needs files that will be used in the final output
101
- - **Examples**: `assets/logo.png` for brand assets, `assets/slides.pptx` for PowerPoint templates, `assets/frontend-template/` for HTML/React boilerplate, `assets/font.ttf` for typography
102
- - **Use cases**: Templates, images, icons, boilerplate code, fonts, sample documents that get copied or modified
103
- - **Benefits**: Separates output resources from documentation, enables Codex to use files without loading them into context
109
+ ## 新規スキル作成の手順(phasegate)
104
110
 
105
- #### What to Not Include in a Skill
106
-
107
- A skill should only contain essential files that directly support its functionality. Do NOT create extraneous documentation or auxiliary files, including:
108
-
109
- - README.md
110
- - INSTALLATION_GUIDE.md
111
- - QUICK_REFERENCE.md
112
- - CHANGELOG.md
113
- - etc.
114
-
115
- The skill should only contain the information needed for an AI agent to do the job at hand. It should not contain auxiliary context about the process that went into creating it, setup and testing procedures, user-facing documentation, etc. Creating additional documentation files just adds clutter and confusion.
116
-
117
- ### Progressive Disclosure Design Principle
118
-
119
- Skills use a three-level loading system to manage context efficiently:
120
-
121
- 1. **Metadata (name + description)** - Always in context (~100 words)
122
- 2. **SKILL.md body** - When skill triggers (<5k words)
123
- 3. **Bundled resources** - As needed by Codex (Unlimited because scripts can be executed without reading into context window)
124
-
125
- #### Progressive Disclosure Patterns
126
-
127
- Keep SKILL.md body to the essentials and under 500 lines to minimize context bloat. Split content into separate files when approaching this limit. When splitting out content into other files, it is very important to reference them from SKILL.md and describe clearly when to read them, to ensure the reader of the skill knows they exist and when to use them.
128
-
129
- **Key principle:** When a skill supports multiple variations, frameworks, or options, keep only the core workflow and selection guidance in SKILL.md. Move variant-specific details (patterns, examples, configuration) into separate reference files.
130
-
131
- **Pattern 1: High-level guide with references**
132
-
133
- ```markdown
134
- # PDF Processing
135
-
136
- ## Quick start
137
-
138
- Extract text with pdfplumber:
139
- [code example]
140
-
141
- ## Advanced features
142
-
143
- - **Form filling**: See [FORMS.md](FORMS.md) for complete guide
144
- - **API reference**: See [REFERENCE.md](REFERENCE.md) for all methods
145
- - **Examples**: See [EXAMPLES.md](EXAMPLES.md) for common patterns
146
- ```
147
-
148
- Codex loads FORMS.md, REFERENCE.md, or EXAMPLES.md only when needed.
149
-
150
- **Pattern 2: Domain-specific organization**
151
-
152
- For Skills with multiple domains, organize content by domain to avoid loading irrelevant context:
153
-
154
- ```
155
- bigquery-skill/
156
- ├── SKILL.md (overview and navigation)
157
- └── reference/
158
- ├── finance.md (revenue, billing metrics)
159
- ├── sales.md (opportunities, pipeline)
160
- ├── product.md (API usage, features)
161
- └── marketing.md (campaigns, attribution)
162
- ```
163
-
164
- When a user asks about sales metrics, Codex only reads sales.md.
165
-
166
- Similarly, for skills supporting multiple frameworks or variants, organize by variant:
167
-
168
- ```
169
- cloud-deploy/
170
- ├── SKILL.md (workflow + provider selection)
171
- └── references/
172
- ├── aws.md (AWS deployment patterns)
173
- ├── gcp.md (GCP deployment patterns)
174
- └── azure.md (Azure deployment patterns)
175
- ```
176
-
177
- When the user chooses AWS, Codex only reads aws.md.
178
-
179
- **Pattern 3: Conditional details**
180
-
181
- Show basic content, link to advanced content:
182
-
183
- ```markdown
184
- # DOCX Processing
185
-
186
- ## Creating documents
187
-
188
- Use docx-js for new documents. See [DOCX-JS.md](DOCX-JS.md).
189
-
190
- ## Editing documents
191
-
192
- For simple edits, modify the XML directly.
193
-
194
- **For tracked changes**: See [REDLINING.md](REDLINING.md)
195
- **For OOXML details**: See [OOXML.md](OOXML.md)
196
- ```
197
-
198
- Codex reads REDLINING.md or OOXML.md only when the user needs those features.
199
-
200
- **Important guidelines:**
201
-
202
- - **Avoid deeply nested references** - Keep references one level deep from SKILL.md. All reference files should link directly from SKILL.md.
203
- - **Structure longer reference files** - For files longer than 100 lines, include a table of contents at the top so Codex can see the full scope when previewing.
204
-
205
- ## Skill Creation Process
206
-
207
- Skill creation involves these steps:
208
-
209
- 1. Understand the skill with concrete examples
210
- 2. Plan reusable skill contents (scripts, references, assets)
211
- 3. Initialize the skill (run init_skill.py)
212
- 4. Edit the skill (implement resources and write SKILL.md)
213
- 5. Package the skill (run package_skill.py)
214
- 6. Iterate based on real usage
215
-
216
- Follow these steps in order, skipping only if there is a clear reason why they are not applicable.
217
-
218
- ### Skill Naming
219
-
220
- - Use lowercase letters, digits, and hyphens only; normalize user-provided titles to hyphen-case (e.g., "Plan Mode" -> `plan-mode`).
221
- - When generating names, generate a name under 64 characters (letters, digits, hyphens).
222
- - Prefer short, verb-led phrases that describe the action.
223
- - Namespace by tool when it improves clarity or triggering (e.g., `gh-address-comments`, `linear-address-issue`).
224
- - Name the skill folder exactly after the skill name.
225
-
226
- ### Step 1: Understanding the Skill with Concrete Examples
227
-
228
- Skip this step only when the skill's usage patterns are already clearly understood. It remains valuable even when working with an existing skill.
229
-
230
- To create an effective skill, clearly understand concrete examples of how the skill will be used. This understanding can come from either direct user examples or generated examples that are validated with user feedback.
231
-
232
- For example, when building an image-editor skill, relevant questions include:
233
-
234
- - "What functionality should the image-editor skill support? Editing, rotating, anything else?"
235
- - "Can you give some examples of how this skill would be used?"
236
- - "I can imagine users asking for things like 'Remove the red-eye from this image' or 'Rotate this image'. Are there other ways you imagine this skill being used?"
237
- - "What would a user say that should trigger this skill?"
238
-
239
- To avoid overwhelming users, avoid asking too many questions in a single message. Start with the most important questions and follow up as needed for better effectiveness.
240
-
241
- Conclude this step when there is a clear sense of the functionality the skill should support.
242
-
243
- ### Step 2: Planning the Reusable Skill Contents
244
-
245
- To turn concrete examples into an effective skill, analyze each example by:
246
-
247
- 1. Considering how to execute on the example from scratch
248
- 2. Identifying what scripts, references, and assets would be helpful when executing these workflows repeatedly
249
-
250
- Example: When building a `pdf-editor` skill to handle queries like "Help me rotate this PDF," the analysis shows:
251
-
252
- 1. Rotating a PDF requires re-writing the same code each time
253
- 2. A `scripts/rotate_pdf.py` script would be helpful to store in the skill
254
-
255
- Example: When designing a `frontend-webapp-builder` skill for queries like "Build me a todo app" or "Build me a dashboard to track my steps," the analysis shows:
256
-
257
- 1. Writing a frontend webapp requires the same boilerplate HTML/React each time
258
- 2. An `assets/hello-world/` template containing the boilerplate HTML/React project files would be helpful to store in the skill
259
-
260
- Example: When building a `big-query` skill to handle queries like "How many users have logged in today?" the analysis shows:
261
-
262
- 1. Querying BigQuery requires re-discovering the table schemas and relationships each time
263
- 2. A `references/schema.md` file documenting the table schemas would be helpful to store in the skill
264
-
265
- To establish the skill's contents, analyze each concrete example to create a list of the reusable resources to include: scripts, references, and assets.
266
-
267
- ### Step 3: Initializing the Skill
268
-
269
- At this point, it is time to actually create the skill.
270
-
271
- Skip this step only if the skill being developed already exists, and iteration or packaging is needed. In this case, continue to the next step.
272
-
273
- When creating a new skill from scratch, always run the `init_skill.py` script. The script conveniently generates a new template skill directory that automatically includes everything a skill requires, making the skill creation process much more efficient and reliable.
274
-
275
- Usage:
276
-
277
- ```bash
278
- scripts/init_skill.py <skill-name> --path <output-directory> [--resources scripts,references,assets] [--examples]
279
- ```
280
-
281
- Examples:
282
-
283
- ```bash
284
- scripts/init_skill.py my-skill --path skills
285
- scripts/init_skill.py my-skill --path skills --resources scripts,references
286
- scripts/init_skill.py my-skill --path skills --resources scripts --examples
287
- ```
288
-
289
- The script:
290
-
291
- - Creates the skill directory at the specified path
292
- - Generates a SKILL.md template with proper frontmatter and TODO placeholders
293
- - Optionally creates resource directories based on `--resources`
294
- - Optionally adds example files when `--examples` is set
295
-
296
- After initialization, customize the SKILL.md and add resources as needed. If you used `--examples`, replace or delete placeholder files.
297
-
298
- ### Step 4: Edit the Skill
299
-
300
- When editing the (newly-generated or existing) skill, remember that the skill is being created for another instance of Codex to use. Include information that would be beneficial and non-obvious to Codex. Consider what procedural knowledge, domain-specific details, or reusable assets would help another Codex instance execute these tasks more effectively.
301
-
302
- #### Learn Proven Design Patterns
303
-
304
- Consult these helpful guides based on your skill's needs:
305
-
306
- - **Multi-step processes**: See references/workflows.md for sequential workflows and conditional logic
307
- - **Specific output formats or quality standards**: See references/output-patterns.md for template and example patterns
308
-
309
- These files contain established best practices for effective skill design.
310
-
311
- #### Start with Reusable Skill Contents
312
-
313
- To begin implementation, start with the reusable resources identified above: `scripts/`, `references/`, and `assets/` files. Note that this step may require user input. For example, when implementing a `brand-guidelines` skill, the user may need to provide brand assets or templates to store in `assets/`, or documentation to store in `references/`.
314
-
315
- Added scripts must be tested by actually running them to ensure there are no bugs and that the output matches what is expected. If there are many similar scripts, only a representative sample needs to be tested to ensure confidence that they all work while balancing time to completion.
316
-
317
- If you used `--examples`, delete any placeholder files that are not needed for the skill. Only create resource directories that are actually required.
318
-
319
- #### Update SKILL.md
320
-
321
- **Writing Guidelines:** Always use imperative/infinitive form.
322
-
323
- ##### Frontmatter
324
-
325
- Write the YAML frontmatter with `name` and `description`:
326
-
327
- - `name`: The skill name
328
- - `description`: This is the primary triggering mechanism for your skill, and helps Codex understand when to use the skill.
329
- - Include both what the Skill does and specific triggers/contexts for when to use it.
330
- - Include all "when to use" information here - Not in the body. The body is only loaded after triggering, so "When to Use This Skill" sections in the body are not helpful to Codex.
331
- - Example description for a `docx` skill: "Comprehensive document creation, editing, and analysis with support for tracked changes, comments, formatting preservation, and text extraction. Use when Codex needs to work with professional documents (.docx files) for: (1) Creating new documents, (2) Modifying or editing content, (3) Working with tracked changes, (4) Adding comments, or any other document tasks"
332
-
333
- Do not include any other fields in YAML frontmatter.
334
-
335
- ##### Body
336
-
337
- Write instructions for using the skill and its bundled resources.
338
-
339
- ### Step 5: Packaging a Skill
340
-
341
- Once development of the skill is complete, it must be packaged into a distributable .skill file that gets shared with the user. The packaging process automatically validates the skill first to ensure it meets all requirements:
342
-
343
- ```bash
344
- scripts/package_skill.py <path/to/skill-folder>
345
- ```
346
-
347
- Optional output directory specification:
348
-
349
- ```bash
350
- scripts/package_skill.py <path/to/skill-folder> ./dist
351
- ```
352
-
353
- The packaging script will:
354
-
355
- 1. **Validate** the skill automatically, checking:
356
- - YAML frontmatter format and required fields
357
- - Skill naming conventions and directory structure
358
- - Description completeness and quality
359
- - File organization and resource references
360
-
361
- 2. **Package** the skill if validation passes, creating a .skill file named after the skill (e.g., `my-skill.skill`) that includes all files and maintains the proper directory structure for distribution. The .skill file is a zip file with a .skill extension.
362
-
363
- If validation fails, the script will report the errors and exit without creating a package. Fix any validation errors and run the packaging command again.
364
-
365
- ### Step 6: Iterate
366
-
367
- After testing the skill, users may request improvements. Often this happens right after using the skill, with fresh context of how the skill performed.
368
-
369
- **Iteration workflow:**
370
-
371
- 1. Use the skill on real tasks
372
- 2. Notice struggles or inefficiencies
373
- 3. Identify how SKILL.md or bundled resources should be updated
374
- 4. Implement changes and test again
111
+ 1. **用途と例の確定** どんな依頼でトリガーし、どんな成果物/助言を出すかを具体例で固める。
112
+ 2. **kind の決定** — 成果物を生成する lifecycle か、助言/検査のみの advisory か。advisory なら allowlist 更新が要る。
113
+ 3. **雛形の用意** 同種の既存スキル(lifecycle は例えば `unit-designer`、advisory `phasegate-config-doctor`)の SKILL.md を土台にコピーし、frontmatter・見出しを埋める。
114
+ 4. **本文作成** — 日本語散文で。3 フェーズ系なら結合文字列をバイト単位で流用。詳細は `references/` へ切り出す。
115
+ 5. **構造検証** — `npx vitest run scripts/harness/__tests__/integration/skill-quality`(corpus-conformance)で宣言 kind の必須セクションに合格することを確認。
116
+ 6. **カタログ登録** — `SKILL_CATEGORIES` / `bundled-skill-selection.ts` / 件数 pin(README・skills-overview)を更新。
117
+ 7. **反復** — 実タスクで使い、SKILL.md / references を改善する。
@@ -38,6 +38,8 @@ languages: [typescript]
38
38
  | `docs/inception/{unit}/{story_id}/scenario_test_design.md` | 📋 推奨 | シナリオテスト設計の存在を確認 |
39
39
  | `docs/product/construction/{unit}/uiux_design.md` | 📋 推奨 | UIUX設計の存在を確認(フロントエンドがある場合) |
40
40
 
41
+ > **パス注記**: 上表の設計文書パス(`docs/product/construction/...` / `docs/inception/...` / `docs/product/environment_contract.md`)は既定値であり、consumer が `phasegate.config.json` の `paths` 設定で上書きしている場合はそちらが優先される。
42
+
41
43
  ### テスト設計・ロジック設計の事前チェック
42
44
 
43
45
  **TDD実装の前に、テスト設計が完了していることを確認してください。テスト設計が不足している場合、テスト漏れのリスクがあります。**
@@ -190,6 +192,44 @@ TDD実装の順序・スコープ・不明点を整理し、人間の承認を
190
192
 
191
193
  ---
192
194
 
195
+ ### 計画観点(Unit特定・ドメイン確認・API設計)
196
+
197
+ 計画作成にあたり、以下の観点を体系的に整理する(旧 `implementation-planner` の計画立案手順を統合)。
198
+
199
+ #### Unit 特定
200
+
201
+ 1. `docs/product/units/integration_contract.md` を読み込み、関連する公開APIエンドポイントを特定する
202
+ 2. 該当 Unit の `{unit}.md` を確認し、Unit 間依存関係を整理する
203
+ 3. Grep/Glob で `docs/product/units/` 配下からストーリーIDやキーワードを検索する
204
+
205
+ > **パス注記**: 設計文書パス(`docs/product/units/...` / `docs/product/construction/...`)は既定値であり、consumer が `phasegate.config.json` の `paths` 設定で上書きしている場合はそちらが優先される。
206
+
207
+ #### ドメインモデル確認の観点
208
+
209
+ `docs/product/construction/{unit}/domain_model.md` を読み込み、以下を把握する:
210
+
211
+ - 集約と不変条件
212
+ - エンティティ・値オブジェクト
213
+ - ドメインイベント
214
+ - 状態遷移
215
+
216
+ 必要に応じて `shared_kernel/domain_model.md` を参照する。
217
+
218
+ #### 既存実装確認
219
+
220
+ Glob/Read でプロジェクトの実装ディレクトリ構造と既存の実装パターンを確認し、コードスタイル・ファイル配置を把握する。
221
+
222
+ #### API設計を含む計画項目
223
+
224
+ 計画には以下を含める:
225
+
226
+ 1. API設計(新規/既存拡張のエンドポイント定義)
227
+ 2. レイヤー別実装内容(Domain / UseCase / Controller / Infrastructure)
228
+ 3. 実装ステップ分解(依存関係に沿った順序)
229
+ 4. 影響範囲特定(他 Unit・他コンポーネントへの波及)
230
+
231
+ ---
232
+
193
233
  ### 出力ファイル
194
234
  `docs/inception/{unit}/{story_id}/tdd_implementation_plan.md`
195
235
 
@@ -319,6 +359,20 @@ Unit → IT → E2E の順序を守ることで:
319
359
  | コード | プロジェクト内 |
320
360
  | レポート | 会話内(環境検証結果 + 教訓フィードバック) |
321
361
 
362
+ ### Phase 2 最低出力基準(品質制約)
363
+
364
+ 以下の基準を満たさない実装は不完全とみなし、レビューで BLOCK とする(旧 `implementation-planner` の最低出力基準を統合)。
365
+
366
+ | 基準 | 最低要件 |
367
+ |------|---------|
368
+ | Unit特定 | 対象ストーリー/機能に関連する Unit が正しく特定されている |
369
+ | ドメインモデル参照 | 関連する集約・エンティティ・値オブジェクトが列挙されている |
370
+ | API設計 | 新規/既存拡張のエンドポイントが具体的に定義されている |
371
+ | レイヤー別実装内容 | 各層(Domain/UseCase/Controller/Infrastructure)の実装内容が記載されている |
372
+ | 実装ステップ | 実装順序が具体的なステップに分解されている |
373
+ | 影響範囲 | 変更が他 Unit・他コンポーネントに与える影響が分析されている |
374
+ | メタデータ | 全生成ファイルに `@unit` / `@layer`(テストは `@story` も)が付与されている |
375
+
322
376
  ---
323
377
 
324
378
  ## 注意事項
@@ -66,10 +66,10 @@ languages: [typescript]
66
66
 
67
67
  **このスキルは3フェーズで実行する。**
68
68
  - **Phase 1(計画)**: Opus がスコープ・方針・不明点を整理し、人間の承認を得る
69
- - **Phase 2(実行)**: Sonnet 4.6 に委任して成果物を生成する(`npx phasegate delegate-sonnet` 経由)
69
+ - **Phase 2(実行)**: 委任先モデルに委任して成果物を生成する(`npx phasegate delegate-sonnet` 経由)
70
70
  - **Phase 3(レビュー)**: Opus が成果物を検証し、問題があれば直接修正する
71
71
 
72
- **Phase 1/2/3を同時に実行してはならない。モデルルーティングの詳細は `docs/principles/model-routing.md` を参照。**
72
+ **Phase 1/2/3を同時に実行してはならない。モデルルーティングの詳細は `docs/principles/model-routing.md` を参照(consumer プロジェクトでは `node_modules/phasegate/docs/principles/model-routing.md`、phasegate 自リポジトリでは `docs/principles/model-routing.md` を参照する)。**
73
73
 
74
74
  ---
75
75
 
@@ -191,11 +191,11 @@ MVPスコープの方針・分類基準・不明点を整理し、人間の承
191
191
  ## Phase 3: レビュー(Opus review)
192
192
 
193
193
  ### 実行主体
194
- メインセッション(Opus 4.6)が実行する。Sonnetへの再委任は行わない。
194
+ メインセッション(model-routing.md の Architect ロール)が実行する。Sonnetへの再委任は行わない。
195
195
 
196
196
  ### レビュー手順
197
197
  1. Sonnetが出力したファイルを読み込む
198
- 2. `docs/principles/model-routing.md` のレビュー観点 R1〜R7 に沿って検証する
198
+ 2. `docs/principles/model-routing.md` の「レビュー観点」節に沿って検証する
199
199
  3. **スキル固有レビュー観点**を検証する
200
200
  4. 判定結果を出力する
201
201
 
@@ -216,3 +216,7 @@ MVPスコープの方針・分類基準・不明点を整理し、人間の承
216
216
  - ストーリーの内容を修正しない(修正が必要な場合はS1 story-writerの再実行を提案)
217
217
  - 全ストーリーがMVPまたはPost-MVPのいずれかに分類されていることを確認する
218
218
  - 優先順位の判断は人間に委ね、AIは推奨案を提示する立場に徹する
219
+
220
+ ## 次ステップ
221
+
222
+ - 成果物 `docs/product/user_story_mapping.md` は、S2 `unit-designer` が**任意(推奨)入力**として取り込む。MVP スコープと優先順位が Unit グルーピング・構築順序の判断材料になるため、本スキル完了後に `unit-designer` を実行する。
@@ -15,7 +15,7 @@ languages: [typescript]
15
15
  ## Pre-flight check (BLOCKING)
16
16
 
17
17
  Before generating any plan, verify `docs/inception/{unit}/WI-XXX/description.md` exists.
18
- If not, halt and ask the user to create the WI first, or offer to run `phasegate scaffold-wi <unit> <story|issue|chore>`.
18
+ If not, halt and ask the user to create the WI first, or offer to run `phasegate scaffold-wi <unit|_cross> <story|issue|fix|refactor|chore>`.
19
19
 
20
20
  ### 必須インプット(存在しなければ`[Question]`で提供を要求)
21
21
  - **要求文書** — 何を作るかを記述した文書。形式は問わない(議事録、要件メモ、口頭要約のテキスト等)
@@ -30,10 +30,10 @@ If not, halt and ask the user to create the WI first, or offer to run `phasegate
30
30
 
31
31
  **このスキルは3フェーズで実行する。**
32
32
  - **Phase 1(計画)**: Opus がスコープ・方針・不明点を整理し、人間の承認を得る
33
- - **Phase 2(実行)**: Sonnet 4.6 に委任して成果物を生成する(`npx phasegate delegate-sonnet` 経由)
33
+ - **Phase 2(実行)**: 委任先モデルに委任して成果物を生成する(`npx phasegate delegate-sonnet` 経由)
34
34
  - **Phase 3(レビュー)**: Opus が成果物を検証し、問題があれば直接修正する
35
35
 
36
- **Phase 1/2/3を同時に実行してはならない。モデルルーティングの詳細は `docs/principles/model-routing.md` を参照。**
36
+ **Phase 1/2/3を同時に実行してはならない。モデルルーティングの詳細は `docs/principles/model-routing.md` を参照(consumer プロジェクトでは `node_modules/phasegate/docs/principles/model-routing.md`、phasegate 自リポジトリでは `docs/principles/model-routing.md` を参照する)。**
37
37
 
38
38
  ---
39
39
 
@@ -120,11 +120,11 @@ If not, halt and ask the user to create the WI first, or offer to run `phasegate
120
120
  ## Phase 3: レビュー(Opus review)
121
121
 
122
122
  ### 実行主体
123
- メインセッション(Opus 4.6)が実行する。Sonnetへの再委任は行わない。
123
+ メインセッション(model-routing.md の Architect ロール)が実行する。Sonnetへの再委任は行わない。
124
124
 
125
125
  ### レビュー手順
126
126
  1. Sonnetが出力したファイルを読み込む
127
- 2. `docs/principles/model-routing.md` のレビュー観点 R1〜R7 に沿って検証する
127
+ 2. `docs/principles/model-routing.md` の「レビュー観点」節に沿って検証する
128
128
  3. **スキル固有レビュー観点**を検証する
129
129
  4. 判定結果を出力する
130
130
 
@@ -146,3 +146,12 @@ If not, halt and ask the user to create the WI first, or offer to run `phasegate
146
146
  - 受け入れ基準は「〜できる」「〜が表示される」等の検証可能な形式にする
147
147
  - 技術的な実装詳細には踏み込まない
148
148
  - **MVP/Post-MVPの分類・優先順位付けはこのスキルでは行わない** → S1.5 `story-mapper` で収束思考として実行する
149
+
150
+ ### ストーリーID採番規約
151
+
152
+ このスキルはユーザーストーリーの**発番元**である。以下の規約に従って ID を採番する。
153
+
154
+ - **形式**: ストーリーIDは `HXX-XX`(例: `H03-01`)。前半 `HXX` が Epic 番号、後半 `-XX` がその Epic 内の連番。基盤系 Epic には `HFxx-XX`(例: `HF1-02`)も許容される。
155
+ - **一意性**: ストーリーID は `docs/product/user_stories.md` 全体で一意。同一 ID を複数ストーリーに割り当てない。
156
+ - **正の在り処**: 全ストーリーID の正本は `docs/product/user_stories.md`(StoryCatalog)。下流の設計文書・テストが参照する `@story-id HXX-XX` / `@story HXX-XX` は、必ずこのカタログに存在する ID であること。受け入れ基準ID は `HXX-XX-N`(絶対形)または対象ストーリー内の相対形 `AC-N`。
157
+ - **WI-XXX との区別(軸が異なる)**: `WI-XXX`(Work Item)は開発タスクの識別子であり、**ストーリーID とは別の軸**。ストーリー(何を作るか=要求単位)と Work Item(いつ・どの作業で実装するか=タスク単位)は 1:1 とは限らない。ストーリーID に `US-XXX` や `WI-XXX` を使わないこと(`US-XXX` は旧規約のレガシー別名で、StoryCatalog では `HXX-XX` へマップされる過去互換用途に限られる)。