What is docs-as-code?
Docs-as-code means writing and shipping documentation with the same tools as code: plain-text files in git, changed through pull requests, built and checked by automation. It gives docs version history and review. It does not, by itself, make them correct: nothing checks that a page still matches the code.
What it includes
- Source files in Markdown, MDX, reStructuredText or AsciiDoc.
- A repository, ideally the same one as the code.
- Pull requests and review for every change.
- A static site generator such as Docusaurus, MkDocs, Sphinx or Starlight.
- CI that builds the site and runs linters and link checks.
What it fixes
Writers and engineers use one workflow. Docs have history, so you can see when a sentence changed and why. A release can ship the docs that match it, and a pull request can include the docs change next to the code change that needs it.
What it does not fix
Build and link checks tell you the site compiles. They cannot tell you that a page says the default is 30 seconds while the code now says 10. A docs-as-code repository can drift as easily as a wiki. The files are just easier to check.
Closing the gap
- Keep docs and code in one repository, or map code folders to the pages that describe them.
- Review docs impact in each pull request, with the evidence quoted.
- Scope the check to the pages that matter, and skip generated pages and changelogs.
- Audit existing pages on a schedule to find the drift that is already there.

A small example
A team keeps docs in the same repository as the code. A pull request changes the default retry count from three to five. The docs build passes, links resolve and the reviewer approves. Three weeks later a user asks why retries seem to run longer than the page claims. Every docs-as-code check passed, because none of them compares a sentence with a value. The page was fine as a file and wrong as a statement, and only a check that reads both would have said so.
Try it on your next pull request.
Free for public repositories, with unlimited members.
Start free with GitHub