Skip to content

Commit 948bb83

Browse files
authored
refactor(prompts): improve spec generation workflow and task list formatting (#30)
* refactor(prompts): reorganize generate-spec workflow steps - Add dedicated Step 1 for spec directory creation - Renumber all subsequent steps (1→2, 2→3, etc.) - Add Questions File Workflow for iterative Q&A process - Update all step references throughout document - Fix typo: 'pre-existing' * docs(prompts): improve task list format with hierarchical structure Update generate-task-list-from-spec prompt to use hierarchical markdown structure for better readability. - Change from flat bullet lists to hierarchical headers (### and ####) - Convert Demo Criteria and Proof Artifacts to bulleted lists - Add TBD placeholder for Tasks section in Phase 2 output format * docs(prompts): remove redundant instruction from iterative process Remove bullet point about handling clarification requests in the current questions file, as this is already covered by the workflow steps above. * docs(prompts): add validation report output location Add 'Saving The Output' section specifying where validation reports should be saved, aligning with other workflow output file locations in the spec directory structure. * docs(prompts): add example format for clarifying questions Add a generic example template showing the expected format for clarifying questions with numbered questions, lettered options, and checkboxes. Remove redundant instruction about providing multiple choice answers. * refactor(prompts): consolidate functional requirements into demoable units Move functional requirements from separate section into each Demoable Unit to make specs more self-contained and easier to read. Each unit now contains all requirements needed for implementation, reducing cross-referencing and making the spec structure more actionable. * refactor(prompts): remove demo criteria, consolidate into proof artifacts Remove separate 'Demo Criteria' sections and consolidate verification into self-documenting proof artifacts. Each proof artifact now describes what it demonstrates (e.g., 'Screenshot: `--help` output demonstrates new command exists'). Changes: - Remove Demo Criteria from spec and task list templates - Update proof artifacts format to include descriptive language - Update all workflow references from demo criteria to proof artifacts - Rename 'Evidence & Output' to 'Verification Result' in validation table - Update all verification checklists to focus on proof artifacts This simplifies the workflow by making proof artifacts the single source of truth for what needs to be demonstrated. * refactor(prompts): align validation to focus on proof artifacts Refactor validation process to consistently focus on proof artifact verification rather than code implementation analysis. This improves cohesion and clarity throughout the validation prompt. Changes: - Update Evaluation Rubric (R1, R5) to focus on proof artifacts - Refactor Step 4 verification to test proof artifacts instead of searching code files - Rename 'Requirement Implementation' to 'Requirement Coverage' - Update Coverage Matrix examples to use proof artifact results - Restructure Validation Issues section with clearer format and table examples - Remove code analysis directives (line numbers, file content checks) - Add commit log analysis to repository compliance checks This aligns validation with its stated goal: verifying proof artifacts demonstrate spec requirements, not analyzing code implementation. * fix(prompts): enforce wait for user answers in spec generation Add explicit STOP AND WAIT instructions to prevent AI from jumping straight from creating clarifying questions to generating the spec without waiting for user responses. Reorganize workflow section for better clarity and add critical enforcement points. * refactor(prompts): improve clarity and enforceability in spec generation - Rename sections for better clarity (Process Overview → Spec Generation Overview) - Add explicit requirement to report scope assessment results - Make context assessment required instead of optional - Standardize question format with uppercase option letters - Remove redundant Final Instructions section - Improve formatting consistency throughout * fix: add missing space
1 parent c3ccfd7 commit 948bb83

File tree

4 files changed

+265
-146
lines changed

4 files changed

+265
-146
lines changed

prompts/generate-spec.md

Lines changed: 120 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,14 @@ This spec serves as the **planning blueprint** for the entire SDD workflow:
2929

3030
**Critical Dependencies:**
3131

32-
- **User Stories** become the basis for task demo criteria
32+
- **User Stories** become the basis for proof artifacts in task generation
3333
- **Functional Requirements** drive implementation task breakdown
3434
- **Technical Considerations** inform architecture and dependency decisions
3535
- **Demoable Units** become parent task boundaries in task generation
3636

3737
**What Breaks the Chain:**
3838

39-
- Vague user stories → unclear demo criteria and task boundaries
39+
- Vague user stories → unclear proof artifacts and task boundaries
4040
- Missing functional requirements → gaps in implementation coverage
4141
- Inadequate technical considerations → architectural conflicts during implementation
4242
- Oversized specs → unmanageable task breakdown and loss of incremental progress
@@ -51,24 +51,54 @@ To create a comprehensive Specification (Spec) based on an initial user input. T
5151

5252
If the user did not include an initial input or reference for the spec, ask the user to provide this input before proceeding.
5353

54-
## Process Overview
54+
## Spec Generation Overview
5555

56-
Follow this exact sequence:
56+
1. **Create Spec Directory** - Create `./docs/specs/[NN]-spec-[feature-name]/` directory structure
57+
2. **Context Assessment** - Review existing codebase for relevant patterns and constraints
58+
3. **Initial Scope Assessment** - Evaluate if the feature is appropriately sized for this workflow
59+
4. **Clarifying Questions** - Gather detailed requirements through structured inquiry
60+
5. **Spec Generation** - Create the detailed specification document
61+
6. **Review and Refine** - Validate completeness and clarity with the user
5762

58-
1. **Initial Scope Assessment** - Evaluate if the feature is appropriately sized for this workflow
59-
2. **Clarifying Questions** - Gather detailed requirements through structured inquiry
60-
3. **Context Assessment** - Review existing codebase for relevant patterns and constraints (optional)
61-
4. **Spec Generation** - Create the detailed specification document
62-
5. **Review and Refine** - Validate completeness and clarity with the user
63+
## Step 1: Create Spec Directory
6364

64-
## Step 1: Initial Scope Assessment
65+
Create the spec directory structure before proceeding with any other steps. This ensures all files (questions, spec, tasks, proofs) have a consistent location.
6566

66-
Before asking questions, evaluate whether this feature request is appropriately sized for this spec-driven workflow.
67+
**Directory Structure:**
68+
69+
- **Path**: `./docs/specs/[NN]-spec-[feature-name]/` where `[NN]` is a zero-padded 2-digit sequence number (e.g., `01`, `02`, `03`)
70+
- **Naming Convention**: Use lowercase with hyphens for the feature name
71+
- **Examples**: `01-spec-user-authentication/`, `02-spec-payment-integration/`, etc.
72+
73+
**Verification**: Confirm the directory exists before proceeding to Step 2.
74+
75+
## Step 2: Context Assessment
76+
77+
If working in a pre-existing project, begin by briefly reviewing the codebase and existing docs to understand:
78+
79+
- Current architecture patterns and conventions
80+
- Relevant existing components or features
81+
- Integration constraints or dependencies
82+
- Files that might need modification or extension
83+
- **Repository Standards and Patterns**: Identify existing coding standards, architectural patterns, and development practices from:
84+
- Project documentation (README.md, CONTRIBUTING.md, docs/)
85+
- AI specific documentation (AGENTS.md, CLAUDE.md)
86+
- Configuration files (package.json, Cargo.toml, pyproject.toml, etc.)
87+
- Existing code structure and naming conventions
88+
- Testing patterns and quality assurance practices
89+
- Commit message conventions and development workflows
90+
91+
**Use this context to inform scope validation and requirements, not to drive technical decisions.** Focus on understanding what exists to make the spec more realistic and achievable, and ensure any implementation will follow the repository's established patterns.
92+
93+
## Step 3: Initial Scope Assessment
94+
95+
Evaluate whether this feature request is appropriately sized for this spec-driven workflow.
6796

6897
**Chain-of-thought reasoning:**
6998

7099
- Consider the complexity and scope of the requested feature
71100
- Compare against the following examples
101+
- Use context from Step 2 to inform the assessment
72102
- If scope is too large, suggest breaking into smaller specs
73103
- If scope is too small, suggest direct implementation without formal spec
74104

@@ -102,13 +132,16 @@ Before asking questions, evaluate whether this feature request is appropriately
102132
- Creating a single database migration with rollback capability
103133
- Implementing one user story with complete end-to-end flow
104134

105-
If the scope appears inappropriate, inform the user and suggest alternatives before proceeding.
135+
### Report Scope Assessment To User
106136

107-
## Step 2: Clarifying Questions
137+
- **ALWAYS** inform the user of the result of the scope assessment.
138+
- If the scope appears inappropriate, **ALWAYS** pause the conversation to suggest alternatives and get input from the user.
108139

109-
Ask clarifying questions to gather sufficient detail. **Always provide numbered or lettered options** to allow the user to make selections easily by responding with *"1A, 2B, 3C"*, etc. Focus on understanding the "what" and "why" rather than the "how."
140+
## Step 4: Clarifying Questions
110141

111-
Adapt your questions based on the user's input. Use the following common areas to guide your questions:
142+
Ask clarifying questions to gather sufficient detail. Focus on understanding the "what" and "why" rather than the "how."
143+
144+
Use the following common areas to guide your questions:
112145

113146
**Core Understanding:**
114147

@@ -126,31 +159,61 @@ Adapt your questions based on the user's input. Use the following common areas t
126159
- Any existing design mockups or UI guidelines to follow?
127160
- Are there any technical constraints or integration requirements?
128161

129-
**Demo & Proof:**
162+
**Proof Artifacts:**
130163

131-
- How will we demonstrate this feature works?
132-
- What proof artifacts will we need (URLs, CLI output, screenshots)?
164+
- What proof artifacts will demonstrate this feature works (URLs, CLI output, screenshots)?
165+
- What will each artifact demonstrate about the feature?
133166

134167
**Progressive Disclosure:** Start with Core Understanding, then expand based on feature complexity and user responses.
135168

136-
## Step 3: Context Assessment (Optional)
169+
### Questions File Format
137170

138-
If the feature involves existing systems, briefly review the codebase and existing docs to understand:
171+
Follow this format exactly when you create the questions file.
139172

140-
- Current architecture patterns and conventions
141-
- Relevant existing components or features
142-
- Integration constraints or dependencies
143-
- Files that might need modification or extension
144-
- **Repository Standards and Patterns**: Identify existing coding standards, architectural patterns, and development practices from:
145-
- Project documentation (README.md, CONTRIBUTING.md, docs/)
146-
- Configuration files (package.json, Cargo.toml, pyproject.toml, etc.)
147-
- Existing code structure and naming conventions
148-
- Testing patterns and quality assurance practices
149-
- Commit message conventions and development workflows
173+
```markdown
174+
# [NN] Questions Round 1 - [Feature Name]
150175

151-
**Use this context to inform scope validation and requirements, not to drive technical decisions.** Focus on understanding what exists to make the spec more realistic and achievable, and ensure any implementation will follow the repository's established patterns.
176+
Please answer each question below (select one or more options, or add your own notes). Feel free to add additional context under any question.
152177

153-
## Step 4: Spec Generation
178+
## 1. [Question Category/Topic]
179+
180+
[What specific aspect of the feature needs clarification?]
181+
182+
- [ ] (A) [Option description explaining what this choice means]
183+
- [ ] (B) [Option description explaining what this choice means]
184+
- [ ] (C) [Option description explaining what this choice means]
185+
- [ ] (D) [Option description explaining what this choice means]
186+
- [ ] (E) Other (describe)
187+
188+
## 2. [Another Question Category/Topic]
189+
190+
[What specific aspect of the feature needs clarification?]
191+
192+
- [ ] (A) [Option description explaining what this choice means]
193+
- [ ] (B) [Option description explaining what this choice means]
194+
- [ ] (C) [Option description explaining what this choice means]
195+
- [ ] (D) [Option description explaining what this choice means]
196+
- [ ] (E) Other (describe)
197+
```
198+
199+
### Questions File Process
200+
201+
1. **Create Questions File**: Save questions to a file named `[NN]-questions-[N]-[feature-name].md` where `[N]` is the round number (starting at 1, incrementing for each new round).
202+
2. **Point User to File**: Direct the user to the questions file and instruct them to answer the questions directly in the file.
203+
3. **STOP AND WAIT**: Do not proceed to Step 5. Wait for the user to indicate they have saved their answers.
204+
4. **Read Answers**: After the user indicates they have saved their answers, read the file and continue the conversation.
205+
5. **Follow-Up Rounds**: If answers reveal new questions, create a new questions file with incremented round number (`[NN]-questions-[N+1]-[feature-name].md`) and repeat the process (return to step 3).
206+
207+
**Iterative Process:**
208+
209+
- If a user's answer reveals new questions or areas needing clarification, ask follow-up questions in a new questions file.
210+
- Build on previous answers - use context from earlier responses to inform subsequent questions.
211+
- **CRITICAL**: After creating any questions file, you MUST STOP and wait for the user to provide answers before proceeding.
212+
- Only proceed to Step 5 after:
213+
- You have received and reviewed all user answers to clarifying questions
214+
- You have enough detail to populate all spec sections (User Stories, Demoable Units with functional requirements, etc.).
215+
216+
## Step 5: Spec Generation
154217

155218
Generate a comprehensive specification using this exact structure:
156219

@@ -174,22 +237,31 @@ Generate a comprehensive specification using this exact structure:
174237
[Focus on tangible progress and WHAT will be demonstrated. Define 2-4 small, end-to-end vertical slices using the format below.]
175238

176239
### [Unit 1]: [Title]
240+
177241
**Purpose:** [What this slice accomplishes and who it serves]
178-
**Demo Criteria:** [What will be shown to verify working value]
179-
**Proof Artifacts:** [Tangible evidence - URLs, CLI commands, test names, screenshots]
242+
243+
**Functional Requirements:**
244+
- The system shall [requirement 1: clear, testable, unambiguous]
245+
- The system shall [requirement 2: clear, testable, unambiguous]
246+
- The user shall [requirement 3: clear, testable, unambiguous]
247+
248+
**Proof Artifacts:**
249+
- [Artifact type]: [description] demonstrates [what it proves]
250+
- Example: `Screenshot: `--help` output demonstrates new command exists`
251+
- Example: `CLI: `command --flag` returns expected output demonstrates feature works`
180252

181253
### [Unit 2]: [Title]
182-
**Purpose:** [What this slice accomplishes and who it serves]
183-
**Demo Criteria:** [What will be shown to verify working value]
184-
**Proof Artifacts:** [Tangible evidence - URLs, CLI commands, test names, screenshots]
185254

186-
## Functional Requirements
255+
**Purpose:** [What this slice accomplishes and who it serves]
187256

188-
[Focus on system behavior and WHAT the system must do. Each should start with "The system shall..." or "The user shall..."]
257+
**Functional Requirements:**
258+
- The system shall [requirement 1: clear, testable, unambiguous]
259+
- The system shall [requirement 2: clear, testable, unambiguous]
189260

190-
1. [**Requirement 1**: clear, testable, unambiguous]
191-
2. [**Requirement 2**: clear, testable, unambiguous]
192-
3. [**Requirement 3**: clear, testable, unambiguous]
261+
**Proof Artifacts:**
262+
- [Artifact type]: [description] demonstrates [what it proves]
263+
- Example: `Test: MyFeature.test.ts passes demonstrates requirement implementation`
264+
- Example: `Order PDF: PDF downloaded from https://example.com/order-submitted shows completed flow demonstrates end-to-end functionality`
193265

194266
## Non-Goals (Out of Scope)
195267

@@ -206,12 +278,13 @@ Generate a comprehensive specification using this exact structure:
206278
## Repository Standards
207279

208280
[Identify existing patterns and practices that implementation should follow. Examples include:
281+
209282
- Coding standards and style guides from the repository
210283
- Architectural patterns and file organization
211284
- Testing conventions and quality assurance practices
212285
- Documentation patterns and commit conventions
213286
- Build and deployment workflows
214-
If no specific standards are identified, state "Follow established repository patterns and conventions."]
287+
If no specific standards are identified, state "Follow established repository patterns and conventions."]
215288

216289
## Technical Considerations
217290

@@ -233,7 +306,7 @@ If no specific standards are identified, state "Follow established repository pa
233306
2. [Question 2]
234307
```
235308

236-
## Step 5: Review and Refinement
309+
## Step 6: Review and Refinement
237310

238311
After generating the spec, present it to the user and ask:
239312

@@ -247,11 +320,10 @@ Iterate based on feedback until the user is satisfied.
247320
## Output Requirements
248321

249322
**Format:** Markdown (`.md`)
250-
**Directory:** Create `./docs/specs/[NN]-spec-[feature-name]/` where `[NN]` is a zero-padded 2-digit sequence number starting from 01 (e.g., `01`, `02`, `03`). For example, `01-spec-user-authentication/`, `02-spec-payment-integration/`, etc.
251323
**Full Path:** `./docs/specs/[NN]-spec-[feature-name]/[NN]-spec-[feature-name].md`
252-
**Example:** For feature "user authentication", create directory `01-spec-user-authentication/` and save file as `01-spec-user-authentication.md` inside it
324+
**Example:** For feature "user authentication", the spec directory would be `01-spec-user-authentication/` with a spec file as `01-spec-user-authentication.md` inside it
253325

254-
## Critical Constraints (Negative Instructions)
326+
## Critical Constraints
255327

256328
**NEVER:**
257329

@@ -265,31 +337,12 @@ Iterate based on feedback until the user is satisfied.
265337
**ALWAYS:**
266338

267339
- Ask clarifying questions before generating the spec
268-
- Provide numbered/lettered options for easy selection
269340
- Validate scope appropriateness before proceeding
270341
- Use the exact spec structure provided above
271342
- Ensure the spec is understandable by a junior developer
272-
- Include proof artifacts and demo criteria for each work unit
343+
- Include proof artifacts for each work unit that demonstrate what will be shown
273344
- Follow identified repository standards and patterns in all requirements
274345

275346
## What Comes Next
276347

277348
Once this spec is complete and approved, instruct the user to run `/generate-task-list-from-spec`. This will start the next step in the workflow, which is to break down the specification into actionable tasks.
278-
279-
## Final Instructions
280-
281-
Follow this exact sequence:
282-
283-
1. **Initial Scope Assessment**: Use the provided examples to evaluate if the feature is appropriately sized
284-
2. **Clarifying Questions**: Ask structured questions with numbered/lettered options for easy selection
285-
3. **Context Assessment**: Review existing codebase for relevant patterns and constraints (optional)
286-
4. **Spec Generation**: Create the spec using the exact structure provided
287-
- **Ensure each section has a distinct purpose** - avoid restating content from previous sections
288-
- **User Stories** focus on motivation and WHY
289-
- **Demoable Units** focus on tangible progress and WHAT will be shown
290-
- **Functional Requirements** focus on system behavior and WHAT the system must do
291-
- **Technical Considerations** focus on implementation constraints and HOW it will be built
292-
5. **Save**: Create directory `./docs/specs/[NN]-spec-[feature-name]/` and save file as `[NN]-spec-[feature-name].md` inside it
293-
6. **Review and Refine**: Validate completeness and clarity with the user
294-
7. **Guide User**: Direct user to the next workflow step (`/generate-task-list-from-spec`)
295-
8. **Stop**: Stop working once user confirms spec is complete

0 commit comments

Comments
 (0)