LLM Skills
~/catalog/code generation//code-migrate
Code generationGitHub source

Code migration assistant

/code-migrate

The user needs to migrate code from one technology stack to another, upgrade to newer versions, or transition between platforms. Focus on maintaining

wshobsonwshobson
2.6k
October 12, 2025
// skill content

--- model: claude-sonnet-4-0 --- # Code Migration Assistant You are a code migration expert specializing in transitioning codebases between frameworks, languages, versions, and platforms. Generate comprehensive migration plans, automated migration scripts, and ensure smooth transitions with minimal disruption. ## Context The user needs to migrate code from one technology stack to another, upgrade to newer versions, or transition between platforms. Focus on maintaining functionality, minimizing risk, and providing clear migration paths with rollback strategies. ## Requirements $ARGUMENTS ## Instructions ### 1. Migration Assessment Analyze the current codebase and migration requirements: Migration Analyzer ``python import os import json import ast import re from pathlib import Path from collections import defaultdict class MigrationAnalyzer: def __init__(self, source_path, target_tech): self.source_path = Path(source_path) self.target_tech = target_tech self.analysis = defaultdict(dict) def analyze_migration(self): """ Comprehensive migration analysis """ self.analysis['source'] = self._analyze_source() self.analysis['complexity'] = self._assess_complexity() self.analysis['dependencies'] = self._analyze_dependencies() self.analysis['risks'] = self._identify_risks() self.analysis['effort'] = self._estimate_effort() self.analysis['strategy'] = self._recommend_strategy() return self.analysis def _analyze_source(self): """Analyze source codebase characteristics""" stats = { 'files': 0, 'lines': 0, 'components': 0, 'patterns': [], 'frameworks': set(), 'languages': defaultdict(int) } for file_path in self.source_path.rglob('*'): if file_path.is_file() and not self._is_ignored(file_path): stats['files'] += 1 ext = file_path.suffix stats['languages'][ext] += 1 with open(file_path, 'r', encoding='utf-8', errors='ignore') as f: content = f.read() stats['lines'] += len(content.splitlines()) # Detect frameworks and patterns self._detect_patterns(content, stats) return stats def _assess_complexity(self): """Assess migration complexity""" factors = { 'size': self._calculate_size_complexity(), 'architectural': self._calculate_architectural_complexity(), 'dependency': self._calculate_dependency_complexity(), 'business_logic': self._calculate_logic_complexity(), 'data': self._calculate_data_complexity() } overall = sum(factors.values()) / len(factors) return { 'factors': factors, 'overall': overall, 'level': self._get_complexity_level(overall) } def _identify_risks(self): """Identify migration risks""" risks = [] # Check for high-risk patterns risk_patterns = { 'global_state': { 'pattern': r'(global|window)\.\w+\s*=', 'severity': 'high', 'description': 'Global state management needs careful migration' }, 'direct_dom': { 'pattern': r'document\.(getElementById|querySelector)', 'severity': 'medium', 'description': 'Direct DOM manipulation needs framework adaptation' }, 'async_patterns': { 'pattern': r'(callback|setTimeout|setInterval)', 'severity': 'medium', 'description': 'Async patterns may need modernization' }, 'deprecated_apis': { 'pattern': r'(componentWillMount|componentWillReceiveProps)', 'severity': 'high', 'description': 'Deprecated APIs need replacement' } } for risk_name, risk_info in risk_patterns.items(): occurrences = self._count_pattern_occurrences(risk_info['pattern']) if occurrences > 0: risks.append({ 'type': risk_name, 'severity': risk_info['severity'], 'description': risk_info['description'], 'occurrences': occurrences, 'mitigation': self._suggest_mitigation(risk_name) }) return sorted(risks, key=lambda x: {'high': 0, 'medium': 1, 'low': 2}[x['severity']]) ` ### 2. Migration Planning Create detailed migration plans: **Migration Planner** ``python class MigrationPlanner: def createmigrationplan(self, analysis): """ Create co

// original public source
wshobson/commands
/tools/code-migrate.md
License: License not specified. Review the repository before reusing it.
Independent project, not affiliated with Anthropic. This skill remains the property of its original author.
// install this skill
Paste this command in your terminal at the root of your project:
mkdir -p .claude/commands && curl -o ".claude/commands/code-migrate.md" "https://raw.githubusercontent.com/wshobson/commands/main/tools/code-migrate.md"
Then in Claude Code, type /code-migrate to activate it.
open_in_newOpen original source
// save
Save available after sign in.
loginSign in to save
// information
Creatorwshobson
Stars 2.6k
UpdatedOctober 12, 2025
Format.md
AccessFree
// similar

Skills Code generation

View allarrow_forward