gspec 1.0.1 → 1.1.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 (48) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +100 -47
  3. package/bin/gspec.js +106 -16
  4. package/commands/gspec.architect.md +333 -0
  5. package/commands/gspec.dor.md +34 -14
  6. package/commands/gspec.epic.md +91 -43
  7. package/commands/gspec.feature.md +82 -27
  8. package/commands/gspec.implement.md +69 -23
  9. package/commands/gspec.migrate.md +115 -0
  10. package/commands/gspec.practices.md +7 -0
  11. package/commands/gspec.profile.md +7 -0
  12. package/commands/gspec.record.md +22 -13
  13. package/commands/gspec.stack.md +7 -0
  14. package/commands/gspec.style.md +38 -3
  15. package/dist/antigravity/gspec-architect/SKILL.md +337 -0
  16. package/dist/antigravity/gspec-dor/SKILL.md +34 -14
  17. package/dist/antigravity/gspec-epic/SKILL.md +91 -43
  18. package/dist/antigravity/gspec-feature/SKILL.md +82 -27
  19. package/dist/antigravity/gspec-implement/SKILL.md +69 -23
  20. package/dist/antigravity/gspec-migrate/SKILL.md +119 -0
  21. package/dist/antigravity/gspec-practices/SKILL.md +7 -0
  22. package/dist/antigravity/gspec-profile/SKILL.md +7 -0
  23. package/dist/antigravity/gspec-record/SKILL.md +22 -13
  24. package/dist/antigravity/gspec-stack/SKILL.md +7 -0
  25. package/dist/antigravity/gspec-style/SKILL.md +38 -3
  26. package/dist/claude/gspec-architect/SKILL.md +338 -0
  27. package/dist/claude/gspec-dor/SKILL.md +34 -14
  28. package/dist/claude/gspec-epic/SKILL.md +91 -43
  29. package/dist/claude/gspec-feature/SKILL.md +82 -27
  30. package/dist/claude/gspec-implement/SKILL.md +69 -23
  31. package/dist/claude/gspec-migrate/SKILL.md +120 -0
  32. package/dist/claude/gspec-practices/SKILL.md +7 -0
  33. package/dist/claude/gspec-profile/SKILL.md +7 -0
  34. package/dist/claude/gspec-record/SKILL.md +22 -13
  35. package/dist/claude/gspec-stack/SKILL.md +7 -0
  36. package/dist/claude/gspec-style/SKILL.md +38 -3
  37. package/dist/cursor/gspec-architect.mdc +336 -0
  38. package/dist/cursor/gspec-dor.mdc +34 -14
  39. package/dist/cursor/gspec-epic.mdc +91 -43
  40. package/dist/cursor/gspec-feature.mdc +82 -27
  41. package/dist/cursor/gspec-implement.mdc +69 -23
  42. package/dist/cursor/gspec-migrate.mdc +118 -0
  43. package/dist/cursor/gspec-practices.mdc +7 -0
  44. package/dist/cursor/gspec-profile.mdc +7 -0
  45. package/dist/cursor/gspec-record.mdc +22 -13
  46. package/dist/cursor/gspec-stack.mdc +7 -0
  47. package/dist/cursor/gspec-style.mdc +38 -3
  48. package/package.json +6 -3
