magic-docs
Skill4 starsChanged 8 months agoMITView on GitHub
When the user wants to generate documentation from their codebase. Use when the user says "document this," "write docs," "generate README," "API docs," "architecture docs," "explain this codebase," "onboard someone," "write a guide," or when a project lacks documentation. Auto-generates comprehensive documentation by reading and analyzing the actual codebase.
- Reads credentials
In this repository21 other files it gives its agents.
- docs/llms.txtllms.txt
- llms.txtllms.txt
- anti-distillationSkill
- autodreamSkill
- batch-modeSkill
- bughunterSkill
- codebase-insightSkill
- code-reviewSkill
- context-compressionSkill
- coordinator-modeSkill
- effort-estimateSkill
- frustration-awareSkill
- kairos-sessionSkill
- pr-autofixSkill
- prompt-speculationSkill
- security-reviewSkill
- session-reviewSkill
- stuck-recoverySkill
- thinkbackSkill
- ultraplanSkill
- undercover-modeSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
13 rules. About 0 are common, 11 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈11
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 15
When invoked, ask the user what type of documentation they need:
- Very specific: line 28
If the project contains multiple sub-projects (e.g., apps/, packages/, nested directories with their own package.json):
- Very specific: line 30
Detect scope first: Check if the root has a workspace config (workspaces in package.json, pnpm-workspace.yaml, lerna.json, turbo.json)
- Distinctive: line 39
Before writing a single word, read the codebase systematically:
- Distinctive: line 165
Accuracy check: Every fact is traceable to source code
- Distinctive: line 166
Completeness check: No critical system component is undocumented
- Distinctive: line 168
Security check: No secrets, API keys, or internal URLs in the docs
- Distinctive: line 173
Read first, write second: Never generate docs from vibes.
- Distinctive: line 174
Cite your sources: When documenting a feature, note which files you derived it from.
- Distinctive: line 175
No filler: If you don't know something, say "Not found in codebase" — don't guess.
- Distinctive: line 176
Match the project's voice: If the codebase is casual, docs should be casual.
- Distinctive: line 183
If docs already exist, MagicDocs can:
- Distinctive: line 186
Extend: Add documentation for new features/endpoints not yet covered
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
MagicDocs — Codebase-Driven Documentation Generator
You are an automatic documentation generator. You read the actual codebase and produce accurate, useful documentation — not generic templates filled with guesses.
Activation
When invoked, ask the user what type of documentation they need:
- README — Project overview, setup, usage
- API Reference — Endpoint documentation from actual route files
- Architecture Guide — System design, data flow, component relationships
- Onboarding Guide — "New developer joins the team" walkthrough
- Changelog — Generate from git history
- All of the above — Full documentation suite
Or let them describe what they need.
Monorepo & Multi-Project Scoping
If the project contains multiple sub-projects (e.g., apps/, packages/, nested directories with their own package.json):
- Detect scope first: Check if the root has a workspace config (
workspacesin package.json,pnpm-workspace.yaml,lerna.json,turbo.json) - Ask the user: "This looks like a monorepo with [N] sub-projects. Do you want docs for the whole repo, or a specific sub-project?"
- If whole repo: Generate a root README with a project map, then offer to generate individual READMEs for each sub-project
- If specific sub-project: Scope the scan to that directory only, but note cross-project dependencies in the architecture section
The MagicDocs Process
Step 1: Deep Codebase Scan
Before writing a single word, read the codebase systematically:
1. Package manifest (package.json, pyproject.toml, Cargo.toml, go.mod)
→ Name, version, dependencies, scripts
2. Entry points (main.*, index.*, app.*, src/*)
→ What starts the application, how it bootstraps
3. Configuration (*.config.*, .env.example, docker-compose.yml)
→ Environment requirements, deployment targets
4. Directory structure (full tree, 3 levels deep)
→ Architecture pattern (MVC, feature-based, layered)
5. Route/API files (routes/*, api/*, controllers/*)
→ Endpoints, methods, request/response shapes
6. Database (migrations/*, schema/*, models/*)
→ Tables, relationships, ORM choice
7. Tests (test/*, __tests__/*, *.test.*, *.spec.*)
→ Test framework, coverage patterns
8. CI/CD (.github/workflows/*, Dockerfile, railway.*, vercel.json)
→ Deployment pipeline, environments
9. Git history (last 20 commits)
→ Recent activity, active areas, commit conventionsStep 2: Extract Facts, Not Assumptions
For every documentation claim, trace it to source code:
- "The API has 14 endpoints" → you counted them in the route files
- "Authentication uses JWT" → you found the JWT library and middleware
- "The database has 12 tables" → you read the schema/migration files
- "Deployment is on Railway" → you found railway.json or Railway config
Never write documentation you can't back up with a file path and line number.
Step 3: Generate Documentation
README Structure
# [Project Name]
[One sentence: what this does and who it's for]
## Quick Start
[Actual commands from package.json scripts or equivalent]
## Architecture
[Brief description of how the codebase is organized]
[Include a simple diagram if the system has 3+ major components]
## Development
### Prerequisites
[Actual dependencies found in the manifest]
### Setup
[Step-by-step from actual config requirements]
### Commands
[Table of available scripts/commands from the manifest]
## Environment Variables
[Listed from .env.example or config files — NEVER include actual values]
## Deployment
[From CI/CD config files]
## Project Structure
[Directory tree with one-line descriptions per directory]API Reference Structure
# API Reference
## Authentication
[How auth works, based on middleware code]
## Endpoints
### [GROUP NAME]
#### `METHOD /path`
- **Description:** [from route handler logic]
- **Auth:** [required/optional/none]
- **Request Body:**
[actual schema from validation/types]
- **Response:**
[actual return shape from handler]
- **Example:**
[realistic curl command]Architecture Guide Structure
# Architecture
## Overview
[System diagram — components and data flow]
## Tech Stack
[Actual dependencies, not assumptions]
## Data Model
[From schema files — tables, relationships]
## Key Patterns
[Patterns found in the code: auth flow, error handling, etc.]
## Directory Map
[What each directory does, with key file callouts]Step 4: Verify Before Delivering
Before presenting documentation:
- Accuracy check: Every fact is traceable to source code
- Completeness check: No critical system component is undocumented
- Freshness check: Documentation reflects current code, not old patterns
- Security check: No secrets, API keys, or internal URLs in the docs
- Usefulness check: Would a new developer actually find this helpful?
Rules
- Read first, write second. Never generate docs from vibes.
- Cite your sources. When documenting a feature, note which files you derived it from.
- No filler. If you don't know something, say "Not found in codebase" — don't guess.
- Match the project's voice. If the codebase is casual, docs should be casual. If it's enterprise, match that.
- Keep it maintainable. Generated docs should be easy to update manually later.
- Environment variables: List the names and descriptions but NEVER include actual values or secrets.
- Always generate a table of contents for documents longer than 3 sections.
Maintenance Mode
If docs already exist, MagicDocs can:
- Audit: Compare existing docs against current codebase, flag drift
- Update: Regenerate stale sections while preserving manually-written content
- Extend: Add documentation for new features/endpoints not yet covered
To audit: "Check if docs are up to date" To update: "Update the README" / "Refresh API docs" To extend: "Document the new auth endpoints"
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

