{
  "version": "act 2.0.0",
  "slug": "verify-refactor",
  "name": "verify-refactor",
  "description": "Verify a refactor preserved behavior \u2014 composes contract, side-effect, and CFG-equivalence checks across two versions of a function. Use after editing a function to confirm the change is safe.",
  "url": "https://act101.ai/docs/skills/verify-refactor",
  "body_md": "# verify-refactor\n\nConfirm a function's refactor is behavior-preserving by composing three\nEngineer-tier verification ops over a two-version comparison (git working-tree\nvs `HEAD` by default, or an explicit before/after pair).\n\nScope note: this skill verifies ONE function pair. For a changed SET of\nfunctions with git context, use `act gate` (see the safe-to-merge skill) \u2014 its\nverdict vocabulary (MERGE/REVIEW/BLOCK/UNKNOWN) is intentionally distinct from\nthis skill's per-function SAFE/REVIEW/UNSAFE/UNKNOWN.\n\n## Tools\n\n| Step | Tool | What it answers |\n|---|---|---|\n| 1 | `verify_contract_preserved` | Did the public + behavioral contract (signature, effects, control, returns, guards, raises) change? |\n| 2 | `verify_side_effects` | Which side effects were added/removed? Was a cleanup dropped? |\n| 3 | `verify_behavioral_equivalence` | Is the control-flow shape equivalent (no new/removed branches, loops, exception paths)? |\n\nAll three are **Engineer**. `verify_behavioral_equivalence` at `scope:\"port\"` is Enterprise.\n\n## How to run\n\n1. Call `verify_contract_preserved` with `target` + `file`. If the verdict is\n   `broken`, report the broken dimensions and stop \u2014 the refactor changed the\n   contract.\n2. Call `verify_side_effects`. Surface any `dropped_cleanup: true` prominently \u2014\n   a removed write/close while an allocation is kept is a likely leak.\n3. Call `verify_behavioral_equivalence`. `equivalent` confirms the shape held;\n   `changed` lists which dimensions; `unknown` means a grammar dimension (e.g.\n   Go exceptions) could not be judged \u2014 say so, do not claim safety.\n\n## Verdict\n\n- **SAFE** \u2014 contract preserved, no dropped cleanup, behaviorally equivalent.\n- **REVIEW** \u2014 contract preserved but effects changed, or CFG `changed` in an\n  expected way; summarize what moved.\n- **UNSAFE** \u2014 contract `broken`, `dropped_cleanup: true`, or behavior changed\n  unexpectedly.\n- **UNKNOWN** \u2014 any op returned `unknown` on a not-modeled dimension; never\n  upgrade UNKNOWN to SAFE.\n\n## Summary format\n\nReport: the verdict, the three op results in one line each, and the specific\ndimensions/effects that changed. Quote `modeled_kinds` when a verdict is UNKNOWN."
}