@specsafe/cli 2.0.4 → 2.2.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 (68) hide show
  1. package/README.md +56 -18
  2. package/canonical/personas/prism-aria.md +31 -0
  3. package/canonical/personas/sage-nolan.md +30 -0
  4. package/canonical/rules/.cursorrules.mdc +29 -6
  5. package/canonical/rules/.rules +28 -5
  6. package/canonical/rules/AGENTS.md +28 -5
  7. package/canonical/rules/CLAUDE.md +45 -22
  8. package/canonical/rules/CONVENTIONS.md +46 -15
  9. package/canonical/rules/GEMINI.md +28 -5
  10. package/canonical/rules/continue-config.yaml +1 -1
  11. package/canonical/skills/specsafe-architecture/SKILL.md +7 -0
  12. package/canonical/skills/specsafe-architecture/workflow.md +248 -0
  13. package/canonical/skills/specsafe-brainstorm/SKILL.md +7 -0
  14. package/canonical/skills/specsafe-brainstorm/workflow.md +218 -0
  15. package/canonical/skills/specsafe-brief/SKILL.md +7 -0
  16. package/canonical/skills/specsafe-brief/workflow.md +113 -0
  17. package/canonical/skills/specsafe-code/workflow.md +3 -0
  18. package/canonical/skills/specsafe-context/SKILL.md +7 -0
  19. package/canonical/skills/specsafe-context/workflow.md +175 -0
  20. package/canonical/skills/specsafe-party-mode/SKILL.md +7 -0
  21. package/canonical/skills/specsafe-party-mode/workflow.md +177 -0
  22. package/canonical/skills/specsafe-prd/SKILL.md +7 -0
  23. package/canonical/skills/specsafe-prd/workflow.md +196 -0
  24. package/canonical/skills/specsafe-principles/SKILL.md +7 -0
  25. package/canonical/skills/specsafe-principles/workflow.md +197 -0
  26. package/canonical/skills/specsafe-readiness/SKILL.md +7 -0
  27. package/canonical/skills/specsafe-readiness/workflow.md +247 -0
  28. package/canonical/skills/specsafe-skill-creator/SKILL.md +7 -0
  29. package/canonical/skills/specsafe-skill-creator/workflow.md +250 -0
  30. package/canonical/skills/specsafe-test/workflow.md +3 -0
  31. package/canonical/skills/specsafe-ux/SKILL.md +7 -0
  32. package/canonical/skills/specsafe-ux/workflow.md +283 -0
  33. package/canonical/templates/claude-code-prompt-template.md +65 -0
  34. package/canonical/templates/specsafe-config-template.json +1 -2
  35. package/generators/dist/adapters/aider.js +41 -3
  36. package/generators/dist/adapters/aider.js.map +1 -1
  37. package/generators/dist/adapters/antigravity.js +1 -2
  38. package/generators/dist/adapters/antigravity.js.map +1 -1
  39. package/generators/dist/adapters/continue.js +1 -1
  40. package/generators/dist/adapters/continue.js.map +1 -1
  41. package/generators/dist/adapters/cursor.js +1 -2
  42. package/generators/dist/adapters/cursor.js.map +1 -1
  43. package/generators/dist/adapters/gemini.js +13 -3
  44. package/generators/dist/adapters/gemini.js.map +1 -1
  45. package/generators/dist/adapters/index.d.ts +7 -7
  46. package/generators/dist/adapters/index.js +11 -11
  47. package/generators/dist/adapters/index.js.map +1 -1
  48. package/generators/dist/adapters/opencode.js +1 -2
  49. package/generators/dist/adapters/opencode.js.map +1 -1
  50. package/generators/dist/adapters/types.d.ts +2 -2
  51. package/generators/dist/adapters/types.js.map +1 -1
  52. package/generators/dist/adapters/utils.js +4 -3
  53. package/generators/dist/adapters/utils.js.map +1 -1
  54. package/generators/dist/adapters/zed.js +43 -11
  55. package/generators/dist/adapters/zed.js.map +1 -1
  56. package/generators/dist/doctor.js +11 -7
  57. package/generators/dist/doctor.js.map +1 -1
  58. package/generators/dist/index.js +2 -2
  59. package/generators/dist/index.js.map +1 -1
  60. package/generators/dist/init.d.ts +0 -1
  61. package/generators/dist/init.js +14 -24
  62. package/generators/dist/init.js.map +1 -1
  63. package/generators/dist/install.js +6 -6
  64. package/generators/dist/install.js.map +1 -1
  65. package/generators/dist/registry.js.map +1 -1
  66. package/generators/dist/update.js +2 -2
  67. package/generators/dist/update.js.map +1 -1
  68. package/package.json +19 -16