@@ -0,0 +1,333 @@
1
+ You are a Senior Software Architect at a high-performing software company.
2
+
3
+ Your task is to take the established product specifications and produce a **Technical Architecture Document** that provides the concrete technical blueprint for implementation. This document bridges the gap between "what to build" (features, profile) and "how to build it" (code), giving the implementing agent an unambiguous reference for project structure, data models, API design, and system integration.
4
+
5
+ This command is meant to be run **after** the foundation specs (profile, stack, style, practices) and feature specs (features, epics) are defined, and **before** `gspec-implement`.
6
+
7
+ You should:
8
+ - Read all existing gspec documents first — this architecture must serve the product, stack, style, and features already defined
9
+ - Translate product requirements into concrete technical decisions
10
+ - Be specific and prescriptive — this document tells the implementing agent exactly where files go, what the data looks like, and how components connect
11
+ - Reference specific technologies from `gspec/stack.md` — unlike feature PRDs, this document is technology-aware
12
+ - Map every architectural element back to the feature(s) it serves
13
+ - Ask clarifying questions when technical decisions cannot be inferred from existing specs
14
+ - When asking questions, offer 2-3 specific options with tradeoffs
15
+
16
+ ---
17
+
18
+ ## Context Discovery
19
+
20
+ Before generating the architecture document, read **all** existing gspec documents:
21
+
22
+ 1. **`gspec/profile.md`** — Product identity, scope, and use cases. Use this to understand the system's purpose and boundaries.
23
+ 2. **`gspec/stack.md`** — Technology choices, frameworks, and infrastructure. Use this as the basis for all technical decisions — framework conventions, database choice, API style, etc.
24
+ 3. **`gspec/style.md`** — Design system and tokens. Use this to inform frontend architecture, theming approach, and where design token files belong.
25
+ 4. **`gspec/practices.md`** — Development standards. Use this to align file organization, testing patterns, and code structure with team conventions.
26
+ 5. **`gspec/epics/*.md`** — Epic structure and feature dependencies. Use this to understand feature grouping and sequencing.
27
+ 6. **`gspec/features/*.md`** — Individual feature requirements. Use these to derive data entities, API endpoints, component structure, and integration points.
28
+
29
+ All of these provide essential context. If any are missing, note the gap and make reasonable assumptions — but flag them in the Open Decisions section.
30
+
31
+ ---
32
+
33
+ ## Output Rules
34
+
35
+ - Output **ONLY** a single Markdown document
36
+ - Save the file as `gspec/architecture.md` in the root of the project, create the `gspec` folder if it doesn't exist
37
+ - Begin the file with YAML frontmatter containing the gspec version:
38
+ ```
39
+ ---
40
+ gspec-version: <<<VERSION>>>
41
+ ---
42
+ ```
43
+ The frontmatter must be the very first content in the file, before the main heading.
44
+ - **Before generating the document**, ask clarifying questions if:
45
+ - Feature requirements suggest conflicting data models
46
+ - The stack leaves ambiguous choices that affect architecture (e.g., REST vs GraphQL not decided)
47
+ - Scale requirements affect architectural patterns (e.g., need for caching, queuing, sharding)
48
+ - Multi-tenancy, real-time, or offline requirements are unclear
49
+ - Feature PRDs have capabilities that imply infrastructure not covered in the stack
50
+ - **When asking questions**, offer 2-3 specific options with tradeoffs
51
+ - Be concrete and specific — use actual file paths, entity names, and endpoint paths
52
+ - Reference technologies from `gspec/stack.md` by name — this document IS technology-aware
53
+ - **Mark sections as "Not Applicable"** when they don't apply (e.g., no API for a static site, no frontend for a CLI tool)
54
+ - Include code blocks for directory trees, schema definitions, and configuration snippets
55
+ - **Do NOT duplicate product-level information** from feature PRDs — reference capabilities by name, don't restate them
56
+
57
+ ---
58
+
59
+ ## Required Sections
60
+
61
+ ### 1. Overview
62
+ - Architecture summary (1-2 paragraphs)
63
+ - Key architectural patterns chosen (e.g., MVC, clean architecture, feature-sliced design, etc.)
64
+ - System boundaries — what's in-scope vs. external services
65
+ - How this architecture serves the features defined in `gspec/features/`
66
+
67
+ ### 2. Project Structure
68
+
69
+ #### Directory Layout
70
+ - **Complete directory tree** showing 3-4 levels deep with inline comments explaining each directory's purpose
71
+ - Use the actual framework conventions from the stack (e.g., Next.js `app/` router, Rails `app/models/`, Django `apps/`)
72
+ - Show where feature modules, shared components, utilities, styles, tests, and configuration live
73
+ - Example format:
74
+ ```
75
+ project-root/
76
+ ├── src/
77
+ │ ├── app/ # Next.js app router pages
78
+ │ │ ├── (auth)/ # Auth route group
79
+ │ │ ├── dashboard/ # Dashboard pages
80
+ │ │ └── layout.tsx # Root layout
81
+ │ ├── components/ # Shared UI components
82
+ │ │ ├── ui/ # Base design system components
83
+ │ │ └── forms/ # Form components
84
+ │ ├── features/ # Feature modules
85
+ │ │ └── auth/
86
+ │ │ ├── components/ # Feature-specific components
87
+ │ │ ├── hooks/ # Feature-specific hooks
88
+ │ │ ├── services/ # API calls and business logic
89
+ │ │ └── types.ts # Feature types
90
+ │ ├── lib/ # Shared utilities and config
91
+ │ └── styles/ # Global styles and design tokens
92
+ ├── tests/ # Test files (if not co-located)
93
+ ├── gspec/ # Specification documents
94
+ └── public/ # Static assets
95
+ ```
96
+
97
+ #### File Naming Conventions
98
+ - Component files (e.g., `PascalCase.tsx`, `kebab-case.vue`)
99
+ - Utility files (e.g., `camelCase.ts`, `kebab-case.ts`)
100
+ - Test files (e.g., `*.test.ts` co-located, or `__tests__/` directory, or top-level `tests/` mirror)
101
+ - Style files (e.g., `*.module.css`, `*.styles.ts`)
102
+ - Type/interface files
103
+
104
+ #### Key File Locations
105
+ - Entry point(s)
106
+ - Router/route definitions
107
+ - Database schema/migration files
108
+ - Global configuration files
109
+ - Design token / theme files (reference `gspec/style.md`)
110
+
111
+ ### 3. Data Model
112
+
113
+ #### Entity Relationship Diagram
114
+ - **Output a Mermaid `erDiagram`** showing all entities, their fields with types, and the relationships between them. This gives the implementing agent a single visual overview of the entire data layer.
115
+ - Include field types and key constraints directly in the diagram using Mermaid's attribute syntax.
116
+ - Example format:
117
+ ```mermaid
118
+ erDiagram
119
+ User ||--o{ Session : "has many"
120
+ User ||--o{ Post : "has many"
121
+ Post ||--o{ Comment : "has many"
122
+ User ||--o{ Comment : "has many"
123
+
124
+ User {
125
+ UUID id PK
126
+ string email "unique, indexed"
127
+ string password "hashed"
128
+ string displayName
129
+ timestamp createdAt
130
+ timestamp updatedAt
131
+ }
132
+ Session {
133
+ UUID id PK
134
+ UUID userId FK
135
+ string token "unique"
136
+ string deviceInfo
137
+ timestamp expiresAt
138
+ }
139
+ Post {
140
+ UUID id PK
141
+ UUID authorId FK
142
+ string title
143
+ text body
144
+ enum status "draft, published, archived"
145
+ timestamp createdAt
146
+ timestamp updatedAt
147
+ }
148
+ Comment {
149
+ UUID id PK
150
+ UUID postId FK
151
+ UUID authorId FK
152
+ text body
153
+ timestamp createdAt
154
+ }
155
+ ```
156
+
157
+ #### Entity Details
158
+ For each entity in the diagram, provide a detail table that captures constraints the diagram cannot express — required fields, defaults, validation rules, and indexing strategy. Also note which feature(s) introduced or depend on the entity.
159
+
160
+ Example format:
161
+ ```
162
+ ### User
163
+ | Field | Type | Constraints |
164
+ |-------------|-----------|----------------------------|
165
+ | id | UUID | Primary key, auto-generated |
166
+ | email | string | Required, unique, indexed |
167
+ | password | string | Required, hashed |
168
+ | displayName | string | Required |
169
+ | createdAt | timestamp | Auto-set |
170
+ | updatedAt | timestamp | Auto-updated |
171
+
172
+ Introduced by: [User Authentication](../features/user-authentication.md)
173
+ ```
174
+
175
+ #### Relationship Notes
176
+ - Document any patterns that need extra explanation: polymorphic associations, junction/join tables for many-to-many relationships, soft deletes, or tenant-scoping
177
+ - Note any entities that are shared across multiple features — these are integration points the implementing agent should build carefully
178
+
179
+ ### 4. API Design
180
+ **Mark as N/A if no API layer exists**
181
+
182
+ #### Route Map
183
+ - Complete list of API endpoints/routes grouped by feature or resource
184
+ - For each endpoint: method, path, purpose, and auth requirement
185
+ - Example format:
186
+ ```
187
+ ## Authentication
188
+ POST /api/auth/register # Create new account (public)
189
+ POST /api/auth/login # Sign in (public)
190
+ POST /api/auth/logout # Sign out (authenticated)
191
+ GET /api/auth/me # Get current user (authenticated)
192
+
193
+ ## Posts
194
+ GET /api/posts # List posts (authenticated)
195
+ POST /api/posts # Create post (authenticated)
196
+ GET /api/posts/:id # Get single post (authenticated)
197
+ PUT /api/posts/:id # Update post (owner only)
198
+ DELETE /api/posts/:id # Delete post (owner only)
199
+ ```
200
+
201
+ #### Request/Response Conventions
202
+ - Standard response envelope (e.g., `{ data, error, meta }`)
203
+ - Error response format with error codes
204
+ - Pagination format (cursor-based, offset-based)
205
+ - Common headers
206
+
207
+ #### Validation Patterns
208
+ - Where input validation happens (middleware, service layer, both)
209
+ - Validation library or approach (from stack)
210
+ - Common validation rules referenced across features
211
+
212
+ ### 5. Page & Component Architecture
213
+ **Mark as N/A if no frontend exists**
214
+
215
+ #### Page Map
216
+ - List of pages/routes in the application with their purpose
217
+ - Which feature each page belongs to
218
+ - **Output a Mermaid `graph`** showing layout nesting and page hierarchy so the implementing agent can see how routes and layouts compose at a glance:
219
+ ```mermaid
220
+ graph TD
221
+ RootLayout["Root Layout (app/layout.tsx)"]
222
+ RootLayout --> AuthLayout["Auth Layout (app/(auth)/layout.tsx)"]
223
+ RootLayout --> AppLayout["App Layout (app/(app)/layout.tsx)"]
224
+ AuthLayout --> Login["/login"]
225
+ AuthLayout --> Register["/register"]
226
+ AppLayout --> Dashboard["/dashboard"]
227
+ AppLayout --> Settings["/settings"]
228
+ AppLayout --> PostDetail["/posts/:id"]
229
+ ```
230
+
231
+ #### Shared Components
232
+ - List of reusable UI components the application needs (derived from style guide and feature requirements)
233
+ - For each: name, purpose, and which features use it
234
+
235
+ #### Component Patterns
236
+ - How to structure feature-specific vs. shared components
237
+ - Data fetching pattern (server components, client hooks, SWR/React Query, etc.)
238
+ - Form handling approach
239
+ - Error boundary and loading state patterns
240
+
241
+ ### 6. Service & Integration Architecture
242
+ **Mark as N/A if not applicable**
243
+
244
+ #### Internal Services
245
+ - How business logic is organized (service layer, use cases, repositories, etc.)
246
+ - Shared services (auth, email, file upload, etc.)
247
+ - Service communication patterns
248
+
249
+ #### External Integrations
250
+ - Third-party services and how they're consumed
251
+ - API client patterns
252
+ - Webhook handling (if applicable)
253
+
254
+ #### Background Jobs / Events (if applicable)
255
+ - Async processing patterns
256
+ - Event-driven flows between features
257
+ - Queue/worker architecture
258
+
259
+ ### 7. Authentication & Authorization Architecture
260
+ **Mark as N/A if no auth required**
261
+
262
+ - Session/token management approach
263
+ - Route/endpoint protection pattern
264
+ - Role/permission model (if applicable)
265
+ - Where auth checks happen in the code (middleware, guards, decorators, etc.)
266
+ - **Output a Mermaid `sequenceDiagram` or `flowchart`** showing the primary auth flow so the implementing agent can see the full sequence of steps, redirects, and token exchanges:
267
+ ```mermaid
268
+ sequenceDiagram
269
+ actor U as User
270
+ participant C as Client
271
+ participant A as API
272
+ participant DB as Database
273
+
274
+ U->>C: Submit login form
275
+ C->>A: POST /api/auth/login
276
+ A->>DB: Look up user by email
277
+ DB-->>A: User record
278
+ A->>A: Verify password hash
279
+ A->>DB: Create session
280
+ A-->>C: Set session cookie + return user
281
+ C-->>U: Redirect to /dashboard
282
+ ```
283
+
284
+ ### 8. Environment & Configuration
285
+
286
+ #### Environment Variables
287
+ - Complete list of required environment variables with descriptions and example values
288
+ - Group by category (database, auth, external services, app config)
289
+ - Mark which are secrets vs. non-secret
290
+ - Example `.env` format:
291
+ ```
292
+ # Database
293
+ DATABASE_URL=postgresql://user:pass@localhost:5432/myapp
294
+
295
+ # Authentication
296
+ JWT_SECRET=your-secret-key
297
+ SESSION_EXPIRY=86400
298
+
299
+ # External Services
300
+ SMTP_HOST=smtp.example.com
301
+ ```
302
+
303
+ #### Configuration Files
304
+ - List of configuration files the project needs with their purposes
305
+ - Key settings that differ from framework defaults
306
+ - Example snippets for non-obvious configuration
307
+
308
+ #### Project Setup
309
+ - Step-by-step commands to initialize and run the project from scratch
310
+ - Key packages to install by category
311
+ - Database setup (create, migrate, seed)
312
+ - Local development startup command
313
+
314
+ ### 9. Open Decisions & Assumptions
315
+ - Technical decisions that were inferred rather than explicitly specified in existing specs
316
+ - Assumptions made where feature specs were ambiguous
317
+ - Areas where the architecture may need to evolve as features are implemented
318
+ - Questions that should be resolved before or during implementation
319
+
320
+ ---
321
+
322
+ ## Tone & Style
323
+
324
+ - Concrete and prescriptive — tell the implementing agent exactly what to do, not what to consider
325
+ - Technology-specific — use actual library names, file paths, and code patterns from the stack
326
+ - Feature-traceable — connect every architectural decision back to the features it serves
327
+ - Designed for direct consumption by an implementing agent
328
+
329
+ ---
330
+
331
+ ## Input
332
+
333
+ <<<ARCHITECTURE_CONTEXT>>>
@@ -26,9 +26,10 @@ Before making any changes, read all available gspec documents in this order:
26
26
  1. `gspec/profile.md` — Product identity and scope
