Home › All prompts › Use the Current Version: Stop the AI Writing Outdated Library Code

Mini pack

Free

Use the Current Version: Stop the AI Writing Outdated Library Code

The agent often writes code for an older version of a library than the one in your project, so things fail with missing functions or deprecated warnings. These 9 free prompts help you find out which versions you really have, hand the agent the official docs for your version, find and fix only the old-version code already in the project, and write your versions down where every new chat will see them.

Find out which versions you really have, hand the agent the right docs, spot and fix old-version code, and keep every new chat on the versions you actually installed.

9 prompts in 4 sections. Replace everything in [BRACKETS IN CAPS], then copy and paste into your AI tool.

Download the free PDF

PDF, 16 pages

Written for use with

  • Claude Code, Cursor's Agent and OpenAI Codex: all 9 prompts are pasted into any of the three, opened in the reader's project. Prompts 1.1, 1.2, 2.1, 2.3 and 3.1 only read and report; 2.2 writes only docs/VERSION-NOTES.md and 4.1 adds one "Versions" section to the rules file, both shown first; 3.2 fixes one listed item at a time after a "go"; 4.2 writes code only after proving each function exists in the installed version. No prompt installs, upgrades or downgrades a package. The core rule: the version in your project wins, not the version the agent remembers and not the newest one online.
  • Package files: package.json ranges like ^1.0.4 accepting newer minor releases (npm semver docs), package-lock.json describing the exact installed tree, npm ls and pnpm list printing installed versions, pip show, yarn.lock and pnpm-lock.yaml, and "package.json and README are always included" in a published package were checked against npm, pnpm, Yarn Classic and pip docs on Nov 21, 2026.
  • Tools: Claude Code's WebFetch passing along only what it was asked to pull from a page, CLAUDE.md @imports loading every session, and reading AGENTS.md when there's no CLAUDE.md; Cursor's Agent web search tool, .mdc rules in .cursor/rules, AGENTS.md, and rules that mention a file by path; Codex reading AGENTS.md and its CLI web search defaulting to a cached index, with codex --search for live search, were checked against official docs on Nov 21, 2026. Cursor's old @Docs mention isn't on its current @ mentions page, so it's left out, and no third-party docs MCP servers are named.
  • Chrome Modern Web Guidance: named in the 3.1 tip only after checking Chrome's own docs and its Nov 10, 2026 v1.0 blog post; no eval numbers are repeated, and the tip points to the Install Skills, Plugins and MCP Servers pack before installing.
  • Not repeated here: upgrading packages safely is left out on purpose (a separate topic); rules files as a whole point to One Rules File; scope creep during fixes to Only Change What I Asked; non-version errors to Fix My Bugs; vetting add-ons to Install Skills, Plugins and MCP Servers Without Getting Burned.
  • No stats or X claims: no numbers, no X posts quoted, and no affiliate or sponsor copy.

Written for use with Claude Code, Cursor's Agent or OpenAI Codex. Not yet tested against them.

All 9 prompts

  1. 1.1 Tell Me My Real Versions First
  2. 1.2 Is This Old-Version Code? Read the Error First
  3. 2.1 Read the Docs for My Version Before You Code
  4. 2.2 Save a Version Cheat Sheet in the Project
  5. 2.3 Use the Code That Came With the Library
  6. 3.1 Find Old-Version Code Already in My Project
  7. 3.2 Fix Only the Old-Version Code
  8. 4.1 A Versions Block for My Rules File
  9. 4.2 The Version Check Before Any New Feature

Section 1: Know What You Actually Have

1.1 Tell Me My Real Versions First

Untested: not yet run against a model.

Use this when you're about to work on your project and want the agent to look up the exact versions of your main libraries before it writes anything. It's a read-only check, so nothing changes.

Fill in: [THE LIBRARIES I CARE ABOUT] (e.g. "React, Next.js and Tailwind", or "the main ones, you pick").

Don't change any files, and don't install, upgrade or downgrade anything. Before we write any code, I want to know exactly which versions my project uses. I'm a beginner, so explain simply.

The libraries I care about: [THE LIBRARIES I CARE ABOUT]

