dot_claude/skills/documentation-generation/SKILL.md
Use when generating or overhauling technical documentation - README files, API references, architecture docs, onboarding guides, changelogs - following documentation-as-code principles where docs live next to code, describe intent and contracts, and never duplicate what the code already says | 技術文書の生成または刷新時に使用 - READMEファイル、APIリファレンス、アーキテクチャ文書、オンボーディングガイド、変更履歴 - ドキュメント・アズ・コードの原則に従い、文書はコードの隣に置き、意図と契約を記述し、コードが既に述べていることを重複させない
npx skillsauth add lv416e/dotfiles documentation-generationInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Bad documentation is worse than no documentation. Stale docs actively mislead. Docs that restate what the code says add noise without signal. Docs without examples are reference manuals nobody reads.
Core principle: Documentation describes INTENT and CONTRACTS, not implementation details. The code shows what happens. The docs explain why it matters and how to use it.
If your docs require updating every time you refactor internals, you're documenting the wrong thing.
Announce at start: "I'm using the documentation-generation skill to create this documentation."
DOCUMENTATION DESCRIBES INTENT AND CONTRACTS, NOT IMPLEMENTATION DETAILS
If a doc would become stale from an internal refactor that doesn't change behavior, that doc is wrong. Rewrite it to describe the contract, not the mechanism.
Generate documentation for ANY of these:
Use this ESPECIALLY when:
Don't skip when:
Not all docs are equal. Each type serves a different audience at a different moment.
| Type | Audience | Purpose | When to Write | |------|----------|---------|---------------| | README | First-time visitors | "What is this and how do I start?" | Project creation, always keep current | | API Reference | Developers integrating | "What can I call and what comes back?" | Every public interface change | | Architecture Docs | Team members, future maintainers | "How does this system fit together and why?" | Initial design, major changes | | Onboarding Guide | New team members | "How do I set up, build, test, and deploy?" | When onboarding takes too long | | Changelog | Users, operators | "What changed and do I need to act?" | Every release | | Migration Guide | Users upgrading | "How do I move from version N to N+1?" | Breaking changes | | ADR | Future decision-makers | "Why did we choose this approach?" | Every architectural decision | | Runbook | On-call engineers | "How do I diagnose and fix this in production?" | Every production system |
Before writing anything new:
Inventory what exists
Identify the gaps
Decide what to kill
Documentation-as-code principles:
project/
├── README.md # Entry point, always
├── docs/
│ ├── architecture.md # System overview (C4 model)
│ ├── adr/ # Architecture decision records
│ │ ├── index.md
│ │ └── 0001-*.md
│ ├── api/ # API reference (or generated)
│ ├── guides/
│ │ ├── onboarding.md # Getting started for developers
│ │ ├── deployment.md # How to deploy
│ │ └── migration-v2.md
│ └── runbooks/ # Operational procedures
├── CHANGELOG.md # At the root, always
└── CONTRIBUTING.md # At the root, always
Rules:
docs/api/docs/guides/Follow the specific templates below for each type.
The README is the front door. It answers: "What is this, why should I care, and how do I start?"
# Project Name
[One-sentence description of what this does and who it's for.]
[](ci-url)
[](coverage-url)
[](license-url)
## Why
[2-3 sentences: What problem does this solve? Why does it exist?
Not "what it is" but "why you need it."]
## Quick Start
[Shortest possible path from zero to working. 5 steps maximum.]
### Prerequisites
- [Runtime] >= [version]
- [Dependency] (install: `command`)
### Install
```bash
npm install project-name
# or
pip install project-name
# Minimal working example - this MUST run as-is
from project import Thing
thing = Thing(config="value")
result = thing.do_something("input")
print(result) # Expected output
[Brief overview of main API surface. Link to full API docs if extensive.]
function_name(param1, param2) -> ReturnType[One sentence: what it does.]
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| param1 | string | Yes | What this parameter controls |
| param2 | int | No | Default: 10. What this parameter controls |
Returns: ReturnType - description
Example:
result = function_name("value", param2=20)
[Table of configuration options with types, defaults, and descriptions.]
See CONTRIBUTING.md for development setup, testing, and PR process.
[License type] - see LICENSE
**README rules:**
- Quick Start must get someone to a working state in under 5 minutes
- Every code example must be copy-pasteable and runnable
- No "see code for details" - if it's in the README, explain it in the README
- Badges at the top: CI status, coverage, license, version
- Keep it concise. Link to detailed docs in `docs/` for depth.
## API Documentation from Code
Extract documentation from source code annotations. Don't maintain API docs separately from code.
### JSDoc / TypeScript
```typescript
/**
* Retrieves a user by their unique identifier.
*
* @param id - The user's UUID
* @returns The user object, or null if not found
* @throws {AuthorizationError} If the caller lacks read permissions
*
* @example
* ```typescript
* const user = await getUser("550e8400-e29b-41d4-a716-446655440000");
* if (user) {
* console.log(user.name);
* }
* ```
*/
async function getUser(id: string): Promise<User | null> {
def get_user(user_id: str) -> User | None:
"""Retrieve a user by their unique identifier.
Args:
user_id: The user's UUID string.
Returns:
The User object if found, None otherwise.
Raises:
AuthorizationError: If the caller lacks read permissions.
ValueError: If user_id is not a valid UUID format.
Example:
>>> user = get_user("550e8400-e29b-41d4-a716-446655440000")
>>> if user:
... print(user.name)
"""
Use the C4 model to document architecture at four zoom levels. Not every project needs all four.
"What is this system and what does it interact with?"
## System Context
[Project Name] is a [type of system] that [what it does].
### External Systems
| System | Relationship | Protocol |
|--------|-------------|----------|
| User Browser | Sends requests | HTTPS |
| Payment Gateway | Processes payments | REST API |
| Email Service | Sends notifications | SMTP |
| Auth Provider | Authenticates users | OAuth 2.0 |
"What are the major deployable units?"
## Containers
| Container | Technology | Purpose |
|-----------|-----------|---------|
| Web App | Next.js | Serves UI, handles SSR |
| API Server | FastAPI | Business logic, REST endpoints |
| Worker | Celery | Async job processing |
| Database | PostgreSQL | Primary data store |
| Cache | Redis | Session store, query cache |
| Queue | RabbitMQ | Job queue for workers |
"What are the major components inside each container?"
## API Server Components
| Component | Responsibility | Key Interfaces |
|-----------|---------------|----------------|
| Auth Module | Token validation, permissions | `verify_token()`, `check_permission()` |
| Order Service | Order lifecycle management | `create_order()`, `cancel_order()` |
| Payment Service | Payment processing orchestration | `charge()`, `refund()` |
| Notification Service | Event-driven notifications | `notify()`, subscribes to order events |
This level is the code itself. Don't write Level 4 docs. That's what the code and its docstrings are for.
Follow Keep a Changelog format. No exceptions.
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/),
and this project adheres to [Semantic Versioning](https://semver.org/).
## [Unreleased]
### Added
- New `/users/search` endpoint with full-text search (#142)
### Changed
- Rate limiting increased from 100 to 500 requests/minute (#138)
### Fixed
- Token refresh race condition causing intermittent 401s (#145)
## [2.1.0] - 2025-03-15
### Added
- Webhook support for order status changes (#130)
- Bulk user import endpoint (#127)
### Deprecated
- `GET /users/list` deprecated in favor of `GET /users` with pagination (#131)
### Security
- Upgrade jwt-decode to 4.0.0 to fix CVE-2024-XXXXX (#135)
[Unreleased]: https://github.com/org/repo/compare/v2.1.0...HEAD
[2.1.0]: https://github.com/org/repo/compare/v2.0.0...v2.1.0
[Unreleased] section always exists at the topBAD:
# Increment counter by one
counter += 1
GOOD:
# Track failed login attempts for rate limiting (locks after 5 failures)
failed_attempts += 1
Document WHY, not WHAT. If the comment restates the code, delete it.
BAD: Write docs once, never update, let them rot for 2 years
GOOD: Docs are updated in the same PR that changes the behavior
The fix is process, not discipline. Make doc updates part of the PR checklist. Review docs in code review. If a PR changes behavior, the reviewer asks: "Where are the doc updates?"
BAD:
`transform(data, options)` - Transforms the data with the given options.
GOOD:
`transform(data, options)` - Applies configured transformations to the dataset.
Example:
result = transform(
data=load_csv("input.csv"),
options={"normalize": True, "drop_nulls": True}
)
# Returns a cleaned DataFrame with 0-1 scaled numeric columns
API docs without examples are dictionaries without example sentences. Technically complete, practically useless.
BAD: Code in repo-A, docs in repo-B (drift guaranteed within a week)
GOOD: Code and docs in the same repo, same PR, same review
Documentation-as-code means docs are code artifacts. They version together, deploy together, and get reviewed together.
BAD:
"This function iterates over all users, checks if their
subscription_end_date is before today, and if so, sets
their status to 'expired' and sends an email via SendGrid."
GOOD:
"Expires subscriptions that have passed their end date.
Affected users are notified via email.
Runs daily via cron (see deployment docs)."
The first version breaks every time you change the implementation. The second survives refactors because it describes the contract.
| Excuse | Reality | |--------|---------| | "The code is self-documenting" | Code shows WHAT. Docs explain WHY, WHEN, and HOW TO USE. | | "Nobody reads docs" | Nobody reads BAD docs. Good docs with examples get read constantly. | | "Docs get stale immediately" | Only when docs describe implementation. Contract-level docs stay current. | | "We'll write docs later" | You won't. Write them now or accept they'll never exist. | | "README is enough" | README is the entry point, not the whole story. | | "Just read the source" | Forcing users to read source is a failure of documentation. | | "We move too fast for docs" | You move too fast for BAD docs. Good docs accelerate the team. | | "It's only used internally" | Internal tools become critical infrastructure. Document them. |
| Phase | Key Activities | Success Criteria |
|-------|---------------|------------------|
| 1. Audit | Inventory existing docs, identify gaps, kill stale docs | Clear picture of what exists and what's missing |
| 2. Structure | Set up doc directory, choose types needed | docs/ directory with clear organization |
| 3. Write | Use templates, include examples, describe contracts | Every doc answers its audience's core questions |
| 4. Verify | Test examples, check links, review in PR | All code runs, all links resolve, team approved |
This skill works with:
Workflow:
Design API → Document contracts (API docs) → Record decisions (ADRs) → Write guides (onboarding, migration)
From teams that adopted documentation-as-code:
development
Use this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved.
testing
Use when creating new skills, editing existing skills, or verifying skills work before deployment - applies TDD to process documentation by testing with subagents before writing, iterating until bulletproof against rationalization | 新しいスキルの作成、既存スキルの編集、またはデプロイ前にスキルが機能するか検証する際に使用 - プロセスドキュメントにTDDを適用し、記述前にサブエージェントでテストし、合理化に対して堅牢になるまで反復
development
Use when design is complete and you need detailed implementation tasks for engineers with zero codebase context - creates comprehensive implementation plans with exact file paths, complete code examples, and verification steps assuming engineer has minimal domain knowledge | 設計が完了し、コードベースの知識がゼロのエンジニア向けに詳細な実装タスクが必要な場合に使用 - 正確なファイルパス、完全なコード例、検証ステップを含む包括的な実装計画を作成。エンジニアの領域知識が最小限であることを前提
tools
Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.