agentleFS
irfad7irfad7/claude-power-skills/skills/magic-docs/SKILL.md

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

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
  1. Distinctive:

    When invoked, ask the user what type of documentation they need:

    line 15
  2. Very specific:

    If the project contains multiple sub-projects (e.g., apps/, packages/, nested directories with their own package.json):

    line 28
  3. Very specific:

    Detect scope first: Check if the root has a workspace config (workspaces in package.json, pnpm-workspace.yaml, lerna.json, turbo.json)

    line 30
  4. Distinctive:

    Before writing a single word, read the codebase systematically:

    line 39
  5. Distinctive:

    Accuracy check: Every fact is traceable to source code

    line 165
  6. Distinctive:

    Completeness check: No critical system component is undocumented

    line 166
  7. Distinctive:

    Security check: No secrets, API keys, or internal URLs in the docs

    line 168
  8. Distinctive:

    Read first, write second: Never generate docs from vibes.

    line 173
  9. Distinctive:

    Cite your sources: When documenting a feature, note which files you derived it from.

    line 174
  10. Distinctive:

    No filler: If you don't know something, say "Not found in codebase" — don't guess.

    line 175
  11. Distinctive:

    Match the project's voice: If the codebase is casual, docs should be casual.

    line 176
  12. Distinctive:

    If docs already exist, MagicDocs can:

    line 183
  13. Distinctive:

    Extend: Add documentation for new features/endpoints not yet covered

    line 186

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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:

  1. README — Project overview, setup, usage
  2. API Reference — Endpoint documentation from actual route files
  3. Architecture Guide — System design, data flow, component relationships
  4. Onboarding Guide — "New developer joins the team" walkthrough
  5. Changelog — Generate from git history
  6. 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):

  1. Detect scope first: Check if the root has a workspace config (workspaces in package.json, pnpm-workspace.yaml, lerna.json, turbo.json)
  2. 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?"
  3. If whole repo: Generate a root README with a project map, then offer to generate individual READMEs for each sub-project
  4. 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 conventions

Step 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:

  1. Accuracy check: Every fact is traceable to source code
  2. Completeness check: No critical system component is undocumented
  3. Freshness check: Documentation reflects current code, not old patterns
  4. Security check: No secrets, API keys, or internal URLs in the docs
  5. 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"

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.