PlaybookPrompts

Migrate code from a deprecated library version to a new API

Coding & Development migrationrefactoringdependencies

Library major versions often break APIs in ways that require mechanical but error-prone find-and-replace across a codebase. This prompt handles a specific file or module at a time, mapping old calls to new ones explicitly.

Prompt
You are a software engineer performing a library migration. I have code that uses an older version of a library and I need to update it to use the new API.

Library name: {{LIBRARY_NAME}}
Old version: {{OLD_VERSION}}
New version: {{NEW_VERSION}}

Migration guide or changelog summary (paste relevant parts):
{{MIGRATION_NOTES}}

Code to migrate:
```
{{CODE_TO_MIGRATE}}
```

Follow these steps:

1. Scan the code and list every usage of the library: imports, function calls, class instantiations, hooks, decorators — all of them.
2. For each usage, state whether it is: (a) unchanged in the new version, (b) renamed or moved, (c) has a changed signature, or (d) removed with no direct replacement.
3. For category (b) and (c), write the exact updated call.
4. For category (d), describe what the closest alternative is, or if there is none, flag it clearly as 'requires manual decision'.
5. Output the fully migrated code.
6. After the code, list any places where the migration changes behavior — not just syntax — so I can verify them in testing.

Do not change anything unrelated to the library migration. If you see unrelated bugs, note them in a separate section at the end labeled 'Unrelated issues spotted' but do not fix them.
Variables to fill in
  • {{LIBRARY_NAME}}
  • {{OLD_VERSION}}
  • {{NEW_VERSION}}
  • {{MIGRATION_NOTES}}
  • {{CODE_TO_MIGRATE}}

How to use this prompt

  1. Copy the prompt above (Copy button on the top-right).
  2. Replace each {{VAR}} with your own value. Variables: {{LIBRARY_NAME}}{{OLD_VERSION}}{{NEW_VERSION}}{{MIGRATION_NOTES}}{{CODE_TO_MIGRATE}}.
  3. Paste it into one of the recommended tools below.
  4. Iterate: tighten constraints in the prompt if the output is generic.

Why this prompt is structured this way

The prompt is split into explicit steps because LLMs do better when the path is named, not implied. Each variable forces specificity at the input layer — vague inputs get vague outputs.

Heads up: some of the links on this page are affiliate links — meaning we may earn a commission if you sign up after clicking, at no extra cost to you. We only recommend tools we'd put on our own stack. You can see our full affiliate disclosure here.

Pair this prompt with a tool

The PlaybookPrompts weekly

One short email per week. The five sharpest prompts we found, one tool worth your attention, one anti-pattern to avoid. Unsubscribe in one click.

Newsletter signup is not configured. Set PUBLIC_NEWSLETTER_USERNAME in the build env.