Refactor

Improve internal structure while preserving observable behavior.

Purpose

Improve internal structure while preserving observable behavior.

Recommended

  • State the structural goal and behavior that must remain unchanged.
  • Work in small transformations and validate after meaningful steps.
  • Keep behavior changes in separately reviewed work.

Avoid

  • Combining an unbounded redesign with feature work.
  • Claiming behavior preservation without relevant tests.

Prompt skeleton

Prompt skeleton — deterministic, no model call

Goal
[Describe the structural improvement.]

Behavior to preserve
[State externally observable invariants.]

Constraints
[Define scope and forbidden behavior changes.]

Validation
[Name tests that prove behavior remains stable.]

From templates/refactor.md. Placeholders describe what to fill in; nothing here invents project facts.

Evidence

community
  • communityRefactoring changes internal structure while preserving externally observable behavior and is safer in small, validated steps.
    Refactoring ↗

Sources