@sandrinio/vdoc 3.4.0 → 3.5.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 CHANGED
@@ -11,9 +11,9 @@ One install command. Your AI handles the rest.
11
11
  vdoc teaches your AI coding agent how to create and maintain feature-centric documentation for your codebase. It's not a CLI you run — it's a skill file that gets installed into your AI platform. After install, you just talk to your AI.
12
12
 
13
13
  ```
14
- /vdoc init → AI explores codebase → proposes plan → you approve → generates docs
15
- /vdoc audit → AI detects stale, missing, dead docs → reports → patches
16
- "how does auth work?" → AI reads manifest routes to right doc → answers
14
+ /vdoc-init → AI explores codebase → proposes plan → you approve → generates docs
15
+ /vdoc-update → AI detects stale, missing, dead docs → reports → patches
16
+ /vdoc-create <feature> → AI documents one specific feature on demand
17
17
  ```
18
18
 
19
19
  ---
@@ -32,9 +32,9 @@ Then open Cursor and type: **`/vdoc init`**
32
32
 
33
33
  | Platform | Install Command | `/vdoc` Command | Invocation |
34
34
  |----------|----------------|----------------|------------|
35
- | **Claude Code** | `npx @sandrinio/vdoc install claude` | `/vdoc init` `/vdoc audit` | Skill (SKILL.md) |
35
+ | **Claude Code** | `npx @sandrinio/vdoc install claude` | `/vdoc-init` `/vdoc-update` `/vdoc-create` | Skills |
36
36
  | **Cursor** | `npx @sandrinio/vdoc install cursor` | `/vdoc init` `/vdoc audit` | Command + Rule |
37
- | **Windsurf** | `npx @sandrinio/vdoc install windsurf` | `/vdoc` | Workflow + Rule |
37
+ | **Windsurf** | `npx @sandrinio/vdoc install windsurf` | `/vdoc` | Workflow + Skill |
38
38
  | **VS Code (Copilot)** | `npx @sandrinio/vdoc install vscode` | `/vdoc` | Prompt + Instructions |
39
39
  | **Continue** | `npx @sandrinio/vdoc install continue` | `/vdoc init` `/vdoc audit` | Invokable Prompt + Rule |
40
40
  | **Cline** | `npx @sandrinio/vdoc install cline` | `/vdoc` | Workflow + Rule |
@@ -57,20 +57,20 @@ Copies skill files to your AI platform's rules and commands locations. That's it
57
57
 
58
58
  ### 2. Init
59
59
 
60
- Type **`/vdoc init`** in your AI tool (or say "document this project"). The skill tells the AI to:
60
+ Type **`/vdoc-init`** in your AI tool (or say "document this project"). The skill tells the AI to:
61
61
 
62
62
  1. **Explore** — identify features, tech stack, architecture
63
63
  2. **Plan** — propose a documentation plan for your approval
64
64
  3. **Generate** — create feature-centric docs using a consistent template
65
65
  4. **Index** — build a semantic manifest for future queries
66
66
 
67
- ### 3. Audit
67
+ ### 3. Update
68
68
 
69
- Type **`/vdoc audit`** (or say "audit docs"). The AI detects what changed via git, finds coverage gaps, flags dead docs, checks cross-references, reports everything, and patches only what you approve.
69
+ Type **`/vdoc-update`** (or say "update docs"). The AI detects what changed via git, finds coverage gaps, flags dead docs, checks cross-references, reports everything, and patches only what you approve.
70
70
 
71
- ### 4. Query
71
+ ### 4. Create
72
72
 
73
- Ask any question. The AI reads the manifest, routes to the right doc, and answers from documented knowledge.
73
+ Type **`/vdoc-create authentication system`** to document a single feature on demand. The AI locates the relevant source files, generates one doc, and updates the manifest.
74
74
 
75
75
  ---
76
76
 
@@ -78,14 +78,19 @@ Ask any question. The AI reads the manifest, routes to the right doc, and answer
78
78
 