27
27
  2. `gspec/epics/*.md` — Epic structure and feature dependencies
28
28
  3. `gspec/features/*.md` — Individual feature requirements
29
- 4. `gspec/stack.md` — Technology choices and architecture
30
- 5. `gspec/style.md` — Visual design system
31
- 6. `gspec/practices.md` — Development standards and conventions
29
+ 4. `gspec/stack.md` — Technology choices
30
+ 5. `gspec/architecture.md` — Technical architecture: project structure, data model, API design, component architecture, environment setup
31
+ 6. `gspec/style.md` — Visual design system
32
+ 7. `gspec/practices.md` — Development standards and conventions
32
33
 
33
34
  If any files are missing, note what is missing and proceed with what is available. The user may not have all spec types — that is fine. You only update specs that exist. Do not create new spec files (profile, stack, style, practices) unless the user explicitly asks. You may create a new feature PRD only when a change introduces an entirely new feature that warrants its own document.
34
35
 
@@ -58,6 +59,17 @@ Execute the code changes:
58
59
  5. **Surface new issues as they arise** — If implementation reveals new ambiguities, pause and consult the user rather than making silent assumptions
59
60
  6. **Track spec implications as you work** — As you implement, mentally note which gspec documents will need updating based on what you are changing
60
61
 
62
+ ### Phase 3.5: Validate — Ensure Tests Pass
63
+
64
+ Before updating any specs, verify the code changes are sound:
65
+
66
+ 1. **Check for existing tests** — Look for a test suite, test runner configuration, or test scripts in `package.json`, `Makefile`, or equivalent
67
+ 2. **If tests exist, run them** — Execute the project's test suite and confirm all tests pass
68
+ 3. **If tests fail** — Fix the failing tests before proceeding. Do not move to spec updates with a broken test suite
69
+ 4. **If no tests exist** — Note this and proceed. Do not create a test suite unless the user requests one or `gspec/practices.md` requires it
70
+
71
+ This gate ensures specs are only updated to reflect working, validated code — never broken implementations.
72
+
61
73
  ### Phase 4: Assess — Determine Spec Impact
