generate-docs

Generate project documentation from an existing codebase. This documentation shall serve Agents and Humans. Creates a project overview, module documentation, and feature documentation with explicit inventories (files/dirs + symbols) for each module. Use this skill when onboarding a new project or creating initial documentation for an undocumented codebase.

23 stars

Best use case

generate-docs is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Generate project documentation from an existing codebase. This documentation shall serve Agents and Humans. Creates a project overview, module documentation, and feature documentation with explicit inventories (files/dirs + symbols) for each module. Use this skill when onboarding a new project or creating initial documentation for an undocumented codebase.

Teams using generate-docs should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/generate-docs/SKILL.md --create-dirs "https://raw.githubusercontent.com/christophacham/agent-skills-library/main/skills/ai-ml/generate-docs/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/generate-docs/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How generate-docs Compares

Feature / Agentgenerate-docsStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Generate project documentation from an existing codebase. This documentation shall serve Agents and Humans. Creates a project overview, module documentation, and feature documentation with explicit inventories (files/dirs + symbols) for each module. Use this skill when onboarding a new project or creating initial documentation for an undocumented codebase.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# Skill: Generate Documentation

## What This Skill Does

Creates structured project documentation from an existing codebase. This documentation shall serve Agents and Humans when working in consecutive sessions with the project.

Produces three artifact types:

1. **Project Overview** (`docs/overview.md`) - High-level architecture, module listing, feature listing
2. **Module Documentation** (`docs/modules/<name>.md`) - Overview + exhaustive inventories (files/dirs + symbols)
3. **Feature Documentation** (`docs/features/<name>.md`) - How features work, with implementation references

## When to Use

- When a project has no structured documentation yet
- When onboarding to an unfamiliar codebase
- When the user asks to "document this project" or "create documentation"

Do NOT use this skill to update existing documentation - use `update-docs` instead.

## Execution Model

- The primary agent spawns `doc-explorer`. `doc-explorer` explores the repo and writes artifacts under `docs/`.
- Rationale: documentation is primarily anchored in the codebase (not in the conversation). Keeping exploration + writing in the same subagent session reduces context loss.
- For large codebases with multiple modules, `doc-explorer` self-delegates: it spawns additional `doc-explorer` instances scoped to individual modules (see Self-Delegation below).
- The primary agent should keep chat output minimal (paths changed + any open questions).

## Self-Delegation

For projects with 3+ modules or modules with 50+ files, doc-explorer SHOULD delegate per-module work to separate doc-explorer instances via the Task tool:

1. **Orchestrator instance**: Identifies modules, creates `docs/overview.md`, spawns per-module instances
2. **Per-module instance**: Receives scoped task ("document module X in directory Y"), explores only that module, writes `docs/modules/<name>.md`
3. **Orchestrator**: Collects status, writes cross-cutting feature docs

This prevents unnecessary context growth from accumulating the entire codebase analysis in a single context.

## Workflow

### Step 1: Assess the Project

Gather information using read/glob/grep and git history.

- Identify the project type, language, framework
- Find the entry points, main modules, key directories
- Identify major features from code, tests, or existing README
- Check if any documentation already exists (skip what exists, or ask user)

### Step 2: Identify Modules

A module is a self-contained part of the project. Criteria for module boundaries:

- Has its own directory/package structure
- Has a clear responsibility (e.g., "authentication", "API layer", "database")
- Could theoretically be replaced independently
- For single-module projects: the entire project is one module

For large codebases, self-delegate per-module analysis to separate doc-explorer instances.

### Step 3: Create the Project Overview

Create `docs/overview.md` following the template structure:

- Fill in project purpose and architecture description
- List all identified modules with brief descriptions
- List key features with brief descriptions  
- Include development setup if discoverable (package.json, Makefile, etc.)
- Link to module and feature docs (even if not yet created)

### Step 4: Create Module Documentation

For each identified module, create `docs/modules/<module-name>.md`:

- **Overview section** (always): Responsibility, dependencies, boundaries
- **Structure**: Exhaustive directory/file inventory for the module (each entry has a purpose)
- **Key Symbols**: Exhaustive symbol inventory for the module (each entry has a purpose + location)
- **Data Flow**: How data moves through this module

