Claude Skills Guide

Automated Code Documentation Workflow with Claude Skills

Documentation is the part of software development most developers neglect not because they do not care, but because it is tedious and time-consuming to write by hand. Keeping docs in sync with rapidly changing code makes it worse. Claude skills offer a practical solution: an automated code documentation workflow that generates accurate, developer-friendly documentation directly from your codebase.

This guide walks through building that workflow from scratch, README files, API references, and change-log summaries.

What You Need

No additional packages or CI setup required to start. You can layer in CI automation once the local workflow is solid.

Step 1: Audit Your Current Documentation State

Before generating docs, understand what you have and what is missing. Start a Claude Code session in your project root:

What documentation does this codebase currently have?
Check for: JSDoc comments, README files, inline comments, API docs,
and any docs/ or documentation/ folders.
List files with good coverage vs files with no documentation.

Claude scans the file tree and reports coverage. A typical output might be:

Documentation audit results:
- README.md: exists but last updated 6 months ago
- src/api/routes.js: 0% JSDoc coverage
- src/utils/helpers.js: 40% coverage
- src/models/: no documentation
- docs/: folder does not exist

Save this audit to supermemory so future sessions know the baseline:

/supermemory
Store documentation audit for this project:
- README needs refresh
- routes.js has zero inline docs
- helpers.js has partial coverage
- models/ folder has no docs
- Goal: full JSDoc coverage + updated README by end of sprint

Step 2: Generate Inline Documentation with JSDoc or Docstrings

For each undocumented file, use Claude to generate inline comments. The key is providing context about the file’s purpose, not just asking Claude to “add comments.”

For a JavaScript utility file:

Generate JSDoc comments for every exported function in src/utils/helpers.js.
For each function document:
- What it does in plain English
- @param types and descriptions
- @returns type and description
- @example showing a real usage case
- @throws if the function can raise errors
Keep comments accurate to the actual code — do not add functionality that is not there.

For a Python module:

Add Google-style docstrings to every class and public method in src/models/user.py.
Follow Google Python Style Guide format.
Include Args, Returns, Raises, and Example sections where applicable.

Run this for each undocumented file. With a 100-line utility file, Claude generates complete JSDoc coverage in under 30 seconds.

Step 3: Generate or Refresh the README

A well-structured README covers installation, configuration, usage, and contribution. Instead of writing it from scratch, let Claude generate it from your actual codebase:

Generate a developer-focused README.md for this project.
Structure it with these sections:
1. Project name and one-sentence description
2. Prerequisites (exact versions of Node, Python, etc.)
3. Installation steps (copy-paste ready commands)
4. Configuration (list every environment variable with description and example)
5. Usage (three to five real examples using actual functions or CLI commands from this codebase)
6. API reference (brief endpoint list if applicable)
7. Running tests
8. Contributing guidelines
9. License

Base everything on the actual code. Do not invent features.

Review the output before committing. Claude occasionally assumes defaults that differ from your setup — the review step takes two minutes and prevents incorrect docs going to production.

Step 4: Generate API Reference Documentation with the pdf Skill

For projects with REST APIs, the pdf skill creates formatted, shareable API reference documents. After Claude generates the documentation content, use the skill to package it:

/pdf
Create an API reference document from the endpoints defined in src/api/routes.js.
For each endpoint include:
- Method and path
- Authentication requirements
- Request body schema with field types
- Response schema for success and error cases
- Example curl command
Output as a well-formatted document suitable for sharing with API consumers.

The pdf skill handles formatting, headers, code blocks, and table of contents automatically. The output is ready to attach to a Notion page, share via Slack, or commit to a docs/ folder as an HTML or Markdown file.

Step 5: Automate Change Documentation on Commit

The most powerful part of the workflow is generating documentation diffs alongside code diffs. When you commit changes, Claude generates a human-readable summary of what changed and why — useful for changelogs, pull request descriptions, and release notes.

Create a shell script scripts/doc-update.sh:

#!/bin/bash
# doc-update.sh — Run after commits to update documentation

