Prompt Library ⚙️ Technical Migrate a Legacy Codebase to Modern Standards
GPT-4o ⚙️ Technical Advanced

Migrate a Legacy Codebase to Modern Standards

Plan and execute a safe migration of legacy code to modern patterns — identifying risks, creating a phased approach, and writing the migration code.

👁 4 views ⎘ 0 copies ♥ 0 likes

The Prompt

# Migrate a Legacy Codebase to Modern Standards

You are a senior engineer leading a legacy modernization project.

## Current State

Language/version: [CURRENT_LANGUAGE_VERSION]
Target language/version: [TARGET_LANGUAGE_VERSION]
Codebase size estimate: [CODEBASE_SIZE]
Age of codebase: [CODEBASE_AGE]
Test coverage: [CURRENT_COVERAGE]%
Team size: [TEAM_SIZE]

What's broken or outdated:
- [ISSUE_1]
- [ISSUE_2]
- [ISSUE_3]

Sample of legacy code:
```
[PASTE_LEGACY_SAMPLE]
```

## Migration Risk Assessment

**High-risk areas:**
Identify the parts of this codebase that are most dangerous to change. What could break silently?

**Dependencies:**
Which third-party libraries are deprecated or incompatible with [TARGET_LANGUAGE_VERSION]?

**Test gap:**
With [CURRENT_COVERAGE]% coverage, what behavior could change without any test catching it?

## Migration Plan

**Phase 1 — Safety net (do first):**
Add tests for the most critical paths before changing anything. What to test first.

**Phase 2 — Incremental migration:**
Break the migration into [PHASE_COUNT] phases that each leave the codebase in a working state. Define each phase.

**Phase 3 — Cleanup:**
Remove compatibility shims and deprecated patterns after full migration.

## Modernized Sample

Rewrite the legacy code sample using [TARGET_LANGUAGE_VERSION] idioms.

## Rollback Plan

Define how to roll back each phase if production breaks.

📝 Fill in the blanks

Replace these placeholders with your own content:

[CURRENT_LANGUAGE_VERSION]
[TARGET_LANGUAGE_VERSION]
[CODEBASE_SIZE]
[CODEBASE_AGE]
[CURRENT_COVERAGE]
[TEAM_SIZE]
[ISSUE_1]
[ISSUE_2]
[ISSUE_3]
[PASTE_LEGACY_SAMPLE]
[PHASE_COUNT]

How to use this prompt

1
Copy the prompt

Click "Copy Prompt" above to copy the full prompt text to your clipboard.

2
Replace the placeholders

Swap out anything in [BRACKETS] with your specific details.

3
Paste into GPT-4o

Open your preferred AI assistant and paste the prompt to get started.