| id | altitude-generalization |
| name | Altitude Generalization Guard |
| description | Detects per-caller special-cases (bandaids) bolted onto shared infrastructure/common functions, and when two or more same-kind special-cases exist proposes generalizing the lower-level mechanism instead. |
| version | 0.1.0 |
| category | midstream |
| phase | midstream |
| applyTo | ["src/**/*.{ts,tsx,js,jsx,mjs,cjs}","scripts/**/*.{ts,tsx,js,jsx,mjs,cjs}","runners/**/*.{ts,tsx,js,jsx,mjs,cjs}"] |
| tags | ["simplify","altitude","generalization","maintainability","midstream"] |
| severity | minor |
| inputContext | ["diff"] |
| outputKind | ["findings","actions"] |
| modelHint | high-accuracy |
| prompt | {"system":"prompt/system.md","user":"prompt/user.md"} |
| eval | {"promptfoo":"eval/promptfoo.yaml"} |
由来: Claude Code の /simplify(Altitude 観点)に由来(inspired by)。Issue #1452 P3 で、skills/agent-skills/river-review-code/references/SIMPLIFY.md から Altitude の詳細検出を本 registry skill へ委譲した。
Pattern declaration
Primary pattern: Reviewer
Secondary patterns: Inversion
Why: 共有基盤への継ぎ接ぎ(bandaid)をチェックリストで評価するが、special-case の証拠が差分に無い変更では実行しない。
Goal / 目的
- 共有基盤・共通関数に「特定の呼び出し元のためだけ」の分岐(bandaid)が積み上がるのを防ぐ。
- 同種の special-case が2つ以上ある場合に、下層機構の一般化(設定テーブル / strategy / caller ごとの宣言的マップ)を促す。
Non-goals / 扱わないこと
- correctness bug・セキュリティ欠陥は対象外(bug 系・security 系観点の責務)。
- 設計思想への一般論(「もっと抽象化すべき」等、差分に証拠のない主張)は出さない。
- リファクタ完了主張の反証は
refactor-claim-audit の責務であり、本観点では扱わない。
applyTo に scripts/** と runners/** を含める理由
applyTo の各 glob は拡張子で境界付けした midstream ソース限定(scoping ガイド「midstream (application source)」の範囲内)である。SIMPLIFY 観点は src/ だけでなく scripts/・runners/ で実行されるコードにも special-case が生じ得る(P2 実地検証では scripts/** の hygiene / 検証ロジックが対象になった)。本 skill はその applyTo 経路差を解消するため、実行コードを持つ3ルートを対象にする。tests/**・docs/**・dist/** は含めない。
Pre-execution Gate / 実行前ゲート
このスキルは以下の条件がすべて満たされない限り NO_REVIEW を返す。dispatcher 経路では Gate が強制されないため、実行時に本文の Gate を必ず自己適用する。
ゲート不成立時の出力: NO_REVIEW: altitude-generalization — 共有基盤への caller special-case の証拠が差分に検出されない