Use when the user says 'no hallucinations', 'verify APIs', 'reality check', or 'don't invent functions'. Prevents the agent from calling methods, imports, or va
复制下面这句话,粘贴给 Claude Code、Codex、Cursor 等 AI 编程工具,它会读取安装说明并在你确认后完成安装。
请阅读 https://ai.atlankj.com/install/asset/gh-strict-api-170cb62273d7 ,按照其中的说明把「strict-api」安装到你(当前 AI 工具)中。执行前先告诉我将运行的命令和写入的位置,等我确认。
查看 AI 将读取的安装说明正在读取 GitHub 原文…
内容来自 GitHub 原始文件,由原作者维护。在 GitHub 查看
Inventing a function that doesn't exist is the opposite of efficiency. You wrote a line that looks minimal. You shipped a bug that takes an hour to debug. The true minimal path is: use only what is provably there.
This skill is a reality-check layer applied before any code is written. It is not about being slow — it is about being correct the first time. Use it alongside minimalist when the user wants both less code and verified code.
Before you write any function call, import, or method access, you must be able to answer:
"Does this exist in the version the user is running?"
If the answer is "probably" or "I think so" — stop. You don't know. Say so.
Made-up methods:
fs.readFileLines() does not exist in Node.js.path.combine() is .NET, not Node.js.csv.read_csv() is pandas, not Python's csv module.Writing these is not minimal code — it is confident garbage.
Framework confusion. Every framework has a twin that sounds like it:
render_template (Flask) vs render() (Django)useForm() (react-hook-form) vs nothing built into Reactapp.listen() (Express) vs server.listen() (raw Node.js http)Deprecated APIs. Writing a deprecated method is writing code that will break on the next upgrade.
When you are not sure if a method exists, annotate it inline:
// verify fs.openAsBlob exists in your Node.js version (>= 20.0)
const blob = await fs.openAsBlob(path);
One comment costs nothing. A silent wrong call costs an hour of the user's time.
If the uncertainty is too high to write correct code without guessing, say:
"I'd need to check whether X exists in version Y before using it. What version are you on?"
| Anti-Pattern | What to do instead |
|---|---|
| Writing a method call you vaguely remember | Stop and verify the exact signature |
| Silently using a deprecated API | Use the current API and note the deprecation |
| Assuming API parity across frameworks | Explicitly name the framework and version |
| Guessing import paths | Check the package's actual export structure |
| Using an API from a different language's stdlib | Verify it exists in this language |
| Writing "it should work" without checking | Ask what version the user is on |
engineering/minimalist — use together: minimalist reduces code volume; strict-api ensures what is written is correct.engineering/zero-hallucination-coder — similar goal; broader hallucination prevention beyond APIs.engineering/karpathy-coder — Karpathy-inspired behavioral guardrails for LLM-assisted coding.