Behavior-Structure Separation 振る舞い変更と構造変更の分離・外部挙動維持

Behavior-Structure Separation 振る舞い変更と構造変更の分離・外部挙動維持 is a skill for Claude Code from s977043/river-review. It costs 211 tokens per session (4,127 once invoked), scanned A, original, MIT.

A code review check that separates refactoring—changing code structure without changing its behavior—from feature changes that intentionally alter what the software does. It also checks whether tests, type checks, or other evidence support the claim that behavior stayed the same.

In plain words
What is it for?
Use it when a change both reorganizes existing code and adds or changes functionality, especially when preserving an existing public behavior matters.
Why use it?
It helps make large changes easier to review and exposes refactors that may have changed behavior without a safety net.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the river-review plugin — 139 skills, 18 commands, 5 agents, 3 hooks shipped together

Good fit Use it when a change both reorganizes existing code and adds or changes functionality, especially when preserving an existing public behavior matters.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/s977043/river-review/behavior-structure-separation
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add s977043/river-review --skill behavior-structure-separation
Clone the repo
git clone --depth 1 https://github.com/s977043/river-review

Made for: Claude Code.

Or install river-review, the plugin that ships this one along with the rest of its 139 skills, 18 commands, 5 agents, 3 hooks.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for Behavior-Structure Separation 振る舞い変更と構造変更の分離・外部挙動維持

