Claude Skills Guide

Claude Code MkDocs Documentation Workflow

Documentation that lives alongside your code instead of drifting away from it is one of the most practical improvements you can make to a development project. MkDocs combined with Claude Code creates a workflow where your documentation updates happen as part of your development process rather than as a separate, often-neglected task. This guide shows you how to set up that workflow from scratch.

What Makes This Workflow Work

MkDocs builds static documentation sites from Markdown files. Claude Code reads your codebase, understands structure and purpose, and generates the Markdown content you need. The connection between them is simple: Claude writes or updates .md files in your docs/ folder, and MkDocs builds those into a browsable site.

You need three things to get started:

Optional but recommended skills accelerate specific parts: the pdf skill generates downloadable documentation exports, the supermemory skill remembers documentation decisions across sessions, and the tdd skill helps keep your docs in sync with test coverage.

Setting Up Your MkDocs Foundation

Create your documentation directory structure first. In your project root:

mkdir docs
cd docs
mkdocs new .

This creates a basic mkdocs.yml configuration and an index.md file. Edit mkdocs.yml to match your project:

site_name: Your Project Name
site_description: Documentation for Your Project
docs_dir: .
markdown_extensions:
  - toc:
      permalink: true
  - codehilite
nav:
  - Home: index.md
  - API: api.md
  - Guides: guides/index.md

Run mkdocs serve to preview locally. The site builds at http://127.0.0.1:8000 and updates as you modify files.

Generating API Documentation with Claude

The most valuable documentation is accurate API reference. Claude reads your source files and generates this automatically. Create a prompt file or session instruction:

Read all source files in src/ and generate API documentation.
For each function, include:
- Function name and signature
- Parameters with types
- Return value type
- One-sentence description of purpose
- Example usage if non-obvious

Output to docs/api.md with proper Markdown headers.

Run this in your Claude Code session:

claude -p "$(cat prompt.txt)" .

For a Python project, this produces output like:

## authenticate_user(username: str, password: str) -> bool

Authenticates credentials against the user database.

**Parameters:**
- `username` (str): The user's login name
- `password` (str): The plain-text password to verify

**Returns:** `bool` — True if authentication succeeds

**Example:**
```python
if authenticate_user("dev", "password123"):
    print("Access granted")

## Automating Documentation Updates

Manual updates still require remembering to run them. Connect documentation generation to your development workflow using git hooks or Claude's native prompt system.

Create a pre-commit hook at `.git/hooks/pre-commit`:

```bash
#!/bin/bash
# Run documentation update
claude -p "Update docs/api.md from current src/ files" .

Make it executable with chmod +x .git/hooks/pre-commit.

Alternatively, add a Makefile target:

.PHONY: docs

docs:
	claude -p "Review all source files and update docs/api.md" .
	mkdocs build

Run make docs whenever you want a full documentation refresh.

Adding Guided Content

API reference is mechanical. Guides and tutorials are where you add context that code alone cannot convey. Use Claude to draft these, then refine them yourself.

Start with a prompt:

Create a getting-started guide at docs/guides/getting-started.md.
Assume new users have basic Python knowledge but are unfamiliar
with this project's architecture. Cover:
1. Installation steps
2. Basic configuration
3. Your first API call
4. Common error messages and fixes

Write in a friendly, tutorial style with code blocks for every step.

Claude generates a first draft. Review it, add your project-specific details, and save. The frontend-design skill helps if you want to add visual elements or structured layouts to your guides.

Preserving Context Across Sessions

Documentation projects span multiple sessions. The supermemory skill stores decisions, style preferences, and architectural notes so you do not repeat yourself.

Configure it once:

claude /supermemory init

Then store documentation decisions:

claude /supermemory "Store: API docs use Google style, guides use present tense"

When starting new sessions, retrieve stored context:

claude /supermemory "Retrieve project documentation context"

This keeps your documentation consistent without re-explaining your conventions every time.

Exporting to PDF

Some audiences need downloadable documentation. The pdf skill converts your MkDocs site to PDF:

claude /pdf "Convert docs/ to docs/project-docs.pdf"

This is useful for offline distribution, client deliverables, or archived versions of your documentation.

Workflow Summary

The complete workflow looks like this:

  1. Write code in your source files
  2. Commit changes — pre-commit hook triggers doc generation
  3. Claude updates docs/api.md and related files
  4. Review the generated content
  5. Run mkdocs serve to preview
  6. Deploy with mkdocs gh-deploy or your preferred hosting

This keeps documentation current without requiring you to write it manually after every code change. The gap between code and docs shrinks to minutes rather than months.

Troubleshooting Common Issues

Claude misses some functions: Add more specific prompts that enumerate the files you want scanned. Use glob patterns explicitly.

MkDocs build fails: Run mkdocs build --verbose to see detailed errors. Most issues are missing files or YAML syntax in mkdocs.yml.

Navigation does not update: MkDocs requires explicit nav configuration. Update your mkdocs.yml nav section when adding new documentation files.

Documentation is inaccurate: Claude generates from code but cannot always infer intent. Always review generated docs before committing, especially for public APIs.

Extending the Workflow

Once the basics work, layer in additional capabilities:

Each extension adds a small piece of functionality without disrupting the core workflow.

This approach scales from small personal projects to larger team documentation. The key insight is that documentation generation and code development happen in the same environment, using the same tools, driven by Claude’s understanding of your codebase.

Built by theluckystrike — More at zovo.one