
Legacy Code Modernization Planner for AI Coding Agents
Creates safe modernization roadmaps for old, messy, undocumented, or fragile codebases, including risk audits, refactor phases, dependency reviews, testing plans, migration steps, and AI coding prompts.
- Create a phased roadmap to migrate jQuery spaghetti code to React components.
- Generate characterization test strategies for undocumented business logic.
- Audit a legacy repository for high-risk security and dependency gaps.
Secure checkout via Stripe
Included in download
- Create a phased roadmap to migrate jQuery spaghetti code to React components.
- Generate characterization test strategies for undocumented business logic.
- browser, file_read, file_write automation included
- Ready for Compatible with ChatGPT Custom GPTs
Sample Output
A real example of what this skill produces.
=== LEGACY CODE MODERNIZATION PLAN ===
Project/system: Old production PHP website with duplicated files, direct database queries, fragile templates, no automated tests, and little documentation.
Modernization goal: Improve maintainability, reliability, and developer confidence while preserving existing URLs, page behavior, forms, sessions, database behavior, and production stability.
System type: Legacy server-rendered PHP website
Confirmed facts:
- The site uses PHP.
- The site is already in production.
- The codebase has many duplicated files.
- There are no automated tests.
- The site uses direct database queries.
- Templates are fragile.
- Documentation is minimal.
Assumptions:
- Existing URLs may matter for SEO.
- The site may use shared includes, global variables, and direct form handlers.
- Database queries may contain hidden business rules.
- Deployment and rollback procedures may be informal.
Unknowns to clarify:
- PHP version
- database type and version
- hosting environment
- routing structure
- whether Composer is used
- whether authentication exists
- whether payments or personal data are involved
- how deployments are performed
- whether staging exists
Current system diagnosis: The codebase should not be rewritten immediately. The absence of tests and documentation makes broad modernization risky. The safest approach is to first document the current system, capture critical behavior with smoke tests, identify high-risk workflows, and then refactor duplicated code in small reversible steps.
Risk map:
-
Production stability — Critical Any broad rewrite could break live pages.
-
SEO-sensitive URLs — High Changing file names, routing, or .htaccess behavior may damage indexing and traffic.
-
Direct database queries — High Queries may contain business-critical assumptions and may be vulnerable or fragile.
-
Forms and session handling — High Legacy form logic may depend on implicit state.
-
Fragile templates — Medium to high Shared visual changes may affect many pages unexpectedly.
-
Lack of tests — High There is no safety net for refactoring.
Do not touch yet:
- production database schema
- authentication/session logic
- payment logic if present
- .htaccess/rewrite rules
- public URLs
- high-traffic pages
- form handlers
- direct database queries in critical workflows
- deployment configuration
- environment variable values
Modernization inventory:
- Documentation: urgent, low risk, high value
- Smoke tests: urgent, medium difficulty, high value
- Duplicated templates: high value, medium risk
- Database query safety: high value, high risk
- Dependency/runtime upgrades: medium value, medium to high risk
- Architecture cleanup: high value, medium risk
- Framework migration: future phase only, high risk
Recommended modernization strategy: Use an incremental stabilization-first strategy. Do not migrate to a framework yet. Create a reliable baseline, document the system, add smoke tests, then consolidate duplicated templates and utilities gradually.
Phased roadmap: Phase 0 — Discovery and safety baseline:
- Map all public PHP entry files and routes.
- Document shared includes, templates, and configuration files.
- Identify top production pages by importance.
- Document database connection points.
- Create backup and rollback notes.
- Record current PHP version and hosting constraints.
Phase 1 — Stabilization:
- Create local setup instructions.
- Add smoke tests for homepage, key content pages, search, contact forms, login if present, and admin if present.
- Add a simple manual QA checklist.
- Add safe error logging if missing.
- Document deployment steps.
Phase 2 — Low-risk cleanup:
- Identify duplicated header, footer, navigation, and layout sections.
- Extract shared templates carefully.
- Remove dead files only after confirming they are unused.
- Centralize repeated helper functions.
- Keep URLs and output behavior unchanged.
Phase 3 — Database safety:
- Inventory direct SQL queries.
- Identify queries used by critical pages.
- Add tests or manual verification for critical query outputs.
- Convert high-risk queries to prepared statements gradually.
- Avoid schema changes unless separately planned.
Phase 4 — Architecture modernization:
- Separate page controllers, templates, helpers, and database access.
- Introduce Composer/autoloading if compatible.
- Create module boundaries for major features.
- Add documentation for data flows.
Phase 5 — Dependency/runtime upgrades:
- Check PHP version compatibility.
- Upgrade libraries one at a time.
- Test after each upgrade.
- Avoid mixing dependency upgrades with refactors.
Phase 6 — Hardening:
- Review input validation and output escaping.
- Improve security headers if appropriate.
- Review file permissions.
- Add monitoring for server errors.
- Improve performance on high-traffic pages.
Phase 7 — Documentation and handoff:
- Create README.
- Create architecture overview.
- Create setup guide.
- Create deployment guide.
- Create database query map.
- Create modernization backlog.
Testing strategy:
- Smoke tests for critical public pages
- Characterization tests for helper functions
- Manual QA checklist for forms and sessions
- Regression checks for URLs and page output
- Database query verification for critical pages
- Accessibility checks for template changes
Documentation plan:
- README with setup instructions
- Route map
- Template/include map
- Database access map
- Deployment guide
- Known risks document
- Modernization backlog
Rollout and rollback plan:
- Work in small branches.
- Deploy only one modernization category at a time.
- Back up files and database before risky changes.
- Keep previous templates until new shared templates are verified.
- Define rollback trigger: broken critical page, form failure, database errors, or unexpected SEO URL changes.
- Verify after deployment using smoke tests.
AI coding agent prompt: Inspect this legacy production PHP website and create a modernization baseline. Do not rewrite the app or migrate it to a framework. First map public entry files, routes, includes, templates, configuration files, database access points, form handlers, and deployment assumptions. Identify duplicated code and high-risk areas. Preserve existing URLs, page behavior, sessions, forms, and database behavior. Do not change production database schema, authentication, payments, .htaccess rules, environment variable values, or deployment configuration unless explicitly requested. Add or recommend smoke tests for the most important pages. Return an architecture map, risk map, do-not-touch list, safe first refactor tasks, testing plan, documentation plan, and rollback notes.
Verification checklist:
- Existing public pages still load.
- Existing URLs remain unchanged.
- Forms still submit correctly.
- No database schema changes were made.
- No secrets were exposed.
- Smoke tests pass.
- Shared templates render consistently.
- Server logs show no new errors.
- Rollback path is clear.
Risks and safety notes: Because the site is in production and has no tests, modernization must be incremental. Framework migration should be postponed until routes, templates, database behavior, and critical workflows are documented and protected by tests.