README.md
[![agentmods](https://agentmods.dev/badge/skills/s977043/river-review/behavior-structure-separation/github.svg)](https://agentmods.dev/skills/s977043/river-review/behavior-structure-separation)
Your own site
<a href="https://agentmods.dev/skills/s977043/river-review/behavior-structure-separation"><img src="https://agentmods.dev/badge/skills/s977043/river-review/behavior-structure-separation/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for Behavior-Structure Separation 振る舞い変更と構造変更の分離・外部挙動維持

Your own site · 80×15
<a href="https://agentmods.dev/skills/s977043/river-review/behavior-structure-separation"><img src="https://agentmods.dev/badge/skills/s977043/river-review/behavior-structure-separation.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 211 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 4,127 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00211 $0.04127
Opus 5.5 $0.00084 $0.01651
Sonnet 5.5 $0.00042 $0.00825
Haiku 4.5 $0.00021 $0.00413

Measured 1mo ago against content hash 0fbaf7aea83c, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

Behavior-Structure Separation 振る舞い変更と構造変更の分離・外部挙動維持 scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugin-dist/river-review/skills/midstream/behavior-structure-separation/SKILL.md · 184 lines

How it starts

The opening of the file, as written. The whole thing — 184 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Origin / 由来

inspired by:

  • https://agilejourney.uzabase.com/entry/2026/07/16/103000 — 構造変更(リファクタリング)と振る舞い変更を分離し、外部挙動を維持したまま設計を更新する営みとしてのリファクタリング論。Preparatory / Post-change Refactoring と Behavior Change の識別、Characterization / Safety Net の考え方。

上記は観測された考え方の紹介であり、本文の転載・著者による endorsement を含まない(nominative fair use)。命名は skills/README.md Naming に従い value を表す新規名として付与した。

Pattern declaration

Primary pattern: Reviewer Secondary patterns: Inversion Why: 振る舞い/構造変更の混在と外部挙動維持の証拠評価は意味的判断が主だが、構造変更の証拠が差分に無い変更では実行を止めるゲートが必要。

Goal / 目的

diff に対し、次を diff-time で確認する。テストが通るだけでは分からない「仕様混在」と「安全網なしの構造変更」を検出する。

  1. 分離: 外部挙動を変える behavior change と、外部挙動を変えない structural change(リファクタリング)が同一 diff に混在していないか。混在する場合、diff・説明・コミットからそれを識別できるか。
  2. 外部挙動維持の証拠: structural change の前後で外部挙動が維持されている証拠(テスト・型・静的解析)が揃っているか。証拠が不足する場合、Characterization Test の追加を促すか needs_review(question)とする。

PlanGate が Behavior Change / Preparatory Refactoring / Post-change Refactoring / Characterization の区分を提供する場合はそれを入力とし、River Review は Plan を再作成せず、diff と検証結果が Plan の変更順序・完了条件を満たすかを確認する。

report-only。finding/question のみを出力し、自動修正・自動マージはしない。

Non-goals / 扱わないこと(委譲表)

  • 公開 API / DTO の破壊的変更検出: エンドポイント・DTO・インターフェースの後方互換破壊とその影響範囲は api-compatibility が担う。本 skill は破壊的変更の検出ではなく、振る舞い変更と構造変更の混在と構造変更の挙動維持証拠を見る。
  • 完了主張の反証・性能特性の退行: 「動作は変えていない」「全部置換した」等の主張の grep 反証と、抽出リファクタの並列度/fast-path/遅延評価の退行・キー集約衝突は refactor-claim-audit が担う。本 skill は主張の有無に関わらず分離の質と証拠の有無を評価する。
  • 新知識の命名・責務・境界への反映、設計知識の保全: knowledge-to-code-alignment(sibling)が担う。本 skill は知識反映ではなく挙動維持を見る。
  • 投機的抽象化・不要なスコープ拡大: altitude-generalization / fix-scope-integrity が担う。
  • テストの命名・網羅性そのものの品質: Characterization Test の中身の良し悪しは testing 系観点の責務。本 skill は「挙動維持の証拠が有るか無いか」の充足のみを見る。

Pre-execution Gate / 実行前ゲート

このスキルは以下の条件がすべて満たされない限り NO_REVIEW を返す。

  • inputContext に diff が含まれている。
  • 差分に構造変更の証拠(関数/メソッドの抽出・移動・改名、ファイル分割/統合、シグネチャ変更、内部データ構造の付け替え等)が少なくとも1つ含まれている。
  • 差分がリポジトリ内で実行されるコードに触れる(docs・コメントのみの差分は対象外)。
  • ビルド成果物・生成物(dist/**・*.map・lockfile・自動生成 manifest)は Gate 判定からもレビュー対象からも除外する。

Read the full file on GitHub · 184 lines

Files

What ships with it

3 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 184 lines · 211 tokens per session scan A 0fbaf7aea83c

Subscribe to this mod's changes

Behavior-Structure Separation 振る舞い変更と構造変更の分離・外部挙動維持 is a skill published in the GitHub repository s977043/river-review (7 stars, last pushed yesterday), licensed MIT. It adds 211 tokens to every session and 4,127 once invoked, about $0.0008 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

Other skills, from other repositories

run-iteration-eval

Run the Logic-Lens content-eval pipeline for one iteration and produce a scored summary.json — use to measure a skill change. Wraps scripts/run-content-evals.sh (runner, costs tokens) and scripts/grade-iteration.py (grader, free, re-runnable). ALWAYS sync the plugin cache first. Use when the user wants to "run the…

hyhmrright/logic-lens · 108 tokens

refactor-engineer

Enforces characterize-before-change discipline with continuous green tests, separating structural changes from behavioral ones. Now with mathematical depth metrics, refactor safety calculus, refactor , and verification gates.

Kshitijpalsinghtomar/depth-skills · 41 tokens

iterate-skill

Run the Logic-Lens skill-improvement loop end to end — baseline → diagnose failures → edit → sync cache → re-eval → verify net gain → iterate until clean. Use whenever the goal is to RAISE a skill's eval score or fix a failing eval mode: "improve logic-review", "the format compliance is failing, fix it", "iterate on…

hyhmrright/logic-lens · 0 tokens

brooks-test

Test quality review drawing on twelve classic engineering books — with primary focus on xUnit Test Patterns, The Art of Unit Testing, How Google Tests Software, and Working Effectively with Legacy Code — that diagnoses structural problems in an existing test suite: brittleness, mock abuse, coverage illusions, slow…

hyhmrright/brooks-lint · 161 tokens

software-code-refactoring

Improve production code quality while preserving all existing test behavior. Commonly used for the Refactor phase of TDD red-green-refactor, but applicable to any codebase with tests. Use when production code works but needs cleanup — reducing duplication, improving naming, simplifying complexity, aligning with…

stencila/stencila · 102 tokens

vibe-gap-analysis

Assesses production readiness or audits a codebase against its specs. Supports quick static mode, deep 17-dimension audit, or single-dimension focus. Use before a production launch, after a major refactor, when inheriting a codebase, or when someone asks how done the project is.

ash1794/vibe-engineering · 65 tokens