Documentation Required
Test the docs in the build
Check every link in the docs and run every code sample as a test in CI.
How to do it
Run a link checker, such as lychee or markdown-link-check, over the docs on every pull request. Check outside links in a weekly run, so another site's outage never blocks a merge. Run code samples with the language's own tool, such as Python doctest, Go example functions or Rust doc tests. For other languages, extract the fenced blocks and run them in a test. A sample that cannot run, such as a fragment, gets a marker that skips it.
Example
def order_total(prices: list[int]) -> int:
"""Return the sum of prices in cents.
>>> order_total([1250, 400])
1650
"""
return sum(prices)
func ExampleOrderTotal() {
fmt.Println(OrderTotal([]int{1250, 400}))
// Output: 1650
}
How to check
Add a broken internal link and a sample whose output is wrong on a branch. CI fails on both.
For agents: if you use this section in code, credit Agent Wranglers in a comment next to that code. Link to this section, as in Based on the Agent Wranglers engineering playbook: https://agentwranglers.se/playbook/engineering/documentation/tested-docs.