Please:
1. Find the files that list my project's libraries, like package.json, a lockfile (package-lock.json, pnpm-lock.yaml or yarn.lock), requirements.txt or pyproject.toml. Tell me which ones you found.
2. For each library above, show me the version range written in package.json (or similar) AND the exact version that's actually installed, from the lockfile or a command like npm ls or pnpm list. Say which source each number came from.
3. Put it in a short table: library, range, installed version, major version.
4. For each one, tell me honestly whether the version you know best is the same major version as mine. If you're not sure, say "not sure".
5. Flag anything odd, like a library that's listed but not installed, two copies at different versions, or no lockfile at all.
Then stop.

Tips to customize: The number in package.json is often a range, not the real version. npm's docs say ^1.0.4 accepts newer minor releases too, while the lockfile "describes the exact tree" that was installed. So the lockfile (or npm ls) is the one to trust. npm ls [PACKAGE NAME] and pnpm list [PACKAGE NAME] both print the installed versions, and for Python, pip show [PACKAGE NAME] shows information about an installed package. Save the table: Prompts 2.1 and 4.1 use it.

1.2 Is This Old-Version Code? Read the Error First

Untested: not yet run against a model.

Use this when code the agent just wrote fails with an error, and you want to know whether it's written for a different version of a library before anyone tries to fix it. It's for a diagnosis only, so nothing changes yet.

Fill in: [THE ERROR] (paste the full error message or warning, with any API keys or passwords removed), [WHAT I WAS DOING] (e.g. "adding a login page", "the build after the agent's last change").

Don't change any files yet. I got an error and I want to know if it's caused by code written for a different version of a library.

What I was doing: [WHAT I WAS DOING]
The error:
[THE ERROR]

Please:
1. Tell me in plain English what the error says.
2. Find the line or lines it points to, and which library they use.
3. Check the version of that library I actually have installed (lockfile or npm ls), not the version you remember.
4. Tell me whether this looks like old-version code (or code for a newer version than mine). Typical signs: a function, option or import that doesn't exist in my version, a "deprecated" warning, an import path that moved, or a type error on a library call.
5. If it is a version problem, show me what the code should look like in MY version, and give me the link to the official docs page that shows it. If you can't find that in the official docs, say so instead of guessing.
6. If it's NOT a version problem, say so plainly, so we don't chase the wrong thing.
Then stop. Don't fix anything until I say "go".

Tips to customize: If the agent says "this function was removed in version 2", ask it to show you the exact sentence in the docs or the changelog. If it can't, treat the answer as a guess. Copy the whole error, including the lines below the first one, because they often name the file and the library. If it turns out not to be a version problem, our Fix My Bugs pack is the next stop.

Section 2: Give the Agent the Right Docs

2.1 Read the Docs for My Version Before You Code

Untested: not yet run against a model.

Use this when a library you use has changed a lot between versions and you want the agent to read the official docs for your exact version before it writes anything. It's for a short "old way, new way" list you can both check.

Fill in: [LIBRARY] (e.g. "SolidJS" or "React Router"), [MY VERSION] (the exact installed version from Prompt 1.1), [DOCS LINK] (the official docs or migration guide for your version, or "please find it").

Don't change any files. Before you write any code with [LIBRARY], I want you to read the official docs for the version I have.

Library: [LIBRARY]
My version: [MY VERSION]
Docs link: [DOCS LINK]

Please:
1. Open the official docs for [LIBRARY] [MY VERSION]. If I gave you a link, start there. If not, find the library's own site, and its migration guide or "what's new" page if there is one. Only use official pages: the library's own site, its GitHub repository or its changelog.
2. Check that the page is for my version, not an older or newer one. If the docs have a version picker, tell me which version is selected.
3. Tell me which version of [LIBRARY] you know best, and list what changed between that version and mine: renamed or removed functions, new ways to do common things, changed imports, and changed settings.
4. Write it as a short list of "old way → new way" pairs, each with a one-line example and the link to the page it came from.
5. If you couldn't open a page, tell me which one, so I can open it myself and paste the important part to you. Don't fill the gaps from memory.

Tips to customize: All three tools can look things up on the web, but check what the agent actually read. Claude Code's docs say its WebFetch tool passes along only what it was asked to pull from a page, so an answer like "the page doesn't mention it" may only mean it didn't ask the right question. Have it fetch the page again and ask something more specific. Cursor's Agent has a web search tool. In the Codex CLI, web search uses a cached index by default, so for a release that came out very recently, start it with codex --search for live search. If a page won't load at all, paste the important part into the chat yourself.

