tslateman

Hope for good stuff!

View on GitHub

Documentation as Code

Documentation deserves the same respect, rigor, and processes we apply to our code. Too often, documentation is an afterthought—something we grudgingly update when we remember. But what if we treated it as a first-class citizen in our development workflow?

The Problem with Traditional Documentation

Most documentation fails because:

Principles of Documentation as Code

1. Live with the Code

Keep documentation in the same repository as your code. When you change behavior, the documentation changes in the same commit. This proximity creates a natural reminder and makes it easier to keep things in sync.

2. Version Together

Documentation should travel through the same version control system. You should be able to checkout any commit and have documentation that matches that exact state of the code.

3. Review Like Code

Documentation changes should go through the same review process as code. Check for:

4. Test Your Docs

Just as we test code, we can test documentation:

5. Automate Where Possible

Practical Implementation

Start small:

  1. Move your README into your repo if it isn’t already
  2. Add documentation checks to your PR template
  3. Include “update relevant docs” in your definition of done
  4. Use markdown linters in your CI pipeline
  5. Treat documentation bugs with the same severity as code bugs

The Payoff

When documentation is treated as code:

Documentation as code isn’t about writing more—it’s about writing documentation that stays accurate, useful, and alive. Make it part of your development cycle, not an afterthought.

Remember: Code explains what and how. Documentation explains why.