Usage Examples

Real-world scenarios demonstrating effective use of the Docs plugin for maintaining living documentation.

Examples

Post-Implementation Documentation Update

Scenario: You have implemented a new feature and need to update project documentation.

# Implement the feature
> claude "implement user authentication with JWT tokens"

# Update documentation to reflect changes
> /docs:update-docs

Expected Flow:

  1. Plugin analyzes changed files and existing documentation

  2. Identifies documentation gaps (missing API docs, outdated README)

  3. Creates or updates relevant documentation

  4. Validates examples and links

Documentation Output:

## Documentation Updates Completed

### Files Updated
- README.md - Added authentication section to Quick Start
- docs/api/authentication.md - New file with JWT flow documentation
- src/auth/README.md - Module README with purpose and exports

### Major Changes
- Added authentication endpoint documentation
- Created troubleshooting section for common auth errors
- Updated environment variables documentation

API Documentation After Adding Endpoints

Scenario: You have added new REST API endpoints and need to document them.

Expected Flow:

  1. Plugin scans for API-related changes (routes, controllers, schemas)

  2. Checks for existing OpenAPI/Swagger documentation

  3. Updates or generates API reference documentation

  4. Adds request/response examples

API Documentation Generated:

Response (201 Created)

Error Responses

Status
Description

400

Invalid request body

401

Missing or invalid authentication

409

Product with same name already exists

Expected Flow:

  1. Plugin focuses on the specified directory

  2. Analyzes module structure and exports

  3. Updates module README with purpose and usage

  4. Adds JSDoc comments for complex functions

Module README Generated:

See: Payment Integration Guide for detailed setup.

Expected Flow:

  1. Inventories all existing documentation

  2. Checks freshness (files older than 6 months flagged)

  3. Identifies duplications and inconsistencies

  4. Prioritizes high-impact updates

  5. Removes or consolidates outdated content

Audit Output:

JSDoc Update for Complex Logic

Scenario: Business logic functions need documentation for maintainability.

Expected Flow:

  1. Identifies complex functions lacking documentation

  2. Adds JSDoc with parameters, return types, and examples

  3. Skips obvious/simple functions (getters, setters, utilities)

  4. Focuses on business logic and integration points

JSDoc Added:

README Files Only

Scenario: Quick update to README files across the project.

Expected Flow:

  1. Scans all README.md files in the project

  2. Updates root README with current quick start

  3. Creates module READMEs where missing

  4. Ensures consistent structure across READMEs

README Updates:

Integration with Other Plugins

Complete Feature Development Workflow

SDD Workflow Integration

Documentation After Refactoring

API Version Migration Documentation

Common Patterns

When to Run Documentation Updates

Scenario
Command
Focus

After implementing feature

/docs:update-docs

Full assessment

After adding API endpoints

/docs:update-docs api

API documentation

After module changes

/docs:update-docs src/module/

Module-specific

Periodic maintenance

/docs:update-docs

Full audit

Before release

/docs:update-docs

Comprehensive review

Documentation Priority Order

  1. Onboarding blockers - Setup instructions, quick start

  2. API documentation - Endpoint references, authentication

  3. Module READMEs - Navigation and purpose

  4. Troubleshooting - Common errors and solutions

  5. Architecture decisions - When they affect usage

  6. JSDoc comments - Complex business logic

Signs Documentation Needs Updating

  • Issues contain "how do I...?" questions

  • Multiple conflicting sources of truth

  • Setup instructions do not work

  • API responses do not match documentation

  • New features have no documentation

  • Links return 404 errors

Last updated