> ## Documentation Index
> Fetch the complete documentation index at: https://gump.build/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Docgen

> Generate missing documentation from existing code.

# Docgen

Generate missing documentation from code.

<Note>
  **Community pattern** — copy this YAML and adapt the doc build gate to your project. Not available as a built-in via `gump run`.
</Note>

## When to use

When your codebase has working code but missing or outdated documentation.

## The workflow

```yaml theme={null}
name: docgen
max_budget: 4.00

steps:
  - name: analyze
    type: split
    get:
      context:
        - bash: "grep -rL '// Package' --include='*.go' . | head -20"
      prompt: |
        Identify undocumented packages.
        For each, produce a task with the package name and public API to document.
    run:
      agent: claude-sonnet
    gate: [schema]
    each:
      - name: document
        type: code
        get:
          prompt: |
            Generate documentation for: {task.description}
            Add doc comments to all public functions.
            Update or create README.md for the package.
        run:
          agent: claude-haiku
          guard:
            max_turns: 30
        gate: [compile]
        retry:
          - exit: 2

  - name: quality
    gate: [compile, test]
```
