@sandrinio/vdoc 3.0.1 → 3.4.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.
Files changed (70) hide show
  1. package/bin/vdoc.mjs +78 -11
  2. package/package.json +1 -1
  3. package/skills/agents/AGENTS.md +17 -143
  4. package/skills/agents/references/audit-workflow.md +65 -0
  5. package/skills/agents/references/doc-template.md +67 -0
  6. package/skills/agents/references/exploration-strategies.md +341 -0
  7. package/skills/agents/references/init-workflow.md +123 -0
  8. package/skills/agents/references/manifest-schema.json +16 -0
  9. package/skills/claude/SKILL.md +14 -41
  10. package/skills/claude/references/exploration-strategies.md +341 -0
  11. package/skills/claude/references/init-workflow.md +44 -7
  12. package/skills/claude/vdoc-audit.md +80 -0
  13. package/skills/claude/vdoc-init.md +216 -0
  14. package/skills/cline/references/audit-workflow.md +65 -0
  15. package/skills/cline/references/doc-template.md +67 -0
  16. package/skills/cline/references/exploration-strategies.md +341 -0
  17. package/skills/cline/references/init-workflow.md +123 -0
  18. package/skills/cline/references/manifest-schema.json +16 -0
  19. package/skills/cline/vdoc-workflow.md +3 -13
  20. package/skills/cline/vdoc.md +10 -148
  21. package/skills/continue/references/audit-workflow.md +65 -0
  22. package/skills/continue/references/doc-template.md +67 -0
  23. package/skills/continue/references/exploration-strategies.md +341 -0
  24. package/skills/continue/references/init-workflow.md +123 -0
  25. package/skills/continue/references/manifest-schema.json +16 -0
  26. package/skills/continue/vdoc-command.md +3 -13
  27. package/skills/continue/vdoc.md +9 -147
  28. package/skills/cursor/RULE.md +68 -0
  29. package/skills/cursor/references/audit-workflow.md +65 -0
  30. package/skills/cursor/references/doc-template.md +67 -0
  31. package/skills/cursor/references/exploration-strategies.md +341 -0
  32. package/skills/cursor/references/init-workflow.md +123 -0
  33. package/skills/cursor/references/manifest-schema.json +16 -0
  34. package/skills/cursor/vdoc-command.md +3 -13
  35. package/skills/gemini/GEMINI.md +17 -143
  36. package/skills/gemini/references/audit-workflow.md +65 -0
  37. package/skills/gemini/references/doc-template.md +67 -0
  38. package/skills/gemini/references/exploration-strategies.md +341 -0
  39. package/skills/gemini/references/init-workflow.md +123 -0
  40. package/skills/gemini/references/manifest-schema.json +16 -0
  41. package/skills/gemini/vdoc.toml +3 -9
  42. package/skills/jetbrains-ai/references/audit-workflow.md +65 -0
  43. package/skills/jetbrains-ai/references/doc-template.md +67 -0
  44. package/skills/jetbrains-ai/references/exploration-strategies.md +341 -0
  45. package/skills/jetbrains-ai/references/init-workflow.md +123 -0
  46. package/skills/jetbrains-ai/references/manifest-schema.json +16 -0
  47. package/skills/jetbrains-ai/vdoc.md +17 -143
  48. package/skills/junie/guidelines.md +17 -143
  49. package/skills/junie/references/audit-workflow.md +65 -0
  50. package/skills/junie/references/doc-template.md +67 -0
  51. package/skills/junie/references/exploration-strategies.md +341 -0
  52. package/skills/junie/references/init-workflow.md +123 -0
  53. package/skills/junie/references/manifest-schema.json +16 -0
  54. package/skills/vscode/SKILL.md +39 -0
  55. package/skills/vscode/references/audit-workflow.md +65 -0
  56. package/skills/vscode/references/doc-template.md +67 -0
  57. package/skills/vscode/references/exploration-strategies.md +341 -0
  58. package/skills/vscode/references/init-workflow.md +123 -0
  59. package/skills/vscode/references/manifest-schema.json +16 -0
  60. package/skills/vscode/vdoc.instructions.md +30 -146
  61. package/skills/vscode/vdoc.prompt.md +5 -15
  62. package/skills/windsurf/SKILL.md +67 -0
  63. package/skills/windsurf/resources/audit-workflow.md +65 -0
  64. package/skills/windsurf/resources/doc-template.md +67 -0
  65. package/skills/windsurf/resources/exploration-strategies.md +341 -0
  66. package/skills/windsurf/resources/init-workflow.md +123 -0
  67. package/skills/windsurf/resources/manifest-schema.json +16 -0
  68. package/skills/windsurf/vdoc-workflow.md +3 -13
  69. package/skills/cursor/vdoc.mdc +0 -176
  70. package/skills/windsurf/vdoc.md +0 -94
