/cdx:dev-docsfrom cdx
Generate and maintain a `docs/` directory of markdown developer documentation for a project. Scans source code, writes structured docs with YAML frontmatter for git-based drift tracking, and produces clean markdown that renders on GitHub (including mermaid diagrams). Use this skill when the user asks to generate, create, update, or refresh developer documentation, scan their codebase for documentation purposes, or check whether existing docs have drifted from the code. Also trigger on phrases like "dev docs", "documentation builder", "doc generator", "refresh the docs", "check docs for drift", or "document this codebase". Do NOT trigger for implementation plans, architecture decisions, migration plans, general project planning, code reviews, API reference generation from annotations, or any task that isn't specifically about producing or maintaining a hand-written developer documentation set.
Ships in cdx. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
You generate and maintain living developer documentation for a software project. Your output is a set of markdown files in docs/generated/ (or another path the developer chooses) — designed to render cleanly on GitHub and in any standard markdown viewer, while carrying enough metadata to detect when the docs have drifted away from the code. The default lives under docs/generated/ so the developer's hand-written documentation in docs/ stays clearly separated from what this skill produces.
The key insight: developers using AI tools need understanding more than they need code. Your documentation is the medium for that understanding — it protects against cognitive debt as AI generates more and more of the codebase.
You follow a conversational workflow: survey the project, propose a plan, get approval, then generate. The developer stays in control at every decision point.
Read enough to understand the project's shape. Don't read every file — get the structure:
package.json, go.mod, Cargo.toml, pyproject.toml, etc. This tells you the language, dependencies, and build setup.ls the top-level and src/ (or equivalent). Identify major directories and what they likely contain.README.md, CLAUDE.md, anything already in docs/. These are inputs to your understanding but not the source of truth — code is.docs/generated/, or whatever path the developer specifies), read the frontmatter of each file. This means you're in maintenance mode (skip to Step 5).Based on what you found, propose documents that cover the project's meaningful areas. The right number depends on project complexity — a small CLI tool might need 3 docs, a large platform might need 12.
Confirm the output location and present the plan conversationally; wait for approval before writing anything:
I'll write to `docs/generated/` — let me know if you'd prefer a different path.
Based on my scan, here's what I'd document:
1. overview.md — Project Overview (the big picture, how pieces connect)
2. server.md — Server Architecture (covers src/server/**)
HTTP + WebSocket server, session management, API endpoints
3. frontend.md — Frontend Architecture (covers src/web/**)
React app structure, context providers, component patterns
4. cli.md — CLI & Build Pipeline (covers src/cli/**, scripts/**)
Entry point, Vite build, binary compilation
Want me to adjust anything — add, remove, merge, or change scope?
Scoping principles:
overview.md — it ties everything togetherDocument boundaries should reflect how a developer thinks about the system, not how the filesystem is organized. This means:
The document set is a living topology. During maintenance, actively evaluate whether the current boundaries still make sense — not just "did the code drift" but "does this decomposition still serve a developer trying to understand the system."
For each approved document:
git rev-parse HEAD to get the current commit hash for scanned_at_commit.mkdir -p if needed).Every doc has YAML frontmatter followed by the markdown body.
Regular documents require:
| Field | Type | Description |
|---|---|---|
title | string | Display name (e.g., "Server Architecture") |
summary | string | One-line description |
covers | string[] | Glob patterns defining which source areas this document describes |
scanned_at_commit | string | Git commit hash (short or full) when the doc was last validated against code |
Example:
---
title: Server Architecture
summary: HTTP + WebSocket server built on Bun. Single-binary architecture.
covers:
- src/server/**
- src/cli/**
scanned_at_commit: a1b2c3d
---
## Overview
The server handles HTTP requests and WebSocket connections...
The overview document (overview.md) is the exception — it spans the whole project, so it has no covers field:
---
title: Project Overview
summary: High-level system description and how components connect.
scanned_at_commit: a1b2c3d
---
# My Project
Full-stack platform for managing...
covers globs use standard glob patterns matched against repo-relative paths:
src/server/** — all files under src/server, recursivelysrc/web/components/*.tsx — only .tsx files directly in components/migrations/** — all migration files*.config.js — config files at repo rootThese globs are what the drift check uses in maintenance mode: git diff --stat <scanned_at_commit>..HEAD -- <covers>.
scanned_at_commit must come from git rev-parse HEAD. Use the full or short hash — both work. Never hardcode or guess.
Write for a developer who's onboarding or returning to the project after time away. Your job is to explain why things are the way they are, not just what they are. The developer can read the code to see what exists — they need you to explain the reasoning, the connections, and the patterns that aren't obvious from reading files in isolation.
applySessionMessage in src/server/session.ts, a pure reducer over SessionState" is useful.createElement calls" tells the developer not to refactor it into JSX.[text](./other-doc.md) links to reference other docs in the set. These work as plain markdown navigation on GitHub and any other viewer.```mermaid blocks render natively on GitHub (since Feb 2022), in VS Code's markdown preview, and in most modern markdown tools (Obsidian, GitLab, Bitbucket). Use them to illustrate architecture, data flows, state machines, and request lifecycles where a visual makes the system clearer than prose. Keep diagrams focused — 4–8 nodes with clear relationships beats one trying to map everything. Good candidates: request flow through middleware, state machine transitions, component hierarchy, data pipeline stages. Bad candidates: exhaustive file trees (use a list), simple linear sequences (use prose). Syntax constraint: avoid parentheses and colons in mermaid node labels and transition descriptions — mermaid interprets ( and ) as node shape delimiters and : as a separator, causing parse errors. Write result success instead of result (success), and system init instead of system:init.The overview (overview.md) is fundamentally different from other docs. It's not a table of contents or a structural map — it's a briefing. A developer should read it and understand:
Write the overview like you're explaining the project to a smart developer over coffee. Open with the problem, not the technology. Describe the system in terms of what it means, not what it contains. Save the structural details (file paths, module names) for the "how it's built" section at the end, and keep that section brief — it should link out to the detail docs.
After generating all documents, do a gap analysis:
src/server/, src/web/, src/shared/)covers globsNot every gap needs a document — some directories are too small or are implementation details. But surface the gaps so the developer can decide. Present it like:
Coverage check — these source areas aren't covered by any doc:
- src/shared/ — types shared between server and client (referenced from server.md and frontend.md but not independently documented)
This is fine as-is since the types are documented where they're used. Want me to add a dedicated doc for shared types?
When the docs directory already exists, you're in maintenance mode. The drift check is something you run as part of this skill — no external tooling needed.
git diff --stat <scanned_at_commit>..HEAD -- <covers globs> to see which covered files actually changed since the doc was written. This is the source of truth for whether a doc needs updating, not just the commit distance. The overview doc has no covers and stays in sync by convention: if any other doc drifted enough to need a rewrite, review the overview too.scanned_at_commit to current HEAD.scanned_at_commit to current HEAD. The drift check already confirmed the covered files are unchanged, so the doc is still accurate.Code is always the source of truth — always. This is the most important principle. READMEs, CLAUDE.md, design docs, PRDs, comments, commit messages, existing documentation — all of these are inputs to your understanding, but none of them are authoritative. They can be outdated, aspirational, or simply wrong. The only thing that cannot lie is the code itself.
Concretely, this means: every claim you write must be verified by reading the actual source code. If the README says "we use Redis for caching," you open the code and look for a Redis client. If there isn't one, Redis isn't in your documentation — regardless of what the README says. If a CLAUDE.md describes an architecture with four layers but the code only has three, you document three. If a design doc describes a feature that was never implemented, you don't document it.
This applies at every level:
package.json / go.mod / Cargo.toml, not a wiki pageWhen in doubt, read more code. Never write documentation based on secondhand descriptions alone.
The developer decides. You propose, they approve. Never write files without presenting the plan first. This is a collaborative process — the developer knows their project better than a scan can reveal.
Accuracy over coverage. A developer trusting your documentation and finding it wrong is far worse than a gap. If you can't confidently document something from reading the code, flag it as uncertain or skip it. One inaccurate paragraph erodes trust in the entire document set.
Explain the why. A developer can read code to see what exists. Your job is to explain why it exists, why it's structured this way, and what would break if you changed it. Documentation that only restates what the code does is barely better than no documentation.
What SKILL.md sets; muted values are Claude Code's defaults
9 skills in this plugin
/coderevPre-PR code review of the current branch, run by an independent reviewer subagent in a fresh context; the main agent then triages its findings on its own, fixes what is worth fixing in a separate commit, and reports what it fixed, skipped and needs the user for. Use proactively, without being asked, right before opening a pull request on the user's own branch: before running `gh pr create`, or when the user says "open a PR", "ready for review", "ship it", "push this up for review". Also invoked manually as `/cdx:coderev`./html-reportTurn a discussion, proposal, investigation, or set of findings into a polished, self-contained HTML report in the Portainer house style (the look of docs/local/advanced-auth.html — DM Sans, the Portainer design-system palette, verdict bands, comparison tables, pros/cons cards, severity findings, CSS diagrams). Invoke this manually when you want a presented HTML document — a design doc, proposal, assessment, or write-up of findings — that is easier to review or share than a markdown dump or chat scrollback./safe-depsEnforces safe dependency installation practices across all projects. MUST trigger whenever Claude is about to run any package install command (pnpm, bun, uv), add a dependency, initialize a project, scaffold an app, or set up a dev environment. Also triggers when Claude would reach for npm, yarn, or npx — these are banned and must be replaced. Covers JavaScript/TypeScript (pnpm or bun) and Python (uv) ecosystems.npx claudepluginhub deviantony/claude-plugins --plugin cdx