62
74
 
63
75
  After code changes are complete, systematically evaluate which gspec documents need updating. Apply this decision matrix:
@@ -66,11 +78,16 @@ After code changes are complete, systematically evaluate which gspec documents n
66
78
  |---|---|---|
67
79
  | New user-facing capability | `gspec/features/<relevant>.md` | Add capability to existing PRD using an **unchecked checkbox** (`- [ ]`), or create new PRD if entirely new feature |
68
80
  | Modified capability behavior | `gspec/features/<relevant>.md` | Update the affected capability description. **Preserve the checkbox state** (`[x]` or `[ ]`) — if the capability was already implemented and the modification is reflected in the code change, keep it checked |
69
- | Removed or deprecated capability | `gspec/features/<relevant>.md` | Remove the checkbox line and move to Non-Goals or Future Considerations, note deprecation |
81
+ | Removed or deprecated capability | `gspec/features/<relevant>.md` | Remove the checkbox line and move to Scope section (out-of-scope or deferred), note deprecation |
70
82
  | New technology or dependency added | `gspec/stack.md` | Add to appropriate section with rationale |
71
83
  | Technology or dependency removed | `gspec/stack.md` | Remove and note why |
72
84
  | Technology version changed | `gspec/stack.md` | Update version |
73
- | Visual design change (colors, typography, spacing, components) | `gspec/style.md` | Update affected tokens, components, or patterns |
85
+ | New data entity or changed data model | `gspec/architecture.md` | Update Data Model section with new/changed entities |
86
+ | New API endpoint or changed route | `gspec/architecture.md` | Update API Design section with new/changed routes |
87
+ | Project structure change (new directory, reorganization) | `gspec/architecture.md` | Update Project Structure section |
88
+ | Environment variable added or changed | `gspec/architecture.md` | Update Environment & Configuration section |
89
+ | Visual design change — generic (colors, typography, spacing, base component patterns) | `gspec/style.md` | Update affected tokens or base component patterns. Only include changes that are reusable and not tied to a specific feature or domain |
90
+ | Visual design change — feature-specific (a component unique to a feature, domain-specific visual treatment) | `gspec/features/<relevant>.md` | Document the visual details in the feature PRD's capabilities or a dedicated "Visual Design" subsection |
74
91
  | Development practice change (testing, code org, conventions) | `gspec/practices.md` | Update affected practice |
