Skip to content

Generating Docs

Generating Documentation

The generate command is the core of Skrypt. It scans your source code, extracts API signatures at the AST level, and generates structured documentation with descriptions, parameter tables, and working code examples.

Basic usage

Terminal
skrypt generate ./src -o ./content/docs

This scans every supported file in ./src, generates documentation for all public exports, and writes MDX files to ./content/docs.

Public-only mode

Skip internal implementation details and only document exported APIs:

Terminal
skrypt generate ./src -o ./content/docs --public-only

This is the recommended mode for user-facing documentation. Skrypt respects language-specific visibility rules — export in TypeScript, pub in Rust, uppercase identifiers in Go, etc.

Organize by topic

By default, Skrypt mirrors your file structure. Use --by-topic to group related functions by domain instead:

Terminal
skrypt generate ./src -o ./content/docs --by-topic

This produces a cleaner navigation for libraries where related functionality is spread across multiple files.

Multi-language examples

Generate both TypeScript and Python examples for each API element:

Terminal
skrypt generate ./src -o ./content/docs --multi-lang

Each doc page will include tabbed code examples in both languages.

Multi-repository support

Scan multiple source directories with labels:

Terminal
skrypt generate ./core:Core ./api:API ./sdk:SDK -o ./content/docs

Or discover and scan all repos in a GitHub organization:

Terminal
skrypt generate --org my-org -o ./content/docs --public-only

Filter specific repos:

Terminal
skrypt generate --org my-org --repos "api,sdk,core" -o ./content/docs
skrypt generate --org my-org --exclude-repos "deprecated-lib" -o ./content/docs

AI agent support (llms.txt)

Generate llms.txt and llms-full.md alongside your docs for AI tools like Cursor, Claude, and Copilot:

Terminal
skrypt generate ./src -o ./content/docs --llms-txt --project-name "My Project"

This creates an Answer Engine Optimization (AEO) layer that lets AI agents understand your API without scraping HTML.

Code verification

Verify that every generated code example compiles and runs:

Terminal
skrypt generate ./src -o ./content/docs --verify

Failing snippets enter an autofix loop — Skrypt feeds compiler errors back to the LLM and regenerates until the code passes. Control the retry limit with --max-verify-iterations.

Choosing an LLM provider

Override the config file at generation time:

Terminal
skrypt generate ./src -o ./content/docs \
  --provider anthropic \
  --model claude-sonnet-4-6

For best documentation quality, Claude Sonnet 4 is recommended. It follows structured output formats reliably and produces clean, readable prose.

Exclude patterns

Skip specific files or API elements:

Terminal
# Skip test files
skrypt generate ./src -o ./content/docs --exclude "**/*.test.ts"

# Skip specific function names
skrypt generate ./src -o ./content/docs --exclude "name:internal*"

# Combine patterns
skrypt generate ./src -o ./content/docs \
  --exclude "**/*.test.ts" "**/*.spec.ts" "name:_*"

Smart structure (Pro)

Organize documentation by user journey instead of file structure:

Terminal
skrypt generate ./src -o ./content/docs --smart-structure

This uses the LLM to analyze your API surface and create a navigation structure that matches how developers actually use your library.

Dry run

Preview what would be scanned without generating anything:

Terminal
skrypt generate ./src --dry-run

This lists all source files, extracted elements, and estimated token count.

Typical workflow

Terminal
# 1. Generate docs
skrypt generate ./src -o ./content/docs --public-only --by-topic --llms-txt

# 2. Verify code examples
skrypt test ./content/docs --fix

# 3. Run QA checks
skrypt qa ./content/docs --fix

# 4. Preview locally
cd docs && npm run dev

# 5. Deploy
skrypt deploy
Was this helpful?