Legacy Code Modernization Planner for AI Coding Agents
Creates safe modernization roadmaps for old, messy, undocumented, or fragile codebases, including risk audits, refactor phases, dependency reviews, testing plans, migration steps, and AI coding prompts.
Secure checkout via Stripe
Included in download
- Create a phased roadmap to migrate jQuery spaghetti code to React components.
- Generate characterization test strategies for undocumented business logic.
- browser, file_read, file_write automation included
- Ready for Compatible with ChatGPT Custom GPTs
- Instant install
Sample Output
A real example of what this skill produces.
=== LEGACY CODE MODERNIZATION PLAN ===
Project/system: Old production PHP website with duplicated files, direct database queries, fragile templates, no automated tests, and little documentation.
Modernization goal: Improve maintainability, reliability, and developer confidence while preserving existing URLs, page behavior, forms, sessions, database behavior, and production stability.
System type: Legacy server-rendered PHP website
Confirmed facts:
- The site uses PHP.
- The site is already in production.
- The codebase has many duplicated files.
- There are no automated tests.
- The site uses direct database queries.
- Templates are fragile.
- Documentation is minimal.
Assumptions:
- Existing URLs may matter for SEO.
- The site may use shared includes, global variables, and direct form handlers.
- Database queries may contain hidden business rules.
- Deployment and rollback procedures may be informal.
Unknowns to clarify:
- PHP version
- database type and version
- hosting environment
- routing structure
- whether Composer is used
- whether authentication exists
- whether payments or personal data are involved
- how deployments are performed
- whether staging exists
Current system diagnosis: The codebase should not be rewritten immediately. The absence of tests and documentation makes broad modernization risky. The safest approach is to first document the current system, capture critical behavior with smoke tests, identify high-risk workflows, and then refactor duplicated code in small reversible steps.
Risk map:
-
Production stability — Critical Any broad rewrite could break live pages.
-
SEO-sensitive URLs — High Changing file names, routing, or .htaccess behavior may damage indexing and traffic.
-
Direct database queries — High Queries may contain business-critical assumptions and may be vulnerable or fragile.
-
Forms and session handling — High Legacy form logic may depend on implicit state.
-
Fragile templates — Medium to high Shared visual changes may affect many pages unexpectedly.
-
Lack of tests — High There is no safety net for refactoring.
Do not touch yet:
- production database schema
- authentication/session logic
- payment logic if present
- .htaccess/rewrite rules
- public URLs
- high-traffic pages
- form handlers
- direct database queries in critical workflows
- deployment configuration
- environment variable values
Modernization inventory:
- Documentation: urgent, low risk, high value
- Smoke tests: urgent, medium difficulty, high value
- Duplicated templates: high value, medium risk
- Database query safety: high value, high risk
- Dependency/runtime upgrades: medium value, medium to high risk
- Architecture cleanup: high value, medium risk
- Framework migration: future phase only, high risk
Recommended modernization strategy: Use an incremental stabilization-first strategy. Do not migrate to a framework yet. Create a reliable baseline, document the system, add smoke tests, then consolidate duplicated templates and utilities gradually.
Phased roadmap: Phase 0 — Discovery and safety baseline:
- Map all public PHP entry files and routes.
- Document shared includes, templates, and configuration files.
- Identify top production pages by importance.
- Document database connection points.
- Create backup and rollback notes.
- Record current PHP version and hosting constraints.
Phase 1 — Stabilization:
- Create local setup instructions.
- Add smoke tests for homepage, key content pages, search, contact forms, login if present, and admin if present.
- Add a simple manual QA checklist.
- Add safe error logging if missing.
- Document deployment steps.
Phase 2 — Low-risk cleanup:
- Identify duplicated header, footer, navigation, and layout sections.
- Extract shared templates carefully.
- Remove dead files only after confirming they are unused.
- Centralize repeated helper functions.
- Keep URLs and output behavior unchanged.
Phase 3 — Database safety:
- Inventory direct SQL queries.
- Identify queries used by critical pages.
- Add tests or manual verification for critical query outputs.
- Convert high-risk queries to prepared statements gradually.
- Avoid schema changes unless separately planned.
Phase 4 — Architecture modernization:
- Separate page controllers, templates, helpers, and database access.
- Introduce Composer/autoloading if compatible.
- Create module boundaries for major features.
- Add documentation for data flows.
Phase 5 — Dependency/runtime upgrades:
- Check PHP version compatibility.
- Upgrade libraries one at a time.
- Test after each upgrade.
- Avoid mixing dependency upgrades with refactors.
Phase 6 — Hardening:
- Review input validation and output escaping.
- Improve security headers if appropriate.
- Review file permissions.
- Add monitoring for server errors.
- Improve performance on high-traffic pages.
Phase 7 — Documentation and handoff:
- Create README.
- Create architecture overview.
- Create setup guide.
- Create deployment guide.
- Create database query map.
- Create modernization backlog.
Testing strategy:
- Smoke tests for critical public pages
- Characterization tests for helper functions
- Manual QA checklist for forms and sessions
- Regression checks for URLs and page output
- Database query verification for critical pages
- Accessibility checks for template changes
Documentation plan:
- README with setup instructions
- Route map
- Template/include map
- Database access map
- Deployment guide
- Known risks document
- Modernization backlog
Rollout and rollback plan:
- Work in small branches.
- Deploy only one modernization category at a time.
- Back up files and database before risky changes.
- Keep previous templates until new shared templates are verified.
- Define rollback trigger: broken critical page, form failure, database errors, or unexpected SEO URL changes.
- Verify after deployment using smoke tests.
AI coding agent prompt: Inspect this legacy production PHP website and create a modernization baseline. Do not rewrite the app or migrate it to a framework. First map public entry files, routes, includes, templates, configuration files, database access points, form handlers, and deployment assumptions. Identify duplicated code and high-risk areas. Preserve existing URLs, page behavior, sessions, forms, and database behavior. Do not change production database schema, authentication, payments, .htaccess rules, environment variable values, or deployment configuration unless explicitly requested. Add or recommend smoke tests for the most important pages. Return an architecture map, risk map, do-not-touch list, safe first refactor tasks, testing plan, documentation plan, and rollback notes.
Verification checklist:
- Existing public pages still load.
- Existing URLs remain unchanged.
- Forms still submit correctly.
- No database schema changes were made.
- No secrets were exposed.
- Smoke tests pass.
- Shared templates render consistently.
- Server logs show no new errors.
- Rollback path is clear.
Risks and safety notes: Because the site is in production and has no tests, modernization must be incremental. Framework migration should be postponed until routes, templates, database behavior, and critical workflows are documented and protected by tests.
About This Skill
Legacy Code Modernization Planner helps AI coding agents, developers, freelancers, founders, SaaS owners, and engineering teams modernize old or fragile codebases safely. It turns vague requests like “clean this code” or “modernize this project” into structured modernization audits, technical debt maps, refactor safety plans, dependency upgrade strategies, framework migration roadmaps, documentation recovery plans, implementation tickets, verification checklists, and paste-ready prompts for tools like Cursor, Claude Code, Codex CLI, OpenCode, Replit, and ChatGPT Agents. The skill emphasizes incremental change, behavior preservation, test-before-refactor strategy, rollback planning, and risk control for legacy frontend, backend, full-stack, PHP, JavaScript, React, Node, Python, WordPress, and monolithic systems.
📖 Learn more: Best DevOps & Deployment Skills for Claude Code →
Use Cases
- Create a phased roadmap to migrate jQuery spaghetti code to React components.
- Generate characterization test strategies for undocumented business logic.
- Audit a legacy repository for high-risk security and dependency gaps.
- Draft precision Cursor prompts for safely refactoring giant monolith files.
- Plan a dependency upgrade strategy without breaking production behavior.
- Create modernization tickets for Jira, GitHub Issues, Linear, or Trello.
- Recover missing documentation for an old codebase before refactoring.
- Design a safe PHP legacy modernization plan without a risky full rewrite.
- Create a test-before-refactor plan for fragile legacy modules.
- Build a rollback and verification checklist for risky modernization phases.
Known Limitations
This skill creates modernization strategies, audit structures, migration plans, testing recommendations, and AI coding prompts, but it does not guarantee that a codebase will be safely modernized, fully tested, secure, scalable, deployable, or free of regressions. Legacy systems with missing tests, undocumented business rules, production-only behavior, complex database migrations, payment flows, authentication logic, security-sensitive code, or fragile third-party integrations may require repository access, staging environments, monitoring tools, backups, rollback plans, and review by experienced developers or security specialists.
How to Install
mkdir -p ~/.claude/skills && curl -sL https://www.agensi.io/api/install/legacy-code-modernization-planner-for-ai-coding-agents | tar xz -C ~/.claude/skills/Free skills install directly. Paid skills require purchase - use the download button above after buying.
Reviews
No reviews yet - be the first to share your experience.
Only users who have downloaded or purchased this skill can leave a review.
Early access skill
Be the first to review this skill.
Only users who have downloaded or purchased this skill can leave a review.
Security Scanned
Passed automated security review
Permissions
Allowed Hosts
File Scopes
This skill uses file access to read user-provided code snippets, repository notes, dependency manifests, configuration examples, documentation, logs, and technical plans. It uses write access to create structured Markdown/text outputs such as modernization plans, technical debt maps, refactor safety plans, dependency upgrade strategies, migration roadmaps, AI coding agent prompts, documentation recovery plans, QA checklists, and SKILL.md files. Terminal access is optional and should only be enabled when the agent is expected to run tests, inspect dependencies, or validate a repository. Browser or network access is only needed for external documentation or migration-guide research. Environment variable access is not normally required, and secret values should never be exposed.
Compatible with ChatGPT Custom GPTs, ChatGPT Agents, Cursor, Claude Code, Codex CLI, OpenCode, Replit, and other AI coding agent workflows that support structured Markdown instruction files such as SKILL.md. It can also be used manually in any AI chat by pasting the instructions.