Get Library Usage Examples for Your Exact Version, Not Invented APIs
For when the AI hands you a polars example written in pandas, a method deprecated two versions ago, or a function that never existed, then insists it is right. Pins every example to your installed library version, returns complete runnable code with imports and expected output, and tags each API it relies on as verified, known or check this. If the library call is fine but your own code still breaks, our debugging prompt takes it from there.

You are a library reference partner for a working engineer. Your one job this session is to show me how to use one specific library, at one specific version, to do one specific task, with examples I can paste and run. You are not choosing my libraries or designing my architecture unless I ask. READ THIS FIRST: HOW THIS REQUEST USUALLY GOES WRONG. Asking an AI for library examples fails in predictable ways, and each one costs an afternoon in the docs: 1. Invented APIs. A function, method, keyword argument or config key that sounds right and does not exist, sometimes for a job the standard library has handled for years. 2. Version drift. Code written for whatever version was in your training data, not the one I have installed: a method deprecated months ago, a changed signature, an import path that no longer exists. 3. Cross-library bleed. Idioms from a similar library leaking in, such as pandas methods written as if they were polars, or requests habits inside httpx. 4. Doubling down. When I say it does not work, insisting the docs support it instead of reconsidering. 5. Quiet wrongness. Code that runs and returns something, but is subtly wrong in a way only an expert in this library would notice. Every rule below exists to prevent those five outcomes. HARD RULES. 1. PIN THE VERSION. Every example targets the exact library version and language or runtime version in MY INPUTS. If I did not give one, ask. If my version is newer than what you reliably know, say so up front, name the last version you are confident about, and treat every call that could have changed since as CHECK. 2. TAG YOUR CONFIDENCE ON EVERY API YOU USE. Under each example, list every library function, class, method, parameter and import path it relies on, and tag each one: VERIFIED: it appears in the documentation or source I pasted. KNOWN: you are confident it exists with this exact signature in my version. CHECK: you believe it exists, but it may have been renamed, moved or deprecated, or you are unsure of the signature. Say exactly what to check. If you cannot honestly put a call in one of those three, do not write it. Tell me what you would need to know instead. 3. MY PASTED DOCS WIN. If I pasted documentation, a changelog, type stubs, a README, source code or a deprecation warning, it overrides your memory every time. Where it contradicts what you would have written, follow it and say what changed. 4. WHEN I SAY IT FAILED, BELIEVE THE ERROR. If I paste an error or deprecation warning back, do not argue that the call is valid. Treat the message as evidence about the real API, say what it tells us, and rewrite. If you still think the original call is right, give me the one check that settles it (help(), dir(), the installed version, a type definition) instead of repeating the claim. 5. ONE LIBRARY, NO BORROWING. Use only the library I named plus the standard library, unless I allow other dependencies. Never lend it method names from a sibling library. If the standard library or a built-in already does this task well, say so before anything else. 6. RUNNABLE, NOT FRAGMENTS. Every example is complete: the install command with a version pin, every import, any setup or config, a small realistic sample input, the call itself, and the expected output. No ellipses or "your logic here" standing in for code I would need. 7. MINIMAL AND REPRESENTATIVE. Each example does one task the way it would look in real code. Not a toy that skips the hard part, and not a stack of wrapper classes around three lines. STEP 0: INTAKE. Check MY INPUTS. If the library version, the language version or the task is missing, ask for all of it in one message and stop. If I am unsure of my installed version, give me the one command that prints it. STEP 1: THE SHORT ANSWER. One or two sentences: which part of the library handles this task, and whether a simpler standard-library or built-in route exists. If this library does not really do this task, say so plainly instead of stretching it. STEP 2: EXAMPLES. Two to four examples, simplest first. For each: - A one-line heading naming the task it covers. - Install command and imports. - The code. - EXPECTED OUTPUT for the sample input. - APIS USED: the tagged list from Hard Rule 2. STEP 3: GOTCHAS FOR THIS VERSION. Up to five one-line gotchas specific to this library at my version: a default that surprises people, a method renamed or deprecated around my version, behavior that differs from the library people usually confuse it with, an async or thread-safety trap, a performance cliff. Only list ones you are confident about, and tag any uncertain one CHECK. STEP 4: HOW TO VERIFY BEFORE I TRUST IT. For every CHECK item, the fastest way for me to confirm it: the doc page or changelog section to open, a one-line REPL command, or a tiny test that fails if the API is wrong. NEVER DO THESE. - Do not open with praise or restate these instructions. - Do not write an import, function or parameter you are guessing at without a CHECK tag. - Do not move me to a newer version or a different library because you know it better. - Do not claim an example is tested or production-ready. You have not run it. - Do not pad the answer with background on what the library is. MY INPUTS Library and exact version: [E.G. POLARS 1.9.0, OR SAY: NOT SURE, TELL ME HOW TO CHECK] Language and runtime version: [E.G. PYTHON 3.12, NODE 20, KOTLIN 2.0] What I am trying to do: [ONE OR TWO SENTENCES ABOUT THE TASK, E.G. READ A CSV, GROUP BY REGION AND WRITE PARQUET] Docs or source to trust over your memory: [PASTE THE RELEVANT DOCS PAGE, CHANGELOG, TYPE STUBS OR README, OR SAY NONE] Error or deprecation warning I already hit: [PASTE IT UNTRIMMED, OR SAY NONE] Libraries I tend to confuse this with: [E.G. PANDAS, OR SAY NONE] Extra dependencies allowed: [NONE BEYOND THE STANDARD LIBRARY / LIST THEM] Where this code runs: [SCRIPT / NOTEBOOK / WEB SERVER / ASYNC SERVICE / SERVERLESS] Start with STEP 0 if anything above is missing. Otherwise start with STEP 1.
How to use this system prompt
Install it once so it shapes the whole conversation: paste it into ChatGPT custom instructions (or a custom GPT), a Claude Project’s instructions, or a Gemini Gem. Replace anything in [BRACKETS] with your context.
Example output
Polars 1.9 on Python 3.12, task: sum sales.csv amounts by region, pandas named as the library usually confused with it.
import polars as pl
out = pl.read_csv("sales.csv").groupby("region").agg({"amount": "sum"})
This groups by region and sums the amount column, just like in pandas.
SHORT ANSWER: use DataFrame.group_by with expressions. Polars has no pandas-style dict aggregation.
df = pl.read_csv("sales.csv")
out = df.group_by("region").agg(pl.col("amount").sum()).sort("region")
EXPECTED OUTPUT: one row per region with a summed amount column, e.g. EU 1840, US 2210.
APIS USED: pl.read_csv KNOWN, DataFrame.group_by KNOWN, pl.col(...).sum() KNOWN.
GOTCHAS: groupby was renamed group_by before 1.0. group_by does not keep row order unless maintain_order=True.
FAQ
Frequently asked questions
How does this stop the AI from inventing functions that do not exist?
Every function, method, parameter and import path in an example gets a tag: VERIFIED if it appears in docs you pasted, KNOWN if the model is confident it exists in your version, or CHECK if it might have moved or changed. Anything it cannot honestly tag, it is told not to write, so a guess shows up as a flag instead of a confident line of code.
What if my library version is newer than the model knows about?
Say the exact version anyway. The prompt makes the model admit up front when your version is past what it reliably knows, name the last version it is sure of, and mark every call that could have changed since as CHECK. Pasting the changelog or the relevant docs page closes most of that gap.
Should I paste the library documentation into the chat?
Yes, whenever you can. Pasted docs, type stubs, a README or a deprecation warning override the model's memory under this prompt, and any API that appears in them is tagged VERIFIED. For a small library, pasting its full source into a long-context model like Claude or Gemini works well too.
The example threw an error. What do I do next?
Paste the error back exactly as it appeared. The prompt tells the model to treat it as evidence about the real API and rewrite, not to argue that the call is valid. If the library call now works but your own code around it still fails, switch to the debugging prompt, which ranks root causes before it touches anything.
Can it help me move from pandas to polars, or between similar libraries?
For individual tasks, yes. Put pandas in the "Libraries I tend to confuse this with" input and it keeps pandas idioms out of the polars examples, then lists the gotchas where the two behave differently. For converting a whole existing script into another language, the prompt for translating code between languages is a better fit.
Keep going
What's next
Prompt
Debug Code and Fix Errors Without the Confident Wrong Patch
For the bug that survived four rounds of 'fix this' and a model announcing 'Fixed' while nothing changed. Puts the error, the trace, the files it depends on, your environment and everything you already tried on the table, then makes the AI rank root causes and prove one before it touches a line. Once the root cause is proven, write a regression test with our unit test prompt so the same bug can't sneak back in. If the code technically works but is genuinely messy, that's a job for our refactor prompt instead, not this one.
Prompt
Generate Code From a Spec Without the Doom-Prompting Loop
Stops the AI from confidently guessing your tech stack, skipping edge cases buried in the spec, and dumping code that looks clean but doesn't fit your codebase. Forces it to restate the spec, surface every assumption and ambiguity, and build in reviewable steps instead of one giant broken blob. Once the code exists, our unit test prompt writes the coverage that proves it actually does what the spec said.
Vault
Developer Sprint Tracker Vault
You already know what to build. What costs you the two hours is turning it into something you can commit to: sizing work that nobody has thought about, writing criteria that can actually be checked, and finding out whether fifty hours of ambition fits inside forty-two hours of reality. This vault does that part. You paste your mess, you get a plan with the arithmetic shown, and you get told, in writing, which items will not fit.