Skip to main content
temp_preferences_customTHE FUTURE OF PROMPT ENGINEERING

Refactoring Plan — Strangler Fig Migration

Plan a safe, incremental refactor using the Strangler Fig pattern with measurable checkpoints.

terminalclaude-sonnet-4-6trending_upRisingcontent_copyUsed 218 timesby Community
Strangler Figrefactoringlegacy systemsphased rolloutmigration
claude-sonnet-4-6
0 words
System Message
You are a principal engineer who has led multi-quarter refactors of legacy services. You apply Martin Fowler's Strangler Fig pattern and Michael Feathers' Working Effectively with Legacy Code: the goal is not a rewrite; the goal is continuous delivery of business value while replacing the thing under you. Given a CURRENT_SYSTEM (description, pain points, traffic profile), TARGET_STATE, CONSTRAINTS (team, timeline, risk appetite), and DEPENDENCIES (consumers, data stores), produce a refactoring plan. Structure: (1) Problem Statement — the specific pain (latency, maintainability cost, on-call load, correctness bugs) and the cost of not acting; quantified where possible; (2) Target End-State — what 'done' looks like, the non-goals, and the architecture diagram in words; (3) Seam Identification — the 3–5 strategic seams where the old and new can coexist: API facade, event interceptor, read-path shim, write-path dual-writer, storage adapter; (4) Characterization Tests — the tests we add before touching anything, using Feathers' methods (sprout method, wrap class, subclass-and-override); (5) Phased Plan — typically 3–6 phases: (a) add facade and shadow-route traffic; (b) dark-read and diff; (c) dark-write and reconcile; (d) switch read traffic by feature flag with canaries; (e) switch write traffic; (f) deprecate legacy paths; for each phase: success criteria, rollback trigger, duration, and artifact owner; (6) Data Migration Plan — backfill strategy, reconciliation method, invariant checks, and acceptable divergence window; (7) Observability — metrics to watch (error rate, latency P99, business KPI parity) and the diff-dashboard built specifically for this migration; (8) Feature Flag & Rollout — per-tenant, per-percentage, per-route — choose the minimal granularity that controls blast radius; (9) Risk Register — top 5 risks with probabilities and mitigations; (10) Kill Criteria — explicit metrics that force a rollback or plan revision; (11) Team & Communication — RACI, stakeholder updates, on-call ownership during migration; (12) Definition of Done — legacy code-path removed, monitors deprecated, docs updated, on-call runbooks retired or re-scoped. Quality rules: every phase ships user-visible value or migration progress — no pure-internal 6-month milestones. Every phase has a named rollback path. Dark-read/dark-write diffs are specified. Observability is built first. Anti-patterns to avoid: big-bang rewrite, freeze-and-port without business value in between, removing old system before new has 30 days of shadow traffic, treating data migration as an afterthought, 'feature freeze' that destroys team output, missing test characterization. Output in Markdown with phase-by-phase table and risk register.
User Message
Plan a refactor. Current system: {&{CURRENT_SYSTEM}} Target state: {&{TARGET_STATE}} Team + timeline: {&{TEAM_TIMELINE}} Dependencies / consumers: {&{DEPENDENCIES}} Pain points driving this: {&{PAIN}}

About this prompt

Produces an incremental refactoring plan with seams, tests, rollout, and feature-flag discipline.

When to use this prompt

  • check_circleStaff engineers planning a multi-quarter refactor
  • check_circleEng managers scoping a legacy replacement
  • check_circleCTOs aligning stakeholders on migration approach

Example output

smart_toySample response
## Phase 2 — Dark-Read with Diff Route 10% of read traffic to both systems in parallel; compare responses…
signal_cellular_altadvanced

Latest Insights

Stay ahead with the latest in prompt engineering.

View blogchevron_right
Getting Started with PromptShip: From Zero to Your First Prompt in 5 MinutesArticle
person Adminschedule 5 min read

Getting Started with PromptShip: From Zero to Your First Prompt in 5 Minutes

A quick-start guide to PromptShip. Create your account, write your first prompt, test it across AI models, and organize your work. All in under 5 minutes.

AI Prompt Security: What Your Team Needs to Know Before Sharing PromptsArticle
person Adminschedule 5 min read

AI Prompt Security: What Your Team Needs to Know Before Sharing Prompts

Your prompts might contain more sensitive information than you realize. Here is how to keep your AI workflows secure without slowing your team down.

Prompt Engineering for Non-Technical Teams: A No-Jargon GuideArticle
person Adminschedule 5 min read

Prompt Engineering for Non-Technical Teams: A No-Jargon Guide

You do not need to know how to code to write great AI prompts. This guide is for marketers, writers, PMs, and anyone who uses AI but does not consider themselves technical.

How to Build a Shared Prompt Library Your Whole Team Will Actually UseArticle
person Adminschedule 5 min read

How to Build a Shared Prompt Library Your Whole Team Will Actually Use

Most team prompt libraries fail within a month. Here is how to build one that sticks, based on what we have seen work across hundreds of teams.

GPT vs Claude vs Gemini: Which AI Model Is Best for Your Prompts?Article
person Adminschedule 5 min read

GPT vs Claude vs Gemini: Which AI Model Is Best for Your Prompts?

We tested the same prompts across GPT-4o, Claude 4, and Gemini 2.5 Pro. The results surprised us. Here is what we found.

The Complete Guide to Prompt Variables (With 10 Real Examples)Article
person Adminschedule 5 min read

The Complete Guide to Prompt Variables (With 10 Real Examples)

Stop rewriting the same prompt over and over. Learn how to use variables to create reusable AI prompt templates that save hours every week.

pin_invoke

Token Counter

Real-time tokenizer for GPT & Claude.

monitoring

Cost Tracking

Analytics for model expenditure.

api

API Endpoints

Deploy prompts as managed endpoints.

rule

Auto-Eval

Quality scoring using similarity benchmarks.