Skip to content

Commit 265657f

Browse files
committed
feat(docs): add docs skill with new/update/review/retcon + site wiring
- add skills/dev-docs/ (template library) and skills/docs/ (operational skill with new/update/review/retcon commands extracted from dev-docs) - add monochrome docs icon, VitePress tile and sidebar entry in correct order (spec → dev → docs → flow → pr); update README workflow table - parallelize docs new/retcon/review and usage report with background agents - parallelize diff.md steps 3–4 (repo structure scan + category diffs) - fix spec new: replace dead-end "Needs changes" button with Other free-text - add xargs, sed, sort, pnpm run docs:build to allowed commands
1 parent 4ca0474 commit 265657f

36 files changed

Lines changed: 2838 additions & 32 deletions

.claude/settings.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@
5151
"Bash(npm run:*)",
5252
"Bash(npx:*)",
5353
"Bash(osascript:*)",
54+
"Bash(pnpm run docs:build:*)",
55+
"Bash(sed:*)",
56+
"Bash(sort:*)",
57+
"Bash(xargs:*)",
5458
"Bash(wc:*)",
5559
"Edit",
5660
"WebFetch",

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ Research requirements, generate proposals, create phase-by-phase implementation
3333
Architecture planning, technical exploration, and repo/branch comparison.</td>
3434
</tr>
3535
<tr>
36+
<td align="center"><img src="docs/public/icons/docs.svg" width="32"></td>
37+
<td><strong>docs</strong> — engineering documentation<br>
38+
Generate, update, review, and retroactively create docs from standard templates.</td>
39+
</tr>
40+
<tr>
3641
<td align="center"><img src="docs/public/icons/flow.svg" width="32"></td>
3742
<td><strong>flow</strong> — end-to-end pipeline orchestration<br>
3843
Chain skill workflows into end-to-end pipelines that run sequentially.</td>

