Skip to main content

Overview

Good documentation is essential but often neglected due to time constraints. Righthands generate and maintain various types of documentation automatically, keeping it in sync with the codebase.

Types of Documentation

Code Documentation

Function Docstrings

Generate documentation for functions, methods, and classes

Inline Comments

Add explanatory comments for complex logic

Type Annotations

Generate type hints and interface definitions

Code Examples

Create usage examples for public APIs

Project Documentation

README Files

Generate comprehensive README with setup and usage

API Documentation

Create API reference documentation

Architecture Docs

Document system architecture and design decisions

Change Logs

Generate CHANGELOG from commits and PRs

Common Use Cases

Function Documentation Generation

function calculateDiscount(price, customerTier, promotionCode) {
  const tierMultiplier = TIER_DISCOUNTS[customerTier] || 1.0;
  const baseDiscount = price * (1 - tierMultiplier);

  if (promotionCode && isValidPromotion(promotionCode)) {
    const promoDiscount = PROMOTIONS[promotionCode];
    return baseDiscount * (1 - promoDiscount);
  }

  return baseDiscount;
}
Example task: “Generate comprehensive JSDoc for the calculateDiscount function”

README Generation

Righthands create complete README files from scratch or update existing ones:
1

Analyze Project Structure

Examines codebase to understand the project
2

Identify Key Components

Detects entry points, main features, and dependencies
3

Generate Sections

Creates installation, usage, configuration, and API sections
4

Add Examples

Includes code examples based on actual usage patterns
Example tasks: “Generate a README for this project” or “Update the README with recent changes”

API Documentation

For public APIs and libraries:
Generate documentation for REST API endpoints including parameters, responses, and examples
Create usage guides for library functions and classes
Generate or update OpenAPI specifications from code
Create runnable code examples for each API endpoint

Architecture Documentation

Document system design and architecture:
Example Request
"Document the architecture of our microservices setup, including
the authentication service, API gateway, and database structure"
Righthand generates:
  • High-level architecture overview
  • Service interaction diagrams (in Mermaid or PlantUML)
  • Data flow documentation
  • Technology stack description
  • Deployment architecture

Advanced Features

Maintaining Documentation Consistency

1

Detect Outdated Docs

Identify documentation that doesn’t match current code
2

Suggest Updates

Generate updated documentation for changed code
3

Track Coverage

Report on which code lacks documentation
4

Enforce Standards

Ensure documentation follows team style guide

Multi-Format Output

Generate documentation in various formats:
FormatUse Case
MarkdownGitHub/GitLab README, wiki pages
HTMLStatic documentation sites
PDFDownloadable documentation
Docusaurus/MintlifyModern documentation platforms
JSDoc/SphinxLanguage-specific doc generators
OpenAPI/SwaggerAPI specifications

Documentation from Code Comments

Convert inline comments to structured documentation:
class PaymentProcessor:
    # Initializes the payment processor with API credentials
    # Validates credentials on initialization
    # Throws ValueError if credentials are invalid
    def __init__(self, api_key, secret):
        self.api_key = api_key
        self.secret = secret
        self._validate_credentials()

    # Processes a payment transaction
    # Returns transaction ID on success
    # May raise PaymentError if transaction fails
    def process_payment(self, amount, currency, customer_id):
        # Validate amount is positive
        if amount <= 0:
            raise ValueError("Amount must be positive")

        # Build payment request
        request = self._build_request(amount, currency, customer_id)

        # Send to payment gateway
        response = self._send_request(request)

        return response['transaction_id']
Prompt: “Generate proper docstrings for PaymentProcessor class”

Integration with Development Workflow

Continuous Documentation

Generate or update docs automatically before commits
Verify PRs include documentation for new code
Create PRs with documentation updates when code changes
Compile release notes from merged PRs and commits

Documentation Site Generation

Build complete documentation sites:
Example Workflow
1. "Generate documentation site for our project"
2. Righthand creates:
   - Getting Started guide
   - API reference from code
   - Architecture documentation
   - Tutorial with examples
   - FAQ from common issues
3. Deploy to docs.yourproject.com

Keeping Docs Updated

1

Detect Changes

Monitor code changes that affect documented behavior
2

Flag Outdated Docs

Create issues or warnings for documentation that needs updating
3

Suggest Updates

Generate updated documentation drafts
4

Review and Merge

Human review of updated docs before publishing

Best Practices

Document Public APIs First

Prioritize documentation for public-facing code

Include Examples

Always add practical usage examples

Keep It Current

Update docs when code changes, not weeks later

Review Generated Docs

Always review AI-generated docs for accuracy

Documentation Quality Checks

Righthand can verify documentation quality:
  • Completeness: Are all parameters documented?
  • Accuracy: Does documentation match actual behavior?
  • Examples: Are usage examples provided?
  • Clarity: Is the documentation easy to understand?
  • Structure: Does it follow team standards?

Example Workflows

Scenario: Document a newly implemented feature
  1. Complete feature implementation
  2. “Document the new user authentication feature”
  3. Righthand generates:
    • Function/method docstrings
    • README section for authentication
    • API endpoint documentation
    • Usage examples
    • Configuration guide
  4. Review and refine generated docs
  5. Commit docs with feature code
Scenario: Add documentation to undocumented legacy code
  1. “Analyze and document the OrderProcessing module”
  2. Righthand examines code and generates:
    • Overview of module purpose
    • Documentation for each class and method
    • Data flow diagrams
    • Integration points with other modules
  3. Break into reviewable chunks
  4. Team reviews and enhances with domain knowledge
  5. Gradually improve documentation coverage
Scenario: Prepare documentation for a new release
  1. “Generate release notes for version 2.5.0”
  2. Righthand compiles:
    • New features from merged PRs
    • Bug fixes and improvements
    • Breaking changes
    • Migration guide
    • Updated API documentation
  3. Review and add marketing copy
  4. Publish release notes with deployment

Documentation Types by Use Case

For End Users

  • Getting Started Guide: Installation, configuration, first steps
  • Tutorials: Step-by-step instructions for common tasks
  • FAQ: Answers to frequently asked questions
  • Troubleshooting: Common problems and solutions

For Developers

  • API Reference: Complete function/method documentation
  • Architecture Guide: System design and component interaction
  • Contributing Guide: How to contribute to the project
  • Code Examples: Practical implementation examples

For Operations

  • Deployment Guide: How to deploy and configure
  • Configuration Reference: All configuration options explained
  • Monitoring Guide: What to monitor and how
  • Runbooks: Step-by-step procedures for common operations
Generated documentation is a starting point. Always review and enhance with your domain expertise and context that only humans can provide.
Keep sensitive information (API keys, internal architecture details, security measures) out of public documentation.