79
79
  ```
80
80
  your-project/
81
- └── vdocs/
82
- ├── _manifest.json ← Semantic index (AI reads first)
83
- ├── _DOCUMENTATION_PLAN.md ← Approved plan (kept for reference)
84
- ├── PROJECT_OVERVIEW_DOC.md
85
- ├── AUTHENTICATION_DOC.md
86
- ├── API_REFERENCE_DOC.md
87
- ├── DATABASE_SCHEMA_DOC.md
88
- └── ...
81
+ ├── vdocs/
82
+ ├── _manifest.json ← Semantic index (AI reads first)
83
+ ├── PROJECT_OVERVIEW_DOC.md
84
+ ├── AUTHENTICATION_DOC.md
85
+ ├── API_REFERENCE_DOC.md
86
+ ├── DATABASE_SCHEMA_DOC.md
87
+ │ └── ...
88
+ └── .claude/skills/vdoc-config/ ← Planning artifacts (Claude example)
89
+ ├── _exploration_log.md ← What was scanned and why
90
+ ├── _DOCUMENTATION_PLAN.md ← Approved plan
91
+ └── references/
92
+ ├── doc-template.md ← Shared doc template
93
+ └── manifest-schema.json ← Shared manifest schema
89
94
  ```
90
95
 
91
96
  Docs are **feature-centric** — organized by what your system does, not by file paths.
@@ -138,7 +143,7 @@ Removes all vdoc skill and rule files from **every** supported platform in one c
138
143
 
139
144
  | Platform | Files Removed |
140
145
  |----------|--------------|
141
- | Claude Code | `.claude/skills/vdoc/` |
146
+ | Claude Code | `.claude/skills/vdoc-init/`, `vdoc-update/`, `vdoc-create/`, `vdoc-config/` |
142
147
  | Cursor | `.cursor/rules/vdoc.mdc`, `.cursor/commands/vdoc.md` |
143
148
  | Windsurf | `.windsurf/rules/vdoc.md`, `.windsurf/workflows/vdoc.md` |
144
149
  | VS Code (Copilot) | `.github/instructions/vdoc.instructions.md`, `.github/prompts/vdoc.prompt.md` |
@@ -166,4 +171,4 @@ None. Your AI coding agent is the runtime.
166
171
 
167
172
  ---
168
173
 
