@codemcp/workflows-core 3.2.3 → 3.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,472 @@
1
+ # yaml-language-server: $schema=../state-machine-schema.json
2
+ ---
3
+ name: 'sdd-feature'
4
+ description: 'Unified specification-driven feature development and enhancement: Analyze → Specify → Clarify → Plan → Tasks → Implement'
5
+ initial_state: 'analyze'
6
+
7
+ # Enhanced metadata for better discoverability
8
+ metadata:
9
+ domain: 'sdd'
10
+ complexity: 'medium'
11
+ bestFor:
12
+ - 'Adding new features'
13
+ - 'Enhancing existing features'
14
+ - 'Iterative development'
15
+ - 'Feature improvements'
16
+ useCases:
17
+ - 'Add new functionality to existing project'
18
+ - 'Improve existing feature capabilities'
19
+ - 'Extend system functionality'
20
+ examples:
21
+ - 'Add user profile management'
22
+ - 'Enhance search functionality'
23
+ - 'Improve reporting capabilities'
24
+
25
+ # States with default instructions and transitions
26
+ states:
27
+ analyze:
28
+ description: 'Analyze current state and requirements (optional for new features)'
29
+ default_instructions: |
30
+ You are analyzing the current state to understand the context for this feature development.
31
+
32
+ **Analysis Tasks:**
33
+ 1. **For New Features**: This phase can be brief - focus on understanding:
34
+ - How this feature fits into the existing system
35
+ - Integration points with current functionality
36
+ - Existing patterns and conventions to follow
37
+
38
+ 2. **For Enhancements**: Conduct thorough analysis:
39
+ - Current implementation and its limitations
40
+ - User pain points and feedback
41
+ - Performance or usability issues
42
+ - Technical debt that should be addressed
43
+
44
+ 3. **Context Gathering**:
45
+ - Review existing codebase and architecture
46
+ - Understand current user workflows
47
+ - Identify constraints and dependencies
48
+ - Document assumptions about the current state
49
+
50
+ **Output**: Create `$VIBE_DIR/specs/$BRANCH_NAME/current-state-analysis.md` documenting your findings. For simple new features, this can be brief. For enhancements, be comprehensive.
51
+
52
+ **Skip Option**: If this is a straightforward new feature with clear requirements, you can proceed directly to specification.
53
+
54
+ transitions:
55
+ - trigger: 'analysis_complete'
56
+ to: 'specify'
57
+ transition_reason: 'Analysis completed, ready to create feature specification'
58
+
59
+ - trigger: 'skip_analysis'
60
+ to: 'specify'
61
+ instructions: >
62
+ Skipping analysis phase for straightforward new feature. Proceed directly to specification
63
+ creation using the provided requirements.
64
+ transition_reason: 'Analysis not needed for this feature, proceeding to specification'
65
+
66
+ specify:
67
+ description: 'Create feature specification'
68
+ default_instructions: |
69
+ You are creating the feature specification that will guide all development decisions.
70
+
71
+ **Specification Process:**
72
+
73
+ 1. **Parse Requirements**: Extract key concepts from the user's description
74
+ - Identify: actors, actions, data, constraints
75
+ - Consider existing system context (from analysis if performed)
76
+ - Focus on WHAT users need and WHY, not HOW to implement
77
+
78
+ 2. **Interactive Requirements Gathering**: Ask clarifying questions about:
79
+ - **Integration Points**: How should this integrate with existing features?
80
+ - **User Impact**: Which existing users will be affected?
81
+ - **Data Dependencies**: What existing data does this feature need?
82
+ - **Performance**: Any specific performance requirements for this feature?
83
+ - **Compatibility**: Any backward compatibility concerns?
84
+
85
+ 3. **Handle Ambiguities Systematically**:
86
+ - Make informed guesses based on context, existing patterns, and industry standards
87
+ - Only use [NEEDS CLARIFICATION: specific question] for critical decisions that:
88
+ - Significantly impact feature scope or user experience
89
+ - Have multiple reasonable interpretations with different implications
90
+ - Lack any reasonable default
91
+ - **LIMIT: Maximum 3 [NEEDS CLARIFICATION] markers total**
92
+ - Prioritize: scope > security/privacy > user experience > technical details
93
+
94
+ 4. **Quality Validation**:
95
+ - No implementation details (languages, frameworks, APIs)
96
+ - Written for non-technical stakeholders
97
+ - All requirements are testable
98
+ - Success criteria are measurable and technology-agnostic
99
+ - Considers existing system constraints
100
+
101
+ Create `$VIBE_DIR/specs/$BRANCH_NAME/spec.md` using the template provided below.
102
+ additional_instructions: |
103
+ **Feature Specification Template:**
104
+
105
+ Use this template to create your `spec.md` file:
106
+
107
+ ```markdown
108
+ # Feature Specification: [FEATURE NAME]
109
+
110
+ **Created**: [DATE]
111
+ **Status**: Draft
112
+
113
+ ## User Scenarios & Testing *(mandatory)*
114
+
115
+ ### User Story 1 - [Brief Title] (Priority: P1)
116
+
117
+ [Describe this user journey in plain language]
118
+
119
+ **Why this priority**: [Explain the value and why it has this priority level]
120
+
121
+ **Independent Test**: [Describe how this can be tested independently]
122
+
123
+ **Acceptance Scenarios**:
124
+ 1. **Given** [initial state], **When** [action], **Then** [expected outcome]
125
+ 2. **Given** [initial state], **When** [action], **Then** [expected outcome]
126
+
127
+ ---
128
+
129
+ ### User Story 2 - [Brief Title] (Priority: P2)
130
+
131
+ [Describe this user journey in plain language]
132
+
133
+ **Why this priority**: [Explain the value and why it has this priority level]
134
+
135
+ **Independent Test**: [Describe how this can be tested independently]
136
+
137
+ **Acceptance Scenarios**:
138
+ 1. **Given** [initial state], **When** [action], **Then** [expected outcome]
139
+
140
+ ---
141
+
142
+ [Add more user stories as needed, each with an assigned priority]
143
+
144
+ ### Edge Cases
145
+
146
+ - What happens when [boundary condition]?
147
+ - How does system handle [error scenario]?
148
+
149
+ ## Requirements *(mandatory)*
150
+
151
+ ### Functional Requirements
152
+
153
+ - **FR-001**: System MUST [specific capability]
154
+ - **FR-002**: System MUST [specific capability]
155
+ - **FR-003**: Users MUST be able to [key interaction]
156
+ - **FR-004**: System MUST [data requirement]
157
+ - **FR-005**: System MUST [behavior]
158
+
159
+ ### Key Entities *(include if feature involves data)*
160
+
161
+ - **[Entity 1]**: [What it represents, key attributes without implementation]
162
+ - **[Entity 2]**: [What it represents, relationships to other entities]
163
+
164
+ ## Success Criteria *(mandatory)*
165
+
166
+ ### Measurable Outcomes
167
+
168
+ - **SC-001**: [Measurable metric, e.g., "Users can complete task in under 2 minutes"]
169
+ - **SC-002**: [Measurable metric, e.g., "System handles 1000 concurrent users"]
170
+ - **SC-003**: [User satisfaction metric, e.g., "90% task completion rate"]
171
+ - **SC-004**: [Business metric, e.g., "Reduce support tickets by 50%"]
172
+
173
+ ## Integration Points
174
+
175
+ - [How this connects with existing functionality]
176
+ - [Dependencies on existing components]
177
+
178
+ ## Assumptions
179
+
180
+ - [Document any assumptions made during specification]
181
+ - [Include reasonable defaults chosen]
182
+
183
+ ## Dependencies
184
+
185
+ - [External systems or prerequisites]
186
+ - [Integration requirements]
187
+ ```
188
+
189
+ Fill in all sections with specific details for your feature. Consider how this integrates with the existing system.
190
+
191
+ transitions:
192
+ - trigger: 'specification_complete'
193
+ to: 'clarify'
194
+ transition_reason: 'Feature specification completed, ready for clarification review'
195
+
196
+ - trigger: 'needs_clarification'
197
+ to: 'specify'
198
+ instructions: >
199
+ Specification has unresolved clarifications. Present structured questions to the user,
200
+ wait for their responses, then update the specification accordingly.
201
+ transition_reason: 'Specification needs user clarification before proceeding'
202
+
203
+ clarify:
204
+ description: 'Review and clarify specification details'
205
+ default_instructions: |
206
+ You are reviewing the specification for completeness and clarity.
207
+
208
+ **Clarification Process:**
209
+
210
+ 1. **Specification Review**:
211
+ - Check for any remaining [NEEDS CLARIFICATION] markers
212
+ - Verify all functional requirements are testable
213
+ - Ensure success criteria are measurable
214
+ - Validate user scenarios are complete
215
+
216
+ 2. **Handle Remaining Clarifications**:
217
+ If [NEEDS CLARIFICATION] markers exist:
218
+ - Extract all markers from the spec
219
+ - For each clarification (max 3), present options in structured format:
220
+ ```
221
+ ## Question [N]: [Topic]
222
+ **Context**: [Quote relevant spec section]
223
+ **What we need to know**: [Specific question]
224
+ **Suggested Answers**:
225
+ | Option | Answer | Implications |
226
+ |--------|--------|--------------|
227
+ | A | [First option] | [Impact on feature] |
228
+ | B | [Second option] | [Impact on feature] |
229
+ | C | [Third option] | [Impact on feature] |
230
+ ```
231
+ - Wait for user responses
232
+ - Update specification with chosen answers
233
+
234
+ 3. **Final Validation**:
235
+ - Ensure no implementation details leaked in
236
+ - Verify requirements align with existing system
237
+ - Confirm specification is ready for planning
238
+
239
+ **Output**: Updated `$VIBE_DIR/specs/$BRANCH_NAME/spec.md` with all clarifications resolved and ready for implementation planning.
240
+
241
+ transitions:
242
+ - trigger: 'clarification_complete'
243
+ to: 'plan'
244
+ transition_reason: 'All clarifications resolved, specification ready for implementation planning'
245
+
246
+ - trigger: 'needs_user_input'
247
+ to: 'clarify'
248
+ instructions: >
249
+ Waiting for user responses to clarification questions. Present the questions clearly
250
+ and wait for user input before proceeding.
251
+ transition_reason: 'Waiting for user input on clarification questions'
252
+
253
+ plan:
254
+ description: 'Generate implementation plan with constitutional compliance'
255
+ default_instructions: |
256
+ You are creating the implementation plan, considering existing system architecture.
257
+
258
+ **Planning Process:**
259
+
260
+ 1. **Load Context**:
261
+ - Read the feature specification (`$VIBE_DIR/specs/$BRANCH_NAME/spec.md`)
262
+ - Read analysis findings (`$VIBE_DIR/specs/$BRANCH_NAME/current-state-analysis.md` if exists)
263
+ - Review existing project constitution or architectural principles
264
+ - Understand current system architecture and patterns
265
+
266
+ 2. **Interactive Integration Planning**: Ask the user about:
267
+ - **Technology Consistency**: Should this use the same tech stack as existing features?
268
+ - **Architecture Alignment**: How should this fit into the current architecture?
269
+ - **Database Changes**: Any new data models or schema changes needed?
270
+
271
+ 3. **Technical Context Analysis**:
272
+ - Identify how this feature integrates with existing system
273
+ - Map dependencies and integration points
274
+ - Choose appropriate technology stack (consistent with existing)
275
+ - Mark unknowns as "NEEDS CLARIFICATION" for research
276
+
277
+ 4. **Constitutional/Architectural Compliance**:
278
+ - Evaluate approach against existing architectural principles
279
+ - Ensure consistency with current patterns and conventions
280
+ - Identify any violations and justify or resolve them
281
+
282
+ 5. **Phase 0 - Research & Decisions**:
283
+ - For each unknown → research task
284
+ - For each integration point → compatibility analysis
285
+ - Generate `$VIBE_DIR/specs/$BRANCH_NAME/technology-research.md` with decisions and rationale
286
+
287
+ 6. **Phase 1 - High-Level Integration Design**:
288
+ - Document how this feature integrates with existing architecture
289
+ - Identify integration points and dependencies
290
+ - Plan compatibility and migration requirements
291
+
292
+ 7. **Integration Strategy**:
293
+ - Plan how to integrate with existing codebase
294
+ - Identify migration or compatibility requirements
295
+ - Document rollout strategy if needed
296
+
297
+ Create `$VIBE_DIR/specs/$BRANCH_NAME/plan.md` with complete implementation strategy that respects existing system architecture.
298
+
299
+ transitions:
300
+ - trigger: 'plan_complete'
301
+ to: 'tasks'
302
+ transition_reason: 'Implementation plan completed, ready to generate actionable tasks'
303
+
304
+ - trigger: 'architectural_conflict'
305
+ to: 'plan'
306
+ instructions: >
307
+ Implementation plan conflicts with existing architecture or principles.
308
+ Review and revise the approach to ensure proper integration.
309
+ transition_reason: 'Plan conflicts with existing architecture, needs revision'
310
+
311
+ tasks:
312
+ description: 'Generate actionable, dependency-ordered tasks organized by user stories'
313
+ default_instructions: |
314
+ You are generating actionable tasks organized by user stories for independent implementation.
315
+
316
+ **Task Generation Process:**
317
+
318
+ 1. **Load Design Documents**:
319
+ - **Required**: `$VIBE_DIR/specs/$BRANCH_NAME/plan.md`, `$VIBE_DIR/specs/$BRANCH_NAME/spec.md` (user stories with priorities)
320
+ - **Optional**: `$VIBE_DIR/specs/$BRANCH_NAME/technology-research.md`, `$VIBE_DIR/specs/$BRANCH_NAME/current-state-analysis.md`
321
+
322
+ 2. **Extract User Stories**: Load $VIBE_DIR/specs/$BRANCH_NAME/spec.md and extract user stories with priorities (P1, P2, P3...)
323
+
324
+ 3. **Generate Tasks Organized by User Story**:
325
+ - **Setup Phase**: Integration setup and shared infrastructure
326
+ - **Foundational Phase**: Prerequisites for this feature (database changes, etc.)
327
+ - **User Story Phases** (P1, P2, P3...): One phase per story in priority order
328
+ - Group all tasks needed to complete JUST that story
329
+ - Include models, services, endpoints, UI components specific to that story
330
+ - Consider integration with existing components
331
+ - Mark parallelizable tasks with [P]
332
+ - Each story should be independently testable
333
+
334
+ 4. **Integration Tasks**:
335
+ - Tasks for connecting with existing system
336
+ - Migration or compatibility tasks if needed
337
+ - Testing integration points
338
+
339
+ 5. **Task Rules**:
340
+ - Different files/components = mark [P] for parallel execution
341
+ - Same file = sequential (no [P])
342
+ - Number tasks sequentially (T001, T002...)
343
+ - Each task specific enough for LLM to complete
344
+
345
+ 6. **Rollout Strategy**: Plan for gradual feature rollout if applicable
346
+
347
+ additional_instructions: |
348
+ **Document Creation Instructions:**
349
+
350
+ Create these documents in the following order:
351
+
352
+ **1. Data Model (`$VIBE_DIR/specs/$BRANCH_NAME/data-model.md`)**:
353
+ - Extract entities from the specification
354
+ - Design data models that integrate with existing system
355
+ - Document relationships with existing entities
356
+ - Include migration requirements if needed
357
+
358
+ **2. API Contracts (`$VIBE_DIR/specs/$BRANCH_NAME/contracts/`)**:
359
+ - Design API contracts that integrate with existing system
360
+ - Ensure compatibility with existing data models and APIs
361
+ - Include versioning strategy if needed
362
+ - Document integration points
363
+
364
+ **3. Development Setup (`$VIBE_DIR/specs/$BRANCH_NAME/quickstart.md`)**:
365
+ - Feature development setup instructions
366
+ - Integration testing setup
367
+ - Local development environment for this feature
368
+ - Testing instructions specific to this feature
369
+
370
+ **4. Task Breakdown (`$VIBE_DIR/specs/$BRANCH_NAME/tasks.md`)**:
371
+ Use this structure for the tasks file:
372
+
373
+ ```markdown
374
+ # Feature Implementation Tasks: [FEATURE NAME]
375
+
376
+ ## Setup Phase
377
+ - T001: [Integration setup] [P]
378
+ - T002: [Shared infrastructure]
379
+
380
+ ## Foundational Phase
381
+ - T003: [Database changes for feature]
382
+ - T004: [Dependencies setup] [P]
383
+
384
+ ## User Story 1 (P1): [Story Title]
385
+ **Goal**: [What this story achieves]
386
+ **Independent Test**: [How to test this story alone]
387
+ **Integration Points**: [How this connects to existing system]
388
+
389
+ - T005: [Model for this story] [P]
390
+ - T006: [Service integration] [P]
391
+ - T007: [API endpoint with existing system]
392
+ - T008: [UI component integration] [P]
393
+
394
+ ## User Story 2 (P2): [Story Title]
395
+ [Continue pattern...]
396
+
397
+ ## Integration Tasks
398
+ - T0XX: [Connect with existing system]
399
+ - T0XX: [Migration tasks if needed]
400
+ - T0XX: [Integration testing]
401
+
402
+ ## Dependencies
403
+ - Story 1 → Story 2 (if applicable)
404
+ - Integration dependencies with existing features
405
+
406
+ ## Rollout Strategy
407
+ [Plan for gradual feature rollout if applicable]
408
+ ```
409
+
410
+ transitions:
411
+ - trigger: 'tasks_generated'
412
+ to: 'implement'
413
+ transition_reason: 'Tasks generated and organized, ready for implementation'
414
+
415
+ implement:
416
+ description: 'Execute implementation following the task breakdown'
417
+ default_instructions: |
418
+ You are implementing the feature by executing the tasks defined in `$VIBE_DIR/specs/$BRANCH_NAME/tasks.md`, ensuring proper integration with the existing system.
419
+
420
+ **Implementation Guidelines:**
421
+ 1. **Follow Task Order**: Execute tasks respecting dependencies and integration requirements
422
+ 2. **System Integration**: Ensure new code follows existing patterns and conventions
423
+ 3. **User Story Focus**: Complete one user story at a time for incremental delivery
424
+ 4. **Quality Gates**: Each user story must meet success criteria from specification
425
+ 5. **Testing**: Test both new functionality and integration with existing features
426
+ 6. **Documentation**: Update existing documentation as needed
427
+
428
+ **Integration Considerations**:
429
+ - Follow existing code style and patterns
430
+ - Respect current architectural decisions
431
+ - Test integration points thoroughly
432
+ - Consider backward compatibility
433
+ - Update relevant configuration or setup
434
+
435
+ **Progress Tracking**:
436
+ - Mark completed tasks with [x] in `$VIBE_DIR/specs/$BRANCH_NAME/tasks.md`
437
+ - Document any integration challenges or decisions
438
+ - Update specification if requirements evolve
439
+
440
+ Focus on delivering working, tested increments that integrate seamlessly with the existing system.
441
+
442
+ transitions:
443
+ - trigger: 'implementation_complete'
444
+ to: 'implement'
445
+ instructions: >
446
+ Feature implementation completed successfully. All user stories have been implemented,
447
+ tested, and integrated with the existing system. The feature meets the success criteria
448
+ defined in the specification.
449
+ transition_reason: 'Implementation complete, feature ready for use'
450
+
451
+ - trigger: 'implementation_blocked'
452
+ to: 'plan'
453
+ instructions: >
454
+ Implementation is blocked by integration issues or technical challenges.
455
+ Return to planning to resolve the blockers and update the approach.
456
+ transition_reason: 'Implementation blocked, need to revise plan'
457
+
458
+ - trigger: 'integration_issues'
459
+ to: 'analyze'
460
+ instructions: >
461
+ Significant integration issues discovered that require better understanding
462
+ of the existing system. Return to analysis to gather more context.
463
+ transition_reason: 'Integration issues require deeper system analysis'
464
+
465
+ # Global transitions available from any state
466
+ global_transitions:
467
+ - trigger: 'abandon_feature'
468
+ to: 'analyze'
469
+ instructions: >
470
+ Feature development abandoned. If you want to restart, you'll begin again with
471
+ analyzing the requirements and current state.
472
+ transition_reason: 'Feature abandoned, restart from beginning'