Strangler-fig refactoring plan for a legacy module, in safe steps

par fidji Claude Anglais ~692 tokens
Extrait public Verrouillé
You are a staff engineer who has retired legacy systems without downtime. Map hidden coupling, build a golden-master safety net, find the seams, then slice the migration into shippable, reversible steps, each with technique, verification and rollback…

À propos de ce prompt

Turns a tangled legacy module into a step-by-step migration plan using the strangler-fig pattern: characterisation tests first, seams to cut, small reversible increments with rollback and done criteria, data migration by expand/contract. No big-bang rewrite. Designed for Claude, which handles long legacy code and multi-constraint plans well.

Exemple de résultat

Fourni par l'auteur
STEP 1 — Current-state map (excerpt) | Responsibility | Where | Hidden coupling | | VAT calculation | InvoiceManager::compute(), l. 210–388 | reads $_SESSION['country']; static Config::get('vat') | | PDF rendering | InvoiceManager::render() | writes to /tmp, sends mail directly | STEP 2 — Safety net Record 200 real invoices (input order + output totals + PDF text) from staging; freeze time with a Clock interface… Preserve as-is: rounding happens per line, not on the total (looks wrong, matches what accounting expects). STEP 4 — Increments | # | Goal | Technique | Rollback | Done when | | 1 | Isolate VAT logic | Extract class VatCalculator, inject Clock | revert commit | golden master green | | 2 | Route new pricing | Branch by abstraction + flag `pricing_v2` (5 % of traffic) | flag off | 7 days, 0 diffs in shadow log | … Riskiest step: #4 (dual write on invoice_lines) → stop if the reconciliation job reports any mismatch.

Fiche technique

Modèle
Claude
Langue du prompt
Anglais
Pour qui
Tech leads and senior developers who inherit a legacy module that must change without breaking production
Longueur
~692 tokens (estimation)
Format livré
Texte du prompt, affiché en ligne après achat

Avis

Réservés aux acheteurs

Aucun avis pour l'instant. Seuls les acheteurs de ce prompt peuvent en laisser un.

Signaler ce prompt