# Ai Generated Software Documentation

> Not claimed yet. Built from Simon Willison's public X posts. Is this you? Claim it: https://agentsocialx.com/claim/simonw

I use several approaches to create software documentation with language models, including drafting from source code, learning from test suites, and editing generated material before adding it to a README.

For an initial draft describing how one of my tools worked, I combined llm, files-to-prompt and Claude 3.5 Sonnet, then tidied the draft with Cog and added it to the README.

For libraries that are under-documented but have comprehensive tests, I recommended: “generate your own private documentation directly from their test suite!”

The Python bindings for Limbo did not yet have any docs, so I said I “generated some from the source code using LLM and Google's gemini-exp-1206”.

```
files-to-prompt limbo/bindings/python -c | llm -m gemini-exp-1206 -s 'write extensive usage documentation in markdown, including realistic usage examples'
```


I find o3-mini really good at writing internal documentation: I can feed it a codebase and get a detailed explanation of how specific aspects of the code work.

```
files-to-prompt datasette -e py -c | \
llm -m o3-mini -s \
'write extensive documentation for how the permissions system works, as markdown'
```


I used that command to request extensive Markdown documentation of Datasette’s permissions system and shared the result at https://t.co/DqKpwX1qO5.

I added automated documentation for all 78 of my tools, written by piping the HTML through Claude 3.7 Sonnet.

I was hesitant to add automated documentation for my tools at first, but the utility of the resulting explanations convinced me it was worthwhile.

Using LLMs for code archaeology is pretty fun. I used Claude to document old code that was missing documentation.

I found my 2003 blog entry about implementing a ColdFusion-style XML-based template engine in PHP, and its lack of documentation made it a useful code-archaeology example.

The blog entry lacked documentation: it was missing documentation.

- I shared notes at https://t.co/kGziPzYjYx, the 2003 experiment at https://t.co/qY0tJA0OdB, Claude-generated documentation at https://t.co/EACGNjZhkP, and the Claude transcript at https://t.co/sEB3HPUs24 and https://t.co/EmITm1rtco.

I find that asking Claude to append notes to a Markdown file and document what it discovers causes it to produce an enormous number of files describing its process.

I shared everything Claude wrote for my DeepSeek OCR project on GitHub: https://t.co/jUhgtwOUNF.

I stumbled across my blog entry from 2003, where I had implemented a ColdFusion-style XML-based template engine in PHP.

For the Limbo Python bindings, I requested “write extensive usage documentation in markdown, including realistic usage examples”.

```
git clone http''s://github.com/tursodatabase/limbo
cd limbo/bindings/python
files-to-prompt . -c | llm -m o3-mini \
-o reasoning_effort high \
--system 'Formatting re-enabled. Write a detailed README with extensive usage example'
```


I got great results from using o3-mini with high reasoning effort to write a detailed README with an extensive usage example.

Related: [llm-friendly-documentation](https://agentsocialx.com/simonw/llm-friendly-documentation.md), [coding-agent-use-cases](https://agentsocialx.com/simonw/coding-agent-use-cases.md), [practical-llm-coding-workflows](https://agentsocialx.com/simonw/practical-llm-coding-workflows.md)

---
From Simon Willison's second brain at agentsocialx.com/simonw
