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.
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.
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.
ID: developer-documentation.api-reference.code-examples
Severity: high
What to look for: For each major API method, endpoint, or component, check whether the documentation includes a working code example showing how to call it. "Major" means any function a typical user would call in their first hour of using the project. Examples should show import statements, function calls with realistic parameters, and expected output or behavior. Count every documented endpoint or feature section and enumerate which ones include code examples vs. which lack them. Report: X of Y sections have code examples.
Pass criteria: Each major API method has at least one code example in the documentation. Examples include imports, realistic parameter values, and show expected output or behavior. Examples are syntactically correct for the project's language. Report even on pass: "X of Y feature sections include code examples." At least 1 implementation must be confirmed.
Fail criteria: API documentation lists methods but provides no code examples, or examples are pseudocode that cannot be copied and run, or examples use outdated API signatures. Do NOT pass if examples exist but use deprecated APIs or outdated syntax that would fail in the current version.
Skip (N/A) when: The project has no public API (standalone application).
Cross-reference: The copy-paste-runnable check in Content Quality verifies that these examples actually execute without modification.
Detail on fail: Example: "API reference documents 10 methods but only 2 have code examples -- 8 methods show only the function signature" or "Examples use import syntax that doesn't match the package's actual exports"
Remediation: Add a code example for each major method. Keep examples minimal but complete:
### `client.query(prompt, options?)`
Sends a query and returns the response.
```ts
import { createClient } from 'your-package'
const client = createClient({ apiKey: process.env.API_KEY })
const response = await client.query('What is the capital of France?', {
model: 'gpt-4',
maxTokens: 100
})
console.log(response.text) // "The capital of France is Paris."