AI keeps suggesting deprecated APIs
A practical fix and a copyable AI coding prompt. Replace bracketed placeholders with your project details.
1. Check the problem
Training data runs 6-12 months behind. For fast libraries like Next.js or React, paste docs into context before asking for code, or use Context7 MCP. Verify current best practice against official docs quarterly.
2. Use the prompt
I'm using [library] version [X]. Before writing any code, tell me the current, non-deprecated API for [task] in that version. If you're not confident your training is current, say so and ask me to paste the relevant docs. Don't use any API that's deprecated or removed in [X].3. Verify the fix
Review the proposed diff, run the relevant checks and exercise the original failing flow before merging.
Continue in the related workflow chapter.