yonatankarp/software-design-skills

arch-strangler-fig

Use when migrating a legacy system incrementally — phrases like "strangler fig", "strangler pattern", "incremental migration", "monolith to microservices", "rewrite without big bang", "replace legacy in place", "facade in front of the legacy system", "antic…

소스 보기

사용 방법

  1. 설치 명령을 복사하고 자신의 에이전트 환경에 설치하기 전에 소스 패키지를 확인하세요.
  2. 필요한 도구, 인증 정보, 지원 환경은 원본 문서에서 확인하세요.
  3. 입력과 원하는 산출물을 설명하고 출처와 결과를 대조하세요.
npx skills add https://github.com/yonatankarp/software-design-skills --skill arch-strangler-fig

시작 전 확인

  • 설치에는 모델 구독, API 한도, 파일 접근 권한이 포함되지 않습니다.
  • 별점 수와 설치 수는 활동 지표이며 독립적인 품질·보안 검증이 아닙니다.
원본 Skill 문서

원본 저장소의 제목, 예시, 코드, 표, 링크, 이미지를 유지해 표시합니다.

One-line summary

Wrap the legacy system in a facade. Route new functionality and gradually-rewritten existing functionality to new services behind that facade. When all functionality has migrated, the legacy system has been "strangled" and can be retired.

When to use this skill

  • Migrating a monolith to microservices over months or years.
  • Replacing a legacy system that's too critical to take offline for a rewrite.
  • Decomposing a system whose internals are poorly understood — you migrate one behaviour at a time and rebuild understanding as you go.
  • Any time someone proposes a "big bang rewrite". This is the safer alternative.

When NOT to use this skill

  • The legacy system is small enough that a direct rewrite is genuinely shorter and lower risk.
  • Functionality is so tangled that no clean facade can be drawn — first invest in a refactor that exposes seams.
  • Strangulation is being used as cover for an indefinite migration that nobody intends to finish — the legacy never goes away.

Core content

The discipline:

  1. Pick a seam. Identify a piece of functionality that can be intercepted at a clear boundary (HTTP endpoint, message handler, scheduled job).
  2. Build the facade. A proxy / gateway / dispatcher routes traffic for that functionality. Initially, all traffic goes to the legacy.
  3. Build the replacement. A new service implements the same external contract for that functionality.
  4. Switch a percentage. Route 1% / 10% / 100% to the new service. Compare outputs (shadow traffic, parallel run).
  5. Decommission. Once all traffic is on the new service for that functionality, delete the legacy code path.
  6. Repeat. Move to the next piece of functionality.

Pairs with Anticorruption Layer (ACL). The legacy system's model is almost always different from the new service's. The ACL translates between them so the new service doesn't inherit the legacy's data shapes or vocabulary. See ddd-context-mapping for the ACL pattern.

Crucial: each migration step must be releasable independently. If a migration step requires "rewrite for 6 months, then switch", you've built a parallel system, not a strangler. Real strangulation ships small migrated slices weekly.

Common facade implementations.

  • API gateway (Kong, Istio, custom proxy) routes by path / header.
  • Database view that abstracts whether reads come from the old or new store.
  • Event bridge for event-shaped systems — old and new services consume the same events, route on a feature flag.
  • Custom dispatcher in code for embedded legacy (a coordinator class that decides "old or new path").

Schemas during migration. The new service typically owns its data. The legacy still has the canonical store. Strategies:

  • Read-from-legacy, write-to-both. The new service reads from the legacy for now; writes go to both stores. Once the new store is canonical, flip the read direction.
  • Replicate from legacy to new. Change data capture (CDC) pushes legacy changes into the new store. New service reads only from the new store.

Decision heuristics

  • Always start by picking the simplest functional slice — proves the migration mechanism works without committing to the riskiest bits first.
  • Parallel-run new and old for a window before cutting over. Compare results; investigate divergences.
  • Have a written kill-the-legacy date and milestone plan. Without it, the migration runs forever and you maintain both systems for 5 years.
  • Decommissioning is part of the work, not an afterthought. Until the legacy code is deleted, the migration isn't done.

Anti-patterns

  • Big-bang rewrite disguised as strangulation. "We're using the strangler pattern" but the plan is "rewrite for 18 months in parallel, then switch". That's a rewrite with extra branding.
  • Indefinite strangulation. The new service handles 30% of traffic for years; nobody completes the migration; both systems are maintained forever.
  • Strangling without an ACL. The new service inherits the legacy's data shapes verbatim. The legacy's bad design propagates into the replacement.
  • Slicing by technical layer. Migrating "the database" or "the API" without migrating coherent functionality — produces a half-migrated mess.

See also

  • ddd-context-mapping — Anticorruption Layer is the canonical companion pattern.
  • arch-microservices — strangulation is the standard path from monolith to microservices.
  • arch-event-driven — bridges between old and new often happen via events.
  • arch-fitness-functions — automate "is the legacy code path actually used" checks.

References

  • Martin Fowler, "StranglerFigApplication" (2004 essay) — original articulation.
  • Sam Newman, Monolith to Microservices (O'Reilly) — full chapter on strangler-pattern migrations.

관련 작업

같은 저장소의 Skills

더 많은 Skills

모든 Skills
yonatankarp
커뮤니티

arch-adr

Use when recording an architectural decision so future maintainers know why — phrases like "ADR", "architecture decision record", "why did we pick X", "lightweight architecture documentation", "decision log", "should this be an ADR", "tribal knowledge", "we chose this two years ago and now nobody remembers why". Defines the ADR as a short, structured document capturing what was decided, why, alternatives considered, and consequences — written at the time of the decision and kept in the repo.

설치 수
2
GitHub Stars
1
업데이트
5월 19일
yonatankarp
커뮤니티

arch-fitness-functions

Use when enforcing architectural characteristics through automation — phrases like "architecture fitness function", "evolutionary architecture", "architecture tests", "ArchUnit", "dependency rules in CI", "automated architecture checks", "guardrails", "drift detection". Defines fitness functions as automated checks that verify architectural characteristics on every change, catching drift before it accumulates.

설치 수
2
GitHub Stars
1
업데이트
5월 19일
yonatankarp
커뮤니티

arch-microservices

Use when designing or reviewing a microservices architecture — phrases like "microservices", "should we split this service", "service boundaries", "bounded context per service", "API gateway", "backend for frontend", "BFF", "service mesh", "microservices vs monolith", "database per service", "data ownership". Defines microservices as independently deployable services aligned with business capabilities — and the discipline of resisting the style until the monolith proves inadequate.

설치 수
2
GitHub Stars
1
업데이트
5월 19일
yonatankarp
커뮤니티

ddd-aggregate

Use when designing or critiquing aggregate boundaries — phrases like "aggregate", "aggregate root", "should these be one entity or two", "consistency boundary", "transactional consistency", "this aggregate is huge", "should I reference by ID or by object". Defines aggregates as transactional consistency boundaries and the rules for entity references within and across them.

설치 수
2
GitHub Stars
1
업데이트
5월 19일