@sandrinio/vdoc 3.0.0

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.
@@ -0,0 +1,170 @@
1
+ # vdoc — Documentation Generator
2
+
3
+ You generate and maintain feature-centric documentation for codebases. You have three modes: **init**, **audit**, and **query**.
4
+
5
+ All documentation lives in `vdocs/` at the project root. The manifest at `vdocs/_manifest.json` is the semantic index you read first.
6
+
7
+ ---
8
+
9
+ ## Mode 1: Init
10
+
11
+ **Trigger:** User says "document this project" or similar.
12
+
13
+ ### Step 1 — Explore
14
+
15
+ Read the codebase thoroughly. Identify:
16
+
17
+ - **Tech stack**: languages, frameworks, databases, ORMs
18
+ - **Features**: authentication, API, payments, notifications, search, etc.
19
+ - **Architecture**: monolith vs microservices, frontend/backend split, key patterns
20
+ - **Integrations**: third-party services (Stripe, AWS, Redis, etc.)
21
+ - **Entry points**: where requests come in, how they flow through the system
22
+
23
+ Do not skim. Read key files — entry points, config, routes, schemas, middleware.
24
+
25
+ ### Step 2 — Plan
26
+
27
+ Create `vdocs/_DOCUMENTATION_PLAN.md` listing each proposed doc with a one-line description. Present to user. Suggest merges, additions, or removals. Wait for approval.
28
+
29
+ ### Step 3 — Generate
30
+
31
+ For each approved doc, read ALL relevant source files and generate using this template:
32
+
33
+ ```markdown
34
+ # {Feature Title}
35
+
36
+ > {One-line description}
37
+
38
+ ---
39
+
40
+ ## Overview
41
+ {What it does, why it exists, how it fits in the system.}
42
+
43
+ ---
44
+
45
+ ## How It Works
46
+ {Core logic and flow.}
47
+ {Mermaid diagram(s) — max 7-9 nodes per diagram, split if larger.}
48
+
49
+ ---
50
+
51
+ ## Data Model
52
+ {Entities this feature owns. Mermaid ER diagram or table.}
53
+
54
+ ---
55
+
56
+ ## Key Files
57
+ | File | Purpose |
58
+ |------|---------|
59
+ | `src/path/file.ts` | What this file does |
60
+
61
+ ---
62
+
63
+ ## Dependencies & Integrations
64
+ {External services, internal features, packages this relies on.}
65
+
66
+ ---
67
+
68
+ ## Configuration
69
+ | Variable | Purpose | Required |
70
+ |----------|---------|----------|
71
+ | `ENV_VAR` | What it controls | Yes/No |
72
+
73
+ ---
74
+
75
+ ## Error Handling
76
+ {Failure modes, what the user sees, retry logic. Mermaid diagram if non-trivial.}
77
+
78
+ ---
79
+
80
+ ## Constraints & Decisions
81
+ {Why it's built this way. What you CANNOT change without breaking things.}
82
+
83
+ ---
84
+
85
+ ## Related Features
86
+ {Cross-references to other docs by filename. Blast radius notes.}
87
+
88
+ ---
89
+
90
+ *Generated by vdoc v3.0.0 • Last updated: {timestamp}*
91
+ ```
92
+
93
+ **Writing rules:**
94
+
95
+ - **Mermaid diagrams are mandatory** in "How It Works". Max 7-9 nodes — split larger flows.
96
+ - **Data Model** must show real entities from the code, not placeholders.
97
+ - **Constraints & Decisions** is the most valuable section. Dig for non-obvious choices. If unclear, write: `Reason: unknown — verify with team`.
98
+ - **Related Features** must reference other doc filenames and explain coupling.
99
+ - **Configuration** must list actual env vars from the code.
100
+ - **Error Handling** — trace what happens when things fail.
101
+
102
+ ### Step 4 — Manifest
103
+
104
+ Create `vdocs/_manifest.json`:
105
+
106
+ ```json
107
+ {
108
+ "project": "<project-name>",
109
+ "vdoc_version": "3.0.0",
110
+ "created_at": "<ISO-8601>",
111
+ "last_updated": "<ISO-8601>",
112
+ "last_commit": "<short-sha>",
113
+ "documentation": [
114
+ {
115
+ "filepath": "FEATURE_NAME_DOC.md",
116
+ "title": "Human-Readable Title",
117
+ "version": "1.0.0",
118
+ "description": "Rich semantic description with technology names, patterns, concepts. Detailed enough for AI to route questions to this doc.",
119
+ "tags": ["keyword-tag"]
120
+ }
121
+ ]
122
+ }
123
+ ```
124
+
125
+ ### Step 5 — Self-Review
126
+
127
+ Verify: every doc has mermaid diagrams, at least 2 constraints, real file paths, actual env vars, cross-references. Manifest descriptions are detailed for semantic routing. No hallucinated content.
128
+
129
+ ---
130
+
131
+ ## Mode 2: Audit
132
+
133
+ **Trigger:** User says "audit docs" or similar.
134
+
135
+ 1. **Read manifest** — load `vdocs/_manifest.json`
136
+ 2. **Detect stale** — `git diff` or `git log --name-only --since="<last_updated>"` to find changed source files. Cross-reference with each doc's "Key Files" section.
137
+ 3. **Detect gaps** — scan codebase for significant source files not covered by any doc (new routes, services, models, config).
138
+ 4. **Detect dead docs** — check each doc's "Key Files" against filesystem. Flag docs referencing deleted files.
139
+ 5. **Check cross-refs** — verify "Related Features" links still exist and coupling is accurate.
140
+ 6. **Report** — present stale, gaps, dead, cross-ref issues, and current docs. Wait for user direction.
141
+ 7. **Patch** — update stale docs, generate new docs for gaps, flag dead docs, fix cross-refs. Update manifest.
142
+
143
+ ---
144
+
145
+ ## Mode 3: Query
146
+
147
+ **Trigger:** User asks any question about the codebase or documentation.
148
+
149
+ 1. Read `vdocs/_manifest.json`
150
+ 2. Match question against `description` and `tags` fields
151
+ 3. Read matching doc(s)
152
+ 4. Answer from documented knowledge
153
+ 5. If no match, suggest running an audit
154
+
155
+ ---
156
+
157
+ ## Naming Convention
158
+
159
+ Files: `FEATURE_NAME_DOC.md` — uppercase, feature-named, `_DOC` suffix.
160
+
161
+ ---
162
+
163
+ ## Rules
164
+
165
+ 1. **Feature-centric, not file-centric.** One doc per logical feature, not per source file.
166
+ 2. **Mermaid over prose.** Diagram flows. Max 7-9 nodes per diagram.
167
+ 3. **Constraints are gold.** Always fill "Constraints & Decisions".
168
+ 4. **Rich manifest descriptions.** Pack with specific terms for semantic routing.
169
+ 5. **No hallucination.** Only document what exists in code.
170
+ 6. **Plan first, always.** Never generate without user-approved plan.
@@ -0,0 +1,174 @@
1
+ <!-- vdoc:start -->
2
+
3
+ # vdoc — Documentation Generator
4
+
5
+ You generate and maintain feature-centric documentation for codebases. You have three modes: **init**, **audit**, and **query**.
6
+
7
+ All documentation lives in `vdocs/` at the project root. The manifest at `vdocs/_manifest.json` is the semantic index you read first.
8
+
9
+ ---
10
+
11
+ ## Mode 1: Init
12
+
13
+ **Trigger:** User says "document this project" or similar.
14
+
15
+ ### Step 1 — Explore
16
+
17
+ Read the codebase thoroughly. Identify:
18
+
19
+ - **Tech stack**: languages, frameworks, databases, ORMs
20
+ - **Features**: authentication, API, payments, notifications, search, etc.
21
+ - **Architecture**: monolith vs microservices, frontend/backend split, key patterns
22
+ - **Integrations**: third-party services (Stripe, AWS, Redis, etc.)
23
+ - **Entry points**: where requests come in, how they flow through the system
24
+
25
+ Do not skim. Read key files — entry points, config, routes, schemas, middleware.
26
+
27
+ ### Step 2 — Plan
28
+
29
+ Create `vdocs/_DOCUMENTATION_PLAN.md` listing each proposed doc with a one-line description. Present to user. Suggest merges, additions, or removals. Wait for approval.
30
+
31
+ ### Step 3 — Generate
32
+
33
+ For each approved doc, read ALL relevant source files and generate using this template:
34
+
35
+ ```markdown
36
+ # {Feature Title}
37
+
38
+ > {One-line description}
39
+
40
+ ---
41
+
42
+ ## Overview
43
+ {What it does, why it exists, how it fits in the system.}
44
+
45
+ ---
46
+
47
+ ## How It Works
48
+ {Core logic and flow.}
49
+ {Mermaid diagram(s) — max 7-9 nodes per diagram, split if larger.}
50
+
51
+ ---
52
+
53
+ ## Data Model
54
+ {Entities this feature owns. Mermaid ER diagram or table.}
55
+
56
+ ---
57
+
58
+ ## Key Files
59
+ | File | Purpose |
60
+ |------|---------|
61
+ | `src/path/file.ts` | What this file does |
62
+
63
+ ---
64
+
65
+ ## Dependencies & Integrations
66
+ {External services, internal features, packages this relies on.}
67
+
68
+ ---
69
+
70
+ ## Configuration
71
+ | Variable | Purpose | Required |
72
+ |----------|---------|----------|
73
+ | `ENV_VAR` | What it controls | Yes/No |
74
+
75
+ ---
76
+
77
+ ## Error Handling
78
+ {Failure modes, what the user sees, retry logic. Mermaid diagram if non-trivial.}
79
+
80
+ ---
81
+
82
+ ## Constraints & Decisions
83
+ {Why it's built this way. What you CANNOT change without breaking things.}
84
+
85
+ ---
86
+
87
+ ## Related Features
88
+ {Cross-references to other docs by filename. Blast radius notes.}
89
+
90
+ ---
91
+
92
+ *Generated by vdoc v3.0.0 • Last updated: {timestamp}*
93
+ ```
94
+
95
+ **Writing rules:**
96
+
97
+ - **Mermaid diagrams are mandatory** in "How It Works". Max 7-9 nodes — split larger flows.
98
+ - **Data Model** must show real entities from the code, not placeholders.
99
+ - **Constraints & Decisions** is the most valuable section. Dig for non-obvious choices. If unclear, write: `Reason: unknown — verify with team`.
100
+ - **Related Features** must reference other doc filenames and explain coupling.
101
+ - **Configuration** must list actual env vars from the code.
102
+ - **Error Handling** — trace what happens when things fail.
103
+
104
+ ### Step 4 — Manifest
105
+
106
+ Create `vdocs/_manifest.json`:
107
+
108
+ ```json
109
+ {
110
+ "project": "<project-name>",
111
+ "vdoc_version": "3.0.0",
112
+ "created_at": "<ISO-8601>",
113
+ "last_updated": "<ISO-8601>",
114
+ "last_commit": "<short-sha>",
115
+ "documentation": [
116
+ {
117
+ "filepath": "FEATURE_NAME_DOC.md",
118
+ "title": "Human-Readable Title",
119
+ "version": "1.0.0",
120
+ "description": "Rich semantic description with technology names, patterns, concepts. Detailed enough for AI to route questions to this doc.",
121
+ "tags": ["keyword-tag"]
122
+ }
123
+ ]
124
+ }
125
+ ```
126
+
127
+ ### Step 5 — Self-Review
128
+
129
+ Verify: every doc has mermaid diagrams, at least 2 constraints, real file paths, actual env vars, cross-references. Manifest descriptions are detailed for semantic routing. No hallucinated content.
130
+
131
+ ---
132
+
133
+ ## Mode 2: Audit
134
+
135
+ **Trigger:** User says "audit docs" or similar.
136
+
137
+ 1. **Read manifest** — load `vdocs/_manifest.json`
138
+ 2. **Detect stale** — `git diff` or `git log --name-only --since="<last_updated>"` to find changed source files. Cross-reference with each doc's "Key Files" section.
139
+ 3. **Detect gaps** — scan codebase for significant source files not covered by any doc (new routes, services, models, config).
140
+ 4. **Detect dead docs** — check each doc's "Key Files" against filesystem. Flag docs referencing deleted files.
141
+ 5. **Check cross-refs** — verify "Related Features" links still exist and coupling is accurate.
142
+ 6. **Report** — present stale, gaps, dead, cross-ref issues, and current docs. Wait for user direction.
143
+ 7. **Patch** — update stale docs, generate new docs for gaps, flag dead docs, fix cross-refs. Update manifest.
144
+
145
+ ---
146
+
147
+ ## Mode 3: Query
148
+
149
+ **Trigger:** User asks any question about the codebase or documentation.
150
+
151
+ 1. Read `vdocs/_manifest.json`
152
+ 2. Match question against `description` and `tags` fields
153
+ 3. Read matching doc(s)
154
+ 4. Answer from documented knowledge
155
+ 5. If no match, suggest running an audit
156
+
157
+ ---
158
+
159
+ ## Naming Convention
160
+
161
+ Files: `FEATURE_NAME_DOC.md` — uppercase, feature-named, `_DOC` suffix.
162
+
163
+ ---
164
+
165
+ ## Rules
166
+
167
+ 1. **Feature-centric, not file-centric.** One doc per logical feature, not per source file.
168
+ 2. **Mermaid over prose.** Diagram flows. Max 7-9 nodes per diagram.
169
+ 3. **Constraints are gold.** Always fill "Constraints & Decisions".
170
+ 4. **Rich manifest descriptions.** Pack with specific terms for semantic routing.
171
+ 5. **No hallucination.** Only document what exists in code.
172
+ 6. **Plan first, always.** Never generate without user-approved plan.
173
+
174
+ <!-- vdoc:end -->
@@ -0,0 +1,12 @@
1
+ <!-- vdoc:start -->
2
+ ## vdoc — Documentation Generator
3
+
4
+ This project uses vdoc for feature-centric documentation. Documentation lives in `vdocs/` with a semantic manifest at `vdocs/_manifest.json`.
5
+
6
+ When the user asks to "document this project", "audit docs", or asks questions about codebase features, follow the detailed instructions in `.github/instructions/vdoc.instructions.md`.
7
+
8
+ Key commands:
9
+ - "document this project" → explore codebase, create plan, generate docs
10
+ - "audit docs" → detect stale/missing/dead docs, report, patch
11
+ - Any question → read manifest, route to right doc, answer
12
+ <!-- vdoc:end -->
@@ -0,0 +1,174 @@
1
+ ---
2
+ applyTo: "vdocs/**"
3
+ ---
4
+
5
+ # vdoc — Documentation Generator
6
+
7
+ You generate and maintain feature-centric documentation for codebases. You have three modes: **init**, **audit**, and **query**.
8
+
9
+ All documentation lives in `vdocs/` at the project root. The manifest at `vdocs/_manifest.json` is the semantic index you read first.
10
+
11
+ ---
12
+
13
+ ## Mode 1: Init
14
+
15
+ **Trigger:** User says "document this project" or similar.
16
+
17
+ ### Step 1 — Explore
18
+
19
+ Read the codebase thoroughly. Identify:
20
+
21
+ - **Tech stack**: languages, frameworks, databases, ORMs
22
+ - **Features**: authentication, API, payments, notifications, search, etc.
23
+ - **Architecture**: monolith vs microservices, frontend/backend split, key patterns
24
+ - **Integrations**: third-party services (Stripe, AWS, Redis, etc.)
25
+ - **Entry points**: where requests come in, how they flow through the system
26
+
27
+ Do not skim. Read key files — entry points, config, routes, schemas, middleware.
28
+
29
+ ### Step 2 — Plan
30
+
31
+ Create `vdocs/_DOCUMENTATION_PLAN.md` listing each proposed doc with a one-line description. Present to user. Suggest merges, additions, or removals. Wait for approval.
32
+
33
+ ### Step 3 — Generate
34
+
35
+ For each approved doc, read ALL relevant source files and generate using this template:
36
+
37
+ ```markdown
38
+ # {Feature Title}
39
+
40
+ > {One-line description}
41
+
42
+ ---
43
+
44
+ ## Overview
45
+ {What it does, why it exists, how it fits in the system.}
46
+
47
+ ---
48
+
49
+ ## How It Works
50
+ {Core logic and flow.}
51
+ {Mermaid diagram(s) — max 7-9 nodes per diagram, split if larger.}
52
+
53
+ ---
54
+
55
+ ## Data Model
56
+ {Entities this feature owns. Mermaid ER diagram or table.}
57
+
58
+ ---
59
+
60
+ ## Key Files
61
+ | File | Purpose |
62
+ |------|---------|
63
+ | `src/path/file.ts` | What this file does |
64
+
65
+ ---
66
+
67
+ ## Dependencies & Integrations
68
+ {External services, internal features, packages this relies on.}
69
+
70
+ ---
71
+
72
+ ## Configuration
73
+ | Variable | Purpose | Required |
74
+ |----------|---------|----------|
75
+ | `ENV_VAR` | What it controls | Yes/No |
76
+
77
+ ---
78
+
79
+ ## Error Handling
80
+ {Failure modes, what the user sees, retry logic. Mermaid diagram if non-trivial.}
81
+
82
+ ---
83
+
84
+ ## Constraints & Decisions
85
+ {Why it's built this way. What you CANNOT change without breaking things.}
86
+
87
+ ---
88
+
89
+ ## Related Features
90
+ {Cross-references to other docs by filename. Blast radius notes.}
91
+
92
+ ---
93
+
94
+ *Generated by vdoc v3.0.0 • Last updated: {timestamp}*
95
+ ```
96
+
97
+ **Writing rules:**
98
+
99
+ - **Mermaid diagrams are mandatory** in "How It Works". Max 7-9 nodes — split larger flows.
100
+ - **Data Model** must show real entities from the code, not placeholders.
101
+ - **Constraints & Decisions** is the most valuable section. Dig for non-obvious choices. If unclear, write: `Reason: unknown — verify with team`.
102
+ - **Related Features** must reference other doc filenames and explain coupling.
103
+ - **Configuration** must list actual env vars from the code.
104
+ - **Error Handling** — trace what happens when things fail.
105
+
106
+ ### Step 4 — Manifest
107
+
108
+ Create `vdocs/_manifest.json`:
109
+
110
+ ```json
111
+ {
112
+ "project": "<project-name>",
113
+ "vdoc_version": "3.0.0",
114
+ "created_at": "<ISO-8601>",
115
+ "last_updated": "<ISO-8601>",
116
+ "last_commit": "<short-sha>",
117
+ "documentation": [
118
+ {
119
+ "filepath": "FEATURE_NAME_DOC.md",
120
+ "title": "Human-Readable Title",
121
+ "version": "1.0.0",
122
+ "description": "Rich semantic description with technology names, patterns, concepts. Detailed enough for AI to route questions to this doc.",
123
+ "tags": ["keyword-tag"]
124
+ }
125
+ ]
126
+ }
127
+ ```
128
+
129
+ ### Step 5 — Self-Review
130
+
131
+ Verify: every doc has mermaid diagrams, at least 2 constraints, real file paths, actual env vars, cross-references. Manifest descriptions are detailed for semantic routing. No hallucinated content.
132
+
133
+ ---
134
+
135
+ ## Mode 2: Audit
136
+
137
+ **Trigger:** User says "audit docs" or similar.
138
+
139
+ 1. **Read manifest** — load `vdocs/_manifest.json`
140
+ 2. **Detect stale** — `git diff` or `git log --name-only --since="<last_updated>"` to find changed source files. Cross-reference with each doc's "Key Files" section.
141
+ 3. **Detect gaps** — scan codebase for significant source files not covered by any doc (new routes, services, models, config).
142
+ 4. **Detect dead docs** — check each doc's "Key Files" against filesystem. Flag docs referencing deleted files.
143
+ 5. **Check cross-refs** — verify "Related Features" links still exist and coupling is accurate.
144
+ 6. **Report** — present stale, gaps, dead, cross-ref issues, and current docs. Wait for user direction.
145
+ 7. **Patch** — update stale docs, generate new docs for gaps, flag dead docs, fix cross-refs. Update manifest.
146
+
147
+ ---
148
+
149
+ ## Mode 3: Query
150
+
151
+ **Trigger:** User asks any question about the codebase or documentation.
152
+
153
+ 1. Read `vdocs/_manifest.json`
154
+ 2. Match question against `description` and `tags` fields
155
+ 3. Read matching doc(s)
156
+ 4. Answer from documented knowledge
157
+ 5. If no match, suggest running an audit
158
+
159
+ ---
160
+
161
+ ## Naming Convention
162
+
163
+ Files: `FEATURE_NAME_DOC.md` — uppercase, feature-named, `_DOC` suffix.
164
+
165
+ ---
166
+
167
+ ## Rules
168
+
169
+ 1. **Feature-centric, not file-centric.** One doc per logical feature, not per source file.
170
+ 2. **Mermaid over prose.** Diagram flows. Max 7-9 nodes per diagram.
171
+ 3. **Constraints are gold.** Always fill "Constraints & Decisions".
172
+ 4. **Rich manifest descriptions.** Pack with specific terms for semantic routing.
173
+ 5. **No hallucination.** Only document what exists in code.
174
+ 6. **Plan first, always.** Never generate without user-approved plan.
@@ -0,0 +1,31 @@
1
+ ---
2
+ agent: 'agent'
3
+ description: 'Generate and maintain feature-centric product documentation'
4
+ name: 'vdoc'
5
+ argument-hint: '[init|audit]'
6
+ tools: ['changes', 'codebase', 'githubRepo', 'problems']
7
+ ---
8
+
9
+ # vdoc — Documentation Generator
10
+
11
+ Run documentation workflows for this project. Full instructions are in `.github/instructions/vdoc.instructions.md`.
12
+
13
+ **Mode: ${input:mode:init}**
14
+
15
+ ## If mode is `init` (or no `vdocs/` folder exists):
16
+
17
+ 1. **Explore** — Read the codebase: tech stack, features, architecture, integrations, entry points. Use #tool:codebase to search broadly. Read actual files.
18
+ 2. **Plan** — Create `vdocs/_DOCUMENTATION_PLAN.md` listing proposed docs. Present to user. Wait for approval.
19
+ 3. **Generate** — For each doc, read ALL relevant source files. Write `vdocs/FEATURE_NAME_DOC.md` following the template in `.github/instructions/vdoc.instructions.md`.
20
+ 4. **Manifest** — Create `vdocs/_manifest.json` with rich semantic descriptions.
21
+ 5. **Verify** — Every doc has mermaid diagrams, real paths, 2+ constraints, cross-references.
22
+
23
+ ## If mode is `audit` (or `vdocs/` already exists):
24
+
25
+ 1. Read `vdocs/_manifest.json`
26
+ 2. **Stale** — Use #tool:changes to find modified source files. Cross-ref with each doc's "Key Files" section.
27
+ 3. **Gaps** — Find undocumented features (new routes, services, models)
28
+ 4. **Dead** — Docs referencing deleted files
29
+ 5. **Cross-refs** — Verify Related Features links still valid
30
+ 6. **Report** — Present findings, wait for user direction
31
+ 7. **Patch** — Update stale docs, generate gaps, fix cross-refs, update manifest
@@ -0,0 +1,31 @@
1
+ # /vdoc — Documentation Generator
2
+
3
+ Run documentation workflows for this project. Full instructions are in `.windsurf/rules/vdoc.md`.
4
+
5
+ ## Steps
6
+
7
+ ### Step 1: Determine Mode
8
+
9
+ Check if `vdocs/_manifest.json` exists:
10
+ - **No manifest** → run Init mode
11
+ - **Manifest exists** → run Audit mode
12
+
13
+ The user may also specify: `/vdoc init` or `/vdoc audit`.
14
+
15
+ ### Step 2a: Init Mode
16
+
17
+ 1. **Explore** — Read the codebase: tech stack, features, architecture, integrations, entry points. Read actual files.
18
+ 2. **Plan** — Create `vdocs/_DOCUMENTATION_PLAN.md` listing proposed docs. Present to user. Wait for approval.
19
+ 3. **Generate** — For each doc, read ALL relevant source files. Write `vdocs/FEATURE_NAME_DOC.md` following the template in `.windsurf/rules/vdoc.md`.
20
+ 4. **Manifest** — Create `vdocs/_manifest.json` with rich semantic descriptions.
21
+ 5. **Verify** — Every doc has mermaid diagrams, real paths, 2+ constraints, cross-references.
22
+
23
+ ### Step 2b: Audit Mode
24
+
25
+ 1. Read `vdocs/_manifest.json`
26
+ 2. **Stale** — git diff since `last_updated`, cross-ref with each doc's "Key Files" section
27
+ 3. **Gaps** — undocumented features (new routes, services, models)
28
+ 4. **Dead** — docs referencing deleted files
29
+ 5. **Cross-refs** — verify Related Features links
30
+ 6. **Report** — present findings, wait for user direction
31
+ 7. **Patch** — update stale, generate gaps, fix cross-refs, update manifest
@@ -0,0 +1,94 @@
1
+ ---
2
+ trigger: model_decision
3
+ description: "Generate and maintain feature-centric product documentation. Modes: init (explore, plan, generate docs), audit (detect stale/missing/dead docs, patch), query (route questions via manifest). Activates on 'document this project', 'audit docs', or documentation questions."
4
+ ---
5
+
6
+ # vdoc — Documentation Generator
7
+
8
+ Three modes: **init**, **audit**, **query**. All docs live in `vdocs/`. Manifest at `vdocs/_manifest.json` is the semantic index.
9
+
10
+ ## Init ("document this project")
11
+
12
+ 1. **Explore** — Read codebase: tech stack, features, architecture, integrations, entry points. Read actual files, don't skim.
13
+ 2. **Plan** — Create `vdocs/_DOCUMENTATION_PLAN.md` listing proposed docs. Present to user, suggest changes. Wait for approval.
14
+ 3. **Generate** — For each doc, read ALL relevant source files. Write `vdocs/FEATURE_NAME_DOC.md` using template below.
15
+ 4. **Manifest** — Create `vdocs/_manifest.json` (schema below).
16
+ 5. **Self-review** — Verify: mermaid diagrams present, real file paths, actual env vars, 2+ constraints per doc, cross-references exist.
17
+
18
+ ## Audit ("audit docs")
19
+
20
+ 1. Read `vdocs/_manifest.json`
21
+ 2. **Stale**: git diff since `last_updated`, cross-ref with each doc's "Key Files" section
22
+ 3. **Gaps**: find significant undocumented source files (routes, services, models)
23
+ 4. **Dead**: docs referencing deleted source files
24
+ 5. **Cross-refs**: verify Related Features links still valid
25
+ 6. **Report** to user, wait for direction, then patch/create/remove as approved
26
+ 7. Update manifest versions and timestamps
27
+
28
+ ## Query (any documentation question)
29
+
30
+ Read manifest → match `description`/`tags` → read matching doc → answer. If no match, suggest audit.
31
+
32
+ ## Doc Template
33
+
34
+ ```markdown
35
+ # {Feature Title}
36
+ > {One-line description}
37
+
38
+ ## Overview
39
+ {What it does, why it exists, system fit.}
40
+
41
+ ## How It Works
42
+ {Core flow. Mermaid diagram(s) — max 7-9 nodes, split if larger.}
43
+
44
+ ## Data Model
45
+ {Entities and relationships. Mermaid ER or table.}
46
+
47
+ ## Key Files
48
+ | File | Purpose |
49
+ |------|---------|
50
+
51
+ ## Dependencies & Integrations
52
+ {External services, internal features, packages.}
53
+
54
+ ## Configuration
55
+ | Variable | Purpose | Required |
56
+ |----------|---------|----------|
57
+
58
+ ## Error Handling
59
+ {Failure modes, user impact, retry logic. Mermaid if non-trivial.}
60
+
61
+ ## Constraints & Decisions
62
+ {Why built this way. What CANNOT change without breaking things.}
63
+
64
+ ## Related Features
65
+ {Cross-refs to other doc filenames. Blast radius.}
66
+ ```
67
+
68
+ ## Manifest Schema
69
+
70
+ ```json
71
+ {
72
+ "project": "<name>",
73
+ "vdoc_version": "3.0.0",
74
+ "created_at": "<ISO-8601>",
75
+ "last_updated": "<ISO-8601>",
76
+ "last_commit": "<sha>",
77
+ "documentation": [{
78
+ "filepath": "FEATURE_NAME_DOC.md",
79
+ "title": "Title",
80
+ "version": "1.0.0",
81
+ "description": "Rich semantic description for AI routing.",
82
+ "tags": ["keyword-tag"]
83
+ }]
84
+ }
85
+ ```
86
+
87
+ ## Rules
88
+
89
+ - **Feature-centric**: one doc per feature, not per file
90
+ - **Mermaid mandatory**: diagram flows, max 7-9 nodes
91
+ - **Constraints are gold**: always fill, prevents breaking changes
92
+ - **Rich descriptions**: manifest descriptions are semantic search indexes
93
+ - **No hallucination**: only document what exists in code
94
+ - **Plan first**: never generate without user approval