원클릭으로
code-migrator
Migrate legacy code to modern frameworks, languages, and patterns with automated refactoring and testing
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Migrate legacy code to modern frameworks, languages, and patterns with automated refactoring and testing
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Analyze and optimize code performance, identify bottlenecks, and suggest improvements
Automated deployment orchestration with rollback, blue-green, and canary deployment strategies
Manage development environments, configurations, and secrets across local, staging, and production
Technical documentation specialist - create docs, API references, user guides for technical and non-technical audiences
Backend architecture agent for API design, database schema, and microservices
Data engineering agent for ETL pipelines, data warehousing, and analytics
| name | code-migrator |
| description | Migrate legacy code to modern frameworks, languages, and patterns with automated refactoring and testing |
| allowed-tools | ["Read","Write","Edit","Glob","Grep","Bash","Task"] |
| version | 1.0.0 |
| author | GLINCKER Team |
| license | Apache-2.0 |
| keywords | ["migration","modernization","refactoring","legacy-code","framework-upgrade","language-translation"] |
⚡ UNIQUE FEATURE: Automated legacy code modernization with AI-powered migration paths, dependency resolution, test generation, and risk analysis. Migrate between languages, frameworks, or architectural patterns with confidence.
Intelligently migrates codebases with minimal manual intervention:
First migration skill with:
Identify Migration Type:
Ask user:
- What are you migrating FROM?
- What are you migrating TO?
- Full codebase or specific modules?
- Any constraints or requirements?
Analyze Current State:
# Discover project structure
Use Glob to find all source files
Use Grep to identify:
- Framework versions
- Import patterns
- Deprecated APIs
- Code smells
Generate Migration Plan:
# Migration Plan: Python 2 → Python 3
## Scope
- Files to migrate: 247
- Estimated effort: 2-3 days
- Risk level: Medium
## Changes Required
### High Priority (Breaking Changes)
1. Print statements → print() function (187 occurrences)
2. Unicode strings (u'') → default strings (423 occurrences)
3. Dict.iteritems() → Dict.items() (89 occurrences)
### Medium Priority (Deprecated APIs)
1. urllib → urllib.request (34 occurrences)
2. ConfigParser → configparser (12 occurrences)
### Low Priority (Best Practices)
1. Old-style classes → new-style classes
2. % formatting → f-strings
## Dependencies to Update
- Django 1.11 → Django 4.2
- requests 2.9 → requests 2.31
- pytest 3.0 → pytest 7.4
## Migration Strategy
- Phase 1: Update dependencies (safe, reversible)
- Phase 2: Automated syntax fixes (safe)
- Phase 3: Manual code review (requires attention)
- Phase 4: Test and validate
## Risk Assessment
- **Critical**: Database migrations (manual review needed)
- **High**: Third-party API calls (may have changed)
- **Medium**: String encoding (test thoroughly)
- **Low**: Print statements (auto-fixable)
Create Migration Branch:
git checkout -b migrate-to-python3
Backup Current State:
# Create backup
git tag pre-migration-backup
Execute Migration (module by module):
For each file/module:
a. Read current code:
Use Read to load file contents
b. Apply transformations:
# Example: Python 2 → 3 print statements
# Before
print "Hello, World!"
# After
print("Hello, World!")
# Example: Unicode strings
# Before
u"Hello, 世界"
# After
"Hello, 世界"
# Example: Dict iteration
# Before
for key, value in my_dict.iteritems():
# After
for key, value in my_dict.items():
c. Update imports:
# Before
import urllib
import ConfigParser
# After
import urllib.request
import configparser
d. Modernize patterns:
# Before: Old-style formatting
"Hello, %s!" % name
# After: f-strings
f"Hello, {name}!"
# Before: Manual file handling
f = open('file.txt')
content = f.read()
f.close()
# After: Context manager
with open('file.txt') as f:
content = f.read()
Use Edit tool to apply changes:
For each transformation:
- Use Edit with old_string/new_string
- Preserve formatting and style
- Add comments where behavior changes
Update package manager files:
# requirements.txt migration
# Before
Django==1.11.29
requests==2.9.1
# After
Django==4.2.0
requests==2.31.0
// package.json migration
// Before
{
"dependencies": {
"react": "^16.8.0"
}
}
// After
{
"dependencies": {
"react": "^18.2.0"
}
}
Install new dependencies:
pip install -r requirements.txt
# or
npm install
Generate Migration Tests:
# Use Task to launch test-generator agent
Task: "Generate tests that verify migration correctness"
For each migrated function:
- Create test with Python 2/3 compatible inputs
- Verify output is identical
- Test edge cases
Run Existing Tests:
# Run original test suite
pytest tests/
# Report:
- Tests passing: 247/250
- Tests failing: 3
- New errors: 0
Run Migration Validation:
# Custom validation checks
- Import validation
- Syntax check (python -m py_compile)
- Linting (flake8, pylint)
- Type checking (mypy for Python, tsc for TypeScript)
For high-risk changes:
## Manual Review Required
### File: api/payments.py (Lines 45-67)
**Risk**: HIGH
**Reason**: External API call with changed response format
```python
# Original (Python 2)
response = urllib.urlopen(url)
data = json.loads(response.read())
# Migrated (Python 3)
response = urllib.request.urlopen(url)
data = json.loads(response.read().decode('utf-8'))
Action needed: Verify API still returns same data structure
Risk: CRITICAL Reason: Database model migration
Action needed: Create and review Django migration files
### Phase 6: Documentation & Rollback Plan
1. **Generate Migration Report**:
```markdown
# Migration Report: Python 2 → Python 3
**Date**: 2025-01-13
**Duration**: 3.2 hours
**Status**: ✅ Complete (3 items need manual review)
## Statistics
- Files modified: 247
- Lines changed: 1,834
- Dependencies updated: 12
- Tests updated: 45
- New tests added: 18
## Breaking Changes
1. Unicode handling in API responses
2. Dictionary iteration in processors
3. Print output in CLI tools
## Rollback Instructions
```bash
git checkout pre-migration-backup
2. **Create Migration Documentation**:
- What changed and why
- How to use new patterns
- Common gotchas
- Troubleshooting guide
## Example Migrations
### Example 1: React Class → Hooks
**User**: "Migrate this component to hooks"
**Input**:
```javascript
class UserProfile extends React.Component {
constructor(props) {
super(props);
this.state = { user: null, loading: true };
}
componentDidMount() {
fetchUser(this.props.userId)
.then(user => this.setState({ user, loading: false }));
}
render() {
const { user, loading } = this.state;
if (loading) return <div>Loading...</div>;
return <div>{user.name}</div>;
}
}
Output:
import { useState, useEffect } from 'react';
function UserProfile({ userId }) {
const [user, setUser] = useState(null);
const [loading, setLoading] = useState(true);
useEffect(() => {
fetchUser(userId)
.then(user => {
setUser(user);
setLoading(false);
});
}, [userId]);
if (loading) return <div>Loading...</div>;
return <div>{user.name}</div>;
}
Before:
function processUser(userId, callback) {
getUser(userId, (err, user) => {
if (err) return callback(err);
getOrders(user.id, (err, orders) => {
if (err) return callback(err);
calculateTotal(orders, (err, total) => {
if (err) return callback(err);
callback(null, { user, total });
});
});
});
}
After:
async function processUser(userId) {
const user = await getUser(userId);
const orders = await getOrders(user.id);
const total = await calculateTotal(orders);
return { user, total };
}
.code-migrator-config.yml:
migration:
backup_enabled: true
incremental: true
generate_tests: true
risk_threshold: medium # Require manual review for high/critical
patterns:
# Custom pattern replacements
- from: "old_api_call"
to: "new_api_call"
risk: high
exclusions:
# Files to skip
- "vendor/*"
- "node_modules/*"
- "*.min.js"
validation:
run_tests: true
run_linters: true
type_check: true
Help add migration paths:
Apache License 2.0 - See LICENSE
GLINCKER Team
🌟 The most comprehensive code migration skill available - save weeks of manual work!