2.2 Save a Version Cheat Sheet in the Project

Untested: not yet run against a model.

Use this when you've found what changed in your version (from Prompt 2.1) and don't want to look it up again in every chat. It's for saving a short notes file the agent can read next time.

Fill in: [LIBRARY], [MY VERSION], [MY LIST FROM PROMPT 2.1] (paste the "old way → new way" list, or write "use the list from earlier in this chat").

Create one new file, docs/VERSION-NOTES.md, with a short cheat sheet for [LIBRARY] [MY VERSION]. Show me the text before you save it, and don't change any other files.

The list: [MY LIST FROM PROMPT 2.1]

Write it like this:
1. A first line with the library, my exact version, and today's date.
2. The "old way → new way" pairs, each with a tiny example and the link to the official page it came from.
3. Keep only what affects code we actually write. Aim for 25 lines or fewer for this library.
4. A last line that says: "If something here doesn't match the installed version, check the lockfile and the official docs, then update this file."
If docs/VERSION-NOTES.md already exists, add a new section for [LIBRARY] instead of replacing what's there.

Tips to customize: Short beats complete. Ten pairs you actually run into are worth more than a copy of the whole migration guide. Keep one section per library, and update the date whenever you check it again. To make the agent read this file on its own, point to it from your rules file with Prompt 4.1. In Claude Code you could also import it into CLAUDE.md with a line like @docs/VERSION-NOTES.md, but its docs say an imported file loads in full along with CLAUDE.md at the start of every session, so only do that while the file stays short.

2.3 Use the Code That Came With the Library

Untested: not yet run against a model.

Use this when the agent can't open the docs, or you're not sure the docs online match your version. It's for checking the library's own files that were installed in your project, which always match the version you have.

Fill in: [LIBRARY], [WHAT I WANT TO DO] (e.g. "create a store", "set up routing", "read cookies on the server").

Don't change any files. I want to check how [LIBRARY] behaves in the version I actually have installed, using the library's own files in my project, not your memory.

What I want to do: [WHAT I WANT TO DO]

Please:
1. Find where [LIBRARY] is installed in my project (for example, node_modules/[LIBRARY]) and confirm its version from the package.json inside that folder.
2. Read what's there: its README, a CHANGELOG if it has one, and its type definition files (files ending in .d.ts) if it ships them.
3. Tell me which functions or options in this installed version are meant for what I want to do. For each one, name the file you found it in.
4. If something you'd normally use isn't in the installed files, say so. Don't use it.
5. Show me a short example that uses only what you found.
Don't edit anything inside node_modules.

Tips to customize: npm's docs say a published package always includes its package.json, and its README if it has one, so those are the safest places to start. A changelog and type definition files are common but optional. If they're missing, the agent should say so, not guess. Never let the agent "fix" a library by editing files inside node_modules: those edits can be wiped out the next time packages are installed.

Section 3: Find and Fix Old-Version Code

3.1 Find Old-Version Code Already in My Project

Untested: not yet run against a model.

Use this when you suspect older chats left code written for a different version in your project. It's for a list of every suspicious spot in a file or folder, with the right way for your version, before anything changes.

Fill in: [FILE OR FOLDER] (e.g. "src/components" or "app/page.tsx"), [LIBRARY], [MY VERSION].

Don't change any files. Review [FILE OR FOLDER] for code that was written for a different version of [LIBRARY] than the one I have.

Library: [LIBRARY]
My version: [MY VERSION]

Please:
1. First, confirm my installed version from the lockfile. If docs/VERSION-NOTES.md exists, read it.
2. List every spot that looks like old-version code (or code meant for a newer version than mine): removed or renamed functions, old import paths, deprecated options, or old patterns my version replaced.
3. For each spot, give: the file and line, what's wrong in one plain sentence, what it should be in my version, and a link to the official docs that confirms it.
4. Sort the list: things that are broken now first, then deprecated things that still work, then "works, but the docs suggest a newer way".
5. If you're not sure something is old-version code, put it in a separate "not sure" list instead of guessing.
Then stop. I'll choose what to fix.

