topological-refactoring

Evaluate code changes for behavior preservation during refactoring.

2|Updated Apr 30, 2026
One-click install
npx skills add https://github.com/NlightNFotis/skills --skill topological-refactoring
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: topological-refactoring
Source: https://github.com/NlightNFotis/skills/tree/main/topological-refactoring
Command: npx skills add https://github.com/NlightNFotis/skills --skill topological-refactoring

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps you determine whether a proposed code change is a true refactor or an accidental behavior change. It gives you a structured way to define what must stay invariant, identify who can observe changes, and prevent hidden contract breaks during cleanup or migration work.

Core Features & Use Cases

  • Behavior-Preserving Refactor Analysis: Maps public boundaries, observers, side effects, persisted formats, and implicit contracts that must remain stable.
  • Cut vs. Glue Review Framework: Classifies changes as safe deformations versus contract-breaking cuts or collapsed distinctions that alter behavior.
  • Verification Planning: Identifies the exact tests, properties, and shadowing strategies needed to prove equivalence before and after refactoring.
  • Use Cases: Review a pull request labeled pure refactor, migrate callers to a new API shape, remove accidental abstractions, or estimate the blast radius of internal restructuring.

Quick Start

Ask the topological-refactoring skill to evaluate your planned refactor by listing the boundary, observers, essential versus accidental abstractions, and the tests that must keep passing.

Frequently Asked Questions about topological-refactoring

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I verify behavior preservation during code refactoring?

Verify behavior preservation during refactoring by mapping public boundaries, identifying observers, and classifying changes as safe deformations versus contract-breaking cuts. This approach ensures observable behavior remains stable while preventing hidden contract breaks during module restructuring or cleanup.

What is a cut versus glue analysis when reviewing a pure refactor pull request?

Cut versus glue analysis is a review framework that classifies refactoring changes as safe deformations versus contract-breaking cuts or collapsed distinctions. It maps essential versus accidental abstractions to prevent accidental behavior changes during API migration or abstraction cleanup.

How do I plan equivalence verification tests for an API migration?

Plan equivalence verification tests for an API migration by identifying exact tests, properties, and shadowing strategies needed to prove equivalence. Map implicit observers and persisted formats to ensure invariant test selection covers all observable side effects across callers.

Can I estimate the blast radius of internal module restructuring without breaking downstream systems?

Estimate the blast radius of module restructuring by identifying all observers, callers, and downstream systems affected. Map explicit boundaries and implicit contracts to analyze which internal changes propagate externally, ensuring contract preservation across operators and tests.

What is the best way to identify implicit contracts that must remain stable during abstraction cleanup?

Identify implicit contracts during abstraction cleanup by mapping public boundaries, side effects, persisted formats, and implicit observers. Distinguishing essential from accidental abstractions reveals which contracts must remain invariant to preserve observable behavior.

When should I not use a behavior-preserving refactor analysis for software architecture changes?

Avoid behavior-preserving refactor analysis when changes intentionally alter observable behavior or break contracts. This framework targets pure refactoring, API migration, and module restructuring where invariants must hold, not feature additions or architectural redesigns requiring new behavior.