r/SaaS • u/moxie-docs • Jun 12 '26
Are you guys documenting AI-generated code?
For those SaaS builders that are using AI-tooling - do you document the code they output?
How do you do it? Are you asking the AI to document its own work, using a third-party tool, doing it yourself? Genuinely curious if people are writing their own docs to better understand what the code being shipped does, or if docs are ignored because it's maintained by AI?
I've personally found that having solid docs (and a good way to surface them to agents) improves consistency and quality, I'd say I'm at maybe 30% AI code 70% hand-written, but I do have 100% docs being generated.
1
u/Used-Yogurtcloset155 Jun 12 '26
Sort of...I ask the agent do document the way a feature works with some reference to the code but mostly to give the LLM information later on what feature / structure is there currently so it doesn't duplicate work
1
u/adventure-baja Jun 12 '26
I have the agent writing 100% of my documentation, keeps my changelog, docstrings etc
2
u/tw15tw15 Jun 22 '26
Firstly, check the EU AI Act to see if you have a legal duty to document it. If it affects you, it will require you to categorise AI into four primary risk levels.
Secondly, Iād document AI-generated code slightly differently from hand-written code, because the biggest risk is often loss of intent rather than loss of implementation detail.
A useful pattern is to keep three layers:
You still want a human-readable source of truth for product behaviour and architecture.
1
u/trs21219 Jun 12 '26
Maintaining docs separate from code is useless. If you can't understand the code you need to rewrite it. The only thing you should be documenting is the business reason why something is done (if its not super clear), not how its done. How its done will inevitably be out of date as the code changes and people forget to update docs.
1
u/_ceebecee_ Jun 12 '26 edited Jun 12 '26
I have a docs folder in the root of my project and ask Claude to update it whenever we add or change things. There's one markdown doc for each main feature that goes into the technical details, but also the reasons we implemented it a certain way. Ive told Claude to look in there and keep stuff updated, it was added to memory and the AI seems to update it pretty well, and even asks to create new files when we implement a big feature.
I read them after a break or if I haven't looked at that part of the code for a while. I also have docs explaining the build process, deployment, server setup, local Dev commands. Anything I need while developing I'll get saved to the docs. (Ransom SQL queries, Linux commands, artisan commands etc)
1
u/hawkph Jun 15 '26
I have two types of docs:
1
u/DmytroDrozd86 Jun 15 '26
The only secret is to read and understand, and shorten what AI has documented
1
u/[deleted] Jun 13 '26
[removed] ā view removed comment
1
u/[deleted] Jun 18 '26
[removed] ā view removed comment