seb1n/code-documentation
Automatically generate clear, comprehensive documentation for codebases — including API references, inline docstrings, README files, and usage guides.
npx skills add https://github.com/seb1n/awesome-ai-agent-skills --skill code-documentation
This skill enables an AI agent to analyze source code and produce high-quality documentation in multiple formats. It covers everything from single-function docstrings to full project README files, ensuring that both human developers and downstream tooling (IDEs, doc generators) benefit from consistent, accurate descriptions.
docs/ directory.@param, @returns, @throws), TypeDoc annotations@param, @return, @throws)/// doc comments with Markdown, #[doc] attributes@param, @return, @example)Point the agent at a file, directory, or specific symbol and describe what documentation you need. Examples of valid requests:
src/services/."The agent will respect existing documentation style in the project. If no convention is detected, it will ask which format to use or default to the most common style for the language.
User Request: "Add docstrings to this class and its methods."
Before:
class TokenBucket:
def __init__(self, capacity, refill_rate):
self.capacity = capacity
self.tokens = capacity
self.refill_rate = refill_rate
self._last_refill = time.monotonic()
def consume(self, tokens=1):
self._refill()
if self.tokens >= tokens:
self.tokens -= tokens
return True
return False
def _refill(self):
now = time.monotonic()
elapsed = now - self._last_refill
self.tokens = min(self.capacity, self.tokens + elapsed * self.refill_rate)
self._last_refill = now
After:
class TokenBucket:
"""A token-bucket rate limiter.
Tokens are added at a constant rate and consumed by callers.
When the bucket is empty, requests are rejected until enough
tokens have accumulated.
Args:
capacity: Maximum number of tokens the bucket can hold.
refill_rate: Tokens added per second.
Example:
>>> bucket = TokenBucket(capacity=10, refill_rate=2)
>>> bucket.consume(3)
True
"""
def __init__(self, capacity: float, refill_rate: float) -> None:
self.capacity = capacity
self.tokens = capacity
self.refill_rate = refill_rate
self._last_refill = time.monotonic()
def consume(self, tokens: int = 1) -> bool:
"""Attempt to consume tokens from the bucket.
Triggers an internal refill based on elapsed time before
checking availability.
Args:
tokens: Number of tokens to consume. Defaults to 1.
Returns:
True if the tokens were available and consumed, False otherwise.
"""
self._refill()
if self.tokens >= tokens:
self.tokens -= tokens
return True
return False
def _refill(self) -> None:
"""Refill the bucket based on time elapsed since the last refill."""
now = time.monotonic()
elapsed = now - self._last_refill
self.tokens = min(self.capacity, self.tokens + elapsed * self.refill_rate)
self._last_refill = now
User Request: "Generate a README for this project."
Given a project with the following layout:
myapi/
├── package.json (name: @acme/myapi, scripts: dev, build, test)
├── src/
│ ├── index.ts (Express app entry point)
│ ├── routes/
│ │ ├── users.ts
│ │ └── orders.ts
│ └── middleware/
│ └── auth.ts
├── tests/
│ └── users.test.ts
└── Dockerfile
Generated README.md:
# @acme/myapi
A RESTful API service built with Express and TypeScript.
## Getting Started
### Prerequisites
- Node.js >= 18
- npm or yarn
### Installation
git clone https://github.com/acme/myapi.git
cd myapi
npm install
### Running Locally
npm run dev # Start the dev server with hot reload
npm run build # Compile TypeScript to dist/
npm test # Run the test suite
### Docker
docker build -t myapi .
docker run -p 3000:3000 myapi
## API Endpoints
| Method | Path | Description |
|--------|----------------|-----------------------|
| GET | /users | List all users |
| POST | /users | Create a new user |
| GET | /orders | List all orders |
| POST | /orders | Create a new order |
## Project Structure
- `src/index.ts` — Application entry point and server bootstrap.
- `src/routes/` — Route handlers grouped by resource.
- `src/middleware/auth.ts` — JWT authentication middleware.
- `tests/` — Jest test files.
## License
MIT
@overload, document each signature variant separately with its own parameter descriptions and examples.Take seb1n/code-documentation from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.
The instructions reference npm, docker.
Without those the skill loads but fails at the first command.