Migration architect

From LeoYeAI/openclaw-master-skills · View interactive version

Migration architect is an AI agent skill from the GitHub repository LeoYeAI/openclaw-master-skills. Migration Architect

How to use this skill

Skill file

Migration Architect

Tier: POWERFUL

Category: Engineering - Migration Strategy

Purpose: Zero-downtime migration planning, compatibility validation, and rollback strategy generation

Overview

The Migration Architect skill provides comprehensive tools and methodologies for planning, executing, and validating complex system migrations with minimal business impact. This skill combines proven migration patterns with automated planning tools to ensure successful transitions between systems, databases, and infrastructure.

Core Capabilities

1. Migration Strategy Planning

2. Compatibility Analysis

3. Rollback Strategy Generation

Migration Patterns

Database Migrations

Schema Evolution Patterns
  1. Expand-Contract Pattern
  1. Parallel Schema Pattern
  1. Event Sourcing Migration
Data Migration Strategies
  1. Bulk Data Migration
  1. Dual-Write Pattern
  1. Change Data Capture (CDC)

Service Migrations

Strangler Fig Pattern
  1. Intercept Requests: Route traffic through proxy/gateway
  2. Gradually Replace: Implement new service functionality incrementally
  3. Legacy Retirement: Remove old service components as new ones prove stable
  4. Monitoring: Track performance and error rates throughout transition
graph TD
    A[Client Requests] --> B[API Gateway]
    B --> C{Route Decision}
    C -->|Legacy Path| D[Legacy Service]
    C -->|New Path| E[New Service]
    D --> F[Legacy Database]
    E --> G[New Database]
Parallel Run Pattern
  1. Dual Execution: Run both old and new services simultaneously
  2. Shadow Traffic: Route production traffic to both systems
  3. Result Comparison: Compare outputs to validate correctness
  4. Gradual Cutover: Shift traffic percentage based on confidence
Canary Deployment Pattern
  1. Limited Rollout: Deploy new service to small percentage of users
  2. Monitoring: Track key metrics (latency, errors, business KPIs)
  3. Gradual Increase: Increase traffic percentage as confidence grows
  4. Full Rollout: Complete migration once validation passes

Infrastructure Migrations

Cloud-to-Cloud Migration
  1. Assessment Phase
  1. Pilot Migration
  1. Production Migration
On-Premises to Cloud Migration
  1. Lift and Shift
  1. Re-architecture
  1. Hybrid Approach

Feature Flags for Migrations

Progressive Feature Rollout

# Example feature flag implementation
class MigrationFeatureFlag:
    def __init__(self, flag_name, rollout_percentage=0):
        self.flag_name = flag_name
        self.rollout_percentage = rollout_percentage
    
    def is_enabled_for_user(self, user_id):
        hash_value = hash(f"{self.flag_name}:{user_id}")
        return (hash_value % 100) < self.rollout_percentage
    
    def gradual_rollout(self, target_percentage, step_size=10):
        while self.rollout_percentage < target_percentage:
            self.rollout_percentage = min(
                self.rollout_percentage + step_size,
                target_percentage
            )
            yield self.rollout_percentage

Circuit Breaker Pattern

Implement automatic fallback to legacy systems when new systems show degraded performance:

class MigrationCircuitBreaker:
    def __init__(self, failure_threshold=5, timeout=60):
        self.failure_count = 0
        self.failure_threshold = failure_threshold
        self.timeout = timeout
        self.last_failure_time = None
        self.state = 'CLOSED'  # CLOSED, OPEN, HALF_OPEN
    
    def call_new_service(self, request):
        if self.state == 'OPEN':
            if self.should_attempt_reset():
                self.state = 'HALF_OPEN'
            else:
                return self.fallback_to_legacy(request)
        
        try:
            response = self.new_service.process(request)
            self.on_success()
            return response
        except Exception as e:
            self.on_failure()
            return self.fallback_to_legacy(request)

Data Validation and Reconciliation

Validation Strategies

  1. Row Count Validation
  1. Checksums and Hashing
  1. Business Logic Validation

Reconciliation Patterns

  1. Delta Detection

