$npx -y skills add jezweb/claude-skills --skill project-docsGenerate project documentation from codebase analysis — ARCHITECTURE.md, API_ENDPOINTS.md, DATABASE_SCHEMA.md. Reads source code, schema files, routes, and config to produce accurate, structured docs. Use when starting a project, onboarding contributors, or when docs are missing
| 1 | # Project Documentation Generator |
| 2 | |
| 3 | Generate structured project documentation by analysing the codebase. Produces docs that reflect the **actual code**, not aspirational architecture. |
| 4 | |
| 5 | ## When to Use |
| 6 | |
| 7 | - New project needs initial documentation |
| 8 | - Docs are missing or stale |
| 9 | - Onboarding someone to the codebase |
| 10 | - Post-refactor doc refresh |
| 11 | |
| 12 | ## Workflow |
| 13 | |
| 14 | ### 1. Detect Project Type |
| 15 | |
| 16 | Scan the project root to determine what kind of project this is: |
| 17 | |
| 18 | | Indicator | Project Type | |
| 19 | |-----------|-------------| |
| 20 | | `wrangler.jsonc` / `wrangler.toml` | Cloudflare Worker | |
| 21 | | `vite.config.ts` + `src/App.tsx` | React SPA | |
| 22 | | `astro.config.mjs` | Astro site | |
| 23 | | `next.config.js` | Next.js app | |
| 24 | | `package.json` with `hono` | Hono API | |
| 25 | | `src/index.ts` with `Hono` | API server | |
| 26 | | `drizzle.config.ts` | Has database layer | |
| 27 | | `schema.ts` or `schema/` | Has database schema | |
| 28 | | `pyproject.toml` / `setup.py` | Python project | |
| 29 | | `Cargo.toml` | Rust project | |
| 30 | |
| 31 | ### 2. Ask What to Generate |
| 32 | |
| 33 | ``` |
| 34 | Which docs should I generate? |
| 35 | 1. ARCHITECTURE.md — system overview, stack, directory structure, key flows |
| 36 | 2. API_ENDPOINTS.md — routes, methods, params, response shapes, auth |
| 37 | 3. DATABASE_SCHEMA.md — tables, relationships, migrations, indexes |
| 38 | 4. All of the above |
| 39 | ``` |
| 40 | |
| 41 | Only offer docs that match the project. Don't offer API_ENDPOINTS.md for a static site. Don't offer DATABASE_SCHEMA.md if there's no database. |
| 42 | |
| 43 | ### 3. Scan the Codebase |
| 44 | |
| 45 | For each requested doc, read the relevant source files: |
| 46 | |
| 47 | **ARCHITECTURE.md** — scan: |
| 48 | - `package.json` / `pyproject.toml` (stack, dependencies) |
| 49 | - Entry points (`src/index.ts`, `src/main.tsx`, `src/App.tsx`) |
| 50 | - Config files (`wrangler.jsonc`, `vite.config.ts`, `tsconfig.json`) |
| 51 | - Directory structure (top 2 levels) |
| 52 | - Key modules and their exports |
| 53 | |
| 54 | **API_ENDPOINTS.md** — scan: |
| 55 | - Route files (`src/routes/`, `src/api/`, or inline in index) |
| 56 | - Middleware files (auth, CORS, logging) |
| 57 | - Request/response types or Zod schemas |
| 58 | - Error handling patterns |
| 59 | |
| 60 | **DATABASE_SCHEMA.md** — scan: |
| 61 | - Drizzle schema files (`src/db/schema.ts`, `src/schema/`) |
| 62 | - Migration files (`drizzle/`, `migrations/`) |
| 63 | - Raw SQL files if present |
| 64 | - Seed files if present |
| 65 | |
| 66 | ### 4. Generate Documentation |
| 67 | |
| 68 | Write each doc to `docs/` (create the directory if it doesn't exist). If the project already has docs there, offer to update rather than overwrite. |
| 69 | |
| 70 | For small projects with no `docs/` directory, write to the project root instead. |
| 71 | |
| 72 | ## Document Templates |
| 73 | |
| 74 | ### ARCHITECTURE.md |
| 75 | |
| 76 | ```markdown |
| 77 | # Architecture |
| 78 | |
| 79 | ## Overview |
| 80 | [One paragraph: what this project does and how it's structured] |
| 81 | |
| 82 | ## Stack |
| 83 | | Layer | Technology | Version | |
| 84 | |-------|-----------|---------| |
| 85 | | Runtime | [e.g. Cloudflare Workers] | — | |
| 86 | | Framework | [e.g. Hono] | [version] | |
| 87 | | Database | [e.g. D1 (SQLite)] | — | |
| 88 | | ORM | [e.g. Drizzle] | [version] | |
| 89 | | Frontend | [e.g. React 19] | [version] | |
| 90 | | Styling | [e.g. Tailwind v4] | [version] | |
| 91 | |
| 92 | ## Directory Structure |
| 93 | [Annotated tree — top 2 levels with purpose comments] |
| 94 | |
| 95 | ## Key Flows |
| 96 | ### [Flow 1: e.g. "User Authentication"] |
| 97 | [Step-by-step: request → middleware → handler → database → response] |
| 98 | |
| 99 | ### [Flow 2: e.g. "Data Processing Pipeline"] |
| 100 | [Step-by-step through the system] |
| 101 | |
| 102 | ## Configuration |
| 103 | [Key config files and what they control] |
| 104 | |
| 105 | ## Deployment |
| 106 | [How to deploy, environment variables needed, build commands] |
| 107 | ``` |
| 108 | |
| 109 | ### API_ENDPOINTS.md |
| 110 | |
| 111 | ```markdown |
| 112 | # API Endpoints |
| 113 | |
| 114 | ## Base URL |
| 115 | [e.g. `https://api.example.com` or relative `/api`] |
| 116 | |
| 117 | ## Authentication |
| 118 | [Method: Bearer token, session cookie, API key, none] |
| 119 | [Where tokens come from, how to obtain] |
| 120 | |
| 121 | ## Endpoints |
| 122 | |
| 123 | ### [Group: e.g. Users] |
| 124 | |
| 125 | #### `GET /api/users` |
| 126 | - **Auth**: Required |
| 127 | - **Params**: `?page=1&limit=20` |
| 128 | - **Response**: `{ users: User[], total: number }` |
| 129 | |
| 130 | #### `POST /api/users` |
| 131 | - **Auth**: Required (admin) |
| 132 | - **Body**: `{ name: string, email: string }` |
| 133 | - **Response**: `{ user: User }` (201) |
| 134 | - **Errors**: 400 (validation), 409 (duplicate email) |
| 135 | |
| 136 | [Repeat for each endpoint] |
| 137 | |
| 138 | ## Error Format |
| 139 | [Standard error response shape] |
| 140 | |
| 141 | ## Rate Limits |
| 142 | [If applicable] |
| 143 | ``` |
| 144 | |
| 145 | ### DATABASE_SCHEMA.md |
| 146 | |
| 147 | ```markdown |
| 148 | # Database Schema |
| 149 | |
| 150 | ## Engine |
| 151 | [e.g. Cloudflare D1 (SQLite), PostgreSQL, MySQL] |
| 152 | |
| 153 | ## Tables |
| 154 | |
| 155 | ### `users` |
| 156 | | Column | Type | Constraints | Description | |
| 157 | |--------|------|-------------|-------------| |
| 158 | | id | TEXT | PK | UUID | |
| 159 | | email | TEXT | UNIQUE, NOT NULL | User email | |
| 160 | | name | TEXT | NOT NULL | Display name | |
| 161 | | created_at | TEXT | NOT NULL, DEFAULT now | ISO timestamp | |
| 162 | |
| 163 | ### `posts |