For large modules, self-delegate: spawn a separate doc-explorer instance scoped to that module's directory.

### Step 5: Create Feature Documentation

For each identified feature, create `docs/features/<feature-name>.md`:

- User flow: what the user experiences
- Technical flow: what happens under the hood
- Implementation references: which modules and symbols are involved
- Edge cases and limitations

Feature docs are inherently incomplete - document what is discoverable and note gaps.

### Step 6: Verify and Report

- Ensure all cross-references between documents are valid
- Present a summary of created documents
- Flag any gaps or areas that need manual enrichment

## Rules

1. **File-based interface**: All output goes into `docs/` directory files. Do not return documentation as chat messages.
2. **No redundancy**: Don't duplicate information between overview and module/feature docs. Use references.
3. **Stack-agnostic**: Do not assume any specific language or framework. Discover everything from the codebase.
4. **Inventories are explained**: File/dir and symbol listings MUST include a purpose; listings without explanation are not acceptable.
5. **No built-in explore agent**: Do NOT use the built-in `explore` subagent type. Self-delegate to `doc-explorer` instead.
6. **Self-delegate for scale**: For large codebases, spawn additional `doc-explorer` instances per module via the Task tool.
7. **Create directories**: Ensure `docs/`, `docs/modules/`, and `docs/features/` exist before writing.

## Templates

This skill includes normative templates as bundled files. Only read the templates when processing them. Output MUST follow the template headings and frontmatter keys:

- `tpl-project-overview.md` - Structure for the project overview
- `tpl-module-documentation.md` - Structure for module documentation
- `tpl-feature-documentation.md` - Structure for feature documentation

Related Skills

docs-writer

23
from christophacham/agent-skills-library

Write, review, and edit documentation files with consistent structure, tone, and technical accuracy. Use when creating docs, reviewing markdown files, writing READMEs, updating `/docs` directories, or when user says "write documentation", "review this doc", "improve this README", "create a guide", or "edit markdown". Do NOT use for code comments, inline JSDoc, or API reference generation.

docs:write-concisely

23
from christophacham/agent-skills-library

Apply writing rules to any documentation that humans will read. Makes your writing clearer, stronger, and more professional.

googledocs-automation

23
from christophacham/agent-skills-library

Automate Google Docs tasks via Rube MCP (Composio): create, edit, search, export, copy, and update documents. Always search tools first for current schemas.

google-docs

23
from christophacham/agent-skills-library

Interact with Google Docs - create documents, search by title, read content, and edit text. Use when user asks to: create a Google Doc, find a document, read doc content, add text to a doc, or replace text in a document. Lightweight alternative to full Google Workspace MCP server with standalone OAuth authentication.

docugenerate-automation

23
from christophacham/agent-skills-library

Automate Docugenerate tasks via Rube MCP (Composio). Always search tools first for current schemas.

docsumo-automation

23
from christophacham/agent-skills-library

Automate Docsumo tasks via Rube MCP (Composio). Always search tools first for current schemas.

algodocs-automation

23
from christophacham/agent-skills-library

Automate Algodocs tasks via Rube MCP (Composio). Always search tools first for current schemas.

docs:update-docs

23
from christophacham/agent-skills-library

Update and maintain project documentation for local code changes using multi-agent workflow with tech-writer agents. Covers docs/, READMEs, JSDoc, and API documentation.

structured-autonomy-generate

23
from christophacham/agent-skills-library

Structured Autonomy Implementation Generator Prompt

generate-image

23
from christophacham/agent-skills-library

Generate or edit images using AI models (FLUX, Nano Banana 2). Use for general-purpose image generation including photos, illustrations, artwork, visual assets, concept art, and any image that is not a technical diagram or schematic. For flowcharts, circuits, pathways, and technical diagrams, use the scientific-schematics skill instead.

generate-handover

23
from christophacham/agent-skills-library

Generate a session handover document that captures progress, decisions, and context for seamless session continuity. This documentation shall serve Agents and Humans when working in consecutive sessions with the project. Use this skill at the end of a work session or when context transfer to a new session is needed.

generate-agents-md

23
from christophacham/agent-skills-library

Generates a project-specific AGENTS.md that captures conventions, build commands, module rules, and coding standards. This file is read at session start by coding agents and helps keep behavior consistent.