docs/.vitepress/config.mjs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export default defineConfig({
2424
"skills/changelog/**",
2525
"skills/cz/**",
2626
"skills/dev/**",
27+
"skills/docs/**",
2728
"skills/docker/**",
2829
"skills/em/**",
2930
"skills/flow/**",
@@ -106,6 +107,7 @@ export default defineConfig({
106107
items: [
107108
{ text: "spec", link: "/skills/spec" },
108109
{ text: "dev", link: "/skills/dev" },
110+
{ text: "docs", link: "/skills/docs" },
109111
{ text: "flow", link: "/skills/flow" },
110112
{ text: "pr", link: "/skills/pr" },
111113
{ text: "qa", link: "/skills/qa" },

docs/index.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ features:
2828
title: dev
2929
details: Architecture planning, technical exploration, repo comparison, and docs generation.
3030
link: /skills/dev
31+
- icon:
32+
src: /icons/docs.svg
33+
title: docs
34+
details: Generate, update, review, and retroactively create engineering documentation.
35+
link: /skills/docs
3136
- icon:
3237
src: /icons/flow.svg
3338
title: flow

docs/public/icons/docs.svg

Lines changed: 3 additions & 0 deletions
Loading

docs/skills/dev.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,8 @@ Plan feature architecture or system design and write a draft to `.codevoyant/pla
4040

4141
### docs — generate architecture documentation
4242

43-
Scan the codebase and produce component maps, data flow diagrams, API inventories, and dependency graphs in `docs/architecture/`.
44-
45-
```bash
46-
/dev docs # generate docs/architecture/ from codebase
47-
/dev docs --bg # run in background, notify when done
48-
```
43+
> **Moved to `docs` skill.** Use `/docs new`, `/docs update`, `/docs review`, or `/docs retcon` instead.
44+
> See [`/skills/docs`](/skills/docs) for the full command reference.
4945
5046
### approve — promote plan to docs and Linear
5147

docs/skills/docs.md

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# docs
2+
3+
Generate, update, review, and retroactively create engineering documentation from standard templates.
4+
5+
## Workflows
6+
7+
### new -- create one or more doc files
8+
9+
Generate a specific documentation file (or multiple files at once) using the appropriate component-type template.
10+
11+
```bash
12+
/docs new auth --type library # generate docs/architecture/auth.md
13+
/docs new auth storage payments # batch: generate three files
14+
/docs readme # generate docs/README.md
15+
/docs architecture # generate docs/architecture/README.md
16+
```
17+
18+
If `--type` is omitted, the type is auto-detected from the component's path in the codebase (`libs/` -> library, `apps/*/routes/api/` -> api, etc.).
19+
20+
### update -- add to an existing doc from session context
21+
22+
Update an existing documentation file with additions based on changes visible in the current session. Additive only -- existing content is preserved.
23+
24+
```bash
25+
/docs update auth # update auth.md from session changes
26+
/docs update storage # update storage.md
27+
```
28+
29+
Detects new env vars, new API endpoints, new design decisions, and new flow steps from the conversation, then adds them to the appropriate sections.
30+
31+
### review -- audit docs/ for template adherence
32+
33+
Evaluate Markdown files in `docs/` against the skill's template standards. Read-only -- nothing is modified. Emits a per-file gap report.
34+
35+
```bash
36+
/docs review # audit all of docs/
37+
/docs review docs/architecture/ # audit one directory
38+
/docs review docs/architecture/auth.md # audit one file
39+
/docs review --json # machine-readable output
40+
```
41+
42+
Checks for: required sections (Overview, Requirements, Design, Implementation, References), prescribed Mermaid diagram types, undefined acronyms, and second-person voice violations.
43+
44+
### retcon -- generate full docs/ for a codebase with none
45+
46+
Discover all major components in the codebase and generate a complete `docs/` structure from scratch. Useful when inheriting a project with no documentation.
47+
48+
```bash
49+
/docs retcon # full codebase docs generation
50+
/docs retcon --dry-run # preview manifest before generating
51+
```
52+
53+
## Templates
54+
55+
All generated docs follow the section order: `Overview -> Requirements -> Design -> Implementation -> References`.
56+
57+
Four component-type templates are available:
58+
59+
| Type | Use for |
60+
|------|---------|
61+
| `api` | REST endpoint groups (`/api/`, route handlers) |
62+
| `library` | Monorepo packages (`libs/`, `packages/`) |
63+
| `frontend` | Svelte/React features, UI component libraries |
64+
| `infra` | Terraform modules (`infra/modules/`) |
65+
66+
## Writing Standard
67+
68+
Generated docs follow a junior-dev-friendly writing standard:
69+
- Define every acronym on first use
70+
- One idea per sentence
71+
- Explain "why" before "what" for non-obvious decisions
72+
- Mermaid diagrams replace prose for all multi-step flows

skills/dev-docs/SKILL.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
> **Superseded by `docs`** — this skill has been extracted into the standalone `docs` skill.
2+
> Use `/docs new`, `/docs update`, `/docs review`, or `/docs retcon` instead.
3+
> This file is kept for backwards compatibility only.
4+
5+
# dev docs
6+
7+
Generate and enforce documentation templates for engineering projects.
8+
9+
Triggers: "dev docs", "generate docs", "create docs", "document {component}", "write docs for", "add docs for"
10+
11+
## Critical Rules
12+
13+
- **Never execute workflow logic here** — this file only parses args and dispatches
14+
- **Step 0 always runs first** — no exceptions
15+
- **Unknown verb → run `help.md`** — never error silently
16+
17+
## Step 0: Parse Arguments
18+
19+
```bash
20+
VERB="[first non-flag argument after 'docs', or empty]"
21+
REMAINING_ARGS="[everything after VERB, preserving order and flags]"
22+
23+
# Normalise
24+
case "$VERB" in
25+
"") VERB="detect" ;; # /dev docs → auto-detect missing docs
26+
"arch") VERB="architecture" ;;
27+
"arch-readme") VERB="architecture" ;;
28+
esac
29+
```
30+
31+
## Step 1: Dispatch to Workflow
32+
33+
Read and execute `references/workflows/{VERB}.md`, passing `$REMAINING_ARGS`.
34+
35+
If `references/workflows/{VERB}.md` does not exist, fall back to `references/workflows/help.md`.
36+
37+
## Workflow Index
38+
39+
- **detect** (`references/workflows/docs.md`) — auto-detect missing docs and generate stubs
40+
- **readme** (`references/workflows/docs.md`) — generate/update `docs/README.md`
41+
- **architecture** (`references/workflows/docs.md`) — generate/update `docs/architecture/README.md` or a component file
42+
- **help** (`references/workflows/help.md`) — print command reference
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# Language Guide
2+
3+
Rules for writing junior-dev-friendly engineering documentation.
4+
5+
## Core Principle
6+
7+
Documentation is for the person joining the team tomorrow with two years of experience.
8+
Not for the person who built the system. Not for a computer science professor.
9+
10+
## Rules
11+
12+
### 1. Define every acronym on first use
13+
14+
Bad: "The app uses OIDC via an M2M flow with RS256 JWT validation."
15+
Good: "The app uses OpenID Connect (OIDC) — an identity layer on top of OAuth 2.0 — to verify who you are. It validates the JSON Web Token (JWT) using the RS256 algorithm (a public-key signature scheme)."
16+
17+
Define once per document, in parentheses after the first use. Not in a glossary at the bottom — by the time the reader gets there, they're already confused.
18+
19+
### 2. One idea per sentence
20+
21+
Bad: "The session cookie, which is HttpOnly and therefore inaccessible to JavaScript running in the browser, contains a base64-encoded JSON object that includes the access token, refresh token, and expiry timestamp, and is validated on every request by re-verifying the JWT signature against Kinde's public JWKS endpoint."
22+
23+
Good:
24+
"The session is stored in an HttpOnly cookie — JavaScript running in the browser cannot read it (this prevents XSS attacks from stealing sessions).
25+
The cookie contains a base64-encoded JSON object with the access token, refresh token, and expiry time.
26+
The server validates this cookie on every request by checking the JWT signature against Kinde's public key."
27+
28+
### 3. Explain the "why" before the "what"
29+
30+
Bad: "Post text is stored in GCS."
31+
Good: "Firestore documents have a 1 MB size limit, which long-form posts would easily exceed. Post text is therefore stored in GCS (Google Cloud Storage), with Firestore holding only a path reference."
32+
33+
### 4. Use "you" (second person) consistently
34+
35+
Bad: "The developer must add their email to `infra/shared/main.tf`."
36+
Good: "Add your email to `infra/shared/main.tf`."
37+
38+
The reader is always "you". Never "the developer", "the user", "one", or passive voice.
39+
40+
### 5. Keep `## Overview` to 3 sentences max
41+
42+
The overview answers three questions:
43+
1. What is this? (one sentence)
44+
2. Where does it live in the codebase? (one sentence)
45+
3. Why does it exist / what problem does it solve? (one sentence)
46+
47+
Everything else goes in Design or Implementation.
48+
49+
### 6. Use tables for lists of 3+ related properties
50+
51+
Bad:
52+
"The cookie is set with HttpOnly=true to prevent XSS. It uses Secure=true in production to require HTTPS. SameSite=Lax is set for CSRF protection."
53+
54+
Good:
55+
| Property | Value | Purpose |
56+
|----------|-------|---------|
57+
| HttpOnly | true | Prevents JavaScript from reading the cookie (XSS protection) |
58+
| Secure | true in prod | Cookie only sent over HTTPS |
59+
| SameSite | Lax | Prevents CSRF attacks |
60+
61+
### 7. Use diagrams to replace, not supplement, prose
62+
63+
If you have a numbered list describing a multi-step flow, replace it with a `sequenceDiagram` or `flowchart`. Keep the numbered list only if the diagram would be harder to read (e.g. a list of 3 simple steps).
64+
65+
The goal is: can a new team member understand the flow in 30 seconds from the diagram alone?
66+
67+
### 8. Avoid impl-detail jargon in Overview and Requirements
68+
69+
- No class names, function names, or file paths in `## Overview`
70+
- No TypeScript generics or internal abstractions in `## Requirements`
71+
- Save those for `## Design` and `## Implementation`
72+
73+
### 9. Code blocks for everything executable
74+
75+
Any command, path, variable value, or snippet that the reader might copy-paste: put it in a code block.
76+
77+
Bad: "Run pnpm install then just dev."
78+
Good: Run `pnpm install` then `just dev`.
79+
Or:
80+
```bash
81+
pnpm install
82+
just dev
83+
```
84+
85+
### 10. Link; don't duplicate
86+
87+
If auth.md already explains the session format, link to it — don't repeat it. Use the `## References` section. Duplication creates maintenance debt.

0 commit comments

Comments
 (0)