agentleFS
s977043s977043/PlanGate/.agents/skills/skill-policy-router/SKILL.md

skill-policy-router

Skill3 starsChanged 14 days agoMITView on GitHub

Intent と Mode を受け取り、必要な Skill・ゲート要件(GatePolicy)を返す。Use when: 依頼の Intent と Mode が確定した後、どの Skill とゲートが必要かを決定したい時。「どのスキルが必要か教えて」「ゲートポリシーを決めて」「Mode に応じた手順を教えて」。

The file

Files
SKILL.md

Skill Policy Router

正本(sync 元): .agents/skills/skill-policy-router/SKILL.md。scripts/sync-plugin-plangate.sh が .agents/skills/ を読み取り plugin/plangate/skills/ を機械生成する。.claude/skills/ と .codex/skills/ は sync 対象外の配布先のため、正本更新時に同一内容を手動で追従させる。

Intent と Mode を入力として受け取り、必要な Skill とゲート要件(GatePolicy)を structured JSON で返す。

参照解決順(.claude/rules/*.md / 導入先で必ずこの順に探す)

本 Skill は Mode / lite_eligible の定義正本として .claude/rules/mode-classification.md を 参照する(§Iron Law / §lite_eligible の扱い)。このパスは上流リポジトリ基準のため、導入先では 次の順で探索する:

  1. 導入先リポジトリの .claude/rules/mode-classification.md
  2. 無ければ plugin root 配下 <plugin_root>/rules/mode-classification.md。 <plugin_root> は Bash で ls "${CLAUDE_PLUGIN_ROOT}/rules/" を実行して展開・確認した 絶対パス(Read ツールは絶対パスを要求し環境変数を展開しないため、${CLAUDE_PLUGIN_ROOT}/... という文字列をそのまま Read しない)。変数が空・未設定ならキャッシュを glob で推測せず 3 へ進む
  3. どちらにも無い場合は 「正本 mode-classification.md を参照できなかった」と明示し、 推測で内容を補わない

Iron Law

GATE POLICY IS DETERMINED BY MODE, NOT BY INTENT

GatePolicy の必須 / 任意判定は Mode によって決まる。 Intent はスキルの優先度や追加推奨にのみ影響する。

Mode の定義・判定基準(変更ファイル数・リスク・lite_eligible)は .claude/rules/mode-classification.md が単一正本。本スキルは確定済み Mode を入力として受け取り GatePolicy へ写像するのみで、Mode 自体は判定しない。下の「Mode 別ポリシー表」は Mode→GatePolicy の写像であり Mode の定義ではない(重複定義ではない)。

Common Rationalizations

こう思ったら現実
「小さな feature だから approval 不要」Mode が high-risk ならば Intent に関わらず approval は必須
「docs なら worktree は不要では?」Mode が high-risk なら docs でも worktree が必要
「ultra-light なら全部スキップでいい」verify は ultra-light でも必須

GatePolicy 型定義

{
  "requiredSkills": ["<skill-name>", "..."],
  "optionalSkills": ["<skill-name>", "..."],
  "requiresUserApproval": "<boolean>",
  "requiresEvidence": "<boolean>",
  "requiresFailingTestFirst": "<boolean>",
  "requiresWorktree": "<boolean>"
}

Skill 識別子:

識別子対応 Skill / 行動
think設計・計画の立案(plan.md 生成)
huntコードベース調査(Grep / Glob 探索)
checkセルフレビュー(diff-audit Skill、旧 self-review)
tddテスト駆動開発(failing test first)
verify受け入れ検査(test-cases.md 突合)
worktree独立ブランチでの作業(worktree 分離)
review外部レビュー(human / external AI)
approval人間の明示的承認取得

Mode 別ポリシー表

フィールドultra-lightlightstandardhigh-riskcritical
requiredSkillsverifycheck, verifythink, check, verifythink, approval, worktree, tdd, check, review, verifythink, approval, worktree, tdd, check, review, verify
optionalSkillscheckthink, hunthunt, tdd——
requiresUserApprovalfalsefalserecommendedtruetrue
requiresEvidencefalsefalsetruetruetrue
requiresFailingTestFirstfalsefalseconditionaltruetrue
requiresWorktreefalsefalsefalsetruetrue

standard の補足:

  • requiresUserApproval=recommended: 人間確認を強く推奨するが必須ではない
  • requiresFailingTestFirst=conditional: TDD が optional として推奨される

critical の追加要件:

  • ロールバック計画の策定が必要
  • セキュリティレビューを含む多角的レビューを推奨
  • 段階的デプロイ計画の策定を推奨

手順

Step 1: 入力検証

以下のフォーマットで入力を受け取る:

{
  "intent": "<feature|bug|refactor|research|review|docs|ops|exploratory>",
  "mode": "<ultra-light|light|standard|high-risk|critical>"
}

mode が不明な場合は standard をデフォルトとして使用する。 intent が不明な場合は feature をデフォルトとして使用する(Intent は GatePolicy に影響しない)。

Step 2: Mode によるベースポリシー決定

「Mode 別ポリシー表」から対応する行を読み取り、ベース GatePolicy を構築する。

Step 3: Intent による調整(任意)

Intent に応じて optionalSkills を追加・調整する:

Intent推奨 optionalSkills 追加
featurethink(未追加の場合)
bughunt(原因調査のため)
refactorcheck(品質確認のため)
research—
reviewcheck
docs—
opsverify(デプロイ検証のため、未追加の場合)。PlanGate CLI 操作(render/approve/doctor/exec)は skill でなく直接 plangate <cmd> を実行する
exploratory— (WF-07 opt-in 推奨。通常フローに留まる場合は intent 相当の Skill 構成を使用)

ただし、requiredSkills に既に含まれている Skill は optionalSkills に重複追加しない。

plangate <cmd> の表記と CLI 不在時の degrade は intent-classifier skill 「PlanGate CLI 操作の認識(ops 補足)」節を正本とする(ここでは再定義しない)。 要点のみ: PATH 解決されるコマンド名は plangate、上流リポジトリの cwd では bin/plangate <cmd>、CLI が無い環境(導入先では既定)は同節の代替手順に置き換える。 GatePolicy の内容は CLI の有無で変えない(強制が機械 block から手動確認に落ちるだけ)。

Step 4: GatePolicy 出力

構築した GatePolicy を structured JSON で出力する。

出力フォーマット

{
  "input": {
    "intent": "<intent>",
    "mode": "<mode>"
  },
  "policy": {
    "requiredSkills": ["<skill-name>"],
    "optionalSkills": ["<skill-name>"],
    "requiresUserApproval": true,
    "requiresEvidence": true,
    "requiresFailingTestFirst": true,
    "requiresWorktree": true
  },
  "notes": "<特記事項(critical の追加要件等)>"
}

使用例

入力: { "intent": "docs", "mode": "ultra-light" }

出力:

{
  "input": {
    "intent": "docs",
    "mode": "ultra-light"
  },
  "policy": {
    "requiredSkills": ["verify"],
    "optionalSkills": ["check"],
    "requiresUserApproval": false,
    "requiresEvidence": false,
    "requiresFailingTestFirst": false,
    "requiresWorktree": false
  },
  "notes": ""
}

入力: { "intent": "feature", "mode": "high-risk" }

出力:

{
  "input": {
    "intent": "feature",
    "mode": "high-risk"
  },
  "policy": {
    "requiredSkills": ["think", "approval", "worktree", "tdd", "check", "review", "verify"],
    "optionalSkills": [],
    "requiresUserApproval": true,
    "requiresEvidence": true,
    "requiresFailingTestFirst": true,
    "requiresWorktree": true
  },
  "notes": ""
}

lite_eligible の扱い(責務分界)

lite_eligible(Lite ゲート可否)は .claude/rules/mode-classification.md の派生属性で、判定は mode-classification 正本が担う。本スキルは確定した lite_eligible を入力として受け取り、true のとき Lite ゲート構成(例: C-2 外部レビューを 1 本に絞る・観点固定)を GatePolicy に反映する。router は lite_eligible を判定せず使用するのみ。判定不能時は安全側(lite_eligible=false 相当の full ゲート)。

関連 Skill

  • intent-classifier: ユーザー依頼文から Intent を判定する。このスキルの前段として使用
  • breakdown-gate: タスク粒度の intake ゲート。intent-classifier よりさらに前段(PlanGate 起動前)でタスク分割要否を判定する(.agents/skills/breakdown-gate/)

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.