PromptBase
Upgrade
Close icon
General
Home
Marketplace
Create
Hire
Login
Chat
Sell
Explore

Prompt Details

Model
(claude-4-7-opus)
Token size
471
Example input
[CURRENT_TECH_STACK]: Legacy JavaScript ES5 [TARGET_TECH_STACK]: TypeScript 5 Strict Mode [MIGRATION_FOCUS]: Strict type safety and eliminating mutation side effects [LEGACY_CODE_CONTEXT]: function processUser(userData) { userData.status = 'active'; var profileUrl = '/api/' + userData.id; return userData; }
Example output
# Code Modernization Blueprint ## PHASE 1: LEGACY GAP ANALYSIS - Technical Drag Audit: The legacy JavaScript code relies entirely on implicit object structures without validation. Any missing API property will trigger an unhandled runtime crash (Cannot read property of undefined). - Behavioral Mapping: The function mutates the incoming payload parameter directly, creating dangerous side effects across other UI components sharing the data block. ## PHASE 2: TARGET ARCHITECTURE & TYPINGS - Modern Specification: Implement strict TypeScript Interfaces with optional field handling. Enforce immutability using deep cloning or readonly properties. - Dependency Mapping: Replace vanilla inline fetch calls with an explicit, typed Axios instance or native typed fetch wrapper. ## PHASE 3: MODERNIZED TRANSFORMATION CODE Before: function processUser(userData) { userData.status = 'active'; var profileUrl = '/api/' + userData.id; return userData; } After: interface UserProfile { readonly id: string; email: string; status?: 'active' | 'inactive'; } export function processUser(user: UserProfile): UserProfile { return { ...user, status: 'active' }; } ## PHASE 4: INCREMENTAL ROLLOUT & RISK MITIGATION - Step-by-Step Transition: Step 1: Enable allowJs and checkJs in tsconfig to audit files. Step 2: Introduce types for shared data models. Step 3: Rename files to .ts sequentially. - Outage Prevention: Risk 1: Incorret mock data breaking compilation. Mitigation: Use runtime validation like Zod alongside TypeScript contracts to catch malformed payloads at the API boundary.
🌀 Claude

Legacy Code Migration Architect

Add to Cart
Instant accessInstant access
Usage rightsCommercial use
Money-back guaranteeMoney‑back
By purchasing this prompt, you agree to our terms of service
CLAUDE-4-7-OPUS
Tested icon
Guide icon
4 examples icon
Free credits icon
Safely migrate and modernize legacy applications. This prompt acts as a Principal Modernization Engineer, analyzing old, outdated, or untyped codebases to plan seamless upgrades (e.g., JS to TypeScript, framework migrations, or architecture shifts). It generates comprehensive gap analyses, target architecture models, before/after code transformations, and zero-downtime migration roadmaps. Perfect for tech leads driving modernization sprints and reducing technical drag.
...more
Added 3 weeks ago
Report
Browse Marketplace