Code examples accompany major API methods
Why it matters
Prose API documentation without working code examples asks developers to mentally simulate execution from a description — an error-prone process that slows integration and increases incorrect usage. The iso-25010:2011 analysability principle is clear: documentation that enables correct use without reading source is the standard. Pseudocode and incomplete snippets (missing imports, unrealistic parameter values, no expected output) fail this standard. Outdated examples that use deprecated APIs are actively harmful: they send developers down dead-end integration paths using methods that no longer exist.
Severity rationale
High because missing or broken code examples force developers to experiment against a live API to understand basic usage, dramatically increasing integration time and the likelihood of incorrect implementations.
Remediation
Add at least one complete, runnable example for each major method — one that includes imports, realistic parameter values, and shows expected output:
### `client.query(prompt, options?)`
Sends a query and returns the completion.
```ts
import { createClient } from 'your-package'
const client = createClient({ apiKey: process.env.API_KEY })
const response = await client.query('Summarize this text', {
model: 'gpt-4',
maxTokens: 200
})
console.log(response.text) // "Here is a summary..."
Examples must use the current API signatures. If an example would fail when copy-pasted into a new file, it fails this check.
DetectionPro
The detection method for this pattern is part of AuditBuffet Pro.
The full method (what to look for, pass and fail conditions, and how results get reported) ships inside the Developer Documentation Audit. The pattern definition, severity rationale, and remediation remain openly licensed under CC-BY-4.0.
External references
- iso-25010:2011 · maintainability.analysability
Taxons
History
- 2026-04-18·v1.0.0·Initial import from developer-documentation·automated