Examples & Case Studies
Relevant source files
The following files were used as context for generating this wiki page:- spec-process-guide/examples/README.md
- spec-process-guide/examples/simple-feature-spec.md
- spec-process-guide/examples/complex-system-spec.md
- spec-process-guide/examples/case-studies.md
- spec-process-guide/templates/micro-spec-template.md
- spec-process-guide/templates/design-template.md
- spec-process-guide/resources/standards.md
This section provides real-world case studies and complete specification examples to demonstrate the spec-driven development methodology in action. The examples cover a range of complexities, from simple features to large-scale systems, and illustrate the "spec trilogy"—the progression from Requirements, to Design, and finally to Tasks. Each example includes commentary on key decisions, implementation notes, and lessons learned, offering practical insights into the process.
The examples are categorized to help users find relevant scenarios, including simple features, complex systems, and domain-specific applications like e-commerce and financial transaction processing. These resources are intended to be used alongside the Process Guide and Ready-to-Use Templates to facilitate learning and adoption of the methodology.
Sources: spec-process-guide/examples/README.md
Example Categories
The repository provides examples categorized by complexity and scope. This allows developers and project managers to see how the spec process scales from minor changes to large, multi-service projects.
| Category | Description | Ideal Use Case |
|---|---|---|
| Micro Specs | Ultra-lightweight specs for changes under 1 day of effort. | Bug fixes, copy changes, minor UI tweaks, config updates. |
| Simple Features | Complete spec trilogies for basic, self-contained features. | User authentication, form handling, single API endpoint. |
| Complex Systems | In-depth specs for large-scale, multi-component systems. | Multi-service architectures, data processing pipelines, real-time systems. |
Sources: spec-process-guide/examples/README.md:25-39, spec-process-guide/templates/micro-spec-template.md:9
When to Use Different Spec Types
The choice of spec type depends on the effort and complexity of the change. A simple decision flow helps determine whether a Micro, Quick, or Standard Spec is appropriate.
This diagram shows the decision process for choosing a spec template based on estimated effort.
Sources: spec-process-guide/templates/micro-spec-template.md:9, spec-process-guide/templates/micro-spec-template.md:91-101
Lightweight Spec Examples (Micro Specs)
Micro specs are designed for rapid documentation of small changes, typically taking less than five minutes to complete. They focus on the "What," "Why," and "How" of a change.
Sources: spec-process-guide/templates/micro-spec-template.md:9-15
Bug Fix: Login Button Alignment
This example shows a micro spec for a simple CSS fix.
| Field | Description |
|---|---|
| What | Fix login button that's misaligned on mobile devices. |
| Why | Button is partially cut off on screens smaller than 375px. |
| How | Update CSS media query in login.css to use flex-direction: column. |
| Acceptance | Login button is fully visible and clickable on screens >= 375px. |
| Files | styles/login.css |
Sources: spec-process-guide/templates/micro-spec-template.md:21-39
Configuration Update: Feature Flag
This example demonstrates a micro spec for a configuration change to enable a feature for a subset of users.
| Field | Description |
|---|---|
| What | Enable advanced_analytics feature flag for premium users. |
| Why | The premium feature is ready for release to paying customers. |
| How | Update feature flag config to check user subscription status. |
| Acceptance | Premium users see the analytics dashboard, free users do not. |
| Files | config/feature-flags.json |
Sources: spec-process-guide/templates/micro-spec-template.md:57-75
Simple Feature Spec: User Authentication
This example illustrates the full spec trilogy for a user authentication feature. It follows the standard process from requirements to design and finally to an actionable task list.
Sources: spec-process-guide/examples/simple-feature-spec.md
Requirements
The requirements are defined using User Stories and the EARS (Easy Approach to Requirements Syntax) format for acceptance criteria.
User Story: As a user, I want to log in to my account, so that I can access personalized content.
Acceptance Criteria (EARS Format):
| Type | Trigger / Condition | System Response |
|---|---|---|
| WHEN | a user provides valid credentials | the system SHALL authenticate the user and create a session. |
| WHEN | a user provides an invalid password | the system SHALL display an "Invalid credentials" error. |
| WHEN | a user attempts to log in with a locked account | the system SHALL display an "Account locked" message. |
| IF | a user is already logged in | the system SHALL redirect them to the dashboard. |
Sources: spec-process-guide/examples/simple-feature-spec.md, spec-process-guide/resources/standards.md:16-47
Design
The design document translates the requirements into a technical plan.
High-Level Architecture
The design proposes a standard client-server architecture for authentication.
This diagram shows the component interactions during a login request.
Sources: spec-process-guide/examples/simple-feature-spec.md, spec-process-guide/templates/design-template.md:41-46
Data Flow
A sequence diagram details the interactions between components over time.
This sequence illustrates the data flow for a successful user login.
Sources: spec-process-guide/examples/simple-feature-spec.md, spec-process-guide/templates/design-template.md:104-116
Tasks
The design is broken down into a sequence of concrete implementation tasks.
- Phase 1: Backend Setup
[ ] 1.1CreateUsermodel and database migration.[ ] 1.2ImplementUserRepositorywith afindByEmailmethod.[ ] 1.3ImplementAuthServicewith password hashing and verification logic.
- Phase 2: API Layer
[ ] 2.1CreatePOST /api/v1/loginendpoint.[ ] 2.2Add input validation for email and password.[ ] 2.3IntegrateAuthServiceto handle login logic and JWT generation.
- Phase 3: Frontend Implementation
[ ] 3.1Build the login form component.[ ] 3.2Implement state management for form inputs.[ ] 3.3Create a service to call the login API endpoint.[ ] 3.4Handle token storage and redirection upon successful login.
Sources: spec-process-guide/examples/simple-feature-spec.md, spec-process-guide/templates/tasks-template.md:33-87
Complex System Spec: Multi-Service API
This example outlines the design for a more complex system, such as a multi-service API architecture, demonstrating how the spec process scales.
Sources: spec-process-guide/examples/complex-system-spec.md
Architecture
System Context Diagram
This diagram shows how the feature fits within the broader system, including external dependencies.
This diagram illustrates the high-level system context for a multi-service e-commerce platform.
Sources: spec-process-guide/examples/complex-system-spec.md, spec-process-guide/templates/design-template.md:32-37
Technology Stack
The design specifies the technology for each layer of the architecture.
| Layer | Technology | Rationale |
|---|---|---|
| API Gateway | NGINX | High performance, robust routing capabilities. |
| Backend Services | Node.js (TypeScript) | Asynchronous, good for I/O-bound microservices. |
| Database | PostgreSQL | Strong consistency, relational data integrity. |
| Messaging | RabbitMQ | Reliable asynchronous communication between services. |
Sources: spec-process-guide/examples/complex-system-spec.md, spec-process-guide/templates/design-template.md:48-55
API Design
The design includes detailed specifications for API endpoints.
Endpoint: Create Order
- Method:
POST - Path:
/api/v1/orders
Request Body:
{
"userId": "string",
"items": [
{
"productId": "string",
"quantity": "number"
}
],
"paymentDetails": {
"token": "string"
}
}
Error Responses:
| Status Code | Error Code | Description |
|---|---|---|
400 Bad Request | VALIDATION_ERROR | Input data is invalid (e.g., missing fields). |
401 Unauthorized | AUTH_ERROR | User is not authenticated. |
404 Not Found | PRODUCT_NOT_FOUND | A product in the order does not exist. |
500 Server Error | INTERNAL_ERROR | An unexpected error occurred. |
Sources: spec-process-guide/examples/complex-system-spec.md, spec-process-guide/templates/design-template.md:118-140, commands/create-steering-documents-standalone.md:126-135
Case Studies & Lessons Learned
Case studies provide insights into the application of the spec-driven process, highlighting successes and lessons learned.
Success Story: E-commerce Checkout Refactor
- Problem: The existing checkout flow was buggy, slow, and difficult to maintain.
- Process: A full spec trilogy was created. The Requirements phase identified 15 critical user stories and over 50 acceptance criteria. The Design phase proposed a new microservice-based architecture, separating concerns for inventory, payment, and shipping. The Tasks phase broke the work into 45 manageable development tasks.
- Outcome: The new checkout system was delivered with a 90% reduction in production bugs and a 50% improvement in page load times.
- Lesson Learned: Investing in a thorough design phase for complex systems prevents costly rework and identifies architectural flaws before a single line of code is written.
Sources: spec-process-guide/examples/case-studies.md
Pitfall: Incomplete Requirements for a Reporting Feature
- Problem: A new reporting feature was built based on vague requirements, leading to a tool that didn't meet user needs.
- Issue: The initial spec skipped a formal requirements phase and jumped straight to design. It missed key non-functional requirements around data freshness and export formats.
- Impact: The feature required a complete rewrite, doubling the development time and cost.
- Lesson Learned: Skipping the requirements phase is a false economy. Using structured formats like EARS ensures all functional and non-functional needs are captured and validated upfront.
Sources: spec-process-guide/examples/case-studies.md, skills/spec-driven-development/SKILL.md:104-107