AI code review

AI code documentation

AI code documentation turns the work nobody does, docstrings, READMEs, change notes, into something that actually gets written, by generating a first draft from the code itself and keeping it current as the code changes. The win is not prose volume; it is documentation that exists and stays true, because the docs that hurt most are the ones that drifted out of sync and now lie about how the code works.

AI code documentation turns the work nobody finds time for, docstrings, READMEs, change notes, into something that actually gets written: it drafts from the code itself and updates as the code changes. The win is not more prose; it is documentation that exists and stays true, because the docs that do the most damage are not the missing ones, they are the ones that drifted out of sync and now confidently describe how the code used to work.

What does AI code documentation actually generate?

Three layers, and they earn their keep in different ways. At the function level, docstrings, what it takes, what it returns, what it throws, drafted from the signature and body so the next reader does not have to reverse-engineer intent. At the module level, a README or overview that explains what this part of the system is for and how the pieces connect, the orientation a new contributor needs and never finds. At the change level, a summary of what a pull request actually did, generated from the diff, so the history is readable later. The honest line is that the AI produces a strong first draft grounded in the code, not the final word, it describes what the code does, and a human still adds the why the code reads cannot reveal: the constraint, the trade-off, the bug this guards against.

Why is documentation drift the real problem AI solves?

Because stale documentation is worse than none, and drift is the default state. A README written on day one is accurate for a week; then the code moves and the doc quietly becomes a lie that a new developer trusts and gets burned by. Humans rarely update docs, the change ships, the doc is forgotten, and the gap widens silently until someone wastes an afternoon on instructions that no longer match reality. This is where AI changes the economics: regenerating a docstring or a module overview from the current code is cheap enough to do on every change, so the docs track the code instead of falling behind it. The point is not that AI writes prettier docs; it is that AI makes keeping docs current affordable enough that it actually happens.

How does documentation connect to the review workflow?

Documentation is the other side of the same review pass. When a pull request changes behavior, the AI can flag that the docstring or README no longer matches and draft the update right there in the diff, so a doc fix ships with the code change instead of being deferred forever. This closes the loop that review usually leaves open, a reviewer catches the logic but rarely notices the now-wrong comment three files away. We treat documentation the way we treat any AI-run output: the machine drafts it inside the workflow, a person approves it before it lands, and the doc travels with the code it describes. A change that updates the behavior and the documentation in the same reviewed unit is a change you can trust six months later.

What documentation still needs a human to write?

The reasoning, not the description. AI can document what a function does from its code; it cannot document why you chose this approach over the obvious one, what production incident this defensive check exists to prevent, or which constraint made the ugly solution the right one. That is the documentation that saves the most time later, and it lives only in the head of the person who made the decision. The architecture decision record, the “here is the trade-off we accepted,” the warning about the sharp edge, those a human writes, because they are judgement, not transcription. Let AI keep the descriptive layer current and accurate on every change; reserve the human’s writing for the intent that the code can never explain on its own.

This is the documentation half of a clean codebase, the other half is the review that catches the change. See GitHub AI code review for wiring review into the workflow, and start at AI code review for the full model. The engineering pod we run treats documentation and review as one discipline: the Web / Engineering Team kit.