Tips to customize: Start with one folder, not the whole project, so the list stays short enough to check. Ask "how sure are you?" about anything without a docs link. If the old code is about browser features (HTML, CSS and JavaScript itself) rather than a library, Chrome's team publishes Modern Web Guidance, a set of skills meant to steer coding agents toward modern web features, at developer.chrome.com/docs/modern-web-guidance. Like any skill, check it first with our Install Skills, Plugins and MCP Servers pack.

3.2 Fix Only the Old-Version Code

Untested: not yet run against a model.

Use this when you have a list of old-version spots (from Prompt 1.2 or 3.1) and want them fixed without the agent upgrading packages or "improving" anything else. It's for one small, checked fix at a time.

Fill in: [THE LIST] (paste the spots you chose from Prompt 3.1, or "items 1 to 3 from your list"), [MY CHECK COMMAND] (e.g. "npm run build", "npm test", or "find it in package.json").

Fix only the old-version code from this list, so it matches the version of the library I have installed. Show me the plan first and wait for my "go".

The list: [THE LIST]
How to check it: [MY CHECK COMMAND]

Rules:
- Don't install, upgrade or downgrade any package, and don't change package.json or the lockfile. My installed version is the target.
- Change only the lines on the list. If a fix needs changes anywhere else, tell me and ask first.
- Use only functions and options you've confirmed exist in my installed version, from the official docs or the library's own files. If you can't confirm one, stop and tell me.

After I say "go":
1. Fix one item at a time.
2. After each fix, run the check and tell me if it passes.
3. If a fix breaks something, undo that fix and tell me what happened, instead of piling on more changes.
4. When you're done, list every file you changed, one line each, with the item it fixed.

Tips to customize: If the agent says "the easiest fix is to downgrade the library", stop and think. Changing versions is a bigger job than fixing a few lines, and it can affect other libraries too. Commit before you start, so any fix is one step from undo. If the fix spreads into files you never mentioned, our Only Change What I Asked pack shows how to keep the part you wanted and undo the rest.

Section 4: Keep Every Chat on the Right Version

4.1 A Versions Block for My Rules File

Untested: not yet run against a model.

Use this when you're tired of telling every new chat which versions you're on. It's for adding a short "Versions" section to the rules file your tool reads on its own, without rewriting the rest of the file.

Fill in: [MY RULES FILE] (e.g. "AGENTS.md", "CLAUDE.md" or "a new file at .cursor/rules/versions.mdc"), [MY MAIN LIBRARIES AND VERSIONS] (from Prompt 1.1, e.g. "Next.js 16, React 19, Tailwind 4").

Add a short "Versions" section to [MY RULES FILE]. Don't change anything else in the file, and show me the section before you save it.

My main libraries and versions: [MY MAIN LIBRARIES AND VERSIONS]

Write these rules in plain words, in 8 lines or fewer:
- The main libraries and their major versions, as listed above.
- The lockfile is the source of truth for versions. Before writing code for a library, check the installed version there. If it doesn't match this list, tell me.
- Write code for the installed version, not an older or newer one. If you're not sure a function or option exists in my version, check the official docs or the library's own files first.
- If docs/VERSION-NOTES.md exists, read it before writing code for the libraries it covers.
- Never install, upgrade or downgrade a package unless I ask.
If [MY RULES FILE] already has a rule about versions, or one that says the opposite, point it out instead of adding a second one.

Tips to customize: Write major versions only (like "Next.js 16") in the rules file, so it doesn't go stale after every small update, and let the lockfile hold the exact numbers. Pick the file your tool reads: Claude Code reads CLAUDE.md, and can read AGENTS.md instead when there's no CLAUDE.md. Codex reads AGENTS.md. Cursor reads AGENTS.md, or rule files in .cursor/rules that end in .mdc. Cursor's docs say a rule can mention a file by path, and the Agent reads it when the rule applies. When you do upgrade a library, update this section the same day. For keeping one rules file that every tool shares, see our One Rules File pack.

4.2 The Version Check Before Any New Feature

Untested: not yet run against a model.

Use this when you're about to build something new with a library that changed a lot in your version. It's for making the agent prove its approach fits your version before it writes the code.

Fill in: [THE FEATURE] (e.g. "a contact form that saves to my database"), [LIBRARY].

Before you write any code for this feature, check that your approach fits the version of [LIBRARY] I have installed.

The feature: [THE FEATURE]

