strangler-fig-patterns

Detailed implementation guide for the Strangler Fig pattern and related migration patterns for incrementally replacing legacy systems. Use this skill for 'strangler fig', 'incremental migration', 'refactoring patterns', 'branch by abstraction', 'parallel run', 'gradual replacement', 'migration pattern selection', and other legacy migration pattern applications. Enhances pattern selection and implementation for refactoring-strategist and migration-engineer. Note: full team orchestration and project management are outside the scope of this skill.

495 stars

Best use case

strangler-fig-patterns is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Detailed implementation guide for the Strangler Fig pattern and related migration patterns for incrementally replacing legacy systems. Use this skill for 'strangler fig', 'incremental migration', 'refactoring patterns', 'branch by abstraction', 'parallel run', 'gradual replacement', 'migration pattern selection', and other legacy migration pattern applications. Enhances pattern selection and implementation for refactoring-strategist and migration-engineer. Note: full team orchestration and project management are outside the scope of this skill.

Teams using strangler-fig-patterns should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/strangler-fig-patterns/SKILL.md --create-dirs "https://raw.githubusercontent.com/revfactory/harness-100/main/en/22-legacy-modernizer/.claude/skills/strangler-fig-patterns/skill.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/strangler-fig-patterns/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How strangler-fig-patterns Compares

Feature / Agentstrangler-fig-patternsStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Detailed implementation guide for the Strangler Fig pattern and related migration patterns for incrementally replacing legacy systems. Use this skill for 'strangler fig', 'incremental migration', 'refactoring patterns', 'branch by abstraction', 'parallel run', 'gradual replacement', 'migration pattern selection', and other legacy migration pattern applications. Enhances pattern selection and implementation for refactoring-strategist and migration-engineer. Note: full team orchestration and project management are outside the scope of this skill.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# Strangler Fig Patterns — Incremental Migration Pattern Guide

Detailed implementation methodologies for proven patterns for replacing legacy systems.

## Pattern Catalog

### 1. Strangler Fig Pattern

**Applicable Conditions**: When incremental transition from a monolith to a new system is needed

```
+---------------------------------------------+
|              Router/Proxy                    |
|  +----------+    +----------------------+   |
|  | Legacy   | <-> | New System          |   |
|  | (shrink- |    | (expanding)          |   |
|  |  ing)    |    |                      |   |
|  +----------+    +----------------------+   |
+---------------------------------------------+
```

**Implementation Steps:**

| Step | Task | Verification Criteria | Rollback Method |
|------|------|----------------------|-----------------|
| 1. Insert Interceptor | Add router/proxy layer | Confirm 100% existing traffic routes through legacy | Remove interceptor |
| 2. Extract by Feature | Start with most independent feature into new service | Verify identical input/output (Shadow Test) | Restore routing |
| 3. Traffic Migration | Canary -> gradual percentage increase | Error rate, latency, business metrics | Revert to 0% |
| 4. Legacy Removal | Delete fully migrated code | Confirm 100% migration complete | N/A |

**Extraction Priority Matrix:**

```
High Business Value
       |
  (3) Quick | (1) Top Priority
    Wins    |  Extraction Targets
  ----------+-----------> Low Coupling
  (4) Defer | (2) Gradual
    Hold    |  Decouple then Extract
       |
Low Business Value
```

### 2. Branch by Abstraction

**Applicable Conditions**: When replacing internal components (within the same codebase)

```python
# Step 1: Insert abstraction layer
class PaymentGateway(ABC):
    @abstractmethod
    def process(self, amount: Decimal) -> PaymentResult: ...

# Step 2: Wrap legacy implementation
class LegacyPayment(PaymentGateway):
    def process(self, amount):
        return self.old_system.charge(amount)

# Step 3: New implementation
class ModernPayment(PaymentGateway):
    def process(self, amount):
        return self.stripe_client.create_charge(amount)

# Step 4: Switch via feature flag
gateway = ModernPayment() if feature_flag('new_payment') else LegacyPayment()
```

### 3. Parallel Run (Scientist Pattern)

**Applicable Conditions**: When verifying the accuracy of a new system before replacement

```python
class Experiment:
    def run(self, input_data):
        control_result = self.legacy.execute(input_data)
        try:
            candidate_result = self.modern.execute(input_data)
            if not self.compare(control_result, candidate_result):
                self.report_mismatch(input_data, control_result, candidate_result)
        except Exception as e:
            self.report_error(input_data, e)
        return control_result  # Always return legacy result
```

**Comparison Strategies:**

| Comparison Level | Method | Tolerance |
|-----------------|--------|-----------|
| Exact match | `==` | 0% difference |
| Structural match | Schema comparison | Field presence/type match |
| Semantic match | Business rule-based | Domain-specific tolerance |
| Statistical match | Aggregate/distribution comparison | >= 99.9% match rate |

### 4. Anti-Corruption Layer (ACL)

**Applicable Conditions**: When legacy and new systems must coexist, preventing domain contamination

**ACL Components:**

| Component | Role | Implementation |
|-----------|------|---------------|
| Translator | Domain model conversion | DTO <-> Domain Object mapping |
| Adapter | Interface conversion | Legacy API -> Modern interface |
| Facade | Complexity hiding | Multiple legacy calls -> single method |

### 5. Feature Toggle Strategy

```yaml
toggles:
  # Phase 1: Dev team only
  new_user_service: { type: permission, users: ["dev-team"] }
  # Phase 2: Canary (10%)
  new_user_service: { type: gradual-rollout, percentage: 10, sticky: true }
  # Phase 3: Full rollout
  new_user_service: { type: release, enabled: true }
  # Phase 4: Remove toggle (delete legacy code)
```

## Pattern Selection Decision Tree