169
- *vdoc v3.0.0 — Documentation skills for AI coding agents*
174
+ *vdoc v3.5.0 — Documentation skills for AI coding agents*
package/bin/vdoc.mjs CHANGED
@@ -13,10 +13,12 @@ const CWD = process.cwd();
13
13
  const PLATFORMS = {
14
14
  claude: {
15
15
  files: [
16
- { src: 'claude/SKILL.md', dest: '.claude/skills/vdoc/SKILL.md' },
17
16
  { src: 'claude/vdoc-init.md', dest: '.claude/skills/vdoc-init/SKILL.md' },
18
- { src: 'claude/vdoc-audit.md', dest: '.claude/skills/vdoc-audit/SKILL.md' },
17
+ { src: 'claude/vdoc-update.md', dest: '.claude/skills/vdoc-update/SKILL.md' },
18
+ { src: 'claude/vdoc-create.md', dest: '.claude/skills/vdoc-create/SKILL.md' },
19
19
  { src: 'claude/references/exploration-strategies.md', dest: '.claude/skills/vdoc-init/references/exploration-strategies.md' },
20
+ { src: 'claude/references/doc-template.md', dest: '.claude/skills/vdoc-config/references/doc-template.md' },
21
+ { src: 'claude/references/manifest-schema.json', dest: '.claude/skills/vdoc-config/references/manifest-schema.json' },
20
22
  ],
21
23
  },
22
24
  cursor: {
@@ -257,8 +259,10 @@ function uninstall() {
257
259
 
258
260
  // Clean skill directories that may have nested files
259
261
  const skillDirs = [
260
- join(CWD, '.claude', 'skills', 'vdoc'),
262
+ join(CWD, '.claude', 'skills', 'vdoc-config'),
261
263
  join(CWD, '.claude', 'skills', 'vdoc-init'),
264
+ join(CWD, '.claude', 'skills', 'vdoc-update'),
265
+ join(CWD, '.claude', 'skills', 'vdoc-create'),
262
266
  join(CWD, '.claude', 'skills', 'vdoc-audit'),
263
267
  join(CWD, '.cursor', 'rules', 'vdoc'),
264
268
  join(CWD, '.windsurf', 'skills', 'vdoc'),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sandrinio/vdoc",
3
- "version": "3.4.0",
3
+ "version": "3.5.1",
4
4
  "description": "Documentation skills for AI coding agents",
5
5
  "type": "module",
6
6
  "bin": {
@@ -0,0 +1,59 @@
1
+ ---
2
+ name: vdoc-create
3
+ description: "Create a single feature doc on demand. Use when user says 'document the auth system', 'create a doc for payments', or wants to add one specific doc to vdocs/."
4
+ argument-hint: "<feature description>"
5
+ ---
6
+
7
+ # vdoc create — Single Doc Generator
8
+
9
+ Create one feature doc based on the user's description. Do NOT create scripts, shell files, scanners, or any tooling — use your built-in tools (Read, Glob, Grep) for everything.
10
+
11
+ ---
12
+
13
+ ## Step 1 — Locate
14
+
15
+ Use the user's description to find the relevant source files:
16
+
17
+ 1. If `.claude/skills/vdoc-config/_exploration_log.md` exists, read it first — it maps the codebase and may already have the feature signal you need
18
+ 2. Otherwise, search the codebase with Glob and Grep to find files matching the user's description
19
+ 3. Read ALL relevant source files — not just the main file, but helpers, types, middleware, tests, API routes, components
20
+
21
+ Do not skim. Understand how the feature actually works before writing.
22
+
23
+ ## Step 2 — Generate
24
+
25
+ 1. Read the template from `.claude/skills/vdoc-config/references/doc-template.md` and follow it exactly
26
+ 2. Write to `vdocs/FEATURE_NAME_DOC.md`
27
+
28
+ ### Writing Rules
29
+
30
+ - **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.
31
+ - **Data Model** must show real entities from the code, not generic placeholders. Use mermaid ER diagrams for relational data, tables for simpler models.
32
+ - **Constraints & Decisions** is the most valuable section. Dig into the code for non-obvious choices. If you can't find the reason, state the constraint and mark it: `Reason: unknown — verify with team`.
33
+ - **Related Features** must reference other docs by filename and explain the coupling.
34
+ - **Configuration** must list actual env vars/secrets from the code, not hypothetical ones.
35
+ - **Error Handling** — trace what happens when things fail. What does the user see? What gets logged? Is there retry logic?
36
+
37
+ ## Step 3 — Update Manifest
38
+
39
+ Read `vdocs/_manifest.json` and add the new doc entry using the schema in `.claude/skills/vdoc-config/references/manifest-schema.json`.
40
+
41
+ If `vdocs/_manifest.json` doesn't exist, create it with the project name, version, and this doc as the first entry.
42
+
43
+ ## Step 4 — Self-Review
44
+
45
+ Before finishing, verify:
46
+
47
+ - [ ] Doc has at least one mermaid diagram in "How It Works"
48
+ - [ ] Doc has at least 2 entries in "Constraints & Decisions"
49
+ - [ ] "Key Files" lists real paths that exist in the codebase
50
+ - [ ] "Configuration" lists actual env vars from the code
51
+ - [ ] "Related Features" references other doc filenames (if other docs exist)
52
+ - [ ] Manifest `description` is detailed enough for semantic routing
53
+ - [ ] Doc explains WHY and HOW, not just WHAT
54
+
55
+ ## Rules
56
+
57
+ 1. **Feature-centric, not file-centric.** The doc covers one logical feature, not one source file.
58
+ 2. **No hallucination.** Only document what exists in code.
59
+ 3. **No scripts.** Do NOT create shell scripts, scanners, or build tools. Use Read/Glob/Grep.
@@ -24,7 +24,7 @@ If no archetype matches, use the Fallback strategy and confirm with the user.
24
24
  Do not skim. Understand how the system actually works before proposing docs.
25
25
 
26
26
  **Phase 3 — Write Exploration Log**
27
- After exploring, write `vdocs/_exploration_log.md` documenting what you found:
27
+ After exploring, write `.claude/skills/vdoc-config/_exploration_log.md` documenting what you found:
28
28
 
29
29
  ```markdown
30
30
  # Exploration Log
@@ -58,7 +58,7 @@ This log is your working memory. It feeds directly into Step 2 (Plan).
58
58
 
59
59
  ## Step 2 — Plan
60
60
 
61
- Create `vdocs/_DOCUMENTATION_PLAN.md` listing each proposed doc:
61
+ Create `.claude/skills/vdoc-config/_DOCUMENTATION_PLAN.md` listing each proposed doc:
62
62
 
63
63
  ```markdown
64
64
  # Documentation Plan
@@ -87,81 +87,9 @@ Present the plan to the user. Actively suggest changes:
87
87
  For each approved doc:
88
88
 
89
89
  1. Read ALL relevant source files for that feature — not just the main file, but helpers, types, middleware, tests
90
- 2. Follow the template below exactly
90
+ 2. Read the template from `.claude/skills/vdoc-config/references/doc-template.md` and follow it exactly
91
91
  3. Write to `vdocs/FEATURE_NAME_DOC.md`
92
92
 
93
- ### Doc Template
94
-
95
- ```markdown
96
- # {Feature Title}
97
-
98
- > {One-line description of what this covers}
99
-
100
- ---
101
-
102
- ## Overview
103
-
104
- {What it does, why it exists, how it fits in the system.}
105
-
106
- ---
107
-
108
- ## How It Works
109
-
110
- {Core logic and flow.}
111
-
112
- {Mermaid diagram(s) — max 7-9 nodes per diagram, split into multiple if larger.}
113
-
114
- ---
115
-
116
- ## Data Model
117
-
118
- {Entities this feature owns and their relationships. Mermaid ER diagram or table.}
119
-
120
- ---
121
-
122
- ## Key Files
123
-
124
- | File | Purpose |
125
- |------|---------|
126
- | `src/path/file.ts` | What this file does |
127
-
128
- ---
129
-
130
- ## Dependencies & Integrations
131
-
132
- {External services, internal features, packages this relies on.}
133
-
134
- ---
135
-
136
- ## Configuration
137
-
138
- | Variable | Purpose | Required |
139
- |----------|---------|----------|
140
- | `ENV_VAR` | What it controls | Yes/No |
141
-
142
- ---
143
-
144
- ## Error Handling
145
-
146
- {Failure modes, what the user sees, retry logic. Mermaid diagram if the error flow is non-trivial.}
147
-
148
- ---
149
-
150
- ## Constraints & Decisions
151
-
152
- {Why it's built this way. What you CANNOT change without breaking things.}
153
-
154
- ---
155
-
156
- ## Related Features
157
-
158
- {Cross-references to other docs by filename. Blast radius — what breaks if this changes.}
159
-
160
- ---
161
-
162
- *Generated by vdoc v3.0.0 • Last updated: {timestamp}*
163
- ```
164
-
165
93
  ### Writing Rules
166
94
 
167
95
  - **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.
@@ -173,26 +101,7 @@ For each approved doc:
173
101
 
174
102
  ## Step 4 — Manifest
175
103
 
176
- Create `vdocs/_manifest.json`:
177
-
178
- ```json
179
- {
180
- "project": "<project-name>",
181
- "vdoc_version": "3.0.0",
182
- "created_at": "<ISO-8601>",
183
- "last_updated": "<ISO-8601>",
184
- "last_commit": "<short-sha>",
185
- "documentation": [
186
- {
187
- "filepath": "FEATURE_NAME_DOC.md",
188
- "title": "Human-Readable Feature Title",
189
- "version": "1.0.0",
190
- "description": "Rich semantic description with specific technology names, patterns, and concepts. Detailed enough that an AI can route any user question to this doc by matching against this field.",
191
- "tags": ["keyword-1", "keyword-2"]
192
- }
193
- ]
194
- }
195
- ```
104
+ Create `vdocs/_manifest.json` using the schema in `.claude/skills/vdoc-config/references/manifest-schema.json`.
196
105
 
197
106
  The `description` field is critical — write it rich enough that you can route any user question to the right doc by matching against descriptions.
198
107
 
@@ -1,9 +1,9 @@
1
1
  ---
2
- name: vdoc-audit
3
- description: "Audit existing vdocs for stale, missing, or dead documentation. Use when user says 'audit docs', 'check docs', or documentation may be out of sync with code."
2
+ name: vdoc-update
3
+ description: "Update existing vdocs to match current code. Use when user says 'update docs', 'sync docs', 'check docs', or documentation may be out of sync with code."
4
4
  ---
5
5
 
6
- # vdoc audit — Documentation Audit
6
+ # vdoc update — Documentation Update
7
7
 
8
8
  Detect stale, missing, and dead documentation. Report and patch. Do NOT create scripts, shell files, scanners, or any tooling — use your built-in tools (Read, Glob, Grep, Bash for git commands) for everything.
9
9
 
@@ -44,7 +44,7 @@ Read each doc's "Related Features" section. Verify that:
44
44
  Present a clear report:
45
45
 
46
46
  ```
47
- Audit Results:
47
+ Update Report:
48
48
 
49
49
  STALE (source files changed):
50
50
  - AUTHENTICATION_DOC.md — src/lib/auth.ts changed (added GitHub provider)
@@ -68,7 +68,7 @@ Proceed with fixes?
68
68
 
69
69
  **Wait for user direction**, then:
70
70
  - Patch stale docs (re-read source files, update affected sections only)
71
- - Generate new docs for coverage gaps (use `/vdoc-init` workflow for each)
71
+ - Generate new docs for coverage gaps (use `/vdoc-create` for each)
72
72
  - Flag dead docs for user to confirm deletion
73
73
  - Fix cross-reference issues
74
74
  - Update manifest: bump versions, update `last_updated`, `last_commit`
@@ -1,28 +0,0 @@
1
- ---
2
- name: vdoc
3
- description: "Query existing project documentation. Use when user asks questions about the codebase and vdocs/ exists. For generating docs use /vdoc-init, for auditing use /vdoc-audit."
4
- ---
5
-
6
- # vdoc — Documentation Query
7
-
8
- Answer questions about the codebase using existing documentation in `vdocs/`.
9
-
10
- ## Other Commands
11
-
12
- - **`/vdoc-init`** — Generate documentation from source code (explore → plan → generate)
13
- - **`/vdoc-audit`** — Audit docs for stale, missing, or dead entries
14
-
15
- ## How to Answer Questions
16
-
17
- 1. Read `vdocs/_manifest.json`
18
- 2. Match the question against `description` and `tags` fields
19
- 3. Read matching doc(s) from `vdocs/`
20
- 4. Answer from documented knowledge
21
- 5. If no match or no `vdocs/` folder, suggest running `/vdoc-init`
22
- 6. If docs seem outdated, suggest running `/vdoc-audit`
23
-
24
- ## Rules
25
-
26
- - Only answer from what's documented — do not hallucinate
27
- - Reference specific doc filenames in your answers
28
- - If the question spans multiple docs, read all relevant ones
@@ -1,65 +0,0 @@
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`
@@ -1,123 +0,0 @@
1
- # Init Workflow
2
-
3
- ## Step 1 — Explore
4
-
5
- Follow the two-phase exploration strategy in `references/exploration-strategies.md`:
6
-
7
- **Phase 1 — Fingerprint** (3-5 file reads max)
8
- Read package/config files and directory structure to identify the project's language, framework, and archetype. Also check for existing documentation (`vdocs/`, `docs/`, `product_documentation/`, substantial `*.md` files). If found, read them first — they're a head start. See the "Existing Documentation" section in `references/exploration-strategies.md`.
9
-
10
- **Phase 2 — Targeted Exploration** (archetype-specific)
11
- Apply the matching archetype playbook from `references/exploration-strategies.md`. Read files in priority order using the glob patterns listed. Identify feature signals — each signal maps to a documentable feature. Combine multiple playbooks when the project doesn't fit a single archetype (see "Composing Archetypes" in the strategies file).
12
-
13
- If no archetype matches, use the Fallback strategy and confirm with the user.
14
-
15
- Do not skim. Understand how the system actually works before proposing docs.
16
-
17
- **Important:** Use your built-in file-reading tools (Read, Glob, Grep) to explore. Do NOT create scanner scripts, shell scripts, or any tooling. vdoc is purely AI-driven — no scripts, no build steps, no infrastructure.
18
-
19
- **Phase 3 — Write Exploration Log**
20
- After exploring, write `vdocs/_exploration_log.md` documenting what you found:
21
-
22
- ```markdown
23
- # Exploration Log
24
-
25
- ## Fingerprint
26
- - **Language(s):** e.g., TypeScript, Python
27
- - **Framework(s):** e.g., Next.js 14, FastAPI
28
- - **Archetype(s):** e.g., Full-stack Framework
29
- - **Scope:** e.g., ~85 files, medium
30
-
31
- ## Files Read
32
- | # | File | Why | What I Found |
33
- |---|------|-----|--------------|
34
- | 1 | package.json | Fingerprint | Next.js 14, Prisma, NextAuth |
35
- | 2 | src/app/ (listing) | Page tree | 12 routes, 3 API routes |
36
- | ... | ... | ... | ... |
37
-
38
- ## Feature Signals Detected
39
- | Signal | Source File(s) | Proposed Doc |
40
- |--------|---------------|--------------|
41
- | Auth middleware + login page | middleware.ts, app/login/page.tsx | AUTHENTICATION_DOC.md |
42
- | Prisma schema with 8 models | prisma/schema.prisma | DATA_MODEL_DOC.md |
43
- | ... | ... | ... |
44
-
45
- ## Ambiguities / Open Questions
46
- - Could not determine why Redis is in dependencies — no usage found. Ask user.
47
- - Payments folder exists but appears incomplete / WIP.
48
- ```
49
-
50
- This log is your working memory. It feeds directly into Step 2 (Plan).
51
-
52
- ## Step 2 — Plan
53
-
54
- Create `vdocs/_DOCUMENTATION_PLAN.md` listing each proposed doc:
55
-
56
- ```markdown
57
- # Documentation Plan
58
-
59
- ## Proposed Documents
60
-
61
- 1. **PROJECT_OVERVIEW_DOC.md** — Tech stack, architecture, project structure, dev setup
62
- 2. **AUTHENTICATION_DOC.md** — OAuth2 flow, JWT lifecycle, session management, RBAC
63
- 3. **API_REFERENCE_DOC.md** — All endpoints, request/response shapes, error codes
64
- ...
65
-
66
- ## Notes
67
- - Each doc covers one logical feature, not one file
68
- - Docs should be useful for onboarding AND as AI context for planning changes
69
- ```
70
-
71
- Present the plan to the user. Actively suggest changes:
72
- - "Should I merge X and Y into one doc?"
73
- - "I found a websocket system — want that documented separately?"
74
- - "Any internal/legacy systems I should skip?"
75
-
76
- Wait for user approval before proceeding.
77
-
78
- ## Step 3 — Generate
79
-
80
- For each approved doc:
81
-
82
- 1. Read ALL relevant source files for that feature — not just the main file, but helpers, types, middleware, tests
83
- 2. Follow the template in `references/doc-template.md` exactly
84
- 3. Write to `vdocs/FEATURE_NAME_DOC.md`
85
-
86
- **Writing rules:**
87
-
88
- - **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.
89
- - **Data Model** must show real entities from the code, not generic placeholders. Use mermaid ER diagrams for relational data, tables for simpler models.
90
- - **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`.
91
- - **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)."
92
- - **Configuration** must list actual env vars/secrets from the code, not hypothetical ones.
93
- - **Error Handling** — trace what happens when things fail. What does the user see? What gets logged? Is there retry logic?
94
-
95
- ## Step 4 — Manifest
96
-
97
- Create `vdocs/_manifest.json` using the schema in `references/manifest-schema.json`.
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
- Example:
102
-
103
- ```json
104
- {
105
- "filepath": "AUTHENTICATION_DOC.md",
106
- "title": "Authentication - OAuth2 & JWT",
107
- "version": "1.0.0",
108
- "description": "OAuth2 flow with Google/GitHub providers, JWT token lifecycle, session management via NextAuth.js, route protection middleware, and role-based access control.",
109
- "tags": ["oauth2", "jwt", "session-management", "rbac"]
110
- }
111
- ```
112
-
113
- ## Step 5 — Self-Review
114
-
115
- Before finishing, verify:
116
-
117
- - [ ] Every doc has at least one mermaid diagram in "How It Works"
118
- - [ ] Every doc has at least 2 entries in "Constraints & Decisions"
119
- - [ ] Every doc's "Key Files" lists real paths that exist in the codebase
120
- - [ ] Every doc's "Configuration" lists actual env vars from the code
121
- - [ ] Every doc's "Related Features" references other doc filenames
122
- - [ ] Manifest `description` is detailed enough for semantic routing
123
- - [ ] No doc is just a shallow restatement of file names — each explains WHY and HOW