CHANGED_FILES=$(git diff HEAD~1 --name-only --diff-filter=AM | grep -E '\.(js|ts|py|go)$')

if [ -z "$CHANGED_FILES" ]; then
  echo "No source files changed, skipping doc update."
  exit 0
fi

echo "Files changed in last commit:"
echo "$CHANGED_FILES"
echo ""
echo "Run Claude Code with: /doc-update"
echo "Changed files: $CHANGED_FILES"

Then in Claude Code, create a skill at ~/.claude/skills/doc-update.md:

# doc-update

You are a documentation updater. When invoked, you will:
1. Review the changed files provided
2. Check if existing inline documentation is still accurate given the changes
3. Update any stale JSDoc or docstrings
4. Generate a one-paragraph changelog entry describing what changed in plain English
5. Suggest if the README needs any updates

Be specific, concise, and accurate. Do not add documentation for unchanged code.

Invoke it after each significant commit:

/doc-update
Changed files from last commit:
- src/api/routes.js (added /users/bulk-delete endpoint)
- src/models/user.js (added softDelete method)

Step 6: Keep Documentation Decisions Persistent

Documentation standards drift across a long project. Use supermemory to lock in your conventions:

/supermemory
Store these documentation conventions for this project:
- Use JSDoc for all JS/TS files
- Use Google-style docstrings for Python
- README uses H2 headers only (no H3 or deeper)
- API docs get regenerated every sprint and committed to docs/api-reference.md
- Changelog format: "YYYY-MM-DD — brief summary of changes"
- Never document private methods (underscore prefix)

In future sessions, reference this:

/supermemory
Retrieve documentation conventions for this project before starting any doc work.

Step 7: Validate Documentation Coverage

At the end of each sprint, run a coverage check:

Audit documentation coverage across the entire codebase.
Report:
- Percentage of exported functions with JSDoc/docstrings
- Files added since last audit with no documentation
- Any documentation that describes functionality that no longer exists
- README sections that are out of date

Format output as a checklist I can copy into our sprint retrospective.

This produces a checklist like:

Documentation Coverage Audit — 2026-03-13

[x] src/utils/helpers.js — 100% coverage
[x] src/api/routes.js — 100% coverage
[ ] src/workers/email.js — 0% coverage (added last week)
[ ] README Installation section — refers to Node 16, project now requires Node 20
[ ] CHANGELOG — last entry was 2025-11-10

Address the open items before the sprint ends.

Test-Driven Documentation

Tests can serve as executable documentation that never goes out of date. When properly written, test files describe expected behavior in code, making them a reliable complement to traditional docs.

// This test documents the user authentication flow
describe('User Authentication', () => {
  it('rejects invalid credentials with helpful error message', async () => {
    const result = await auth.login('user@example.com', 'wrongpassword');
    expect(result.success).toBe(false);
    expect(result.error).toContain('Invalid credentials');
  });

  it('returns JWT token on successful login', async () => {
    const result = await auth.login('user@example.com', 'correctpassword');
    expect(result.token).toBeDefined();
    expect(result.token).toMatch(/^eyJ/);
  });
});

Any developer reading the test understands exactly how the authentication system works—inputs, outputs, and error handling. Use the tdd skill to generate tests that double as living documentation for your most critical code paths.

Putting It Together

The full automated code documentation workflow looks like this:

  1. Sprint start: run the documentation audit prompt, store results in supermemory
  2. During development: after writing new functions, generate JSDoc immediately rather than at the end
  3. On commit: run doc-update.sh and invoke /doc-update to keep docs in sync
  4. API changes: regenerate API reference with /pdf and commit to docs/
  5. Sprint end: run the coverage audit, fix gaps, update README if needed

This workflow turns documentation from a quarterly cleanup task into a continuous, mostly automated process. The total time investment per sprint is under an hour — compared to a full day of manual doc writing that most teams skip entirely.


Related guides: Best Way to Use Claude Code for Database Migrations

Built by theluckystrike — More at zovo.one