Orchestrate a comprehensive legacy system modernization using the strangler fig pattern, enabling gradual replacement of outdated components while maintaining continuous business operations through ex
Add this skill
npx mdskills install sickn33/framework-migration-legacy-modernizeComprehensive modernization workflow with structured phases and expert agent orchestration
1---2name: framework-migration-legacy-modernize3description: "Orchestrate a comprehensive legacy system modernization using the strangler fig pattern, enabling gradual replacement of outdated components while maintaining continuous business operations through ex"4---56# Legacy Code Modernization Workflow78Orchestrate a comprehensive legacy system modernization using the strangler fig pattern, enabling gradual replacement of outdated components while maintaining continuous business operations through expert agent coordination.910[Extended thinking: The strangler fig pattern, named after the tropical fig tree that gradually envelops and replaces its host, represents the gold standard for risk-managed legacy modernization. This workflow implements a systematic approach where new functionality gradually replaces legacy components, allowing both systems to coexist during transition. By orchestrating specialized agents for assessment, testing, security, and implementation, we ensure each migration phase is validated before proceeding, minimizing disruption while maximizing modernization velocity.]1112## Use this skill when1314- Working on legacy code modernization workflow tasks or workflows15- Needing guidance, best practices, or checklists for legacy code modernization workflow1617## Do not use this skill when1819- The task is unrelated to legacy code modernization workflow20- You need a different domain or tool outside this scope2122## Instructions2324- Clarify goals, constraints, and required inputs.25- Apply relevant best practices and validate outcomes.26- Provide actionable steps and verification.27- If detailed examples are required, open `resources/implementation-playbook.md`.2829## Phase 1: Legacy Assessment and Risk Analysis3031### 1. Comprehensive Legacy System Analysis32- Use Task tool with subagent_type="legacy-modernizer"33- Prompt: "Analyze the legacy codebase at $ARGUMENTS. Document technical debt inventory including: outdated dependencies, deprecated APIs, security vulnerabilities, performance bottlenecks, and architectural anti-patterns. Generate a modernization readiness report with component complexity scores (1-10), dependency mapping, and database coupling analysis. Identify quick wins vs complex refactoring targets."34- Expected output: Detailed assessment report with risk matrix and modernization priorities3536### 2. Dependency and Integration Mapping37- Use Task tool with subagent_type="architect-review"38- Prompt: "Based on the legacy assessment report, create a comprehensive dependency graph showing: internal module dependencies, external service integrations, shared database schemas, and cross-system data flows. Identify integration points that will require facade patterns or adapter layers during migration. Highlight circular dependencies and tight coupling that need resolution."39- Context from previous: Legacy assessment report, component complexity scores40- Expected output: Visual dependency map and integration point catalog4142### 3. Business Impact and Risk Assessment43- Use Task tool with subagent_type="business-analytics::business-analyst"44- Prompt: "Evaluate business impact of modernizing each component identified. Create risk assessment matrix considering: business criticality (revenue impact), user traffic patterns, data sensitivity, regulatory requirements, and fallback complexity. Prioritize components using a weighted scoring system: (Business Value × 0.4) + (Technical Risk × 0.3) + (Quick Win Potential × 0.3). Define rollback strategies for each component."45- Context from previous: Component inventory, dependency mapping46- Expected output: Prioritized migration roadmap with risk mitigation strategies4748## Phase 2: Test Coverage Establishment4950### 1. Legacy Code Test Coverage Analysis51- Use Task tool with subagent_type="unit-testing::test-automator"52- Prompt: "Analyze existing test coverage for legacy components at $ARGUMENTS. Use coverage tools to identify untested code paths, missing integration tests, and absent end-to-end scenarios. For components with <40% coverage, generate characterization tests that capture current behavior without modifying functionality. Create test harness for safe refactoring."53- Expected output: Test coverage report and characterization test suite5455### 2. Contract Testing Implementation56- Use Task tool with subagent_type="unit-testing::test-automator"57- Prompt: "Implement contract tests for all integration points identified in dependency mapping. Create consumer-driven contracts for APIs, message queue interactions, and database schemas. Set up contract verification in CI/CD pipeline. Generate performance baselines for response times and throughput to validate modernized components maintain SLAs."58- Context from previous: Integration point catalog, existing test coverage59- Expected output: Contract test suite with performance baselines6061### 3. Test Data Management Strategy62- Use Task tool with subagent_type="data-engineering::data-engineer"63- Prompt: "Design test data management strategy for parallel system operation. Create data generation scripts for edge cases, implement data masking for sensitive information, and establish test database refresh procedures. Set up monitoring for data consistency between legacy and modernized components during migration."64- Context from previous: Database schemas, test requirements65- Expected output: Test data pipeline and consistency monitoring6667## Phase 3: Incremental Migration Implementation6869### 1. Strangler Fig Infrastructure Setup70- Use Task tool with subagent_type="backend-development::backend-architect"71- Prompt: "Implement strangler fig infrastructure with API gateway for traffic routing. Configure feature flags for gradual rollout using environment variables or feature management service. Set up proxy layer with request routing rules based on: URL patterns, headers, or user segments. Implement circuit breakers and fallback mechanisms for resilience. Create observability dashboard for dual-system monitoring."72- Expected output: API gateway configuration, feature flag system, monitoring dashboard7374### 2. Component Modernization - First Wave75- Use Task tool with subagent_type="python-development::python-pro" or "golang-pro" (based on target stack)76- Prompt: "Modernize first-wave components (quick wins identified in assessment). For each component: extract business logic from legacy code, implement using modern patterns (dependency injection, SOLID principles), ensure backward compatibility through adapter patterns, maintain data consistency with event sourcing or dual writes. Follow 12-factor app principles. Components to modernize: [list from prioritized roadmap]"77- Context from previous: Characterization tests, contract tests, infrastructure setup78- Expected output: Modernized components with adapters7980### 3. Security Hardening81- Use Task tool with subagent_type="security-scanning::security-auditor"82- Prompt: "Audit modernized components for security vulnerabilities. Implement security improvements including: OAuth 2.0/JWT authentication, role-based access control, input validation and sanitization, SQL injection prevention, XSS protection, and secrets management. Verify OWASP top 10 compliance. Configure security headers and implement rate limiting."83- Context from previous: Modernized component code84- Expected output: Security audit report and hardened components8586## Phase 4: Performance Validation and Optimization8788### 1. Performance Testing and Optimization89- Use Task tool with subagent_type="application-performance::performance-engineer"90- Prompt: "Conduct performance testing comparing legacy vs modernized components. Run load tests simulating production traffic patterns, measure response times, throughput, and resource utilization. Identify performance regressions and optimize: database queries with indexing, caching strategies (Redis/Memcached), connection pooling, and async processing where applicable. Validate against SLA requirements."91- Context from previous: Performance baselines, modernized components92- Expected output: Performance test results and optimization recommendations9394### 2. Progressive Rollout and Monitoring95- Use Task tool with subagent_type="deployment-strategies::deployment-engineer"96- Prompt: "Implement progressive rollout strategy using feature flags. Start with 5% traffic to modernized components, monitor error rates, latency, and business metrics. Define automatic rollback triggers: error rate >1%, latency >2x baseline, or business metric degradation. Create runbook for traffic shifting: 5% → 25% → 50% → 100% with 24-hour observation periods."97- Context from previous: Feature flag configuration, monitoring dashboard98- Expected output: Rollout plan with automated safeguards99100## Phase 5: Migration Completion and Documentation101102### 1. Legacy Component Decommissioning103- Use Task tool with subagent_type="legacy-modernizer"104- Prompt: "Plan safe decommissioning of replaced legacy components. Verify no remaining dependencies through traffic analysis (minimum 30 days at 0% traffic). Archive legacy code with documentation of original functionality. Update CI/CD pipelines to remove legacy builds. Clean up unused database tables and remove deprecated API endpoints. Document any retained legacy components with sunset timeline."105- Context from previous: Traffic routing data, modernization status106- Expected output: Decommissioning checklist and timeline107108### 2. Documentation and Knowledge Transfer109- Use Task tool with subagent_type="documentation-generation::docs-architect"110- Prompt: "Create comprehensive modernization documentation including: architectural diagrams (before/after), API documentation with migration guides, runbooks for dual-system operation, troubleshooting guides for common issues, and lessons learned report. Generate developer onboarding guide for modernized system. Document technical decisions and trade-offs made during migration."111- Context from previous: All migration artifacts and decisions112- Expected output: Complete modernization documentation package113114## Configuration Options115116- **--parallel-systems**: Keep both systems running indefinitely (for gradual migration)117- **--big-bang**: Full cutover after validation (higher risk, faster completion)118- **--by-feature**: Migrate complete features rather than technical components119- **--database-first**: Prioritize database modernization before application layer120- **--api-first**: Modernize API layer while maintaining legacy backend121122## Success Criteria123124- All high-priority components modernized with >80% test coverage125- Zero unplanned downtime during migration126- Performance metrics maintained or improved (P95 latency within 110% of baseline)127- Security vulnerabilities reduced by >90%128- Technical debt score improved by >60%129- Successful operation for 30 days post-migration without rollbacks130- Complete documentation enabling new developer onboarding in <1 week131132Target: $ARGUMENTS133
Full transparency — inspect the skill content before installing.