Automatically migrate Python web applications between frameworks (Flask → FastAPI, Django → FastAPI). Use when you need to migrate an existing web application to a modern framework while preserving functionality. The skill analyzes the codebase, updates routes, handlers, configuration, dependency injection patterns, and tests. Creates git commits for each migration phase and generates a comprehensive summary of all changes. Supports automatic dependency updates, code transformations, and test adaptations.
npx skills add https://github.com/ArabelaTso/Skills-4-SE --skill framework-migration-assistant
This skill automatically migrates Python web applications between frameworks, transforming code, configuration, and tests while preserving existing functionality. It handles route migration, request/response patterns, dependency injection, configuration updates, and test adaptations, committing changes incrementally with detailed summaries.
# Navigate to your repository
cd /path/to/your/repo
# Run migration
python scripts/migrate.py . --from flask --to fastapi
The migration process will:
# Migrate Flask app to FastAPI
python scripts/migrate.py /path/to/flask-app --from flask --to fastapi
# Output:
# ✓ Created migration branch: migrate-flask-to-fastapi
# ✓ Analyzing codebase...
# ✓ Found 15 route files
# ✓ Found 23 test files
# ✓ Migrating dependencies...
# ✓ Migrating routes...
# ✓ Migrating configuration...
# ✓ Migrating tests...
# ✓ Migration completed successfully!
What gets migrated:
@app.route() → @app.get(), @app.post(), etc.request.args → query parameters, request.json → Pydantic modelsjsonify() → direct returnExample transformation:
Before (Flask):
@app.route('/users/<int:user_id>', methods=['GET'])
def get_user(user_id):
user = db.get_user(user_id)
return jsonify(user)
After (FastAPI):
@app.get('/users/{user_id}')
async def get_user(user_id: int) -> UserSchema:
user = await db.get_user(user_id)
return user
What gets migrated:
The migration tool automatically:
Updates package dependencies:
requirements.txtpyproject.tomlExample changes:
flask>=2.0.0 → fastapi>=0.104.0
werkzeug>=2.0.0 → uvicorn[standard]>=0.24.0
flask-cors>=3.0.0 → fastapi-cors>=0.0.6
Transforms route definitions and handlers:
Updates configuration files:
Adapts test files:
Creates a comprehensive report:
MIGRATION_SUMMARY.jsonpython scripts/migrate.py <repo_path> --from <source> --to <target>
# Options:
# repo_path: Path to the repository
# --from: Source framework (flask, django, or auto)
# --to: Target framework (fastapi)
You can also run individual migration steps:
from migrate_dependencies import DependencyMigrator
from migrate_routes import RouteMigrator
from migrate_config import ConfigMigrator
from migrate_tests import TestMigrator
# Run specific migration
migrator = RouteMigrator(repo_path, 'flask', 'fastapi')
migrator.migrate()
After migration completes:
git log --oneline
git diff main..migrate-flask-to-fastapi
pip install -r requirements.txt
pytest
uvicorn main:app --reload
git checkout main
git merge migrate-flask-to-fastapi
references/framework_comparison.md - Detailed comparison of Flask, Django, and FastAPI including architecture, routing, request handling, and performancereferences/migration_guide.md - Comprehensive migration guide with step-by-step instructions, common patterns, troubleshooting, and post-migration checklistreferences/migration_patterns.md - Common migration patterns for routes, requests, responses, authentication, database operations, and testingExample applications are provided in assets/:
example_flask_app.py - Flask application before migrationexample_fastapi_app.py - Same application after migration to FastAPICompare these files to understand the transformations applied.
After migration, review MIGRATION_SUMMARY.json:
{
"source_framework": "flask",
"target_framework": "fastapi",
"total_changes": 47,
"changes_by_type": {
"dependency": 5,
"route": 15,
"config": 4,
"test": 23
},
"files_modified": [...],
"next_steps": [...]
}
Issue: Import errors after migration
pip install -r requirements.txtIssue: Tests fail with async errors
@pytest.mark.asyncio and install pytest-asyncioIssue: Database connections fail
Issue: CORS errors
See references/migration_guide.md for detailed troubleshooting.
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).
Automatically creates user-facing changelogs from git commits by analyzing commit history, categorizing changes, and transforming technical commits into clear, customer-friendly release notes. Turns hours of manual changelog writing into minutes of automated generation.
Use when implementation is complete, all tests pass, and you need to decide how to integrate the work - guides completion of development work by presenting structured options for merge, PR, or cleanup
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).
React Native and Expo best practices for building performant mobile apps. Use when building React Native components, optimizing list performance, implementing animations, or working with native modules. Triggers on tasks involving React Native, Expo, mobile performance, or native platform APIs.
React and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React/Next.js code to ensure optimal performance patterns. Triggers on tasks involving React components, Next.js pages, data fetching, bundle optimization, or performance improvements.
Next.js best practices - file conventions, RSC boundaries, data patterns, async APIs, metadata, error handling, route handlers, image/font optimization, bundling
Use when starting feature work that needs isolation from current workspace or before executing implementation plans - creates isolated git worktrees with smart directory selection and safety verification
Take arabelatso/framework-migration-assistant from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.
The instructions reference pip.
Without those the skill loads but fails at the first command.