Claude Skills Guide

Claude Code API Reference Generation Guide

API reference documentation is critical for any library or service, yet manually maintaining it drains developer time. Claude Code skills provide a practical solution for generating accurate, up-to-date API references directly from your codebase. This guide walks through building an automated API reference generation workflow.

What You Need

Before starting, ensure you have:

You do not need additional tooling or paid services. The workflow uses skills that load directly into Claude Code.

Step 1: Set Up Your Documentation Structure

Create a dedicated folder for API documentation in your project:

project/
├── src/
│   └── api/
│       ├── users.js
│       └── orders.js
├── docs/
│   └── api-reference/
└── package.json

Initialize the folder structure first. Then add documentation comments to your source files using JSDoc or similar formats. Claude reads these comments when generating references.

For example, a documented function in src/api/users.js:

/**
 * Fetch a user by their unique identifier.
 * @param {string} userId - The user's unique ID
 * @param {Object} options - Fetch options
 * @param {boolean} options.includeProfile - Include full profile data
 * @returns {Promise<User>} The user object
 * @throws {NotFoundError} When user does not exist
 */
async function getUser(userId, options = {}) {
  // implementation
}

Step 2: Configure Claude for API Documentation

Create a skill configuration for API reference generation. The pdf skill handles output formatting, while supermemory tracks which endpoints have been documented.

Load both skills in your Claude session:

/load pdf
/load supermemory

Define the documentation scope:

I am building API reference documentation for my project.
Scan src/api/ for all exported functions and classes.
Generate reference entries with: function signature, parameters, return type, 
examples, and any thrown errors.
Output to docs/api-reference/

Step 3: Generate the Initial Reference

Claude scans your source files and extracts documentation comments. The output depends on your comment quality.

A typical generation output:

Processing: src/api/users.js
- getUser(userId, options) ✓
- createUser(data) ✓
- updateUser(userId, data) - MISSING return docs

Processing: src/api/orders.js
- getOrder(orderId) ✓
- listOrders(filters) - MISSING examples

Review the output and fill gaps in your source comments. The tdd skill helps here—it ensures your documentation matches actual behavior by cross-referencing tests with implementation.

Step 4: Format and Style the Output

The frontend-design skill improves visual presentation. Apply consistent styling:

Apply documentation styling to docs/api-reference/
Use: grouped by module, alphabetical within groups,
code blocks with syntax highlighting, clear parameter tables

This skill generates CSS and templates for readable output. It works alongside the pdf skill to produce both HTML and PDF versions of your API reference.

For PDF output specifically:

Using the pdf skill, compile docs/api-reference/ into a single
API-Reference.pdf file with table of contents, page numbers,
and consistent formatting.

Step 5: Automate Updates

Keep references in sync with code changes using a simple update workflow:

  1. After any API change, run the generation command
  2. Compare output with previous version using git diff
  3. Commit updated documentation alongside code

Store documentation decisions in supermemory:

Remember: our API reference uses the following conventions:
- Parameters marked optional are wrapped in [] 
- Return types use TypeScript-style notation
- Examples show both success and error cases
- Every endpoint includes a curl command

This ensures consistency across regeneration cycles.

Example: Complete Workflow

A practical session with Claude Code:

> /load pdf
> /load supermemory
> /load tdd

> Generate API reference for src/api/ v2.0
  Include: authentication, users, orders, webhooks modules
  Output format: Markdown with YAML front matter
  Add: version badge, changelog link, rate limit notes

Claude processes each module:
- authentication.md: 4 endpoints documented
- users.md: 7 endpoints, 2 need examples added
- orders.md: 5 endpoints complete
- webhooks.md: NEW - 3 events documented

> Apply frontend-design styling
  Theme: clean, developer-focused, dark-mode compatible

> Compile to PDF using pdf skill
  Output: docs/api-reference-v2.0.pdf

Troubleshooting Common Issues

Missing parameter documentation: Add JSDoc comments directly in source. Claude cannot document what is not there.

Outdated return types: Run the tdd skill alongside generation—it compares documented types with actual implementation.

Formatting inconsistencies: Define a documentation style guide in supermemory and reference it during each generation.

Large APIs timeout: Process modules individually, then merge. The pdf skill combines multiple files into a single document at the end.

Extending the Workflow

Once the basic workflow is solid, extend it with additional skills:

The pdf skill handles final output, while source comments remain the single source of truth for your API surface.


Built by theluckystrike — More at zovo.one