codebase-documenter
The codebase-documenter skill generates structured, beginner-friendly documentation for software projects, including READMEs, architecture guides, API docs, and code comments. Use it when documenting project structure, creating getting-started guides, explaining code organization, or helping new developers onboard to a codebase through templates and documented best practices like progressive disclosure and concrete examples.
git clone --depth 1 https://github.com/ailabs-393/ai-labs-claude-skills /tmp/codebase-documenter && cp -r /tmp/codebase-documenter/packages/skills/codebase-documenter ~/.claude/skills/codebase-documenterSKILL.md
# Codebase Documenter
## Overview
This skill enables creating comprehensive, beginner-friendly documentation for codebases. It provides structured templates and best practices for writing READMEs, architecture guides, code comments, and API documentation that help new users quickly understand and contribute to projects.
## Core Principles for Beginner-Friendly Documentation
When documenting code for new users, follow these fundamental principles:
1. **Start with the "Why"** - Explain the purpose before diving into implementation details
2. **Use Progressive Disclosure** - Present information in layers from simple to complex
3. **Provide Context** - Explain not just what the code does, but why it exists
4. **Include Examples** - Show concrete usage examples for every concept
5. **Assume No Prior Knowledge** - Define terms and avoid jargon when possible
6. **Visual Aids** - Use diagrams, flowcharts, and file tree structures
7. **Quick Wins** - Help users get something running within 5 minutes
## Documentation Types and When to Use Them
### 1. README Documentation
**When to create:** For project root directories, major feature modules, or standalone components.
**Structure to follow:**
```markdown
# Project Name
## What This Does
[1-2 sentence plain-English explanation]
## Quick Start
[Get users running the project in < 5 minutes]
## Project Structure
[Visual file tree with explanations]
## Key Concepts
[Core concepts users need to understand]
## Common Tasks
[Step-by-step guides for frequent operations]
## Troubleshooting
[Common issues and solutions]
```
**Best practices:**
- Lead with the project's value proposition
- Include setup instructions that actually work (test them!)
- Provide a visual overview of the project structure
- Link to deeper documentation for advanced topics
- Keep the root README focused on getting started
### 2. Architecture Documentation
**When to create:** For projects with multiple modules, complex data flows, or non-obvious design decisions.
**Structure to follow:**
```markdown
# Architecture Overview
## System Design
[High-level diagram and explanation]
## Directory Structure
[Detailed breakdown with purpose of each directory]
## Data Flow
[How data moves through the system]
## Key Design Decisions
[Why certain architectural choices were made]
## Module Dependencies
[How different parts interact]
## Extension Points
[Where and how to add new features]
```
**Best practices:**
- Use diagrams to show system components and relationships
- Explain the "why" behind architectural decisions
- Document both the happy path and error handling
- Identify boundaries between modules
- Include visual file tree structures with annotations
### 3. Code Comments
**When to create:** For complex logic, non-obvious algorithms, or code that requires context.
**Annotation patterns:**
**Function/Method Documentation:**
```javascript
/**
* Calculates the prorated subscription cost for a partial billing period.
*
* Why this exists: Users can subscribe mid-month, so we need to charge
* them only for the days remaining in the current billing cycle.
*
* @param {number} fullPrice - The normal monthly subscription price
* @param {Date} startDate - When the user's subscription begins
* @param {Date} periodEnd - End of the current billing period
* @returns {number} The prorated amount to charge
*
* @example
* // User subscribes on Jan 15, period ends Jan 31
* calculateProratedCost(30, new Date('2024-01-15'), new Date('2024-01-31'))
* // Returns: 16.13 (17 days out of 31 days)
*/
```
**Complex Logic Documentation:**
```python
# Why this check exists: The API returns null for deleted users,
# but empty string for users who never set a name. We need to
# distinguish between these cases for the audit log.
if user_name is None:
# User was deleted - log this as a security event
log_deletion_event(user_id)
elif user_name == "":
# User never completed onboarding - safe to skip
continue
```
**Best practices:**
- Explain "why" not "what" - the code shows what it does
- Document edge cases and business logic
- Add examples for complex functions
- Explain parameters that aren't self-explanatory
- Note any gotchas or counterintuitive behavior
### 4. API Documentation
**When to create:** For any HTTP endpoints, SDK methods, or public interfaces.
**Structure to follow:**
```markdown
## Endpoint Name
### What It Does
[Plain-English explanation of the endpoint's purpose]
### Endpoint
`POST /api/v1/resource`
### Authentication
[What auth is required and how to provide it]
### Request Format
[JSON schema or example request]
### Response Format
[JSON schema or example response]
### Example Usage
[Concrete example with curl/code]
### Common Errors
[Error codes and what they mean]
### Related Endpoints
[Links to related operations]
```
**Best practices:**
- Provide working curl examples
- Show both success and error responses
- Explain authentication clearly
- Document rate limits and constraints
- Include troubleshooting for common issues
## Documentation Workflow
### Step 1: Analyze the Codebase
Before writing documentation:
1. **Identify entry points** - Main files, index files, app initialization
2. **Map dependencies** - How modules relate to each other
3. **Find core concepts** - Key abstractions users need to understand
4. **Locate configuration** - Environment setup, config files
5. **Review existing docs** - Build on what's there, don't duplicate
### Step 2: Choose Documentation Type
Based on user request and codebase analysis:
- **New project or missing README** → Start with README documentation
- **Complex architecture or multiple modules** → Create architecture documentation
- **Confusing code sections** → Add inline code comments
- **HTTP/API endpoints** → Write API documentation
- **Multiple types needed** → Address in order: README → Architecture → API → Comments
### Step 3: Generate Documentation
Use the templates fThis skill should be used when the user requests brand analysis, brand guidelines creation, brand audits, or establishing brand identity and consistency standards. It provides comprehensive frameworks for analyzing brand elements and creating actionable brand guidelines based on requirements.
This skill should be used when analyzing business sales and revenue data from CSV files to identify weak areas, generate statistical insights, and provide strategic improvement recommendations. Use when the user requests a business performance report, asks to analyze sales data, wants to identify areas of weakness, or needs recommendations on business improvement strategies.
This skill should be used when the user requests to create professional business documents (proposals, business plans, or budgets) from templates. It provides PDF templates and a Python script for generating filled documents from user data.
This skill should be used when creating or configuring CI/CD pipeline files for automated testing, building, and deployment. Use this for generating GitHub Actions workflows, GitLab CI configs, CircleCI configs, or other CI/CD platform configurations. Ideal for setting up automated pipelines for Node.js/Next.js applications, including linting, testing, building, and deploying to platforms like Vercel, Netlify, or AWS.
This skill should be used when working with CSV files to create interactive data visualizations, generate statistical plots, analyze data distributions, create dashboards, or perform automatic data profiling. It provides comprehensive tools for exploratory data analysis using Plotly for interactive visualizations.
This skill should be used when analyzing CSV datasets, handling missing values through intelligent imputation, and creating interactive dashboards to visualize data trends. Use this skill for tasks involving data quality assessment, automated missing value detection and filling, statistical analysis, and generating Plotly Dash dashboards for exploratory data analysis.
This skill should be used when containerizing applications with Docker, creating Dockerfiles, docker-compose configurations, or deploying containers to various platforms. Ideal for Next.js, React, Node.js applications requiring containerization for development, production, or CI/CD pipelines. Use this skill when users need Docker configurations, multi-stage builds, container orchestration, or deployment to Kubernetes, ECS, Cloud Run, etc.
Comprehensive document creation, editing, and analysis with support for tracked changes, comments, formatting preservation, and text extraction. When Claude needs to work with professional documents (.docx files) for: (1) Creating new documents, (2) Modifying or editing content, (3) Working with tracked changes, (4) Adding comments, or any other document tasks