@esthernandez/vibe-doc 0.2.2 → 0.3.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,441 @@
1
+ # Breadcrumb Heuristics
2
+
3
+ Reference for agents. Defines artifact patterns, gap questions, and extraction strategies for each of the 7 doc types.
4
+
5
+ **Used by:** Scan skill (during gap identification), Generate skill (synthesis questions).
6
+
7
+ ---
8
+
9
+ ## 1. Threat Model
10
+
11
+ **Purpose:** Identify attack surfaces, threats, and mitigations. Required for security reviews and regulated deployments.
12
+
13
+ ### Keywords (Search Artifacts For)
14
+
15
+ - auth, security, HTTPS, encryption, credentials, secrets, API key, token, permission, role, access control
16
+ - data sensitive, PII, PHI, financial, payment, database, encryption at rest, encryption in transit
17
+ - vulnerability, threat, attack, injection, XSS, CSRF, DDoS, Man-in-the-Middle, privilege escalation
18
+ - compliance, HIPAA, PCI-DSS, SOC 2, GDPR, audit, logging, breach, incident
19
+
20
+ ### File Patterns (Search Project For)
21
+
22
+ - `security/`, `threat*`, `risk*`, `architecture/security*`
23
+ - `.env`, `.env.example`, `.env.production` (credential patterns)
24
+ - `src/auth*`, `src/*auth*`, `services/*security*`
25
+ - `CLAUDE.md`, `.cursorrules` (often discuss security decisions)
26
+ - `docs/*security*`, `docs/*threat*`, `docs/*risk*`
27
+
28
+ ### Git Patterns
29
+
30
+ - Commits mentioning "security", "HIPAA", "auth", "credentials", "vulnerability", "patch"
31
+ - Commits from security team or external auditors
32
+ - PRs titled with "security", "CVE", "fix vulnerability"
33
+
34
+ ### Code Patterns
35
+
36
+ ```
37
+ - Firebase auth configuration (custom claims, JWT validation)
38
+ - Role-based access control (RBAC) middleware
39
+ - Database encryption (Mongoose schema with encrypt flag)
40
+ - API authentication (Bearer tokens, API keys)
41
+ - Input validation and sanitization patterns
42
+ - Dependencies flagged by `npm audit`
43
+ ```
44
+
45
+ ### Required Sections (In Generated Doc)
46
+
47
+ 1. **Executive Summary** — key threats, overall risk level
48
+ 2. **Attack Surface Inventory** — entry points, users, data flows
49
+ 3. **Threat Scenarios** — specific attack trees (access control breach, data exposure, injection, DoS)
50
+ 4. **Mitigations** — controls for each threat
51
+ 5. **Compliance Mapping** — regulations applicable to threats
52
+ 6. **Residual Risk** — threats mitigated vs. accepted
53
+
54
+ ### Gap Questions (For Synthesis)
55
+
56
+ When generating a Threat Model, ask:
57
+
58
+ 1. **"Beyond authentication and data encryption, what other sensitive operations exist?"** (payments, admin functions, external integrations?)
59
+ 2. **"Are there known external dependencies or services your app relies on?"** (Firebase, Stripe, third-party APIs, cloud providers?)
60
+ 3. **"Have you ever had a security incident, breach attempt, or audit finding?"** (helps identify real-world threats vs. theoretical)
61
+ 4. **"What's your most sensitive data?"** (customer PII, payment info, health records, IP, competitive data?)
62
+
63
+ ---
64
+
65
+ ## 2. Architecture Decision Records (ADRs)
66
+
67
+ **Purpose:** Capture the why behind major tech choices and design decisions. Helps future maintainers understand tradeoffs.
68
+
69
+ ### Keywords (Search Artifacts For)
70
+
71
+ - chose, decision, trade-off, tradeoff, why, because, instead of, considered, vs., rejected
72
+ - architecture, design, pattern, framework, library, language, database, infrastructure
73
+ - considered, alternative, option, proposal, RFC, design doc
74
+
75
+ ### File Patterns (Search Project For)
76
+
77
+ - `ADR/`, `docs/adr/`, `architecture/`, `.ai/ARCHITECTURE.md`
78
+ - `CLAUDE.md` (planning and decision discussions)
79
+ - `.cursorrules`, `.agent/skills/` (design philosophy)
80
+ - `docs/architecture*`, `docs/design*`
81
+
82
+ ### Git Patterns
83
+
84
+ - Commits that introduce major changes ("feat: migrate to microservices", "refactor: switch to GraphQL")
85
+ - Commit messages with reasoning ("Use PostgreSQL instead of MongoDB for consistency")
86
+ - Large diffs with explanatory messages
87
+ - Merges of significant feature branches
88
+
89
+ ### Code Patterns
90
+
91
+ ```
92
+ - Technology presence in package.json or equivalent (React, Node, TypeScript, Flask, etc.)
93
+ - Architectural code organization (flat vs. feature-sliced, service-oriented vs. monolith)
94
+ - Pattern implementations (MVC, CQRS, event-sourcing, etc.)
95
+ - Framework configuration (Next.js vs. plain React, Express vs. Fastify)
96
+ - Build/deploy patterns (Docker, serverless, Kubernetes, etc.)
97
+ ```
98
+
99
+ ### Required Sections (In Generated Doc)
100
+
101
+ 1. **Decision Statement** — what was decided, when
102
+ 2. **Context** — problem being solved, constraints
103
+ 3. **Options Considered** — alternatives evaluated
104
+ 4. **Decision** — which option was chosen
105
+ 5. **Rationale** — why this option vs. others
106
+ 6. **Consequences** — positive and negative impacts
107
+ 7. **Status** — accepted, superseded, deprecated, etc.
108
+
109
+ ### Gap Questions (For Synthesis)
110
+
111
+ When generating ADRs, ask:
112
+
113
+ 1. **"What major architectural decisions have you made?"** (tech stack, monolith vs. microservices, database choice, auth approach?)
114
+ 2. **"Were there competing options you considered?"** (e.g., "We could have used microservices but chose monolith because...")
115
+ 3. **"Have any major decisions been revisited or changed?"** (migrations, framework upgrades, pattern shifts?)
116
+
117
+ ---
118
+
119
+ ## 3. Runbook
120
+
121
+ **Purpose:** Step-by-step operational procedures. Helps on-call engineers deploy, debug, and recover from incidents.
122
+
123
+ ### Keywords (Search Artifacts For)
124
+
125
+ - deploy, deployment, rollback, emergency, incident, alarm, alert, monitoring, health check, SLA, uptime
126
+ - steps, procedure, checklist, guide, how to, troubleshoot, debug, restart, recover, failover
127
+ - environment, staging, production, configuration, environment variable, secret, credentials
128
+
129
+ ### File Patterns (Search Project For)
130
+
131
+ - `.github/workflows/`, `.gitlab-ci.yml`, CircleCI config (CI/CD procedures)
132
+ - `Dockerfile`, `kubernetes/`, `terraform/`, `docker-compose.yml` (infrastructure)
133
+ - `monitoring/`, `alerts/`, `dashboards/` (observability setup)
134
+ - `docs/deploy*`, `docs/runbook*`, `docs/operations*`
135
+ - `.env.example`, `config/` (configuration patterns)
136
+
137
+ ### Git Patterns
138
+
139
+ - Commits deploying to production ("deploy: v1.2.3 to production")
140
+ - Hotfix branches and emergency merges
141
+ - Changes to CI/CD configs or infrastructure code
142
+ - Commits reverting previous changes (hints at rollback scenarios)
143
+
144
+ ### Code Patterns
145
+
146
+ ```
147
+ - Entry point files (bin/cli.js, main.py, src/index.ts)
148
+ - Server startup code (port binding, connection pools, health checks)
149
+ - Environment variable usage (dotenv, process.env, ConfigMap)
150
+ - Error handling and graceful shutdown
151
+ - Database connection and migration patterns
152
+ - Logging setup (Winston, Pino, structured logging)
153
+ - Health check endpoints (/health, /status, /metrics)
154
+ ```
155
+
156
+ ### Required Sections (In Generated Doc)
157
+
158
+ 1. **Pre-Deployment Checklist** — what to verify before deploying
159
+ 2. **Deployment Steps** — exact commands or UI steps
160
+ 3. **Monitoring & Verification** — how to verify successful deployment
161
+ 4. **Rollback Procedure** — how to revert if something breaks
162
+ 5. **Common Issues & Troubleshooting** — incident scenarios and fixes
163
+ 6. **On-Call Escalation** — who to contact, when
164
+ 7. **SLAs & Targets** — uptime targets, acceptable downtime
165
+
166
+ ### Gap Questions (For Synthesis)
167
+
168
+ When generating a Runbook, ask:
169
+
170
+ 1. **"What's your typical deployment frequency?"** (daily, weekly, on-demand? How long does a deploy take?)
171
+ 2. **"How do you monitor health after deploying?"** (health checks, monitoring dashboards, alerts? What indicates a problem?)
172
+ 3. **"What's your rollback procedure?"** (revert code, database migrations, zero-downtime strategies?)
173
+ 4. **"Have you had production incidents?"** (helps identify real troubleshooting scenarios vs. theoretical)
174
+
175
+ ---
176
+
177
+ ## 4. API Specification
178
+
179
+ **Purpose:** Document interface contracts for REST/GraphQL/gRPC services. Helps clients understand endpoints and integrate correctly.
180
+
181
+ ### Keywords (Search Artifacts For)
182
+
183
+ - endpoint, route, path, GET, POST, PUT, DELETE, PATCH, method, request, response, parameter, query, body
184
+ - status code, error, 200, 404, 500, validation, authentication, authorization
185
+ - schema, type, interface, contract, OpenAPI, Swagger, GraphQL, schema.graphql
186
+
187
+ ### File Patterns (Search Project For)
188
+
189
+ - `src/routes*`, `src/api*`, `controllers/`, `handlers/` (endpoint definitions)
190
+ - `openapi.yml`, `swagger.json`, `schema.graphql`, `.graphqlconfig` (existing API docs)
191
+ - `src/types*`, `src/models*`, `src/schema*` (data schemas)
192
+ - `docs/api*`, `docs/endpoints*`
193
+ - `package.json` → look for swagger, openapi, apollo, graphql packages
194
+
195
+ ### Git Patterns
196
+
197
+ - Commits adding or changing endpoints ("feat: add /users endpoint", "breaking: rename /profile to /me")
198
+ - Changes to API version or contract
199
+ - Commits discussing API design decisions
200
+
201
+ ### Code Patterns
202
+
203
+ ```
204
+ - Express/Fastify route definitions (app.get('/users', ...))
205
+ - GraphQL resolvers and type definitions
206
+ - Request validation (joi, zod, class-validator)
207
+ - Error handling and response formatting
208
+ - Authentication middleware (JWT, API key)
209
+ - Rate limiting and pagination logic
210
+ - Request/response transformation (serializers)
211
+ ```
212
+
213
+ ### Required Sections (In Generated Doc)
214
+
215
+ 1. **Authentication** — how to authenticate requests
216
+ 2. **Base URL & Versioning** — endpoint location and version strategy
217
+ 3. **Endpoints** — for each endpoint:
218
+ - HTTP method and path
219
+ - Description
220
+ - Request parameters (query, body, headers)
221
+ - Response structure
222
+ - Possible status codes and errors
223
+ 4. **Error Handling** — standard error response format
224
+ 5. **Rate Limiting** — request limits and throttling
225
+ 6. **Pagination** — cursor or offset-based pagination
226
+
227
+ ### Gap Questions (For Synthesis)
228
+
229
+ When generating an API Spec, ask:
230
+
231
+ 1. **"How do clients authenticate?"** (API keys, OAuth, JWT, mutual TLS?)
232
+ 2. **"Do you have rate limiting or quotas?"** (requests per minute, per user, etc?)
233
+ 3. **"How do you handle errors?"** (specific error codes, error messages, retry behavior?)
234
+ 4. **"Is there pagination for list endpoints?"** (cursor-based, offset, or limit/offset?)
235
+
236
+ ---
237
+
238
+ ## 5. Deployment Procedure
239
+
240
+ **Purpose:** Document the build, test, and deploy pipeline. Helps teams understand CI/CD and control deployment gates.
241
+
242
+ ### Keywords (Search Artifacts For)
243
+
244
+ - build, test, deploy, push, merge, release, version, tag, branch, pipeline, stage, step, approval, gate
245
+ - testing, unit test, integration test, E2E test, coverage
246
+ - environment, staging, production, approval, rollout, canary, blue-green
247
+
248
+ ### File Patterns (Search Project For)
249
+
250
+ - `.github/workflows/`, `.gitlab-ci.yml`, `circle.yml`, `Jenkinsfile` (CI/CD configs)
251
+ - `Dockerfile`, `.dockerignore` (build)
252
+ - `package.json` scripts, `Makefile`, `scripts/` (build commands)
253
+ - `.github/` → `CODEOWNERS`, `pull_request_template.md` (approval gates)
254
+ - `docs/deploy*`, `docs/ci*`, `docs/pipeline*`
255
+
256
+ ### Git Patterns
257
+
258
+ - Branch naming conventions (main, develop, release/*, feature/*, hotfix/*)
259
+ - Release tags (v1.0.0, v2.1.3)
260
+ - Protected branch rules (require reviews, passing checks)
261
+ - Release commits or merge patterns
262
+
263
+ ### Code Patterns
264
+
265
+ ```
266
+ - Build outputs (dist/, build/, .next/)
267
+ - Test configuration (jest.config.js, vitest.config.ts, pytest.ini)
268
+ - Environment variables for different stages (development, staging, production)
269
+ - Health checks in startup code
270
+ - Feature flags or configuration for deployment stages
271
+ - Database migration scripts
272
+ ```
273
+
274
+ ### Required Sections (In Generated Doc)
275
+
276
+ 1. **Pipeline Overview** — stages from commit to production
277
+ 2. **Build Stage** — compile, bundle, create artifacts
278
+ 3. **Test Stage** — unit, integration, E2E tests; coverage requirements
279
+ 4. **Approval Gates** — who approves, what checks must pass
280
+ 5. **Deployment Stage** — push to staging, then production; strategy (rolling, blue-green, canary)
281
+ 6. **Verification** — health checks, smoke tests post-deploy
282
+ 7. **Rollback** — how to revert if deployment fails
283
+
284
+ ### Gap Questions (For Synthesis)
285
+
286
+ When generating a Deployment Procedure, ask:
287
+
288
+ 1. **"What stages does your pipeline have?"** (build → test → staging → production? Other stages?)
289
+ 2. **"Are there approval gates?"** (who approves deployments, what checks must pass?)
290
+ 3. **"What's your deployment strategy?"** (rolling updates, blue-green, canary, big bang?)
291
+ 4. **"How long does the full pipeline take?"** (helps set expectations for CI/CD performance)
292
+
293
+ ---
294
+
295
+ ## 6. Test Plan
296
+
297
+ **Purpose:** Document testing strategy, coverage targets, and test scenarios. Helps teams understand QA approach and regression risk.
298
+
299
+ ### Keywords (Search Artifacts For)
300
+
301
+ - test, unit test, integration test, E2E, end-to-end, testing, QA, quality assurance
302
+ - coverage, percent, target, benchmark, suite
303
+ - scenario, case, browser, device, performance, load, stress
304
+
305
+ ### File Patterns (Search Project For)
306
+
307
+ - `__tests__/`, `tests/`, `test/`, `spec/` (test files)
308
+ - `jest.config.js`, `vitest.config.ts`, `cypress.config.ts`, `playwright.config.ts` (test configs)
309
+ - `coverage/`, `.nyc_output/` (coverage reports)
310
+ - `.github/workflows/*test*` (CI test stages)
311
+ - `docs/testing*`, `docs/qa*`, `docs/test-plan*`
312
+
313
+ ### Git Patterns
314
+
315
+ - Commits with test files (*.test.js, *.spec.ts)
316
+ - PR requirements for coverage or test additions
317
+ - Test-related commits ("test: add scenarios for login flow")
318
+
319
+ ### Code Patterns
320
+
321
+ ```
322
+ - Test helper utilities (fixtures, factories, mocks)
323
+ - Test data generators or seed files
324
+ - Cypress/Playwright page object models (E2E structure)
325
+ - Mock service workers or API mocking
326
+ - Coverage configuration (include/exclude patterns)
327
+ - Test database setup (SQLite for tests, not production DB)
328
+ ```
329
+
330
+ ### Required Sections (In Generated Doc)
331
+
332
+ 1. **Testing Strategy** — approach to testing (unit, integration, E2E split)
333
+ 2. **Coverage Targets** — lines, branches, functions (e.g., 80% coverage required)
334
+ 3. **Unit Tests** — what's tested at the unit level
335
+ 4. **Integration Tests** — service-to-service, database interactions
336
+ 5. **E2E Tests** — critical user journeys (signup, login, purchase, etc.)
337
+ 6. **Performance Tests** — load testing, benchmarks (if applicable)
338
+ 7. **Test Data** — how test environments are seeded
339
+ 8. **Manual Testing** — scenarios that require manual QA
340
+
341
+ ### Gap Questions (For Synthesis)
342
+
343
+ When generating a Test Plan, ask:
344
+
345
+ 1. **"What's your coverage target?"** (unit, integration, E2E split? e.g., 80% overall?)
346
+ 2. **"What are the critical user journeys?"** (signup, login, core workflow, payment, etc?)
347
+ 3. **"Do you test on multiple browsers or devices?"** (cross-browser testing, mobile, etc?)
348
+ 4. **"Do you have performance or load testing?"** (target response times, concurrent users?)
349
+
350
+ ---
351
+
352
+ ## 7. Data Model Documentation
353
+
354
+ **Purpose:** Document database schemas, entities, relationships, and data pipelines. Helps teams understand data structure and dependencies.
355
+
356
+ ### Keywords (Search Artifacts For)
357
+
358
+ - schema, table, entity, relationship, primary key, foreign key, index, migration, database
359
+ - model, ORM, Mongoose, Sequelize, TypeORM, SQLAlchemy, Prisma
360
+ - data type, nullable, unique, constraint, default, validation
361
+
362
+ ### File Patterns (Search Project For)
363
+
364
+ - `db/migrations/`, `migrations/` (schema evolution)
365
+ - `src/models/`, `src/entities/`, `src/db/schema*` (data schemas)
366
+ - `schema.sql`, `init.sql`, database definition files
367
+ - `docs/data*`, `docs/schema*`, `docs/database*`
368
+ - `package.json` → ORM packages (prisma, mongoose, sequelize, typeorm, sqlalchemy)
369
+
370
+ ### Git Patterns
371
+
372
+ - Commits adding migrations ("feat: add users table", "refactor: rename column")
373
+ - Schema change PRs
374
+ - Data-related commits (seeding, backfill, cleanup)
375
+
376
+ ### Code Patterns
377
+
378
+ ```
379
+ - ORM model definitions (Mongoose schemas, Prisma models, SQLAlchemy models)
380
+ - Database indexes and constraints
381
+ - Relationship definitions (1-to-many, many-to-many)
382
+ - Validation rules (required, unique, constraints)
383
+ - Migration files with up/down logic
384
+ - Seed files for test data
385
+ - Query patterns and optimization notes
386
+ ```
387
+
388
+ ### Required Sections (In Generated Doc)
389
+
390
+ 1. **Entity-Relationship Diagram** — tables/collections and relationships
391
+ 2. **Entity Definitions** — for each table/collection:
392
+ - Purpose
393
+ - Fields (name, type, nullable, constraints, default)
394
+ - Indexes
395
+ - Relationships to other entities
396
+ 3. **Data Lifecycle** — creation, updates, deletion, retention
397
+ 4. **Scaling & Performance** — indexes for common queries, sharding strategy (if applicable)
398
+ 5. **Backup & Recovery** — backup frequency, restoration procedures
399
+ 6. **Data Quality** — validation rules, constraints
400
+
401
+ ### Gap Questions (For Synthesis)
402
+
403
+ When generating Data Model Documentation, ask:
404
+
405
+ 1. **"What's the main data domain?"** (users, products, transactions, events, etc?)
406
+ 2. **"Are there special data handling requirements?"** (PII, encryption, retention, regional residency?)
407
+ 3. **"What are the most important queries?"** (by user, by date, search, reporting?)
408
+ 4. **"Do you need to scale?"** (projection of data growth, sharding strategy?)
409
+
410
+ ---
411
+
412
+ ## Heuristic Application
413
+
414
+ **During Scan skill:**
415
+ For each detected document type, use keywords/patterns to search artifacts. If found, mark as "exists". If not found but artifact signals suggest the doc is needed, mark as "missing" in gap report.
416
+
417
+ **During Generate skill:**
418
+ For each selected gap, use the "Gap Questions" to ask for synthesis information. Save answers and pass to CLI generation command. Present the generated doc showing confidence per section based on extraction quality.
419
+
420
+ ---
421
+
422
+ ## Confidence Scoring
423
+
424
+ **High confidence (>85%):**
425
+ - Extracted directly from explicit sources (commit messages, code comments, .ai/ARCHITECTURE.md)
426
+ - Supported by multiple artifact signals
427
+ - User confirmed in synthesis questions
428
+
429
+ **Medium confidence (60-85%):**
430
+ - Inferred from code patterns or structure
431
+ - Supported by single artifact source
432
+ - Some user clarification provided
433
+
434
+ **Low confidence (<60%):**
435
+ - Pattern-matched but not confirmed
436
+ - Theoretical or best-practice suggestion
437
+ - No direct artifact source found
438
+
439
+ ---
440
+
441
+ **Last updated:** 2026-04-11 | **Reference version:** 1.0