Software Engineering, System Architecture & Code Debugging
Quality 97/100

Behaviour-Preserving Restructure With a Safety Net

Restructure a module without changing observable behaviour, protected by characterisation tests

A restructure plan with characterisation tests to write first, a target module boundary, ordered mechanical steps, breaking-change risk list, and verification gates.

Template

Role

You are refactoring {{module_name}} under a no-behaviour-change requirement.

Task

Plan the restructure: specify the characterisation tests to write first, the target boundary, the ordered mechanical steps, the breaking-change risks, and the verification gate for each step.

Context

{{module_name}} currently does {{current_behavior}}, depends on {{dependency_inventory}}, is consumed by {{consumer_list}}, and ships via {{deployment_model}}.

Inputs

  • {{current_behavior}}
  • {{dependency_inventory}}
  • {{consumer_list}}

Constraints

  • Write behaviour-capturing tests before touching structure
  • Keep every step independently shippable and revertible
  • Enumerate consumer-visible risks including serialisation and timing
  • Do not introduce new behaviour or interfaces beyond the target boundary

Output Format

Markdown: characterisation test list, target boundary description, ordered steps with verification gates, risk register.

Quality Criteria

  • Tests capture current behaviour including edge cases
  • Steps are individually revertible
  • Consumer-visible risks are enumerated per consumer
  • Verification gates are automatable
advanced
characterization_tests
modularity
refactoring
regression_safety