Here's a change that ships every day somewhere:
// before export function createClient(apiKey: string): Client // after export function createClient(options: { apiKey: string; region?: Region }): Client The PR is small, the tests pass, two people approve it. It merges.
Meanwhile docs/quickstart.md still says:
const client = createClient(process.env.ACME_API_KEY); Nobody touched that file, so nobody reviewed it. The first person to notice is a new user who copies the Quickstart, gets a type error on line one, and decides your SDK is broken. They're half right.
Why this keeps happening
Code review is built around the diff. Reviewers read the lines that changed. The docs that describe those lines usually live somewhere else: another folder, another repo, sometimes another team. Nothing in the PR points at them, so nobody checks them.
Tests don't help either. Your test suite checks that createClient works. It doesn't check that the page telling people how to call it is still true.
So docs drift one small, reasonable PR at a time.
Three checks you can add today
None of these need a new tool.
1. A docs line in the PR template
.github/pull_request_template.md:
## Docs - [ ] Nothing users see changed - [ ] I updated the pages that describe this change: <!-- links --> It's cheap and it works about as well as any checkbox: it reminds the author, but the author still has to know which pages to update.
2. Make the docs owner a reviewer on the code the docs describe
In .github/CODEOWNERS, add your docs owner to the paths that public docs describe:
/src/client/ @acme/sdk-team @acme/docs /src/api/ @acme/api-team @acme/docs Now a change to the client asks a docs person for a review. This works well on small teams. On busy repos it turns into a flood of review requests that people start skipping.
3. Compile your code samples
If your docs are full of code, treat the code samples as code. Pull them out of the Markdown and type-check them in CI.
scripts/extract-doc-samples.mjs:
import { globSync, mkdirSync, readFileSync, writeFileSync } from "node:fs"; mkdirSync("doc-samples", { recursive: true }); let n = 0; for (const file of globSync("docs/**/*.md")) { const text = readFileSync(file, "utf8"); for (const [, code] of text.matchAll(/`{3}ts\n([\s\S]*?)`{3}/g)) { writeFileSync(`doc-samples/sample-${n++}.ts`, code); } } console.log(`extracted ${n} samples`); tsconfig.docs.json, pointing your package name at your source:
{ "compilerOptions": { "strict": true, "noEmit": true, "target": "es2022", "module": "esnext", "moduleResolution": "bundler", "paths": { "@acme/sdk": ["./src/index.ts"] } }, "include": ["doc-samples"] } And in your workflow:
- run: node scripts/extract-doc-samples.mjs - run: npx tsc -p tsconfig.docs.json This would have caught the createClient example above. The catch: it only covers full, runnable samples. A lot of docs are fragments (client.forecast("Berlin") with no setup), and prose like "retries default to 2" can't be compiled at all.
Automating the rest
That gap is what I've been working on. I built Rimfe, a GitHub app that does the "which docs did this PR just make wrong?" part.
On each pull request it:
- finds the docs pages that describe the code that changed, in the same repo or in a separate docs repo
- compares what the docs say with what the code now does, prose included, not only code samples
- posts a check and a comment that quotes the code and the docs side by side, with a suggested Markdown fix
- opens a docs PR with the fix when you tick a box, or commits it to the same PR with
@rimfe apply patch
A person approves every change. It works with Docusaurus, MkDocs, Mintlify, Fumadocs, Nextra and plain Markdown.
It's free for public repositories, and the free plan includes 10 reviews a month on one private repo.
It will sometimes miss things and sometimes flag something that's still right. If it does, reply @rimfe wrong on the PR and tell me, because that's the feedback I need most right now.
Over to you
How does your team keep docs in sync with code today? A checkbox, a docs owner, tested samples, or hoping for the best? I'd like to hear what's actually worked.