@@ -0,0 +1,216 @@
1
+ ---
2
+ name: vdoc-init
3
+ description: "Generate feature-centric documentation from source code. Use when user says 'document this project', 'generate docs', or wants to create vdocs from scratch."
4
+ ---
5
+
6
+ # vdoc init — Generate Documentation
7
+
8
+ Generate feature-centric documentation from source code. All docs go in `vdocs/`. Do NOT create scripts, shell files, scanners, or any tooling — use your built-in tools (Read, Glob, Grep) for everything.
9
+
10
+ ---
11
+
12
+ ## Step 1 — Explore
13
+
14
+ Follow the two-phase exploration strategy in `references/exploration-strategies.md`:
15
+
16
+ **Phase 1 — Fingerprint** (3-5 file reads max)
17
+ Read package/config files and directory structure using Read, Glob, and Grep 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`.
18
+
19
+ **Phase 2 — Targeted Exploration** (archetype-specific)
20
+ 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).
21
+
22
+ If no archetype matches, use the Fallback strategy and confirm with the user.
23
+
24
+ Do not skim. Understand how the system actually works before proposing docs.
25
+
26
+ **Phase 3 — Write Exploration Log**
27
+ After exploring, write `vdocs/_exploration_log.md` documenting what you found:
28
+
29
+ ```markdown
30
+ # Exploration Log
31
+
32
+ ## Fingerprint
33
+ - **Language(s):** e.g., TypeScript, Python
34
+ - **Framework(s):** e.g., Next.js 14, FastAPI
35
+ - **Archetype(s):** e.g., Full-stack Framework
36
+ - **Scope:** e.g., ~85 files, medium
37
+
38
+ ## Files Read
39
+ | # | File | Why | What I Found |
40
+ |---|------|-----|--------------|
41
+ | 1 | package.json | Fingerprint | Next.js 14, Prisma, NextAuth |
42
+ | 2 | src/app/ (listing) | Page tree | 12 routes, 3 API routes |
43
+ | ... | ... | ... | ... |
44
+
45
+ ## Feature Signals Detected
46
+ | Signal | Source File(s) | Proposed Doc |
47
+ |--------|---------------|--------------|
48
+ | Auth middleware + login page | middleware.ts, app/login/page.tsx | AUTHENTICATION_DOC.md |
49
+ | Prisma schema with 8 models | prisma/schema.prisma | DATA_MODEL_DOC.md |
50
+ | ... | ... | ... |
51
+
52
+ ## Ambiguities / Open Questions
53
+ - Could not determine why Redis is in dependencies — no usage found. Ask user.
54
+ - Payments folder exists but appears incomplete / WIP.
55
+ ```
56
+
57
+ This log is your working memory. It feeds directly into Step 2 (Plan).
58
+
59
+ ## Step 2 — Plan
60
+
61
+ Create `vdocs/_DOCUMENTATION_PLAN.md` listing each proposed doc:
62
+
63
+ ```markdown
64
+ # Documentation Plan
65
+
66
+ ## Proposed Documents
67
+
68
+ 1. **PROJECT_OVERVIEW_DOC.md** — Tech stack, architecture, project structure, dev setup
69
+ 2. **AUTHENTICATION_DOC.md** — OAuth2 flow, JWT lifecycle, session management, RBAC
70
+ 3. **API_REFERENCE_DOC.md** — All endpoints, request/response shapes, error codes
71
+ ...
72
+
73
+ ## Notes
74
+ - Each doc covers one logical feature, not one file
75
+ - Docs should be useful for onboarding AND as AI context for planning changes
76
+ ```
77
+
78
+ Present the plan to the user. Actively suggest changes:
79
+ - "Should I merge X and Y into one doc?"
80
+ - "I found a websocket system — want that documented separately?"
81
+ - "Any internal/legacy systems I should skip?"
82
+
83
+ **Wait for user approval before proceeding.**
84
+
85
+ ## Step 3 — Generate
86
+
87
+ For each approved doc:
88
+
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
91
+ 3. Write to `vdocs/FEATURE_NAME_DOC.md`
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
+ ### Writing Rules
166
+
167
+ - **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.
168
+ - **Data Model** must show real entities from the code, not generic placeholders. Use mermaid ER diagrams for relational data, tables for simpler models.
169
+ - **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`.
170
+ - **Related Features** must reference other docs by filename and explain the coupling.
171
+ - **Configuration** must list actual env vars/secrets from the code, not hypothetical ones.
172
+ - **Error Handling** — trace what happens when things fail. What does the user see? What gets logged? Is there retry logic?
173
+
174
+ ## Step 4 — Manifest
175
+
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
+ ```
196
+
197
+ 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
+
199
+ ## Step 5 — Self-Review
200
+
201
+ Before finishing, verify:
202
+
203
+ - [ ] Every doc has at least one mermaid diagram in "How It Works"
204
+ - [ ] Every doc has at least 2 entries in "Constraints & Decisions"
205
+ - [ ] Every doc's "Key Files" lists real paths that exist in the codebase
206
+ - [ ] Every doc's "Configuration" lists actual env vars from the code
207
+ - [ ] Every doc's "Related Features" references other doc filenames
208
+ - [ ] Manifest `description` is detailed enough for semantic routing
209
+ - [ ] No doc is just a shallow restatement of file names — each explains WHY and HOW
210
+
211
+ ## Rules
212
+
213
+ 1. **Feature-centric, not file-centric.** One doc per logical feature, not per source file.
214
+ 2. **No hallucination.** Only document what exists in code.
215
+ 3. **No scripts.** Do NOT create shell scripts, scanners, or build tools. Use Read/Glob/Grep.
216
+ 4. **Plan first.** Never generate without user-approved plan.
@@ -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,67 @@
1
+ # {Feature Title}
2
+
3
+ > {One-line description of what this covers}
4
+
5
+ ---
6
+
7
+ ## Overview
8
+
9
+ {What it does, why it exists, how it fits in the system.}
10
+
11
+ ---
12
+
13
+ ## How It Works
14
+
15
+ {Core logic and flow.}
16
+
17
+ {Mermaid diagram(s) — max 7-9 nodes per diagram, split into multiple if larger.}
18
+
19
+ ---
20
+
21
+ ## Data Model
22
+
23
+ {Entities this feature owns and their relationships. Mermaid ER diagram or table.}
24
+
25
+ ---
26
+
27
+ ## Key Files
28
+
29
+ | File | Purpose |
30
+ |------|---------|
31
+ | `src/path/file.ts` | What this file does |
32
+
33
+ ---
34
+
35
+ ## Dependencies & Integrations
36
+
37
+ {External services, internal features, packages this relies on.}
38
+
39
+ ---
40
+
41
+ ## Configuration
42
+
43
+ | Variable | Purpose | Required |
44
+ |----------|---------|----------|
45
+ | `ENV_VAR` | What it controls | Yes/No |
46
+
47
+ ---
48
+
49
+ ## Error Handling
50
+
51
+ {Failure modes, what the user sees, retry logic. Mermaid diagram if the error flow is non-trivial.}
52
+
53
+ ---
54
+
55
+ ## Constraints & Decisions
56
+
57
+ {Why it's built this way. What you CANNOT change without breaking things.}
58
+
59
+ ---
60
+
61
+ ## Related Features
62
+
63
+ {Cross-references to other docs by filename. Blast radius — what breaks if this changes.}
64
+
65
+ ---
66
+
67
+ *Generated by vdoc v3.0.0 • Last updated: {timestamp}*
@@ -0,0 +1,341 @@
1
+ # Exploration Strategies
2
+
3
+ Smart, targeted codebase exploration. Two phases: fingerprint the project, then follow the right archetype playbook.
4
+
5
+ ## Phase 1 — Fingerprint
6
+
7
+ Read these high-signal files first (whichever exist) to classify the project. **3-5 reads max.**
8
+
9
+ ### Package / Config Files (read 1-2)
10
+
11
+ | File | Ecosystem |
12
+ |------|-----------|
13
+ | `package.json` | Node.js / JavaScript / TypeScript |
14
+ | `pyproject.toml` / `setup.py` / `requirements.txt` | Python |
15
+ | `go.mod` | Go |
16
+ | `Cargo.toml` | Rust |
17
+ | `Gemfile` | Ruby |
18
+ | `pom.xml` / `build.gradle` | Java / Kotlin |
19
+ | `composer.json` | PHP |
20
+ | `*.csproj` / `*.sln` | .NET |
21
+ | `pubspec.yaml` | Dart / Flutter |
22
+
23
+ ### Structure Scan
24
+
25
+ - List root directory
26
+ - List `src/` or `app/` or `lib/` (whichever exists)
27
+
28
+ ### Entry Points (read 1-2)
29
+
30
+ - README.md (first 50 lines)
31
+ - Main entry file (e.g., `src/index.ts`, `main.py`, `cmd/main.go`)
32
+
33
+ ### Determine
34
+
35
+ 1. **Primary language(s)** and framework(s)
36
+ 2. **Project archetype** — match to a playbook below
37
+ 3. **Rough scope** — small (< 20 files), medium (20-100), large (100+)
38
+
39
+ If the project spans multiple archetypes (e.g., monorepo with frontend + API), apply multiple playbooks.
40
+
41
+ ---
42
+
43
+ ## Phase 2 — Archetype Playbooks
44
+
45
+ Match the detected archetype and follow its playbook. Each defines:
46
+ - **Glob patterns** — files to read, in priority order
47
+ - **What to extract** — what each file category reveals
48
+ - **Feature signals** — patterns that indicate documentable features
49
+
50
+ ### Composing Archetypes
51
+
52
+ Most real projects don't fit a single archetype. **Combine playbooks** when needed:
53
+
54
+ - A FastAPI app with AI agent workflows → **Web API** playbook for routes/middleware/auth + read `**/workflows/**`, `**/agents/**`, `**/chains/**`, `**/prompts/**` for the agent layer
55
+ - A Next.js app with a Python microservice → **Full-Stack Framework** + **Web API** playbooks
56
+ - A CLI that wraps an SDK → **CLI Tool** + **Library/SDK** playbooks
57
+
58
+ **How to compose:**
59
+ 1. Pick the **primary archetype** (what the project fundamentally is)
60
+ 2. Follow its playbook fully
61
+ 3. When you encounter directories/patterns that belong to another archetype, pull in that playbook's glob patterns and feature signals
62
+ 4. In the exploration log, note which archetypes you composed and why
63
+
64
+ Do not force a project into one archetype. The playbooks are building blocks — use what fits.
65
+
66
+ ---
67
+
68
+ ### Web API
69
+
70
+ **Signals:** Express, FastAPI, Django REST, Rails, Spring Boot, Gin, Actix, Phoenix, Hono, NestJS
71
+
72
+ | Priority | Glob Pattern | What to Extract |
73
+ |----------|-------------|-----------------|
74
+ | 1 | `**/routes/**`, `**/router.*`, `**/urls.py` | Endpoints, HTTP methods, URL structure |
75
+ | 2 | `**/middleware/**`, `**/middleware.*` | Auth, CORS, rate limiting, logging, error handling |
76
+ | 3 | `**/models/**`, `**/schema*`, `**/migrations/**` | Data model, entities, relationships |
77
+ | 4 | `**/controllers/**`, `**/handlers/**`, `**/views/**` | Business logic per endpoint |
78
+ | 5 | `**/services/**`, `**/lib/**` | Shared logic, external integrations |
79
+ | 6 | `**/config/**`, `.env*`, `**/settings*` | Environment config, feature flags |
80
+ | 7 | `**/tests/**` (skim 2-3) | What's tested reveals what matters |
81
+
82
+ **Feature signals:**
83
+ - Auth routes/middleware → Authentication doc
84
+ - Payment/billing routes → Payments doc
85
+ - File upload handlers → File Management doc
86
+ - WebSocket/SSE handlers → Real-time doc
87
+ - Background jobs/queues → Background Processing doc
88
+ - Email/notification services → Notifications doc
89
+ - Search endpoints → Search doc
90
+ - Admin routes → Admin Panel doc
91
+
92
+ ---
93
+
94
+ ### Frontend SPA
95
+
96
+ **Signals:** React (CRA/Vite), Vue, Svelte, Angular, Solid
97
+
98
+ | Priority | Glob Pattern | What to Extract |
99
+ |----------|-------------|-----------------|
100
+ | 1 | `**/pages/**`, `**/views/**`, `**/routes*` | Page tree, routing structure |
101
+ | 2 | `**/store/**`, `**/context/**`, `**/state/**`, `**/*slice*` | State shape, data flow |
102
+ | 3 | `**/api/**`, `**/services/**`, `**/hooks/use*` | API integration, data fetching |
103
+ | 4 | `**/components/**` (skim top-level) | Component architecture, shared vs feature |
104
+ | 5 | `**/types/**`, `**/interfaces/**`, `**/*.d.ts` | Data contracts, shared types |
105
+ | 6 | `**/utils/**`, `**/helpers/**` | Shared utilities |
106
+ | 7 | `**/config/**`, `.env*` | Feature flags, API URLs, build config |
107
+
108
+ **Feature signals:**
109
+ - Auth context/store + login pages → Authentication doc
110
+ - Form components + validation → Forms doc
111
+ - Data tables with pagination → Data Display doc
112
+ - Charts/dashboards → Analytics doc
113
+ - Theming/i18n files → Theming / Internationalization doc
114
+ - File upload components → Media Management doc
115
+
116
+ ---
117
+
118
+ ### Full-Stack Framework
119
+
120
+ **Signals:** Next.js, Nuxt, SvelteKit, Remix, RedwoodJS, Blitz, Astro (SSR)
121
+
122
+ | Priority | Glob Pattern | What to Extract |
123
+ |----------|-------------|-----------------|
124
+ | 1 | `**/app/**/page.*`, `**/pages/**`, `**/routes/**` | UI pages AND API routes — the router is the architecture |
125
+ | 2 | `**/api/**`, `**/server/**`, `**/actions/**` | Server-side logic, server actions |
126
+ | 3 | `**/models/**`, `**/schema*`, `**/prisma/**`, `**/drizzle/**` | Data layer, ORM config |
127
+ | 4 | `**/middleware.*`, `**/middleware/**` | Request pipeline, auth, redirects |
128
+ | 5 | `**/components/**` (skim top-level) | Shared UI components |
129
+ | 6 | `**/lib/**`, `**/utils/**`, `**/services/**` | Shared server + client utilities |
130
+ | 7 | `**/config/**`, `.env*`, `next.config.*`, `nuxt.config.*` | Framework and environment config |
131
+
132
+ **Feature signals:**
133
+ - All Web API signals + all Frontend SPA signals
134
+ - Server actions / mutations → Data Mutation doc
135
+ - ISR/SSG configuration → Rendering Strategy doc
136
+ - Edge functions / middleware → Edge Computing doc
137
+
138
+ ---
139
+
140
+ ### CLI Tool
141
+
142
+ **Signals:** Commander, Yargs, Click, Typer, Cobra, Clap, oclif, Argparse
143
+
144
+ | Priority | Glob Pattern | What to Extract |
145
+ |----------|-------------|-----------------|
146
+ | 1 | `**/commands/**`, `**/cmd/**`, `**/cli.*` | Command tree, subcommands |
147
+ | 2 | Main entry (`bin/*`, `src/index.*`, `src/main.*`) | Argument parsing, top-level flow |
148
+ | 3 | `**/config*`, `**/*rc*`, `**/settings*` | Config file formats, defaults |
149
+ | 4 | `**/utils/**`, `**/lib/**`, `**/core/**` | Core logic behind commands |
150
+ | 5 | `**/output*`, `**/format*`, `**/display*` | Output formatting (JSON, table, etc.) |
151
+ | 6 | `**/templates/**`, `**/scaffolds/**` | Code generation templates |
152
+
153
+ **Feature signals:**
154
+ - Multiple subcommands → one doc per command group
155
+ - Config file handling → Configuration doc
156
+ - Plugin/extension system → Plugin Architecture doc
157
+ - Interactive prompts → User Interaction doc
158
+ - File I/O operations → File Processing doc
159
+
160
+ ---
161
+
162
+ ### Library / SDK
163
+
164
+ **Signals:** Published package with `main`/`exports` in package.json, `lib/` with clear public API, type declarations
165
+
166
+ | Priority | Glob Pattern | What to Extract |
167
+ |----------|-------------|-----------------|
168
+ | 1 | Main export (`src/index.*`, `lib/index.*`, `__init__.py`) | Public API surface |
169
+ | 2 | `**/*.d.ts`, `**/types.*`, `**/interfaces.*` | Type contracts, input/output shapes |
170
+ | 3 | `**/core/**`, `**/lib/**` | Internal implementation |
171
+ | 4 | `**/utils/**`, `**/helpers/**` | Supporting utilities |
172
+ | 5 | `**/examples/**`, `**/demo/**` | Usage patterns |
173
+ | 6 | `**/plugins/**`, `**/adapters/**`, `**/providers/**` | Extension points |
174
+ | 7 | `**/tests/**` (skim 2-3) | Edge cases, expected behavior |
175
+
176
+ **Feature signals:**
177
+ - Multiple exported classes/functions → Core API doc
178
+ - Plugin/adapter pattern → Extension Architecture doc
179
+ - Multiple output formats → Serialization doc
180
+ - Caching layer → Performance doc
181
+
182
+ ---
183
+
184
+ ### Mobile App
185
+
186
+ **Signals:** React Native, Flutter, SwiftUI, Jetpack Compose, Expo, Ionic, Capacitor
187
+
188
+ | Priority | Glob Pattern | What to Extract |
189
+ |----------|-------------|-----------------|
190
+ | 1 | `**/screens/**`, `**/pages/**`, `**/views/**` | Screen tree, navigation structure |
191
+ | 2 | `**/navigation/**`, `**/router*` | Navigation graph, deep linking |
192
+ | 3 | `**/store/**`, `**/state/**`, `**/providers/**` | State management, data flow |
193
+ | 4 | `**/api/**`, `**/services/**`, `**/network/**` | Backend communication, offline sync |
194
+ | 5 | `**/components/**` (skim) | Shared UI components |
195
+ | 6 | `**/native/**`, `**/platform/**`, `**/ios/**`, `**/android/**` | Platform-specific code, native modules |
196
+ | 7 | `**/assets/**` (list only) | Bundled resources |
197
+
198
+ **Feature signals:**
199
+ - Push notification setup → Notifications doc
200
+ - Camera/media access → Media Capture doc
201
+ - Offline storage (SQLite, Realm, AsyncStorage) → Data Persistence doc
202
+ - Deep linking / universal links → Navigation doc
203
+ - Platform-specific native modules → Platform Integration doc
204
+
205
+ ---
206
+
207
+ ### Data Pipeline / ML
208
+
209
+ **Signals:** Airflow, dbt, Prefect, Dagster, Luigi, Pandas, Spark, TensorFlow, PyTorch, scikit-learn, Jupyter notebooks
210
+
211
+ | Priority | Glob Pattern | What to Extract |
212
+ |----------|-------------|-----------------|
213
+ | 1 | `**/dags/**`, `**/pipelines/**`, `**/flows/**`, `**/workflows/**` | Pipeline definitions, DAGs, task graph |
214
+ | 2 | `**/models/**` (ML or dbt) | Model definitions, training logic or SQL transforms |
215
+ | 3 | `**/sources/**`, `**/extractors/**`, `**/connectors/**` | Data sources, ingestion logic |
216
+ | 4 | `**/transforms/**`, `**/processors/**` | Data transformation logic |
217
+ | 5 | `**/schemas/**`, `**/contracts/**` | Data contracts, validation |
218
+ | 6 | `**/notebooks/**`, `*.ipynb` | Exploratory analysis, experiments |
219
+ | 7 | `**/config/**`, `**/profiles*` | Connection strings, environment config |
220
+
221
+ **Feature signals:**
222
+ - Multiple DAGs/pipelines → one doc per pipeline
223
+ - ML model training → Model Training doc
224
+ - Feature engineering → Feature Store doc
225
+ - Data validation (Great Expectations, Pandera) → Data Quality doc
226
+ - Scheduled runs → Orchestration doc
227
+
228
+ ---
229
+
230
+ ### Monorepo
231
+
232
+ **Signals:** Turborepo, Nx, Lerna, Rush, Bazel, pnpm workspaces — has `packages/`, `apps/`, or `workspace` config
233
+
234
+ | Priority | Glob Pattern | What to Extract |
235
+ |----------|-------------|-----------------|
236
+ | 1 | Root config (`turbo.json`, `nx.json`, `lerna.json`, `pnpm-workspace.yaml`) | Workspace structure, build pipeline |
237
+ | 2 | `packages/*/package.json` or `apps/*/package.json` | All packages/apps and their dependencies |
238
+ | 3 | `**/shared/**`, `**/common/**`, `**/core/**` | Shared packages that others depend on |
239
+ | 4 | Each app/package entry point (skim) | Purpose of each workspace member |
240
+
241
+ **Then apply the matching sub-archetype playbook** to each significant package/app (e.g., Web API for the backend, Frontend SPA for the frontend, Library for shared packages).
242
+
243
+ **Feature signals:**
244
+ - Shared packages → Shared Infrastructure doc
245
+ - Build/deploy pipeline → Build System doc
246
+ - Inter-package dependencies → Architecture Overview doc (dependency graph)
247
+
248
+ ---
249
+
250
+ ### Microservices
251
+
252
+ **Signals:** Docker Compose, Kubernetes manifests, multiple services with separate entry points, API gateway, service mesh
253
+
254
+ | Priority | Glob Pattern | What to Extract |
255
+ |----------|-------------|-----------------|
256
+ | 1 | `docker-compose*`, `**/k8s/**`, `**/helm/**`, `**/terraform/**` | Service topology, infrastructure |
257
+ | 2 | API gateway config, `**/gateway/**` | Routing, load balancing, auth gateway |
258
+ | 3 | Each service's entry point and routes (skim) | Service responsibilities, API surface |
259
+ | 4 | `**/proto/**`, `**/graphql/**`, `**/schemas/**` | Inter-service contracts (gRPC, GraphQL) |
260
+ | 5 | `**/queues/**`, `**/events/**`, `**/messaging/**` | Async communication, event bus |
261
+ | 6 | `**/shared/**`, `**/common/**` | Shared libraries across services |
262
+
263
+ **Then apply the Web API playbook** to each significant service.
264
+
265
+ **Feature signals:**
266
+ - Service discovery → Service Mesh doc
267
+ - Event-driven communication → Event Architecture doc
268
+ - Shared vs per-service database → Data Architecture doc
269
+ - Health checks / circuit breakers → Resilience doc
270
+
271
+ ---
272
+
273
+ ### Infrastructure / IaC
274
+
275
+ **Signals:** Terraform, Pulumi, CloudFormation, Ansible, CDK, Serverless Framework
276
+
277
+ | Priority | Glob Pattern | What to Extract |
278
+ |----------|-------------|-----------------|
279
+ | 1 | `**/main.tf`, `**/stacks/**`, `**/lib/**` (CDK) | Resource definitions, stack structure |
280
+ | 2 | `**/variables*`, `**/inputs*`, `**/config*` | Parameterization, environment configs |
281
+ | 3 | `**/modules/**`, `**/constructs/**` | Reusable infrastructure modules |
282
+ | 4 | `**/environments/**`, `**/stages/**` | Environment-specific overrides |
283
+ | 5 | `**/outputs*`, `**/exports*` | Cross-stack references |
284
+ | 6 | CI/CD config (`.github/workflows/`, `Jenkinsfile`) | Deployment pipeline |
285
+
286
+ **Feature signals:**
287
+ - Networking (VPC, subnets, security groups) → Networking doc
288
+ - Compute (ECS, Lambda, EC2) → Compute Architecture doc
289
+ - Data stores (RDS, DynamoDB, S3) → Data Infrastructure doc
290
+ - CI/CD pipeline → Deployment Pipeline doc
291
+ - Monitoring (CloudWatch, Datadog) → Observability doc
292
+
293
+ ---
294
+
295
+ ## Fallback — Unknown Archetype
296
+
297
+ If the project doesn't clearly match any archetype:
298
+
299
+ 1. List the root directory and `src/` (or equivalent)
300
+ 2. Read the top 5 largest files by line count
301
+ 3. Read any files with "main", "app", "server", "index", or "core" in the name
302
+ 4. Check test files — they reveal what developers think is important
303
+ 5. Check CI/CD config (`.github/workflows/`, `Jenkinsfile`) — pipeline steps reveal build/deploy architecture
304
+
305
+ Then propose an archetype to the user: *"This looks like a [X] project. I'll explore it using the [X] playbook. Sound right?"*
306
+
307
+ ---
308
+
309
+ ## Existing Documentation
310
+
311
+ During fingerprinting, check if the project already has documentation:
312
+
313
+ - `vdocs/_manifest.json` — previous vdoc output
314
+ - `docs/`, `documentation/`, `product_documentation/` — existing docs folder
315
+ - `README.md` (if substantial, beyond basic setup)
316
+ - `*.md` files in the project root
317
+
318
+ **If existing docs are found:**
319
+
320
+ 1. **Read the existing docs first** — they are a head start, not waste
321
+ 2. **Cross-reference with the actual codebase** — verify claims in the docs against real code. Flag anything that's:
322
+ - **Stale** — docs describe behavior that no longer matches the code
323
+ - **Missing** — code has features not covered in docs
324
+ - **Accurate** — docs match the code (reuse this content, don't rewrite it)
325
+ 3. **In the exploration log**, add a section:
326
+
327
+ ```markdown
328
+ ## Existing Documentation
329
+ | Source | Status | Notes |
330
+ |--------|--------|-------|
331
+ | product_documentation/AUTH_DOC.md | Accurate | Matches current auth flow |
332
+ | product_documentation/API_DOC.md | Stale | 3 new endpoints not documented |
333
+ | (no existing doc) | Gap | RAG retrieval pipeline undocumented |
334
+ ```
335
+
336
+ 4. **In the Plan (Step 2)**, propose:
337
+ - **Update** for stale docs (specify what changed)
338
+ - **New** for gaps
339
+ - **Keep** for accurate docs (copy/adapt into vdocs/ format)
340
+
341
+ This avoids regenerating documentation that already exists and is correct.