Docsbook
← Back to catalog
creation

docs-from-code

Build Markdown docs from a code repository — README, source tree, exported APIs, examples, comments. Use when the source of truth is GitHub source code rather than a marketing site. Produces docs-output/<name>/ ready for /docs-publish or the full /docs-create pipeline.

Install & use this skill

Pick your AI client — install this single skill and call it.

1. Install
npx skills add Docsbook-io/docs-skills --skill docs-from-code -a claude-code
2. Use
/docs-from-code

Invoke as a slash command in chat.

Or: runtime discovery via Docsbook MCP

Already connected to the Docsbook MCP server? Skip install — ask your agent to load this skill on demand.

@docsbook find_skill "docs-from-code"

docs-from-code — Build docs from a code repository

The actual work is done by the docs-code-crawler subagent (Haiku, pinned model) shipped in docs-claude-plugins. This skill is the knowledge base — the subagent is the executor.

Workflow#

  1. Resolve the repo. Accept github.com/<owner>/<repo> or a local path. For GitHub URLs, use gh repo clone --depth 1 into a temp directory; for local paths, work in place.
    • Take the project name from the repo name (the <repo> part after owner/), not from a guess. Use it for the docs-output/<name>/ folder and the workspace display name. If you're working from an unnamed local path with no clear name, ask the user rather than inventing one.
  2. Detect the project type. Inspect root files: package.json (Node/TS), pyproject.toml / setup.py (Python), go.mod (Go), Cargo.toml (Rust), *.csproj (.NET). Pick the strongest signal; on conflict, prefer the one with a lib / src / pkg directory.
  3. Extract the README spine. Convert the root README.md into docs-output/<name>/README.md. Split long top-level sections (## Installation, ## Usage, ## API) into dedicated pages under getting-started/, guides/, api/.
  4. Enumerate the public API surface. For Node/TS: read package.json#exports and the entry files; for Python: read __all__ from the top package; for Go: list exported identifiers from each top-level package. Generate one Markdown file per module / package under api/.
  5. Pull in examples. If examples/, samples/, or demo/ exists, copy each subfolder's README (or generate one from the file tree) into guides/<example>.md.
  6. Read configuration docs. Look for .env.example, config/*.example.*, docker-compose.yml — generate a guides/configuration.md listing variables with descriptions pulled from adjacent comments.
  7. Write _branding.json. Source: package.json#author, GitHub repo description, repo avatar from https://github.com/<owner>.png. No accent color is detected here — leave accentColor absent so the workspace configurator skips update_branding rather than picking a default.

Guardrails#

Acceptance Criteria#

View source on GitHub →Browse full catalog repo →
Keywords
coderepogithubsourcegenerateapireadme