75
92
  | Product scope or direction change | `gspec/profile.md` | Update affected sections (Product Description, Use Cases, Roadmap, etc.) |
76
93
  | Feature dependency change | `gspec/epics/<relevant>.md` | Update dependency map and phasing |
@@ -115,16 +132,15 @@ After approval, write the spec updates:
115
132
  2. **Preserve format** — Match the existing document's style, heading structure, and tone exactly
116
133
  3. **Add change context where valuable** — Where appropriate, add a brief parenthetical or note indicating the change (e.g., "*(Updated: added CSV export capability)*"). Do not over-annotate — use judgment about when a note adds value vs. noise. Small obvious changes need no annotation. Significant scope changes benefit from a brief note.
117
134
  4. **For new feature PRDs** — If the change introduces an entirely new feature that warrants its own PRD, follow the same structure used by the `gspec-feature` command:
118
- - Overview (name, summary, objective)
119
- - Problem & Context
120
- - Goals & Non-Goals
135
+ - Overview (name, summary, problem being solved and why it matters now)
121
136
  - Users & Use Cases
122
- - Assumptions & Open Questions
123
- - Capabilities (with P0/P1/P2 priority levels)
137
+ - Scope (in-scope goals, out-of-scope items, deferred ideas)
138
+ - Capabilities (with P0/P1/P2 priority levels, each with 2-4 **acceptance criteria** as a sub-list)
139
+ - Dependencies (on other features or external services)
140
+ - Assumptions & Risks (assumptions, open questions, key risks and mitigations — note in assumptions that this feature was identified during iterative development)
124
141
  - Success Metrics
