Verify With Docs (Retrieval-First)
Your training data has a cutoff and libraries move fast, so for any code that
touches a specific dependency, retrieve before you write.
Prefer retrieval over pre-training memory — never trust the model's memorized
API surface when the current docs are reachable.
When this applies
Reach for this skill when the task:
- implements against a named library/framework/SDK, especially a fast-moving one
(web frameworks, cloud SDKs, AI/LLM SDKs, build tools, ORMs);
- depends on exact signatures, option names, return shapes, or config keys;
- says "latest", "current", "did X change in version Y", or names a version;
- is failing with an error that looks like a wrong/renamed API.
Skip it for stable stdlib usage you are certain of, or pure logic with no
external API surface.
References Local-First
Before fetching from the web, check if the target library is available as a
local reference in opencode.jsonc → references. If mounted (e.g., via
references: { "opencode": { "repository": "anomalyco/opencode" } }), read
the source code from the local clone first. Only fall back to web fetch if:
- The reference is outdated (commit older than the version in use)
- The reference does not cover the relevant code paths
- No reference is mounted for the target library
The loop
- Pin the exact version. Read the version actually in use before reading any
docs — the docs must match it.
- JS/TS:
package.json + the lockfile (node_modules/<pkg>/package.json is
the ground truth for the installed version).
- Python:
pyproject.toml / requirements.txt / pip show <pkg>.
- Go:
go.mod. Rust: Cargo.toml / Cargo.lock.
- Go to the primary source, matched to that version. Prefer, in order:
official docs for that version → the library's own repo (tag/branch matching
the version) → typed definitions shipped with the package (
.d.ts, stubs,
godoc) → reputable references. Skip blog posts and Q&A for signatures.
- Extract only what you need. The exact signature, required vs optional
params, return type, error modes, and any breaking-change note between the
installed version and what memory assumes. Don't dump whole pages into
context — quote the minimal relevant lines.
- Report verified facts with citations. Every signature you hand back must
carry a source URL or file path so the implementing agent can trust it.
- Only then implement — against the retrieved API, not the remembered one.
Prefer mounted references over repeated fetches
For a library you consult often, mount it once as an OpenCode reference so
agents search a local, version-pinned copy instead of re-fetching docs every
session (cheaper and offline-safe):
// opencode.json
"references": {
"somelib": {
"repository": "https://github.com/org/somelib",
"branch": "v4" // pin to the version you actually use
},
"internal-lib": {
"path": "./vendor/internal-lib",
"description": "Our vendored copy — read-only context"
}
}
Then search the mounted reference for the exact API before answering. If the
reference is missing or stale, refresh it rather than falling back to memory.
Output format
## Verified against docs
- <API/signature> — source: <URL or path> (version <x.y.z>)
- <option/return shape> — source: <URL or path>
## Changed / gotchas (if any)
- <what differs from a naive memory-based guess, and why it matters>
## Ready to implement
<one line: the caller can now code against the above without guessing>
Anti-patterns
- Writing the call first and "checking later" — verify before you write.
- Citing a doc version that doesn't match the installed version.
- Pasting entire doc pages into context instead of the few relevant lines.
- Trusting a blog/Q&A snippet over the official docs or the shipped type definitions.
1---2name: verify-with-docs3description: Verify a specific or fast-moving library, framework, or API against its current documentation before writing code — retrieval-first, never from memory. Use when implementing against a named dependency (especially one that changes fast or whose exact signatures matter), when unsure of an API's current shape, or when the task mentions "which version", "latest API", "did this change", "check the docs", "SDK", or a specific library/framework by name.4---56# Verify With Docs (Retrieval-First)78Your training data has a cutoff and libraries move fast, so for any code that9touches a specific dependency, **retrieve before you write.**10Prefer retrieval over pre-training memory — never trust the model's memorized11API surface when the current docs are reachable.1213## When this applies1415Reach for this skill when the task:1617- implements against a named library/framework/SDK, especially a fast-moving one18 (web frameworks, cloud SDKs, AI/LLM SDKs, build tools, ORMs);19- depends on exact signatures, option names, return shapes, or config keys;20- says "latest", "current", "did X change in version Y", or names a version;21- is failing with an error that looks like a wrong/renamed API.2223Skip it for stable stdlib usage you are certain of, or pure logic with no24external API surface.2526## References Local-First2728Before fetching from the web, check if the target library is available as a29local reference in `opencode.jsonc` → `references`. If mounted (e.g., via30`references: { "opencode": { "repository": "anomalyco/opencode" } }`), read31the source code from the local clone first. Only fall back to web fetch if:32- The reference is outdated (commit older than the version in use)33- The reference does not cover the relevant code paths34- No reference is mounted for the target library3536## The loop37381. **Pin the exact version.** Read the version actually in use before reading any39 docs — the docs must match it.40 - JS/TS: `package.json` + the lockfile (`node_modules/<pkg>/package.json` is41 the ground truth for the installed version).42 - Python: `pyproject.toml` / `requirements.txt` / `pip show <pkg>`.43 - Go: `go.mod`. Rust: `Cargo.toml` / `Cargo.lock`.442. **Go to the primary source, matched to that version.** Prefer, in order:45 official docs for that version → the library's own repo (tag/branch matching46 the version) → typed definitions shipped with the package (`.d.ts`, stubs,47 godoc) → reputable references. Skip blog posts and Q&A for signatures.483. **Extract only what you need.** The exact signature, required vs optional49 params, return type, error modes, and any breaking-change note between the50 installed version and what memory assumes. Don't dump whole pages into51 context — quote the minimal relevant lines.524. **Report verified facts with citations.** Every signature you hand back must53 carry a source URL or file path so the implementing agent can trust it.545. **Only then implement** — against the retrieved API, not the remembered one.5556## Prefer mounted references over repeated fetches5758For a library you consult often, mount it once as an OpenCode **reference** so59agents search a local, version-pinned copy instead of re-fetching docs every60session (cheaper and offline-safe):6162```jsonc63// opencode.json64"references": {65 "somelib": {66 "repository": "https://github.com/org/somelib",67 "branch": "v4" // pin to the version you actually use68 },69 "internal-lib": {70 "path": "./vendor/internal-lib",71 "description": "Our vendored copy — read-only context"72 }73}74```7576Then search the mounted reference for the exact API before answering. If the77reference is missing or stale, refresh it rather than falling back to memory.7879## Output format8081```82## Verified against docs83- <API/signature> — source: <URL or path> (version <x.y.z>)84- <option/return shape> — source: <URL or path>8586## Changed / gotchas (if any)87- <what differs from a naive memory-based guess, and why it matters>8889## Ready to implement90<one line: the caller can now code against the above without guessing>91```9293## Anti-patterns9495- Writing the call first and "checking later" — verify before you write.96- Citing a doc version that doesn't match the installed version.97- Pasting entire doc pages into context instead of the few relevant lines.98- Trusting a blog/Q&A snippet over the official docs or the shipped type definitions.