## Machine-Readable Contract ```yaml contract_schema_version: v1 issue_kind: implementation parent_issue: "none" goal_ref: "decide_rewrite_route.py の入力 state 契約を self-describe 可能にし、agent の試行錯誤(--help 試行 / Invalid JSON / source 再読)を排除する" change_kind: workflow ``` ## Parent Issue none(単独改善) ## Parent Goal Ref なし(単独改善)。関連文脈として #791(agent ops token/context 削減 parent, 大半 child は実装済み)の補完にあたるが、本 Issue は #791 の close 条件には含めない standalone 改善。 ## Current Validated Scope `.claude/skills/issue-refinement-loop/scripts/decide_rewrite_route.py` の CLI インターフェースのみ。route 判定ロジック・出力 schema は変更しない。 ## Remaining Parent Gaps なし(単独改善)。 ## Outcome `decide_rewrite_route.py` が `--print-schema` / `--example-input` / `--from-file` をサポートし、呼び出し側 agent が source を読まずに必要な入力 state JSON を構築・検証できる状態(更新された script + 追加 test が PASS)。 ## In Scope - `--print-schema`: 入力 state の JSON Schema(または等価な機械可読 schema)を stdout に出力し exit 0 で終了する - `--example-input`: そのまま標準入力に渡すと有効に route が決まる最小 valid state JSON を stdout に出力し exit 0 で終了する - `--from-file <path>`: stdin の代わりに指定ファイルから state JSON を読む - 入力 state が schema 不適合の場合に missing / unexpected キーを stderr に列挙し exit 2 を返す(既存の挙動が exit 0/1 のみなら invalid 系を整理する) - 上記 CLI 挙動を検証する test を追加する ## Out of Scope - route 判定ロジック自体(どの route を選ぶか)の変更 - route 結果の出力 schema の変更 - `decide_rewrite_route.py` 以外の script / SKILL.md の変更 - auto-fix や issue body mutation ## Acceptance Criteria - [ ] AC1: `--print-schema` 実行時に入力 state の機械可読 schema を stdout に出力し exit 0 で終了する - [ ] AC2: `--example-input` 実行時に最小 valid state JSON を stdout に出力し exit 0 で終了する - [ ] AC3: `--from-file` / invalid-input の exit code 契約を検証する test が追加され PASS する ## Verification Commands ```bash # AC1 uv run python3 .claude/skills/issue-refinement-loop/scripts/decide_rewrite_route.py --print-schema ``` ```bash # AC2 uv run python3 .claude/skills/issue-refinement-loop/scripts/decide_rewrite_route.py --example-input ``` ```bash # AC3 uv run pytest .claude/skills/issue-refinement-loop/tests/test_decide_rewrite_route_cli.py ``` ## Allowed Paths - .claude/skills/issue-refinement-loop/scripts/decide_rewrite_route.py - .claude/skills/issue-refinement-loop/tests/test_decide_rewrite_route_cli.py ## Stop Conditions - Allowed Paths 外の変更が必要と判明した場合 - In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合 - 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合) - 後続 Phase / 別スコープへの波及が判明した場合 - nested SubAgent delegation が必要になった場合 - 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合 - `--print-schema` / `--example-input` の出力を caller(SKILL.md / 既存 test)が消費する契約変更が必要と判明した場合 ## Required Skills - Python(argparse / JSON 出力), pytest ## Scope Delta(任意) N/A
Activity