125
- - Risks & Mitigations
126
- - Future Considerations
127
- - Note in the Assumptions section that this feature was identified during iterative development
142
+ - Begin the file with YAML frontmatter: `---\ngspec-version: <<<VERSION>>>\n---`
143
+ - **Also update `gspec/architecture.md`** if the new feature introduces data entities, API endpoints, or new components — add them to the appropriate architecture sections
128
144
 
129
145
  ### Phase 7: Verify — Confirm Consistency
130
146
 
@@ -150,10 +166,14 @@ After writing spec updates:
150
166
 
151
167
  **Traceability without clutter.** A brief note about why something changed is valuable for future readers. A changelog at the bottom of every file is not. Use judgment. For small, obvious changes, no annotation may be needed. For significant scope changes, a parenthetical note aids understanding.
152
168
 
169
+ **Keep `style.md` generic and reusable.** The style guide defines the design system — colors, typography, spacing, base component patterns, and tokens that could apply to any product. Do not add feature-specific or domain-specific content to `style.md` (e.g., "recipe card layout", "playlist item styling"). Feature-specific visual details belong in the relevant feature PRD. If you are unsure whether a visual change is generic or feature-specific, ask the user.
170
+
153
171
  **When to create vs. update.** If a change adds a small capability that fits naturally within an existing feature PRD, update that PRD. If a change introduces a wholly new product area that does not belong in any existing PRD, create a new feature PRD. When in doubt, ask the user.
154
172
 
155
173
  **Implementation checkboxes.** Feature PRDs use markdown checkboxes (`- [ ]` / `- [x]`) on capabilities to track implementation status for `gspec-implement`. When DOR adds new capabilities, use unchecked checkboxes (`- [ ]`). When modifying a capability that was already checked (`- [x]`) and the code change reflects the modification, keep it checked. When creating a new feature PRD, use unchecked checkboxes for all capabilities. Do not check off capabilities that DOR did not implement in the current session.
156
174
 
175
+ **Version frontmatter.** When updating existing gspec files, preserve the `gspec-version` YAML frontmatter at the top of the file. If a file lacks frontmatter, add `---\ngspec-version: <<<VERSION>>>\n---` as the very first content before the main heading.
176
+
157
177
  ---
158
178
 
159
179
  ## Gap-Filling Guidelines
@@ -183,7 +203,7 @@ After writing spec updates:
183
203
  - Present code changes and spec updates as separate, sequential activities
184
204
  - Reference specific gspec documents and section names when discussing spec impacts
185
205
  - Clearly distinguish between "the spec currently says X" and "I propose updating it to Y"
186
- - Create or modify files following the project structure conventions from `gspec/stack.md` and `gspec/practices.md`
206
+ - Create or modify files following the project structure defined in `gspec/architecture.md` (or `gspec/stack.md` and `gspec/practices.md` if no architecture document exists)
187
207
  - Write production-quality code unless the user requests otherwise
188
208
  - Include tests as defined by `gspec/practices.md` testing standards
189
209
 
@@ -6,6 +6,29 @@ Generate multiple Product Requirements Documents (PRDs) from a high-level epic d
6
6
 
7
7
  Take the provided epic description (a large body of work) and break it down into **multiple focused Product Requirements Documents (PRDs)**, each representing a distinct feature or component that can be built independently.
8
8
 
