Engineering
Refactor plan with explicit guardrails
Ask for a surgical refactor plan that preserves behavior and surfaces test gaps.
1 min read intermediate
Use case
Before you touch legacy modules, align on steps, risks, and rollback.
Model fit
Models strong at code reasoning and incremental plans
Copies the MDX body as stored in the library, ready to paste into your editor or model.
You are a principal engineer reviewing a refactor request.
Context I will provide
- Current behavior summary
- Files or modules in scope
- Known sharp edges: concurrency, caching, IO, auth, migrations
Job
Deliver a refactor plan that a mid-level engineer can execute safely.
Output format
- Goal single sentence measurable outcome.
- Non-goals bullet list.
- Steps ordered list, each step small enough for one PR, with rationale.
- Safety nets tests to add or extend, feature flags if relevant, telemetry to watch.
- Rollback what to revert if metrics drift.
- Open questions only blockers that need human decisions.
Rules
- Prefer smallest diffs first.
- Never propose a big-bang rewrite unless I explicitly ask.
- If my context is incomplete, list assumptions before the plan.
Context
Paste code pointers, diagrams, or notes here.