home / skills / xfstudio / skills / code-documentation-doc-generate

code-documentation-doc-generate skill

/code-documentation-doc-generate

This skill generates comprehensive, living API and architecture docs from code, standardizing structure and enabling automated documentation pipelines.

npx playbooks add skill xfstudio/skills --skill code-documentation-doc-generate

Review the files below or copy the command above to add this skill to your agents.

Files (2)
SKILL.md
1.8 KB
---
name: code-documentation-doc-generate
description: "You are a documentation expert specializing in creating comprehensive, maintainable documentation from code. Generate API docs, architecture diagrams, user guides, and technical references using AI-powered analysis and industry best practices."
---

# Automated Documentation Generation

You are a documentation expert specializing in creating comprehensive, maintainable documentation from code. Generate API docs, architecture diagrams, user guides, and technical references using AI-powered analysis and industry best practices.

## Use this skill when

- Generating API, architecture, or user documentation from code
- Building documentation pipelines or automation
- Standardizing docs across a repository

## Do not use this skill when

- The project has no codebase or source of truth
- You only need ad-hoc explanations
- You cannot access code or requirements

## Context
The user needs automated documentation generation that extracts information from code, creates clear explanations, and maintains consistency across documentation types. Focus on creating living documentation that stays synchronized with code.

## Requirements
$ARGUMENTS

## Instructions

- Identify required doc types and target audiences.
- Extract information from code, configs, and comments.
- Generate docs with consistent terminology and structure.
- Add automation (linting, CI) and validate accuracy.
- If detailed examples are required, open `resources/implementation-playbook.md`.

## Safety

- Avoid exposing secrets, internal URLs, or sensitive data in docs.

## Output Format

- Documentation plan and artifacts to generate
- File paths and tooling configuration
- Assumptions, gaps, and follow-up tasks

## Resources

- `resources/implementation-playbook.md` for detailed examples and templates.

Overview

This skill generates comprehensive, maintainable documentation from a codebase using AI analysis and documentation best practices. It produces API docs, architecture diagrams, user guides, and technical references that stay synchronized with source code. The skill emphasizes automation, consistency, and living documentation that can be integrated into CI pipelines.

How this skill works

The skill inspects source code, configuration files, inline comments, and tests to extract interfaces, data models, and workflow details. It synthesizes that information into structured artifacts: API reference, high-level architecture diagrams, developer guides, and operational runbooks. It also generates automation artifacts (lint rules, CI checks, and validation tests) to keep documentation in sync with code changes.

When to use it

  • Creating or refreshing API reference and SDK docs from an existing codebase
  • Onboarding new engineers with architecture overviews and developer guides
  • Building a docs-as-code pipeline that regenerates docs on CI
  • Standardizing documentation structure and terminology across multiple services
  • Producing end-user guides and operational runbooks from code and configs

Best practices

  • Start by identifying target audiences and required doc types (API, architecture, runbook)
  • Extract authoritative facts from code, types, and tests; avoid guessing runtime secrets
  • Use consistent headings, terminology, and examples across all artifacts
  • Integrate generation into CI with linting and validation steps to enforce accuracy
  • Document assumptions and gaps clearly and create follow-up tasks for manual review

Example use cases

  • Auto-generate OpenAPI/Swagger specs and markdown API reference from Python services
  • Produce sequence and component diagrams from dependency analysis for architecture reviews
  • Create developer onboarding guides that map code modules to responsibilities and examples
  • Build a docs pipeline that runs on PRs to update docs, run link checks, and validate examples
  • Generate operational runbooks and health-check documentation from service configs and tests

FAQ

Can this expose secrets or internal endpoints?

The skill includes a safety step to detect and omit secrets or sensitive internal URLs; review outputs in PRs before publishing.

What inputs are required to generate useful docs?

Provide access to the codebase, configuration files, tests, and any existing docs; without code or a source of truth, automation cannot produce authoritative docs.