liveBook · Manning

Documentation generation

As explained in Coding with AI

Documentation generation is the automatic production of software documentation from source code, comments, or related project information.

Documentation generation uses generative AI to turn source code and comments into code documentation, reducing routine writing while leaving developers responsible for accuracy and revision. section 1.7.2 section 2.1.2

A practical workflow is:

  • Select code in an editor or ask through a chat window. section 2.1.2
  • Use comments, function names, and surrounding project code to provide context. section 2.1.2
  • Review, edit, and revise the generated documentation rather than accepting it unchanged. section 3.4

From blank page to reviewed draft

A developer can highlight a Python function and ask GitHub Copilot to document it in the editor or chat window. Copilot produces comments or other code documentation; the developer checks the result and corrects omissions. For broader design documents, ChatGPT can create a first draft in seconds, shifting the work from initial creation to curation. section 2.1.2 section 3.4

Figure 2.8 You can automatically generate comments and other code documentation using Copilot. This is one of my favorite features of the tool, as it saves a tremendous amount of time.
A screenshot of a computer

Description automatically generated

View an example of Copilot automatically generating comments and other code documentation. section 2.1.2

How Coding with AI covers it

How deep it goes
Demonstrates editor and chat workflows, then stops short of prescribing documentation standards or eliminating human review.
Examples
Uses GitHub Copilot comments, Python code, editor and chat prompts, and ChatGPT-assisted system overviews and design documents.
What it assumes
Assumes working code and access to an AI coding or chat tool, while demonstrating the documentation workflow directly.
What you can do after
Apply it via GitHub Copilot or ChatGPT to produce documentation drafts, then curate and revise them.
How it connects
Connects documentation generation with generative AI, source code, comments, IDEs, and large language models.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Coding with AI. The section links point to the parts of the book it draws on.