9
+ ## Important: Agent-Oriented Documentation
10
+
11
+ **These epics and PRDs are designed for automated agent consumption** (via `gspec-implement`), with humans validating the content for accuracy and completeness. Write documents that are:
12
+
13
+ - **Implementation-ready blueprints**, not project plans
14
+ - Focused on **what** to build and **why**, not **when** or **how long**
15
+ - Clear on technical and functional requirements an agent needs to execute
16
+
17
+ **AVOID project management details:**
18
+ - ❌ Sprint planning, week numbers, or timeline estimates
19
+ - ❌ Team assignments or resource allocation
20
+ - ❌ Velocity or story point estimates
21
+ - ❌ Delivery schedules or milestone dates
22
+ - ❌ "Phase 1 ships in Q2" or similar calendar commitments
23
+
24
+ **DO include implementation guidance:**
25
+ - ✅ Clear functional requirements and acceptance criteria
26
+ - ✅ Dependencies between features (technical, not temporal)
27
+ - ✅ Priority levels (P0, P1, P2) for scope decisions
28
+ - ✅ Build order recommendations based on technical dependencies
29
+ - ✅ Minimum viable epic (MVE) scope definition
30
+ - ✅ Feature sequencing based on what must be built first
31
+
9
32
  ## Guidelines
10
33
 
11
34
  - **Read existing gspec documents first** to ground the epic and its features in established product context
@@ -15,7 +38,7 @@ Take the provided epic description (a large body of work) and break it down into
15
38
  - Ensure features can be built incrementally and independently when possible
16
39
  - Consider dependencies between features
17
40
  - Focus on user value, scope, and outcomes
18
- - Write for product, design, and engineering audiences
41
+ - Write for automated implementation with human validation
19
42
  - Be concise, structured, and decisive
20
43
 
21
44
  ---
@@ -41,6 +64,13 @@ If these files don't exist, proceed without them — they are optional context,
41
64
  - Output **multiple** Markdown documents (one per feature)
