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