@sandrinio/vdoc 3.0.0 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -13
- package/bin/vdoc.mjs +2 -0
- package/package.json +1 -1
- package/skills/claude/SKILL.md +27 -184
- package/skills/claude/references/audit-workflow.md +65 -0
- package/skills/claude/references/init-workflow.md +86 -0
package/README.md
CHANGED
|
@@ -21,7 +21,7 @@ vdoc teaches your AI coding agent how to create and maintain feature-centric doc
|
|
|
21
21
|
## Quick Start
|
|
22
22
|
|
|
23
23
|
```bash
|
|
24
|
-
npx vdoc install cursor
|
|
24
|
+
npx @sandrinio/vdoc install cursor
|
|
25
25
|
```
|
|
26
26
|
|
|
27
27
|
Then open Cursor and type: **`/vdoc init`**
|
|
@@ -32,16 +32,16 @@ Then open Cursor and type: **`/vdoc init`**
|
|
|
32
32
|
|
|
33
33
|
| Platform | Install Command | `/vdoc` Command | Invocation |
|
|
34
34
|
|----------|----------------|----------------|------------|
|
|
35
|
-
| **Claude Code** | `npx vdoc install claude` | `/vdoc init` `/vdoc audit` | Skill (SKILL.md) |
|
|
36
|
-
| **Cursor** | `npx vdoc install cursor` | `/vdoc init` `/vdoc audit` | Command + Rule |
|
|
37
|
-
| **Windsurf** | `npx vdoc install windsurf` | `/vdoc` | Workflow + Rule |
|
|
38
|
-
| **VS Code (Copilot)** | `npx vdoc install vscode` | `/vdoc` | Prompt + Instructions |
|
|
39
|
-
| **Continue** | `npx vdoc install continue` | `/vdoc init` `/vdoc audit` | Invokable Prompt + Rule |
|
|
40
|
-
| **Cline** | `npx vdoc install cline` | `/vdoc` | Workflow + Rule |
|
|
41
|
-
| **Gemini CLI** | `npx vdoc install gemini` | `/vdoc init` `/vdoc audit` | TOML Command + GEMINI.md |
|
|
42
|
-
| **JetBrains AI** | `npx vdoc install jetbrains` | Natural language | Rule only |
|
|
43
|
-
| **JetBrains Junie** | `npx vdoc install junie` | Natural language | Guidelines only |
|
|
44
|
-
| **Universal** | `npx vdoc install agents` | Natural language | AGENTS.md |
|
|
35
|
+
| **Claude Code** | `npx @sandrinio/vdoc install claude` | `/vdoc init` `/vdoc audit` | Skill (SKILL.md) |
|
|
36
|
+
| **Cursor** | `npx @sandrinio/vdoc install cursor` | `/vdoc init` `/vdoc audit` | Command + Rule |
|
|
37
|
+
| **Windsurf** | `npx @sandrinio/vdoc install windsurf` | `/vdoc` | Workflow + Rule |
|
|
38
|
+
| **VS Code (Copilot)** | `npx @sandrinio/vdoc install vscode` | `/vdoc` | Prompt + Instructions |
|
|
39
|
+
| **Continue** | `npx @sandrinio/vdoc install continue` | `/vdoc init` `/vdoc audit` | Invokable Prompt + Rule |
|
|
40
|
+
| **Cline** | `npx @sandrinio/vdoc install cline` | `/vdoc` | Workflow + Rule |
|
|
41
|
+
| **Gemini CLI** | `npx @sandrinio/vdoc install gemini` | `/vdoc init` `/vdoc audit` | TOML Command + GEMINI.md |
|
|
42
|
+
| **JetBrains AI** | `npx @sandrinio/vdoc install jetbrains` | Natural language | Rule only |
|
|
43
|
+
| **JetBrains Junie** | `npx @sandrinio/vdoc install junie` | Natural language | Guidelines only |
|
|
44
|
+
| **Universal** | `npx @sandrinio/vdoc install agents` | Natural language | AGENTS.md |
|
|
45
45
|
|
|
46
46
|
---
|
|
47
47
|
|
|
@@ -50,7 +50,7 @@ Then open Cursor and type: **`/vdoc init`**
|
|
|
50
50
|
### 1. Install (~5 seconds)
|
|
51
51
|
|
|
52
52
|
```bash
|
|
53
|
-
npx vdoc install claude
|
|
53
|
+
npx @sandrinio/vdoc install claude
|
|
54
54
|
```
|
|
55
55
|
|
|
56
56
|
Copies skill files to your AI platform's rules and commands locations. That's it.
|
|
@@ -131,7 +131,7 @@ The `_manifest.json` acts as a semantic index. Each entry has a rich `descriptio
|
|
|
131
131
|
## Uninstall
|
|
132
132
|
|
|
133
133
|
```bash
|
|
134
|
-
npx vdoc uninstall
|
|
134
|
+
npx @sandrinio/vdoc uninstall
|
|
135
135
|
```
|
|
136
136
|
|
|
137
137
|
Removes all vdoc skill and rule files from **every** supported platform in one command. No platform argument needed — it scans for and deletes everything vdoc may have created:
|
package/bin/vdoc.mjs
CHANGED
|
@@ -16,6 +16,8 @@ const PLATFORMS = {
|
|
|
16
16
|
{ src: 'claude/SKILL.md', dest: '.claude/skills/vdoc/SKILL.md' },
|
|
17
17
|
{ src: 'claude/references/doc-template.md', dest: '.claude/skills/vdoc/references/doc-template.md' },
|
|
18
18
|
{ src: 'claude/references/manifest-schema.json', dest: '.claude/skills/vdoc/references/manifest-schema.json' },
|
|
19
|
+
{ src: 'claude/references/init-workflow.md', dest: '.claude/skills/vdoc/references/init-workflow.md' },
|
|
20
|
+
{ src: 'claude/references/audit-workflow.md', dest: '.claude/skills/vdoc/references/audit-workflow.md' },
|
|
19
21
|
],
|
|
20
22
|
},
|
|
21
23
|
cursor: {
|
package/package.json
CHANGED
package/skills/claude/SKILL.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: vdoc
|
|
3
|
-
description:
|
|
3
|
+
description: "Use when user says /vdoc, 'document this project', 'audit docs', or asks questions about codebase documentation. Generates feature-centric docs in vdocs/ with semantic manifest for AI routing."
|
|
4
4
|
argument-hint: "[init|audit] or ask any documentation question"
|
|
5
5
|
user-invocable: true
|
|
6
6
|
allowed-tools: ["Bash", "Read", "Write", "Edit", "Glob", "Grep"]
|
|
@@ -8,205 +8,48 @@ allowed-tools: ["Bash", "Read", "Write", "Edit", "Glob", "Grep"]
|
|
|
8
8
|
|
|
9
9
|
# vdoc — Documentation Generator
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
Three modes: **init**, **audit**, **query**. All docs live in `vdocs/`. Manifest at `vdocs/_manifest.json` is the semantic index.
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
## Init (`/vdoc init`)
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
## Mode 1: Init
|
|
18
|
-
|
|
19
|
-
**Trigger:** `/vdoc init` or user says "document this project"
|
|
20
|
-
|
|
21
|
-
### Step 1 — Explore
|
|
22
|
-
|
|
23
|
-
Read the codebase thoroughly. Identify:
|
|
24
|
-
|
|
25
|
-
- **Tech stack**: languages, frameworks, databases, ORMs
|
|
26
|
-
- **Features**: authentication, API, payments, notifications, search, etc.
|
|
27
|
-
- **Architecture**: monolith vs microservices, frontend/backend split, key patterns (MVC, event-driven, etc.)
|
|
28
|
-
- **Integrations**: third-party services (Stripe, AWS, Redis, etc.)
|
|
29
|
-
- **Entry points**: where requests come in, how they flow through the system
|
|
30
|
-
|
|
31
|
-
Do not skim. Read key files — entry points, config files, route definitions, schema files, middleware. Understand how the system actually works before proposing docs.
|
|
32
|
-
|
|
33
|
-
### Step 2 — Plan
|
|
34
|
-
|
|
35
|
-
Create `vdocs/_DOCUMENTATION_PLAN.md` listing each proposed doc:
|
|
36
|
-
|
|
37
|
-
```markdown
|
|
38
|
-
# Documentation Plan
|
|
39
|
-
|
|
40
|
-
## Proposed Documents
|
|
41
|
-
|
|
42
|
-
1. **PROJECT_OVERVIEW_DOC.md** — Tech stack, architecture, project structure, dev setup
|
|
43
|
-
2. **AUTHENTICATION_DOC.md** — OAuth2 flow, JWT lifecycle, session management, RBAC
|
|
44
|
-
3. **API_REFERENCE_DOC.md** — All endpoints, request/response shapes, error codes
|
|
45
|
-
...
|
|
46
|
-
|
|
47
|
-
## Notes
|
|
48
|
-
- Each doc covers one logical feature, not one file
|
|
49
|
-
- Docs should be useful for onboarding AND as AI context for planning changes
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
Present the plan to the user. Actively suggest changes:
|
|
53
|
-
- "Should I merge X and Y into one doc?"
|
|
54
|
-
- "I found a websocket system — want that documented separately?"
|
|
55
|
-
- "Any internal/legacy systems I should skip?"
|
|
56
|
-
|
|
57
|
-
Wait for user approval before proceeding.
|
|
58
|
-
|
|
59
|
-
### Step 3 — Generate
|
|
60
|
-
|
|
61
|
-
For each approved doc:
|
|
62
|
-
|
|
63
|
-
1. Read ALL relevant source files for that feature — not just the main file, but helpers, types, middleware, tests
|
|
64
|
-
2. Follow the template in `references/doc-template.md` exactly
|
|
65
|
-
3. Write to `vdocs/FEATURE_NAME_DOC.md`
|
|
66
|
-
|
|
67
|
-
**Writing rules:**
|
|
68
|
-
|
|
69
|
-
- **Mermaid diagrams are mandatory** in "How It Works". Show the actual flow — request lifecycle, state transitions, data pipeline. If a flow has more than 7-9 nodes, split into multiple diagrams.
|
|
70
|
-
- **Data Model** must show real entities from the code, not generic placeholders. Use mermaid ER diagrams for relational data, tables for simpler models.
|
|
71
|
-
- **Constraints & Decisions** is the most valuable section. Dig into the code for non-obvious choices: "Uses polling instead of websockets because...", "Auth tokens expire in 15min because...". If you can't find the reason, state the constraint and mark it: `Reason: unknown — verify with team`.
|
|
72
|
-
- **Related Features** must reference other docs by filename and explain the coupling: "Changes to the JWT schema will require updates to API_REFERENCE_DOC.md (auth middleware affects all endpoints)."
|
|
73
|
-
- **Configuration** must list actual env vars/secrets from the code, not hypothetical ones.
|
|
74
|
-
- **Error Handling** — trace what happens when things fail. What does the user see? What gets logged? Is there retry logic?
|
|
75
|
-
|
|
76
|
-
### Step 4 — Manifest
|
|
77
|
-
|
|
78
|
-
Create `vdocs/_manifest.json`:
|
|
79
|
-
|
|
80
|
-
```json
|
|
81
|
-
{
|
|
82
|
-
"project": "<project-name>",
|
|
83
|
-
"vdoc_version": "3.0.0",
|
|
84
|
-
"created_at": "<ISO-8601>",
|
|
85
|
-
"last_updated": "<ISO-8601>",
|
|
86
|
-
"last_commit": "<short-sha>",
|
|
87
|
-
"documentation": [
|
|
88
|
-
{
|
|
89
|
-
"filepath": "AUTHENTICATION_DOC.md",
|
|
90
|
-
"title": "Authentication - OAuth2 & JWT",
|
|
91
|
-
"version": "1.0.0",
|
|
92
|
-
"description": "OAuth2 flow with Google/GitHub providers, JWT token lifecycle, session management via NextAuth.js, route protection middleware, and role-based access control.",
|
|
93
|
-
"tags": ["oauth2", "jwt", "session-management", "rbac"]
|
|
94
|
-
}
|
|
95
|
-
]
|
|
96
|
-
}
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
The `description` field is critical — write it rich enough that you can route any user question to the right doc by matching against descriptions. Include specific technology names, patterns, and concepts.
|
|
100
|
-
|
|
101
|
-
### Step 5 — Self-Review
|
|
102
|
-
|
|
103
|
-
Before finishing, verify:
|
|
104
|
-
|
|
105
|
-
- [ ] Every doc has at least one mermaid diagram in "How It Works"
|
|
106
|
-
- [ ] Every doc has at least 2 entries in "Constraints & Decisions"
|
|
107
|
-
- [ ] Every doc's "Key Files" lists real paths that exist in the codebase
|
|
108
|
-
- [ ] Every doc's "Configuration" lists actual env vars from the code
|
|
109
|
-
- [ ] Every doc's "Related Features" references other doc filenames
|
|
110
|
-
- [ ] Manifest `description` is detailed enough for semantic routing
|
|
111
|
-
- [ ] No doc is just a shallow restatement of file names — each explains WHY and HOW
|
|
15
|
+
Generate feature-centric documentation from source code.
|
|
112
16
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
## Mode 2: Audit
|
|
116
|
-
|
|
117
|
-
**Trigger:** `/vdoc audit` or user says "audit docs"
|
|
118
|
-
|
|
119
|
-
### Step 1 — Read Current State
|
|
120
|
-
|
|
121
|
-
Read `vdocs/_manifest.json`. Load the list of documented features and their source files.
|
|
122
|
-
|
|
123
|
-
### Step 2 — Detect Changes
|
|
124
|
-
|
|
125
|
-
Run `git log --name-only --since="<last_updated>" --pretty=format:""` or use `git diff` to find all source files that changed since the last audit.
|
|
126
|
-
|
|
127
|
-
Cross-reference changed files against each doc's "Key Files" section to identify which docs are stale.
|
|
128
|
-
|
|
129
|
-
### Step 3 — Detect Coverage Gaps
|
|
130
|
-
|
|
131
|
-
Scan the codebase for significant features not covered by any doc. Look for:
|
|
132
|
-
- New route files / API endpoints
|
|
133
|
-
- New service classes or modules
|
|
134
|
-
- New database models / schema changes
|
|
135
|
-
- New configuration or infrastructure files
|
|
136
|
-
|
|
137
|
-
If you find undocumented features, propose new docs.
|
|
138
|
-
|
|
139
|
-
### Step 4 — Detect Dead Docs
|
|
140
|
-
|
|
141
|
-
Check each doc's "Key Files" section against the actual filesystem. If key files no longer exist, the doc may be dead. Flag it: "PAYMENT_PROCESSING_DOC.md references 3 files that no longer exist — remove or archive?"
|
|
142
|
-
|
|
143
|
-
### Step 5 — Check Cross-References
|
|
17
|
+
**Workflow:** Explore → Plan → Generate → Manifest → Self-review
|
|
144
18
|
|
|
145
|
-
|
|
146
|
-
- Referenced doc filenames still exist
|
|
147
|
-
- The described coupling is still accurate (skim the relevant code)
|
|
19
|
+
For detailed steps, read [references/init-workflow.md](references/init-workflow.md).
|
|
148
20
|
|
|
149
|
-
|
|
21
|
+
**Key rules:**
|
|
22
|
+
- Follow the template in [references/doc-template.md](references/doc-template.md) exactly
|
|
23
|
+
- Manifest schema in [references/manifest-schema.json](references/manifest-schema.json)
|
|
24
|
+
- Never generate without user-approved plan
|
|
25
|
+
- Mermaid diagrams mandatory (max 7-9 nodes)
|
|
26
|
+
- Only document what exists in code
|
|
150
27
|
|
|
151
|
-
|
|
28
|
+
## Audit (`/vdoc audit`)
|
|
152
29
|
|
|
153
|
-
|
|
154
|
-
Audit Results:
|
|
30
|
+
Detect stale, missing, and dead documentation. Report and patch.
|
|
155
31
|
|
|
156
|
-
|
|
157
|
-
- AUTHENTICATION_DOC.md — src/lib/auth.ts changed (added GitHub provider)
|
|
158
|
-
- API_REFERENCE_DOC.md — 2 new endpoints added
|
|
32
|
+
**Workflow:** Read manifest → Detect stale → Detect gaps → Detect dead → Check cross-refs → Report → Patch
|
|
159
33
|
|
|
160
|
-
|
|
161
|
-
- src/services/notification.ts — no doc covers notifications
|
|
34
|
+
For detailed steps, read [references/audit-workflow.md](references/audit-workflow.md).
|
|
162
35
|
|
|
163
|
-
|
|
164
|
-
- LEGACY_ADMIN_DOC.md — all 4 source files deleted
|
|
165
|
-
|
|
166
|
-
CROSS-REF ISSUES:
|
|
167
|
-
- AUTHENTICATION_DOC.md references BILLING_DOC.md which no longer exists
|
|
168
|
-
|
|
169
|
-
CURRENT (no changes needed):
|
|
170
|
-
- DATABASE_SCHEMA_DOC.md
|
|
171
|
-
- PROJECT_OVERVIEW_DOC.md
|
|
172
|
-
|
|
173
|
-
Proceed with fixes?
|
|
174
|
-
```
|
|
175
|
-
|
|
176
|
-
Wait for user direction, then:
|
|
177
|
-
- Patch stale docs (re-read source files, update affected sections only)
|
|
178
|
-
- Generate new docs for coverage gaps (follow init workflow for each)
|
|
179
|
-
- Flag dead docs for user to confirm deletion
|
|
180
|
-
- Fix cross-reference issues
|
|
181
|
-
- Update manifest: bump versions, update `last_updated`, `last_commit`
|
|
182
|
-
|
|
183
|
-
---
|
|
184
|
-
|
|
185
|
-
## Mode 3: Query
|
|
186
|
-
|
|
187
|
-
**Trigger:** User asks any question about the codebase or its documentation.
|
|
36
|
+
## Query (any documentation question)
|
|
188
37
|
|
|
189
38
|
1. Read `vdocs/_manifest.json`
|
|
190
|
-
2. Match
|
|
191
|
-
3. Read
|
|
192
|
-
4. Answer from
|
|
193
|
-
5. If no
|
|
194
|
-
|
|
195
|
-
---
|
|
39
|
+
2. Match question against `description` and `tags` fields
|
|
40
|
+
3. Read matching doc(s)
|
|
41
|
+
4. Answer from documented knowledge
|
|
42
|
+
5. If no match, suggest running `/vdoc audit`
|
|
196
43
|
|
|
197
44
|
## Naming Convention
|
|
198
45
|
|
|
199
46
|
Files: `FEATURE_NAME_DOC.md` — uppercase, feature-named, `_DOC` suffix.
|
|
200
47
|
|
|
201
|
-
Examples: `PROJECT_OVERVIEW_DOC.md`, `AUTHENTICATION_DOC.md`, `API_REFERENCE_DOC.md`, `DATABASE_SCHEMA_DOC.md`, `PAYMENT_PROCESSING_DOC.md`
|
|
202
|
-
|
|
203
|
-
---
|
|
204
|
-
|
|
205
48
|
## Rules
|
|
206
49
|
|
|
207
|
-
1. **Feature-centric, not file-centric.** One doc per logical feature, not per source file.
|
|
208
|
-
2. **Mermaid over prose.**
|
|
209
|
-
3. **Constraints are gold.**
|
|
210
|
-
4. **Rich manifest descriptions.**
|
|
211
|
-
5. **No hallucination.** Only document what exists in
|
|
212
|
-
6. **Plan first, always.** Never generate
|
|
50
|
+
1. **Feature-centric, not file-centric.** One doc per logical feature, not per source file.
|
|
51
|
+
2. **Mermaid over prose.** Diagram flows. Max 7-9 nodes per diagram.
|
|
52
|
+
3. **Constraints are gold.** Always fill "Constraints & Decisions" — prevents breaking changes.
|
|
53
|
+
4. **Rich manifest descriptions.** Pack with specific terms for semantic routing.
|
|
54
|
+
5. **No hallucination.** Only document what exists in code.
|
|
55
|
+
6. **Plan first, always.** Never generate without user-approved plan. Report before patching.
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# Audit Workflow
|
|
2
|
+
|
|
3
|
+
## Step 1 — Read Current State
|
|
4
|
+
|
|
5
|
+
Read `vdocs/_manifest.json`. Load the list of documented features and their metadata.
|
|
6
|
+
|
|
7
|
+
## Step 2 — Detect Stale Docs
|
|
8
|
+
|
|
9
|
+
Run `git log --name-only --since="<last_updated>" --pretty=format:""` or use `git diff` to find all source files that changed since the last audit.
|
|
10
|
+
|
|
11
|
+
Cross-reference changed files against each doc's "Key Files" section to identify which docs are stale.
|
|
12
|
+
|
|
13
|
+
## Step 3 — Detect Coverage Gaps
|
|
14
|
+
|
|
15
|
+
Scan the codebase for significant features not covered by any doc. Look for:
|
|
16
|
+
- New route files / API endpoints
|
|
17
|
+
- New service classes or modules
|
|
18
|
+
- New database models / schema changes
|
|
19
|
+
- New configuration or infrastructure files
|
|
20
|
+
|
|
21
|
+
If you find undocumented features, propose new docs.
|
|
22
|
+
|
|
23
|
+
## Step 4 — Detect Dead Docs
|
|
24
|
+
|
|
25
|
+
Check each doc's "Key Files" section against the actual filesystem. If key files no longer exist, the doc may be dead. Flag it: "PAYMENT_PROCESSING_DOC.md references 3 files that no longer exist — remove or archive?"
|
|
26
|
+
|
|
27
|
+
## Step 5 — Check Cross-References
|
|
28
|
+
|
|
29
|
+
Read each doc's "Related Features" section. Verify that:
|
|
30
|
+
- Referenced doc filenames still exist
|
|
31
|
+
- The described coupling is still accurate (skim the relevant code)
|
|
32
|
+
|
|
33
|
+
## Step 6 — Report
|
|
34
|
+
|
|
35
|
+
Present a clear report:
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
Audit Results:
|
|
39
|
+
|
|
40
|
+
STALE (source files changed):
|
|
41
|
+
- AUTHENTICATION_DOC.md — src/lib/auth.ts changed (added GitHub provider)
|
|
42
|
+
- API_REFERENCE_DOC.md — 2 new endpoints added
|
|
43
|
+
|
|
44
|
+
COVERAGE GAPS (undocumented features):
|
|
45
|
+
- src/services/notification.ts — no doc covers notifications
|
|
46
|
+
|
|
47
|
+
DEAD DOCS (source files removed):
|
|
48
|
+
- LEGACY_ADMIN_DOC.md — all 4 source files deleted
|
|
49
|
+
|
|
50
|
+
CROSS-REF ISSUES:
|
|
51
|
+
- AUTHENTICATION_DOC.md references BILLING_DOC.md which no longer exists
|
|
52
|
+
|
|
53
|
+
CURRENT (no changes needed):
|
|
54
|
+
- DATABASE_SCHEMA_DOC.md
|
|
55
|
+
- PROJECT_OVERVIEW_DOC.md
|
|
56
|
+
|
|
57
|
+
Proceed with fixes?
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Wait for user direction, then:
|
|
61
|
+
- Patch stale docs (re-read source files, update affected sections only)
|
|
62
|
+
- Generate new docs for coverage gaps (follow init workflow for each)
|
|
63
|
+
- Flag dead docs for user to confirm deletion
|
|
64
|
+
- Fix cross-reference issues
|
|
65
|
+
- Update manifest: bump versions, update `last_updated`, `last_commit`
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# Init Workflow
|
|
2
|
+
|
|
3
|
+
## Step 1 — Explore
|
|
4
|
+
|
|
5
|
+
Read the codebase thoroughly. Identify:
|
|
6
|
+
|
|
7
|
+
- **Tech stack**: languages, frameworks, databases, ORMs
|
|
8
|
+
- **Features**: authentication, API, payments, notifications, search, etc.
|
|
9
|
+
- **Architecture**: monolith vs microservices, frontend/backend split, key patterns (MVC, event-driven, etc.)
|
|
10
|
+
- **Integrations**: third-party services (Stripe, AWS, Redis, etc.)
|
|
11
|
+
- **Entry points**: where requests come in, how they flow through the system
|
|
12
|
+
|
|
13
|
+
Do not skim. Read key files — entry points, config files, route definitions, schema files, middleware. Understand how the system actually works before proposing docs.
|
|
14
|
+
|
|
15
|
+
## Step 2 — Plan
|
|
16
|
+
|
|
17
|
+
Create `vdocs/_DOCUMENTATION_PLAN.md` listing each proposed doc:
|
|
18
|
+
|
|
19
|
+
```markdown
|
|
20
|
+
# Documentation Plan
|
|
21
|
+
|
|
22
|
+
## Proposed Documents
|
|
23
|
+
|
|
24
|
+
1. **PROJECT_OVERVIEW_DOC.md** — Tech stack, architecture, project structure, dev setup
|
|
25
|
+
2. **AUTHENTICATION_DOC.md** — OAuth2 flow, JWT lifecycle, session management, RBAC
|
|
26
|
+
3. **API_REFERENCE_DOC.md** — All endpoints, request/response shapes, error codes
|
|
27
|
+
...
|
|
28
|
+
|
|
29
|
+
## Notes
|
|
30
|
+
- Each doc covers one logical feature, not one file
|
|
31
|
+
- Docs should be useful for onboarding AND as AI context for planning changes
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Present the plan to the user. Actively suggest changes:
|
|
35
|
+
- "Should I merge X and Y into one doc?"
|
|
36
|
+
- "I found a websocket system — want that documented separately?"
|
|
37
|
+
- "Any internal/legacy systems I should skip?"
|
|
38
|
+
|
|
39
|
+
Wait for user approval before proceeding.
|
|
40
|
+
|
|
41
|
+
## Step 3 — Generate
|
|
42
|
+
|
|
43
|
+
For each approved doc:
|
|
44
|
+
|
|
45
|
+
1. Read ALL relevant source files for that feature — not just the main file, but helpers, types, middleware, tests
|
|
46
|
+
2. Follow the template in `references/doc-template.md` exactly
|
|
47
|
+
3. Write to `vdocs/FEATURE_NAME_DOC.md`
|
|
48
|
+
|
|
49
|
+
**Writing rules:**
|
|
50
|
+
|
|
51
|
+
- **Mermaid diagrams are mandatory** in "How It Works". Show the actual flow — request lifecycle, state transitions, data pipeline. If a flow has more than 7-9 nodes, split into multiple diagrams.
|
|
52
|
+
- **Data Model** must show real entities from the code, not generic placeholders. Use mermaid ER diagrams for relational data, tables for simpler models.
|
|
53
|
+
- **Constraints & Decisions** is the most valuable section. Dig into the code for non-obvious choices: "Uses polling instead of websockets because...", "Auth tokens expire in 15min because...". If you can't find the reason, state the constraint and mark it: `Reason: unknown — verify with team`.
|
|
54
|
+
- **Related Features** must reference other docs by filename and explain the coupling: "Changes to the JWT schema will require updates to API_REFERENCE_DOC.md (auth middleware affects all endpoints)."
|
|
55
|
+
- **Configuration** must list actual env vars/secrets from the code, not hypothetical ones.
|
|
56
|
+
- **Error Handling** — trace what happens when things fail. What does the user see? What gets logged? Is there retry logic?
|
|
57
|
+
|
|
58
|
+
## Step 4 — Manifest
|
|
59
|
+
|
|
60
|
+
Create `vdocs/_manifest.json` using the schema in `references/manifest-schema.json`.
|
|
61
|
+
|
|
62
|
+
The `description` field is critical — write it rich enough that you can route any user question to the right doc by matching against descriptions. Include specific technology names, patterns, and concepts.
|
|
63
|
+
|
|
64
|
+
Example:
|
|
65
|
+
|
|
66
|
+
```json
|
|
67
|
+
{
|
|
68
|
+
"filepath": "AUTHENTICATION_DOC.md",
|
|
69
|
+
"title": "Authentication - OAuth2 & JWT",
|
|
70
|
+
"version": "1.0.0",
|
|
71
|
+
"description": "OAuth2 flow with Google/GitHub providers, JWT token lifecycle, session management via NextAuth.js, route protection middleware, and role-based access control.",
|
|
72
|
+
"tags": ["oauth2", "jwt", "session-management", "rbac"]
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Step 5 — Self-Review
|
|
77
|
+
|
|
78
|
+
Before finishing, verify:
|
|
79
|
+
|
|
80
|
+
- [ ] Every doc has at least one mermaid diagram in "How It Works"
|
|
81
|
+
- [ ] Every doc has at least 2 entries in "Constraints & Decisions"
|
|
82
|
+
- [ ] Every doc's "Key Files" lists real paths that exist in the codebase
|
|
83
|
+
- [ ] Every doc's "Configuration" lists actual env vars from the code
|
|
84
|
+
- [ ] Every doc's "Related Features" references other doc filenames
|
|
85
|
+
- [ ] Manifest `description` is detailed enough for semantic routing
|
|
86
|
+
- [ ] No doc is just a shallow restatement of file names — each explains WHY and HOW
|