python-modernization-analyzer
Skill3 starsChanged 3 months agoMITView on GitHub
Analyzes legacy Python codebases and produces actionable modernization plans. Primary migration paths include Python 2 to 3.12+, sync to async, Flask/Django monolith to FastAPI, requirements.txt to pyproject.toml, and bare classes to Pydantic/dataclasses. Does NOT perform the migration — assesses, quantifies risk, and plans.
In this repository86 other files it gives its agents.
- AGENTS.mdAGENTS.md
- project-templates/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- project-templates/CLAUDE.mdCLAUDE.md
- alembic-migration-managerSkill
- architecture-journalSkill
- architecture-reviewSkill
- automated-code-reviewSkill
- axum-scaffolderSkill
- capture-consolidateSkill
- cargo-package-scaffoldSkill
- code-review-coachSkill
- confluence-guide-writerSkill
- dependency-mapperSkill
- doc-syncSkill
- dotnet-architecture-checklistSkill
- dotnet-controller-api-scaffolderSkill
- dotnet-security-reviewSkill
- dotnet-vertical-sliceSkill
- ef-migration-managerSkill
- email-captureSkill
- environment-healthSkill
- evaluate-testsSkill
- fastapi-scaffolderSkill
- fitness-functionsSkill
- jira-comment-writerSkill
- legacy-migration-analyzerSkill
- minimal-api-scaffolderSkill
- nuget-package-scaffoldSkill
- oss-vettingSkill
- pattern-tradeoff-analyzerSkill
- php-api-scaffolderSkill
- php-architecture-checklistSkill
- php-feature-sliceSkill
- php-migration-managerSkill
- php-package-scaffoldSkill
- php-security-reviewSkill
- pr-feedback-writerSkill
- pypi-package-scaffoldSkill
- python-architecture-checklistSkill
- python-feature-sliceSkill
- python-security-reviewSkill
- qraspi-architectureSkill
- qraspi-graduateSkill
- qraspi-implementSkill
- qraspi-planSkill
- qraspi-questionsSkill
- qraspi-researchSkill
- qraspi-skeletonSkill
- qrspi-implementSkill
- qrspi-planSkill
- qrspi-questionsSkill
- qrspi-researchSkill
- qrspi-specSkill
- react-app-scaffolderSkill
- react-architecture-checklistSkill
- react-component-scaffolderSkill
- react-feature-sliceSkill
- react-modernization-analyzerSkill
- react-security-reviewSkill
- The first 60 shown.
The file
Files
Python Modernization Analyzer
"The best time to modernize was five years ago. The second best time is now." -- Adapted from software engineering practice
"Big bang rewrites fail. Incremental migration succeeds." -- Martin Fowler, Refactoring
Core Philosophy
Legacy Python codebases accumulate technical debt in predictable patterns: Python 2 syntax that
2to3 can partially fix, synchronous I/O that blocks under load, monolithic Flask/Django apps that
resist scaling, requirements.txt files with unpinned dependencies, and bare dictionaries where
Pydantic models would provide safety.
This skill assesses, quantifies, and plans — it does NOT perform the migration. The output is a prioritized modernization plan with risk scores, effort estimates, and a recommended migration sequence. The plan is the deliverable; execution is a separate task.
Non-Negotiable Constraints:
- Assess before acting — never recommend a migration path without evidence from the codebase.
- Incremental over big-bang — every recommendation must be achievable in phases, not a single rewrite.
- Preserve business logic unchanged — the goal is modernization, not reimplementation.
- Dependencies are the real blockers — a framework migration blocked by an unmaintained dependency is not viable.
- Every recommendation must cite evidence —
grep -r "from flask"is evidence; "I think this is Flask" is not.
What this skill is NOT: a migration execution tool (it produces a plan, not code); a code-quality
review (use python-architecture-checklist); a security review (use python-security-review).
The 10 domain principles and the knowledge-base lookup queries that ground every decision live in
references/domain-principles.md.
Workflow
Phase 1: SCAN
Inventory the codebase: Python version(s); framework (Flask/Django/FastAPI/bare/none); packaging
(requirements.txt/setup.py/setup.cfg/pyproject.toml); test framework and coverage; async
usage; ORM/database access pattern; deployment method.
Full detection command set (Python 2 markers, framework greps, packaging, coverage, async,
2to3 -l, pyupgrade --dry-run) is in references/scan-commands.md.
Phase 2: ASSESS
Score each migration path by effort, risk, and blocker potential. The migration-path catalog (tool
- assessment method) is in
references/scan-commands.md; scoring dimensions and the full risk table are inreferences/migration-risk-matrix.md.
Phase 3: PLAN
Produce a prioritized, phased plan, each phase leaving the app in a working state: 0. Prerequisites — tests, CI/CD, Docker (if missing)
- Low-risk wins — packaging, type hints, linting
- Framework-independent — Python version upgrade, dependency updates
- Architecture — service layer extraction, ORM adoption
- Framework — Flask/Django → FastAPI (if applicable)
- Async — sync → async migration (if applicable)
- Auth — authentication modernization (last, highest risk)
Phase 4: REPORT
Deliver the plan with evidence, risk scores, and effort estimates. Use the risk scoring table in
references/migration-risk-matrix.md and the deliverable layout in ## Output Template below.
Apply the domain principles throughout (references/domain-principles.md), and follow the AI
discipline rules in references/discipline-and-recovery.md at every phase.
State Block
<python-modernization-state>
phase: SCAN | ASSESS | PLAN | REPORT | COMPLETE
python_version: [2.x / 3.x / unknown]
framework: flask | django | fastapi | bare | unknown
packaging: requirements_txt | setup_py | pyproject_toml | unknown
test_coverage: none | low | medium | high | unknown
async_usage: none | partial | full
migration_paths_identified: 0
blockers_identified: 0
last_action: [description]
next_action: [description]
</python-modernization-state>Output Template
The full Modernization Assessment Summary (Markdown — header block, migration-paths table, blockers
table, phased plan) is in references/assessment-summary-template.md. Before/after compatibility
examples for Python 2→3, sync→async, and Flask→FastAPI are in references/compatibility-patterns.md.
AI Discipline
Evidence before recommendation, quantify before scoring, and incremental plans only — with worked
WRONG/RIGHT examples, the 10-row anti-pattern catalog, and error-recovery procedures (tools missing,
unknown dependency compatibility, zero test coverage) — are in references/discipline-and-recovery.md.
Integration with Other Skills
| Skill | Relationship |
python-architecture-checklist | Run architecture review after modernization to verify the new structure meets quality gates. |
python-security-review | Run security review after framework migration — new frameworks have different security patterns. |
alembic-migration-manager | Database migration is often part of modernization. Use this skill for the migration lifecycle. |
fastapi-scaffolder | When the modernization plan includes FastAPI adoption, use this skill for endpoint scaffolding. |
legacy-migration-analyzer | Cross-reference for teams with mixed Python/.NET stacks. Assessment philosophy is identical; tooling differs. |
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