```
Is legacy replacement needed?
+-- External system/service replacement -> Strangler Fig
+-- Internal component replacement
|   +-- Pre-replacement verification needed -> Parallel Run + Branch by Abstraction
|   +-- Confident in replacement -> Branch by Abstraction
+-- Long-term legacy-new coexistence -> Anti-Corruption Layer
+-- All cases -> Feature Toggle recommended in combination
```

## Warning Signs and Responses

| Warning Sign | Meaning | Response |
|-------------|---------|----------|
| Module to extract has 10+ dependencies | Excessive coupling | Insert ACL then incrementally resolve dependencies |
| Parallel Run mismatch rate > 5% | Excessive behavioral differences | Re-verify business rules, collect edge cases |
| > 20 toggles active simultaneously | Toggle debt | Introduce regular toggle cleanup sprints |
| Migration ongoing for 6+ months | Increasing parallel operation costs | Reduce scope or consider partial Big Bang |

Related Skills

risk-response-patterns

495
from revfactory/harness-100

risk response strategy pattern library. response-strategist and monitoring-planner agent risk response plan establishto do when reference. 'risk response', 'mitigation strategy', 'response plan' request when usage. However, insurance design legal risk specialistdocument scope outside.

rhetoric-patterns

495
from revfactory/harness-100

numbercompany pattern library. speech-writer and debate-preparer agent persuasioncapability speech and buildingto do when reference. 'numbercompany', ' structure', 'persuasion technique' request when usage. However, actual presentation nature training scope outside.

kpi-dashboard-patterns

495
from revfactory/harness-100

KPI dashboard design pattern. analyst agent core indicator analysisand executive-summarizer management reporting dashboard compositionto do when reference. 'KPI analysis', 'dashboard design', ' indicator' request when usage. However, actualtime BI whensystem building scope outside.

diagram-patterns

495
from revfactory/harness-100

Mermaid diagram pattern library. diagram-maker agent technical document diagram writingto do when reference verifydone pattern . 'diagram pattern', 'Mermaid template', ' diagram pattern' request when usage. However, actual un-degree specialistperson tool work scope outside.

code-example-patterns

495
from revfactory/harness-100

technical document code example pattern library. doc-writer agent code example, writingto do when reference. 'code example pattern', ' code writing' request when usage. However, actual code file test execution scope outside.

claim-drafting-patterns

495
from revfactory/harness-100

Strategic drafting patterns and claim scope design guide for patent claims. The 'claim-drafter' and 'patent-reviewer' agents must use this skill's drafting patterns, terminology rules, and dependent claim strategies when writing or verifying claims. Used for 'claim drafting', 'claim scope design', 'dependent claim strategy', etc. Note: Overall patent orchestration or prior art search is outside the scope of this skill.

sdk-design-patterns

495
from revfactory/harness-100

SDK/API client design patterns: builder pattern, interceptor chain, retry strategy, type-safe design, error handling, and pagination wrapper guide. Use this skill for requests involving 'SDK design', 'client patterns', 'retry strategy', 'interceptor', 'builder pattern', 'SDK error handling', 'type safety', 'SDK architecture', etc. Enhances sdk-developer's SDK design capabilities. Note: API spec parsing, test authoring, and documentation are outside the scope of this skill.

openapi-spec-patterns

495
from revfactory/harness-100

OpenAPI 3.x spec analysis patterns, schema normalization, authentication method mapping, pagination/error pattern extraction, and GraphQL/gRPC spec interpretation guide. Use this skill for requests involving 'OpenAPI', 'Swagger', 'spec analysis', 'schema normalization', 'API authentication', 'pagination patterns', 'GraphQL schema', 'gRPC proto', etc. Enhances spec-parser's spec analysis capabilities. Note: SDK code generation and test authoring are outside the scope of this skill.

data-validation-patterns

495
from revfactory/harness-100

Migration data validation patterns: row count comparison, checksums, sampling validation, FK integrity, and business rule validation query design guide. Use this skill for requests involving 'data validation', 'migration validation', 'checksum', 'row count comparison', 'integrity validation', 'regression testing', 'Go/No-Go checklist', etc. Enhances validation-engineer's validation design capabilities. Note: schema mapping and rollback planning are outside the scope of this skill.

query-optimization-patterns

495
from revfactory/harness-100

SQL/NoSQL query optimization pattern, execution plan analysis, index strategy, N+1 resolution etc. database performance optimization guide. 'query optimization', 'execution plan', 'EXPLAIN', 'index ', 'N+1 ', 'slow query', 'slow query', 'DB performance' etc. database query performance improvement this for. bottleneck-analystand optimization-engineerof DB performance analysis -ize. , before system profilingthis benchmark execution this of scope .

test-design-patterns

495
from revfactory/harness-100

Patterns for effective test design, including boundary value analysis, equivalence partitioning, state transition testing, and other systematic test case derivation methodologies. Use this skill for 'test design', 'test case derivation', 'boundary value analysis', 'equivalence partitioning', 'state transition testing', 'pairwise', 'test matrix', and other test design tasks. Enhances the test design capabilities of test-strategist and unit-tester. Note: test infrastructure setup and CI/CD configuration are outside the scope of this skill.

distributed-patterns

495
from revfactory/harness-100

Implementation guide and selection matrix for core distributed system patterns (Saga, CQRS, Circuit Breaker, Event Sourcing, etc.). Use this skill for 'distributed transactions', 'Saga pattern', 'CQRS', 'circuit breaker', 'event sourcing', 'distributed patterns', 'compensating transactions', 'eventual consistency', and other distributed system pattern applications. Enhances the distributed system design capabilities of communication-designer and service-architect. Note: infrastructure setup and monitoring configuration are outside the scope of this skill.