```sql

-- Example delta query for reconciliation

SELECT 'missing_in_target' as issue_type, source_id

FROM source_table s

WHERE NOT EXISTS (

SELECT 1 FROM target_table t

WHERE t.id = s.id

)

UNION ALL

SELECT 'extra_in_target' as issue_type, target_id

FROM target_table t

WHERE NOT EXISTS (

SELECT 1 FROM source_table s

WHERE s.id = t.id

);

```

  1. Automated Correction

Rollback Strategies

Database Rollback

  1. Schema Rollback
  1. Data Rollback

Service Rollback

  1. Blue-Green Deployment
  1. Rolling Rollback

Infrastructure Rollback

  1. Infrastructure as Code
  1. Data Persistence

Risk Assessment Framework

Risk Categories

  1. Technical Risks
  1. Business Risks
  1. Operational Risks

Risk Mitigation Strategies

  1. Technical Mitigations
  1. Business Mitigations
  1. Operational Mitigations

Migration Runbooks

Pre-Migration Checklist

During Migration

Post-Migration

Communication Templates

Executive Summary Template

Migration Status: [IN_PROGRESS | COMPLETED | ROLLED_BACK]
Start Time: [YYYY-MM-DD HH:MM UTC]
Current Phase: [X of Y]
Overall Progress: [X%]

Key Metrics:
- System Availability: [X.XX%]
- Data Migration Progress: [X.XX%]
- Performance Impact: [+/-X%]
- Issues Encountered: [X]

Next Steps:
1. [Action item 1]
2. [Action item 2]

Risk Assessment: [LOW | MEDIUM | HIGH]
Rollback Status: [AVAILABLE | NOT_AVAILABLE]

Technical Team Update Template

Phase: [Phase Name] - [Status]
Duration: [Started] - [Expected End]

Completed Tasks:
✓ [Task 1]
✓ [Task 2]

In Progress:
🔄 [Task 3] - [X% complete]

Upcoming:
⏳ [Task 4] - [Expected start time]

Issues:
⚠️ [Issue description] - [Severity] - [ETA resolution]

Metrics:
- Migration Rate: [X records/minute]
- Error Rate: [X.XX%]
- System Load: [CPU/Memory/Disk]

Success Metrics

Technical Metrics

Business Metrics

Operational Metrics

Tools and Technologies

Migration Planning Tools

Validation Tools

Monitoring and Alerting

Best Practices

Planning Phase

  1. Start with Risk Assessment: Identify all potential failure modes before planning
  2. Design for Rollback: Every migration step should have a tested rollback procedure
  3. Validate in Staging: Execute full migration process in production-like environment
  4. Plan for Gradual Rollout: Use feature flags and traffic routing for controlled migration

Execution Phase

  1. Monitor Continuously: Track both technical and business metrics throughout
  2. Communicate Proactively: Keep all stakeholders informed of progress and issues
  3. Document Everything: Maintain detailed logs for post-migration analysis
  4. Stay Flexible: Be prepared to adjust timeline based on real-world performance

Validation Phase

  1. Automate Validation: Use automated tools for data consistency and performance checks
  2. Business Logic Testing: Validate critical business processes end-to-end
  3. Load Testing: Verify system performance under expected production load
  4. Security Validation: Ensure security controls function properly in new environment

Integration with Development Lifecycle

CI/CD Integration

# Example migration pipeline stage
migration_validation:
  stage: test
  script:
    - python scripts/compatibility_checker.py --before=old_schema.json --after=new_schema.json
    - python scripts/migration_planner.py --config=migration_config.json --validate
  artifacts:
    reports:
      - compatibility_report.json
      - migration_plan.json

Infrastructure as Code

# Example Terraform for blue-green infrastructure
resource "aws_instance" "blue_environment" {
  count = var.migration_phase == "preparation" ? var.instance_count : 0
  # Blue environment configuration
}

resource "aws_instance" "green_environment" {
  count = var.migration_phase == "execution" ? var.instance_count : 0
  # Green environment configuration
}

This Migration Architect skill provides a comprehensive framework for planning, executing, and validating complex system migrations while minimizing business impact and technical risk. The combination of automated tools, proven patterns, and detailed procedures enables organizations to confidently undertake even the most complex migration projects.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.