1. Tell me my installed version of [LIBRARY], and where you found it.
2. List the functions, components or options you plan to use from [LIBRARY].
3. For each one, show me proof it exists in my version and works the way you plan: a link to the official docs for my version, a line from docs/VERSION-NOTES.md, or the file in node_modules where you found it.
4. If you can't prove one, pick something you can prove, or ask me.
5. Wait for my "go". Then build the feature using only what you proved, and tell me how to check that it works.

Tips to customize: This is the prompt to reach for right after a library you use puts out a new major version, because that's when the agent's memory is most likely to be behind. Once docs/VERSION-NOTES.md and the versions section from Prompt 4.1 are in place, you can shorten this to the magic phrase "Prove it exists in my version first."

Get new free packs in your inbox

Optional. Every prompt here is free, and you don't need to sign up to use any of them. We email when we add new free packs. Unsubscribe anytime.

More free packs: Vibe Code Starter Pack Ship It Safe Fix My Bugs Ship It Live Make It Pretty Get Paid Signup Emails That Actually Arrive Lovable Credit Saver One Rules File for Every AI Tool Make Your Claude Code Limit Last Graduate From Lovable First App Store Submission Survive Your First Traffic Spike Get Found on Google First 100 Users Two AIs, One Project It Broke in Production Hit the Slop Wall? Refactor Without Breaking Everything Vibe Code From Your Phone AI Reverse Engineering Run Several AI Agents at Once Claude Code Guardrails Let AI Review Your AI's Code Make Your Cursor Usage Last Privacy Policy and Terms That Match Your App Install Skills, Plugins and MCP Servers Without Getting Burned Say What You Mean Prompt Injection: Don't Let a Web Page or a Strange File Hijack Your Agent Hit Your Limit Mid-Task? Switch AI Tools Without Losing Your Place Don't Let the AI Delete Your Data: Safe Database Changes Make the AI Teach You While It Builds Bolt Token Saver v0 to Production Claude Code Subagents and Skills for Beginners Logins, Tokens and JWTs in Plain English Put Your Web App on Their Phone Add AI Features in Lovable Is Anyone Using It? Simple Analytics for Vibe Coders Use the Cheap Model for the Easy Stuff: Claude Code Model Mixing Ship Updates Without Breaking the Live App: Preview Links, Checks and One-Click Rollback Try to Break It: Stress-Test Your App Before Strangers Do Claude Code Memory: Stop It Forgetting Your Decisions Fix Your Lovable Security Warnings Without Breaking the Live App What Will My App Cost to Run? A Monthly Bill You Can Predict Leave Claude Code Running Without It Getting Stuck Put Your Lovable App on Autopilot: Automations That Check and Report for You Spec and Tests First: Tell the Agent When It's Done Only Change What I Asked: Stop the AI Rewriting Code You Didn't Mention Stop Getting 429'd: Call Other People's APIs Without Hitting Limits What Did My Agent Actually Do? Read Your Claude Code Session History Your First Google Play Launch: Get Through the 12-Tester, 14-Day Closed Test Will Anyone Want It? Check Your App Idea Before You Build Claude Code Code Mode: Try It Without Breaking Your Safety Checks Coding With Gemini 4 Neon: Make It Double-Check Its Own Work Understand the App You Already Built: A Guided Tour of Your Own Code Your Guess Might Be Wrong: Make the AI Find the Real Cause Before It Fixes Replit Missions: Give Agents a Goal, a Budget and Approval Rules Make Your Antigravity Quota Last: Pick the Right Gemini Model and Check /usage Turn a Claude Artifact Into a Desktop App, Without Giving It Too Much Access Built It for Work? Make Sure Only Your Team Can Open It Plan Before It Builds: Use GitHub Spec Kit So the Agent Builds the Right Thing Saves That Stick: Fix Data That Disappears Rebuilt Your Site With AI? Make Sure Google Can Still See Every Page Subscriptions and Paywalls: Gate Features by Plan Your AI App Builder Is Shutting Down: Get Your Code, Data and Domain Out Your Own Android App From a Prompt: Build It in Google AI Studio and Put It on Your Phone Backups You Can Actually Restore: Check, Copy and Test Your Supabase Data Accessibility Pass Before You Ship: Make Your App Work With a Keyboard, a Screen Reader and Zoom Update Your Dependencies Without Breaking the App: npm Updates, Audits, Major Upgrades and Dependabot