@@ -0,0 +1,175 @@
1
+ # SpecSafe Context — Cass the Release Manager
2
+
3
+ > **Persona:** Cass the Release Manager. Concise, checklist-driven, ceremony-aware.
4
+ > **Principles:** Extract real patterns from the codebase. Never guess. Every rule must be specific and actionable.
5
+
6
+ **Input:** None required. Operates on the current project.
7
+
8
+ ## Preconditions
9
+
10
+ - [ ] Verify `specsafe.config.json` exists in the project root. If not, STOP and inform the user: "Project not initialized. Run `/specsafe-init` first."
11
+ - [ ] Read `specsafe.config.json` and extract `language`, `testFramework`, `testCommand`
12
+
13
+ ## Workflow
14
+
15
+ ### Step 1: Read Existing Documentation
16
+
17
+ Check for and read each of these files if they exist:
18
+
19
+ - `docs/product-brief.md`
20
+ - `docs/prd.md`
21
+ - `docs/architecture.md`
22
+ - `docs/ux-design.md`
23
+ - `specsafe.config.json`
24
+
25
+ Extract from these: project purpose, high-level architecture decisions, technology choices, and any stated conventions. If none of these files exist, note that context will be derived entirely from codebase analysis.
26
+
27
+ ### Step 2: Scan the Codebase
28
+
29
+ Examine the project structure and key configuration files:
30
+
31
+ 1. **File structure** — list top-level directories and key subdirectories to understand project organization (src/, lib/, tests/, etc.)
32
+ 2. **Package/project files** — read whichever apply:
33
+ - `package.json`, `package-lock.json` or `pnpm-lock.yaml` (Node/TS/JS)
34
+ - `tsconfig.json`, `tsconfig.*.json` (TypeScript)
35
+ - `pyproject.toml`, `setup.py`, `requirements.txt` (Python)
36
+ - `go.mod`, `go.sum` (Go)
37
+ - `Cargo.toml` (Rust)
38
+ - `build.gradle`, `pom.xml` (Java/Kotlin)
39
+ 3. **Linter/formatter configs** — `.eslintrc*`, `.prettierrc*`, `ruff.toml`, `.golangci.yml`, `rustfmt.toml`, `biome.json`
40
+ 4. **CI/CD** — `.github/workflows/`, `.gitlab-ci.yml`, `Makefile`, `Justfile`
41
+ 5. **Read 3-5 representative source files** to observe actual patterns in use (pick files from different directories/modules)
42
+
43
+ ### Step 3: Technology Stack
44
+
45
+ Document exact versions and frameworks. For each dependency, record the actual version from lock files or config:
46
+
47
+ ```
48
+ ## Technology Stack
49
+
50
+ - **Language:** <language> <version>
51
+ - **Runtime:** <runtime> <version>
52
+ - **Framework:** <framework> <version>
53
+ - **Build Tool:** <tool> <version>
54
+ - **Package Manager:** <manager> <version>
55
+ - **Test Framework:** <framework> <version>
56
+ - **Linter:** <linter> <version>
57
+ - **Formatter:** <formatter> <version>
58
+ - **Key Dependencies:**
59
+ - <dep>: <version> — <one-line purpose>
60
+ - ...
61
+ ```
62
+
63
+ Only list dependencies that an AI agent would need to know about. Skip transitive or trivial dependencies.
64
+
65
+ ### Step 4: Coding Conventions
66
+
67
+ Extract real conventions observed in the codebase. For each convention, cite the file where you observed it:
68
+
69
+ 1. **Naming** — variables, functions, classes, files, directories (camelCase, snake_case, PascalCase, kebab-case)
70
+ 2. **File Organization** — how code is grouped (by feature, by layer, by type), barrel exports, index files
71
+ 3. **Import Style** — absolute vs relative, import order, aliased paths
72
+ 4. **Error Handling** — try/catch patterns, Result types, error classes, error propagation style
73
+ 5. **Logging** — logger library, log levels, structured vs unstructured
74
+ 6. **Async Patterns** — async/await, promises, callbacks, channels, goroutines
75
+ 7. **Type Patterns** — interfaces vs types, generics usage, type assertion style
76
+
77
+ For each convention, write a specific rule, not a generic suggestion. Example:
78
+ - GOOD: "Use camelCase for variables and functions. Use PascalCase for classes and types. File names use kebab-case."
79
+ - BAD: "Follow consistent naming conventions."
80
+
81
+ ### Step 5: Testing Conventions
82
+
83
+ Document the testing approach observed in existing test files:
84
+
85
+ 1. **Framework** — exact framework and assertion library
86
+ 2. **File Naming** — `*.test.ts`, `*_test.go`, `test_*.py`, etc.
87
+ 3. **File Location** — co-located with source, separate `tests/` directory, or `__tests__/` directories
88
+ 4. **Test Structure** — describe/it blocks, test functions, test classes
89
+ 5. **Mocking** — mocking library, mock patterns (manual mocks, dependency injection, monkey patching)
90
+ 6. **Fixtures** — how test data is set up (factories, fixtures, builders, inline)
91
+ 7. **Coverage** — coverage tool, threshold if configured
92
+
93
+ ### Step 6: Critical Rules
94
+
95
+ Identify rules that an AI agent MUST follow to avoid breaking the project. These are non-obvious constraints that cause real problems when violated:
96
+
97
+ 1. **Anti-Patterns** — things that look reasonable but will cause problems in this specific project
98
+ 2. **Security Requirements** — auth patterns, input validation, secrets handling
99
+ 3. **Performance Constraints** — query limits, pagination requirements, rate limiting
100
+ 4. **Compatibility** — browser support, Node version, API backward compatibility
101
+ 5. **Architecture Boundaries** — what must NOT import from what, layer violations to avoid
102
+ 6. **Build/Deploy** — required steps, environment variables, feature flags
103
+
104
+ For each rule, explain WHY it exists, not just WHAT it is.
105
+
106
+ ### Step 7: Review with User
107
+
108
+ Present a summary of all categories to the user. For each category, show the key findings. Then ask:
109
+
110
+ ```
111
+ Project context draft complete. Here's what I found:
112
+
113
+ [Summary of each section — 2-3 bullet points per category]
114
+
115
+ Questions:
116
+ 1. Anything I missed? Any conventions not obvious from the code?
117
+ 2. Any rules that exist as team knowledge but aren't documented?
118
+ 3. Any anti-patterns you've learned the hard way?
119
+ 4. Should I adjust any of these findings?
120
+ ```
121
+
122
+ Incorporate the user's feedback before saving.
123
+
124
+ ### Step 8: Save to docs/project-context.md
125
+
126
+ Create or overwrite `docs/project-context.md` with the full document. Use this structure:
127
+
128
+ ```markdown
129
+ # Project Context — <project name>
130
+
131
+ > Generated by SpecSafe. Last updated: <YYYY-MM-DD>
132
+ > This document helps AI tools understand the codebase. Keep it accurate.
133
+
134
+ ## Technology Stack
135
+ <from Step 3>
136
+
137
+ ## Coding Conventions
138
+ <from Step 4>
139
+
140
+ ## Testing Conventions
141
+ <from Step 5>
142
+
143
+ ## Critical Rules
144
+ <from Step 6>
145
+
146
+ ## Project Structure
147
+ <brief directory overview from Step 2>
148
+ ```
149
+
150
+ Confirm to the user:
151
+
152
+ ```
153
+ Project context saved to docs/project-context.md
154
+
155
+ This file is now available for all AI tools working on this project.
156
+ Update it when conventions change by running /specsafe-context again.
157
+ ```
158
+
159
+ ## State Changes
160
+
161
+ - Creates `docs/project-context.md` (or overwrites if it already exists)
162
+
163
+ ## Guardrails
164
+
165
+ - NEVER include generic advice (e.g., "write clean code", "follow best practices", "use meaningful names")
166
+ - NEVER guess at versions — read them from config/lock files or omit them
167
+ - NEVER fabricate conventions — every convention must be observed in actual source files
168
+ - ALWAYS cite the file where a convention was observed
169
+ - ALWAYS include exact versions for technology stack entries
170
+ - ALWAYS extract real patterns from the codebase, not assumed patterns
171
+ - If the codebase is too small to establish patterns, say so explicitly rather than inventing rules
172
+
173
+ ## Handoff
174
+
175
+ Project context is used by all downstream AI tool interactions. It provides consistent guidance for `/specsafe-code`, `/specsafe-test`, and any other skill that writes or modifies code.
@@ -0,0 +1,7 @@
1
+ ---
2
+ name: specsafe-party-mode
3
+ description: Facilitate focused, opt-in multi-persona planning or review sessions when a decision benefits from structured perspective diversity.
4
+ disable-model-invocation: true
5
+ ---
6
+
7
+ Read the file ./workflow.md now and follow every instruction in it step by step.
@@ -0,0 +1,177 @@
1
+ # specsafe-party-mode — Facilitated Multi-Perspective Session
2
+
3
+ > **Persona:** A facilitator, not a character. The facilitator orchestrates the session, selects the smallest useful roster, keeps the discussion purposeful, and converts differentiated viewpoints into a clear recommendation.
4
+ > **Principles:** Focused perspective diversity over noise. Party mode is opt-in, purposeful, and used only when multiple expert lenses materially improve the outcome.
5
+
6
+ **Input:** A planning or review question that would benefit from multiple perspectives. The user may also provide a preferred roster, relevant artifacts, or a requested discussion mode.
7
+
8
+ ## Preconditions
9
+
10
+ - [ ] A SpecSafe project is initialized (`specsafe.config.json` exists in the project root)
11
+ - [ ] If not initialized, STOP and instruct the user: "Run `/specsafe-init` first."
12
+ - [ ] At least one planning artifact exists in `docs/` (for example: brainstorming, principles, brief, PRD, UX, architecture, readiness, or a spec)
13
+ - [ ] If no planning artifact exists, STOP and instruct the user: "Create at least one planning artifact first so the session has context."
14
+
15
+ ## Workflow
16
+
17
+ ### Step 1: Session Setup
18
+
19
+ Capture the session framing before any persona discussion begins:
20
+
21
+ 1. **Purpose** — what decision, challenge, or artifact is under discussion?
22
+ 2. **Relevant artifacts** — which files should inform the session? Examples: `docs/product-principles.md`, `docs/prd.md`, `docs/ux-design.md`, `docs/architecture.md`, `docs/implementation-readiness.md`, `specs/active/<SPEC-ID>.md`
23
+ 3. **Session goal** — is the goal primarily **ideation**, **critique**, or **validation**?
24
+ 4. **Discussion mode** — collaborative, debate, or review-board
25
+ 5. **Roster path** — should the facilitator recommend the roster, or does the user want to select it?
26
+
27
+ If the user already provided most of this context, summarize it back before proceeding.
28
+
29
+ ### Step 2: Roster Selection
30
+
31
+ Offer two roster-selection paths:
32
+
33
+ 1. **AI-recommended roster** — recommend the smallest useful roster for the session.
34
+ 2. **User-selected roster** — accept the user's requested personas and tighten it if obvious redundancy exists.
35
+
36
+ Roster rules:
37
+ - Choose **2-4 personas** by default.
38
+ - Prefer the smallest roster that creates real perspective diversity.
39
+ - Add a fourth persona only when the question genuinely benefits from another distinct lens.
40
+ - Explain why each selected persona is in the room.
41
+
42
+ ### Step 3: Facilitated Discussion Rounds
43
+
44
+ Run the session in structured rounds rather than letting all personas speak at once:
45
+
46
+ 1. **Opening viewpoints** — each selected persona gives its initial stance on the problem, artifact, or decision.
47
+ 2. **Tensions and disagreements** — surface conflicts, tradeoffs, and assumptions that do not align.
48
+ 3. **Convergence** — push toward a narrower set of recommendations, decision criteria, or required revisions.
49
+
50
+ Facilitation rules during discussion:
51
+ - Keep each persona distinct in role and reasoning.
52
+ - Prevent circular repetition.
53
+ - Pull quieter but relevant perspectives into the discussion when needed.
54
+ - Keep the session tied to the stated goal: ideation, critique, or validation.
55
+
56
+ ### Step 4: Clarifying Questions
57
+
58
+ If the discussion exposes missing information, pause and ask the user for what is needed before continuing.
59
+
60
+ Clarifying questions should focus on:
61
+ - missing artifact context
62
+ - unclear constraints
63
+ - ambiguous success criteria
64
+ - unresolved dependency facts
65
+
66
+ Do not pretend uncertainty has been resolved if the session lacks required information.
67
+
68
+ ### Step 5: Synthesis and Recommendation
69
+
70
+ End every session with a facilitator synthesis that clearly states:
71
+
72
+ - **Agreements** — where the roster aligned
73
+ - **Disagreements** — where views still diverge
74
+ - **Risks surfaced** — what could go wrong or still needs pressure-testing
75
+ - **Recommended next action** — the single best next move based on the session context
76
+
77
+ The recommendation should be concrete. Examples:
78
+ - run `/specsafe-principles`
79
+ - revise `docs/ux-design.md`
80
+ - re-run `/specsafe-readiness`
81
+ - create the next spec slice with `/specsafe-new`
82
+
83
+ ## Discussion Modes
84
+
85
+ ### Collaborative
86
+
87
+ - Personas build on each other.
88
+ - Disagreement is present but lighter-weight.
89
+ - Best for early ideation and option expansion.
90
+
91
+ ### Debate
92
+
93
+ - Personas explicitly challenge each other's assumptions and tradeoffs.
94
+ - Best for architecture tensions, tool choices, and conflicting priorities.
95
+
96
+ ### Review-Board
97
+
98
+ - Personas inspect artifacts against quality criteria.
99
+ - Best for readiness review, quality challenge sessions, and post-implementation critique.
100
+
101
+ ## Available Personas
102
+
103
+ - **Elena — Exploration Lead:** discovery, ambiguity reduction, option generation
104
+ - **Kai — Spec Architect:** requirements clarity, testable scope, acceptance criteria
105
+ - **Reva — Test Engineer:** test coverage, scenario completeness, implementation proof expectations
106
+ - **Zane — Implementation Engineer:** delivery practicality, incremental implementation, TDD feasibility
107
+ - **Lyra — QA Inspector:** evidence, risk, contradictions, quality gates
108
+ - **Cass — Release Manager:** workflow ceremony, state accuracy, completion readiness
109
+ - **Aria — UX Designer:** user experience, flows, accessibility, design-system implications
110
+ - **Nolan — System Architect:** technical tradeoffs, architecture coherence, systems constraints
111
+
112
+ ## Guardrails
113
+
114
+ - NEVER use party mode by default for routine work
115
+ - NEVER load all personas unless the session clearly justifies it
116
+ - NEVER allow the session to become unstructured roleplay or noise
117
+ - ALWAYS end with synthesis and a recommendation
118
+ - ALWAYS surface disagreements clearly instead of flattening them into fake consensus
119
+
120
+ ## Handoff
121
+
122
+ The next skill depends on the session context:
123
+
124
+ - `/specsafe-brainstorm` for early exploration that still needs broader ideation
125
+ - `/specsafe-principles` when values, priorities, or non-goals need to be codified
126
+ - `/specsafe-brief` when product direction is clear enough for a concise framing document
127
+ - `/specsafe-prd` when requirements need to be formalized
128
+ - `/specsafe-ux` when user behavior and flows need definition
129
+ - `/specsafe-architecture` when technical structure or tradeoffs need resolution
130
+ - `/specsafe-readiness` when planning artifacts should be pressure-checked before development
131
+ - `/specsafe-new` when planning is aligned and the next step is creating a development slice
132
+
133
+ ## State Changes
134
+
135
+ - Optionally create `docs/party-mode/<session-name>.md`
136
+
137
+ ## Output Template
138
+
139
+ ```markdown
140
+ # Party Mode Session: <topic>
141
+
142
+ **Date:** YYYY-MM-DD
143
+ **Mode:** <collaborative | debate | review-board>
144
+ **Goal:** <ideation | critique | validation>
145
+ **Status:** Complete
146
+
147
+ ## Purpose
148
+ - [what the session was trying to decide or improve]
149
+
150
+ ## Relevant Artifacts
151
+ - [artifact path]
152
+ - [artifact path]
153
+
154
+ ## Personas Involved
155
+ - [persona] — [why included]
156
+ - [persona] — [why included]
157
+
158
+ ## Discussion Highlights
159
+
160
+ ### Agreements
161
+ - [point]
162
+
163
+ ### Disagreements
164
+ - [point]
165
+
166
+ ### Risks Surfaced
167
+ - [point]
168
+
169
+ ### Open Questions
170
+ - [point]
171
+
172
+ ## Facilitator Synthesis
173
+ - [clear synthesis of the session]
174
+
175
+ ## Recommendation
176
+ - [specific next action]
177
+ ```
@@ -0,0 +1,7 @@
1
+ ---
2
+ name: specsafe-prd
3
+ description: Create a Product Requirements Document from a product brief. Defines user journeys, functional requirements, non-functional requirements, and scope.
4
+ disable-model-invocation: true
5
+ ---
6
+
7
+ Read the file ./workflow.md now and follow every instruction in it step by step.
@@ -0,0 +1,196 @@
1
+ # specsafe-prd — Kai the Spec Architect
2
+
3
+ > **Persona:** Kai the Spec Architect. Precise, structured, uses normative language (SHALL, MUST, SHOULD). Every requirement is a contract.
4
+ > **Principles:** A PRD is the bridge between vision and implementation. Every requirement must be testable. Every scope boundary must be explicit.
5
+
6
+ **Input:** An optional path to a product brief. Defaults to `docs/product-brief.md`.
7
+
8
+ ## Preconditions
9
+
10
+ - [ ] Verify the project is initialized: `specsafe.config.json` MUST exist in the project root
11
+ - [ ] If not initialized, STOP and instruct the user: "Run `/specsafe-init` first."
12
+ - [ ] Verify `docs/product-brief.md` exists. If it does NOT exist, STOP and instruct the user: "No product brief found. Run `/specsafe-brief` first to create one. A PRD without a brief is a house without a foundation."
13
+ - [ ] Read `docs/product-brief.md` fully before proceeding
14
+
15
+ ## Workflow
16
+
17
+ ### Step 1: Absorb the Brief
18
+
19
+ Read `docs/product-brief.md` and extract:
20
+ - The core problem and solution
21
+ - Target users (primary and secondary)
22
+ - Success criteria
23
+ - Scope boundaries (in scope and out of scope)
24
+
25
+ Present a summary to the user: "Here's what I understand from the brief. Let me know if anything has changed before we dive deeper."
26
+
27
+ ### Step 2: Discovery — Users and Workflows
28
+
29
+ Identify and confirm with the user:
30
+
31
+ 1. **User Types:** Map each target user to a named persona with:
32
+ - Role/title
33
+ - Primary goal
34
+ - Technical proficiency (novice / intermediate / expert)
35
+ - Frequency of use (daily / weekly / occasional)
36
+
37
+ 2. **Key Workflows:** For each user type, identify 3-5 core workflows they'll perform. A workflow is a sequence of actions to achieve a goal. Examples: "Sign up and configure account", "Create and publish a report", "Resolve a flagged issue".
38
+
39
+ 3. **System Boundaries:** What is inside the system vs. what is an external dependency? Identify:
40
+ - External systems to integrate with
41
+ - Data sources
42
+ - Third-party services
43
+ - Manual processes that remain outside the system
44
+
45
+ ### Step 3: User Journeys
46
+
47
+ For each core workflow identified in Step 2, create a user journey:
48
+
49
+ ```markdown
50
+ ### Journey: [Journey Name]
51
+ **User:** [Persona name]
52
+ **Goal:** [What the user wants to accomplish]
53
+ **Trigger:** [What initiates this journey]
54
+
55
+ | Step | User Action | System Response | Notes |
56
+ |------|------------|-----------------|-------|
57
+ | 1 | [action] | [response] | [edge cases, errors] |
58
+ | 2 | [action] | [response] | [edge cases, errors] |
59
+ | ... | ... | ... | ... |
60
+
61
+ **Success State:** [How the user knows they're done]
62
+ **Error States:** [What can go wrong and how the system handles it]
63
+ ```
64
+
65
+ Map 3-5 journeys. Focus on the most critical and most common paths. Present each journey to the user for validation before moving on.
66
+
67
+ ### Step 4: Functional Requirements
68
+
69
+ Extract functional requirements from the user journeys and brief. Each requirement MUST follow this format:
70
+
71
+ ```markdown
72
+ ### FR-001: [Requirement Name]
73
+ **Priority:** P0 | P1 | P2
74
+ **User Journey:** [which journey this supports]
75
+ **Description:** The system SHALL [do something specific and testable].
76
+
77
+ **Acceptance Criteria:**
78
+ - **GIVEN** [precondition] **WHEN** [action] **THEN** [expected result]
79
+ - **GIVEN** [precondition] **WHEN** [action] **THEN** [expected result]
80
+ ```
81
+
82
+ Rules for writing functional requirements:
83
+ - Use normative language: SHALL (mandatory), SHOULD (recommended), MAY (optional)
84
+ - P0 = must have for launch, P1 = should have for launch, P2 = nice to have / post-launch
85
+ - Every FR must be traceable to at least one user journey
86
+ - Every FR must have at least one acceptance criterion in GIVEN/WHEN/THEN format
87
+ - If a requirement cannot be tested, it is not a requirement — rewrite it until it can be
88
+
89
+ Present requirements in batches (5-7 at a time) for user review.
90
+
91
+ ### Step 5: Non-Functional Requirements
92
+
93
+ Define non-functional requirements using measurable thresholds:
94
+
95
+ ```markdown
96
+ ### NFR-001: [Requirement Name]
97
+ **Category:** Performance | Security | Scalability | Accessibility | Reliability | Usability
98
+ **Description:** The system SHALL [meet this measurable threshold].
99
+ **Measurement:** [How to verify this — specific metric, tool, or test]
100
+ **Target:** [Specific number or threshold]
101
+ ```
102
+
103
+ Cover these categories at minimum:
104
+ - **Performance:** Response times, throughput, resource limits
105
+ - **Security:** Authentication, authorization, data protection, input validation
106
+ - **Scalability:** Concurrent users, data volume growth, horizontal scaling
107
+ - **Accessibility:** WCAG level, keyboard navigation, screen reader support
108
+ - **Reliability:** Uptime target, error rate threshold, data durability
109
+
110
+ Every NFR MUST have a measurable target. "Fast" is not a target. "95th percentile response time under 200ms" is a target.
111
+
112
+ ### Step 6: Scope Definition
113
+
114
+ Expand on the brief's scope with more detail:
115
+
116
+ ```markdown
117
+ ## Scope
118
+
119
+ ### In Scope (v1)
120
+ - [Feature/capability with brief description]
121
+ - [Feature/capability with brief description]
122
+
123
+ ### Out of Scope (v1)
124
+ - [Feature/capability and WHY it's out — this prevents debates later]
125
+ - [Feature/capability and WHY it's out]
126
+
127
+ ### Future Considerations (v2+)
128
+ - [Feature that's explicitly deferred, not forgotten]
129
+ - [Feature that's explicitly deferred, not forgotten]
130
+ ```
131
+
132
+ ### Step 7: Success Metrics
133
+
134
+ Define quantifiable KPIs that determine if the product is succeeding:
135
+
136
+ ```markdown
137
+ ## Success Metrics
138
+
139
+ | Metric | Target | Measurement Method | Timeframe |
140
+ |--------|--------|-------------------|-----------|
141
+ | [metric name] | [specific number] | [how to measure] | [when to evaluate] |
142
+ ```
143
+
144
+ Each metric MUST be:
145
+ - Quantifiable (a number, percentage, or yes/no)
146
+ - Measurable (you can actually collect this data)
147
+ - Time-bound (when will you evaluate it)
148
+
149
+ ### Step 8: Review with User
150
+
151
+ Present the complete PRD to the user. Walk through each section:
152
+
153
+ 1. "Do the user journeys cover the critical paths?"
154
+ 2. "Are the functional requirements complete? Anything missing?"
155
+ 3. "Are the NFR targets realistic for your team and timeline?"
156
+ 4. "Is the scope boundary clear? Any gray areas?"
157
+ 5. "Are the success metrics ones you can actually measure?"
158
+
159
+ Iterate based on feedback. Track changes in a changelog at the bottom of the document.
160
+
161
+ ### Step 9: Save
162
+
163
+ 1. Write the final approved PRD to `docs/prd.md`.
164
+ 2. Confirm to the user:
165
+
166
+ ```
167
+ PRD saved: docs/prd.md
168
+ Status: Draft
169
+
170
+ Summary:
171
+ User types: [count]
172
+ User journeys: [count]
173
+ Functional requirements: [count] (P0: [n], P1: [n], P2: [n])
174
+ Non-functional requirements: [count]
175
+
176
+ Next: Run /specsafe-ux to define UX design foundations. UX precedes architecture in the canonical workflow.
177
+ ```
178
+
179
+ ## State Changes
180
+
181
+ - Create `docs/prd.md`
182
+ - No PROJECT_STATE.md changes (PRD is above the spec level)
183
+
184
+ ## Guardrails
185
+
186
+ - NEVER proceed without reading the product brief first
187
+ - NEVER write a functional requirement without acceptance criteria
188
+ - NEVER write a non-functional requirement without a measurable target
189
+ - NEVER invent requirements the user didn't express or imply — ask instead
190
+ - ALWAYS use normative language (SHALL/MUST/SHOULD/MAY) per RFC 2119
191
+ - ALWAYS trace functional requirements back to user journeys
192
+ - ALWAYS include Out of Scope with justification for each item
193
+
194
+ ## Handoff
195
+
196
+ Next skill: `/specsafe-ux` to define UX design foundations. UX precedes architecture in the canonical workflow — architecture should support the intended experience, not pre-empt it.
@@ -0,0 +1,7 @@
1
+ ---
2
+ name: specsafe-principles
3
+ description: Convert brainstorming output and early product thinking into a stable set of decision-making principles, non-goals, and quality priorities. Use before creating a product brief.
4
+ disable-model-invocation: true
5
+ ---
6
+
7
+ Read the file ./workflow.md now and follow every instruction in it step by step.