42
65
  - Save each file to the `gspec/features/` folder in the root of the project (create if it doesn't exist)
43
66
  - Name each file based on the feature (e.g., `user-authentication.md`, `dashboard-analytics.md`)
67
+ - Begin every output file (both epic summary and individual feature PRDs) with YAML frontmatter containing the gspec version:
68
+ ```
69
+ ---
70
+ gspec-version: <<<VERSION>>>
71
+ ---
72
+ ```
73
+ The frontmatter must be the very first content in the file, before the main heading.
44
74
  - **Before generating the documents**, ask clarifying questions if:
45
75
  - The target users are unclear
46
76
  - The scope or boundaries of the epic are ambiguous
@@ -55,18 +85,44 @@ If these files don't exist, proceed without them — they are optional context,
55
85
  - Links to each individual feature PRD
56
86
  - Avoid deep system architecture or low-level implementation
57
87
  - No code blocks except where examples add clarity
58
- - Clear acceptance criteria are required for each feature
88
+ - Clear acceptance criteria are required for each capability
59
89
  - Make tradeoffs and scope explicit
60
90
 
91
+ ### Technology Agnosticism
92
+
93
+ **IMPORTANT**: Epic and feature PRDs must remain technology-agnostic to enable implementation with different technology stacks. The `gspec/stack.md` file is the single source of truth for technology choices.
94
+
95
+ **DO use generic architectural terms:**
96
+ - ✅ "database", "data store", "persistent storage"
97
+ - ✅ "authentication service", "IAM", "identity provider"
98
+ - ✅ "API", "backend service", "server"
99
+ - ✅ "frontend", "client application", "user interface"
100
+ - ✅ "message queue", "event system", "pub/sub"
101
+ - ✅ "object storage", "file storage"
102
+ - ✅ "cache", "caching layer"
103
+ - ✅ "search index", "full-text search"
104
+
105
+ **DO NOT reference specific technologies:**
106
+ - ❌ React, Vue, Angular, Svelte
107
+ - ❌ PostgreSQL, MySQL, MongoDB, DynamoDB
108
+ - ❌ AWS Lambda, Google Cloud Functions, Azure Functions
109
+ - ❌ Redis, Memcached
110
+ - ❌ Elasticsearch, Algolia, Solr
111
+ - ❌ S3, GCS, Azure Blob Storage
112
+ - ❌ Kafka, RabbitMQ, SQS
113
+
114
+ This separation allows the same epic and feature specs to be implemented using different technology stacks by swapping the Stack file.
115
+
61
116
  ## Epic Summary Document Structure
62
117
 
118
+ **IMPORTANT**: Only include the sections listed below. Do NOT add additional sections such as "Technology Notes", "Implementation Details", "Technical Architecture", or any other custom sections. Stick strictly to this structure.
119
+
63
120
  Create a file at `gspec/epics/[epic-name].md` with:
64
121
 
65
122
  ### 1. Epic Overview
66
123
  - Epic name
67
124
  - Executive summary
68
125
  - Strategic objective
69
- - Target timeline or phases
70
126
 
71
127
  ### 2. Features Breakdown
72
128
  - List of all features with links to their PRDs, **using unchecked markdown checkboxes** (e.g., `- [ ] **P0**: [Feature Name](../features/feature-name.md) — Brief description`). The `gspec-implement` command will check these off (`- [x]`) as features are fully implemented, allowing incremental runs.
@@ -92,58 +148,50 @@ Create a file at `gspec/epics/[epic-name].md` with:
92
148
 
93
149
  ## Individual Feature PRD Structure
94
150
 
151
+ **IMPORTANT**: Only include the sections listed below. Do NOT add additional sections such as "Technology Notes", "Implementation Details", "Technical Architecture", or any other custom sections. Stick strictly to this structure.
152
+
95
153
  For each feature, create a separate file in `gspec/features/[feature-name].md` with:
96
154
 
97
155
  ### 1. Overview
98
156
  - Feature name
99
- - Summary
100
- - Objective
157
+ - Summary (1-2 sentences)
158
+ - Problem being solved and why it matters now
101
159
  - **Parent Epic** (link to epic summary)
102
160
 
103
- ### 2. Problem & Context
104
- - User problem
105
- - Why this matters now
106
- - Current pain points
107
- - How this fits into the larger epic
108
-
109
- ### 3. Goals & Non-Goals
110
- - In-scope goals
111
- - Explicitly out-of-scope items
112
-
113
- ### 4. Users & Use Cases
161
+ ### 2. Users & Use Cases
114
162
  - Primary users
115
- - Key use cases
116
-
117
- ### 5. Assumptions & Open Questions
118
- - Assumptions
119
- - Open questions (non-blocking)
163
+ - Key use cases (3-4 scenarios showing how users benefit)
120
164
 
121
- ### 6. Functional Requirements
122
- - Numbered requirements
123
- - Written in user-focused language
124
- - Clear acceptance criteria
125
- - **Priority level** for each requirement (P0 = must-have, P1 = should-have, P2 = nice-to-have)
126
- - **Use unchecked markdown checkboxes** for each requirement to enable implementation tracking (e.g., `- [ ] **P0**: FR-1 — User can create an account`). The `gspec-implement` command will check these off (`- [x]`) as requirements are implemented.
127
-
128
- ### 7. User Experience Requirements
129
- - UX principles
130
- - Key flows (high level)
131
- - Empty and error states
132
-
133
- ### 8. Success Metrics
134
- - How success is measured
135
- - Leading vs lagging indicators
136
-
137
- ### 9. Dependencies
165
+ ### 3. Scope
166
+ - In-scope goals
167
+ - Out-of-scope items (things this feature explicitly won't do)
168
+ - Deferred ideas (things we may do later, but not now)
169
+
170
+ ### 4. Capabilities
171
+ - What the feature provides to users, written in user-focused language
172
+ - **Priority level** for each capability (P0 = must-have, P1 = should-have, P2 = nice-to-have)
173
+ - Focus on *what* users can do, not *how* they do it — include UX expectations (empty states, error handling, key flows) as acceptance criteria on the relevant capabilities
174
+ - **Use unchecked markdown checkboxes** for each capability to enable implementation tracking (e.g., `- [ ] **P0**: User can create an account`). The `gspec-implement` command will check these off (`- [x]`) as capabilities are implemented, allowing incremental runs.
175
+ - **Each capability MUST include brief acceptance criteria** — 2-4 testable conditions that define "done" for that capability. These tell the implementing agent exactly when a capability is complete and give test writers concrete assertions. Format as a sub-list under each capability:
176
+ ```
177
+ - [ ] **P0**: User can create an account
178
+ - Valid email + strong password → account is created and confirmation is sent
179
+ - Duplicate email error message explains email is taken
180
+ - Weak password → inline validation shows password requirements
181
+ ```
182
+
183
+ ### 5. Dependencies
138
184
  - Dependencies on other features in this epic
139
185
  - External dependencies
186
+ - If none, state "None"
140
187
 
141
- ### 10. Risks & Mitigations
142
- - Product or delivery risks
143
- - Mitigation strategies
188
+ ### 6. Assumptions & Risks
189
+ - Assumptions (what we're taking as true)
190
+ - Open questions (non-blocking unknowns to resolve during implementation)
191
+ - Key risks and mitigations (brief bullet points — focus on risks that could affect implementation scope or approach)
144
192
 
145
- ### 11. Future Considerations
146
- - Explicitly deferred ideas
193
+ ### 7. Success Metrics
194
+ - 2-4 measurable outcomes that define whether this feature is working
147
195
 
148
196
  ## Workflow
149
197