Example result: Upgrade a library to a new major version
AI-generated example · Upgrade Guide
Updated

Upgrade a library to a new major version

This prompt plans a major version upgrade, such as a router or framework, for code like yours. It lists the breaking changes with before and after examples and an upgrade order that keeps the app working.

text-code-upgrade-major-version — claude — 97 words

Act as a senior developer planning an upgrade.

Library: [e.g. React Router] from version [OLD] to [NEW]
How we use it: [PASTE THE MAIN FILES OR DESCRIBE]
Tests we have: [e.g. unit tests, no end-to-end tests]

List the breaking changes that affect code like mine, with before and after examples. Give me an upgrade order that keeps the app working, including any codemods or compatibility modes. Tell me what to test by hand afterwards. If you are not sure about a detail of the new version, say so and point me to the library's own migration guide.

Always check the library's own migration guide too. AI knowledge of very new versions can be out of date.

Get a better result

What you will get

The breaking changes in the new version that touch code like yours, with before and after examples, an upgrade order that keeps the app running, any codemods or compatibility modes, and a list of things to test by hand.

Why it works

Pasting how you use the library narrows a long changelog down to the changes that touch your code. The line about tests sets how cautious the plan should be. The request to say when it is unsure is honest about a real limit: models can lag behind very new releases, so pointing you to the official migration guide is part of a good answer.

Common mistake

It describes changes from a different version.

Fix: Give the exact old and new version numbers, and check each breaking change in the library’s own migration guide, as the tip says.

Also watch for
  • The plan upgrades everything in one big step. Ask for small steps that each leave the app working, with a commit after each.
  • Peer dependencies break after the upgrade. Paste your package file and ask which other packages need to move to a matching version.
Try a variation: decide whether to upgrade

Ask for the case for and against upgrading now, including how long the old version will get security fixes, if the project says.

Still not right? Reply with this

List the screens and flows I must test by hand after this upgrade, ordered by how likely they are to break.

More chat & writing prompts

See all 465 →