- Version: 2.0
Generates complete implementation code, unit tests, integration tests, and browser tests for a story based on project context.
/plugin marketplace add ninthspace/claude-code-marketplace/plugin install sdd@ninthspace-marketplacePurpose: Generate complete implementation including production code, unit tests, integration tests, and browser tests using the project's actual technical stack and coding standards.
Syntax: /sdd:story-implement [story_id]
| Parameter | Type | Required | Default | Description | Validation |
|---|---|---|---|---|---|
| story_id | string | No | current branch | Story identifier (e.g., "STORY-001") | Must match pattern STORY-\d{3,} |
/docs/stories/development/[story-id].md/docs/project-context/ directory/docs/project-context/ directory exists/sdd:project-init first/docs/project-context/technical-stack.md:
/docs/project-context/coding-standards.md:
/docs/project-context/development-process.md:
DETERMINE story ID:
/docs/stories/development//sdd:story-startREAD story file at /docs/stories/development/[story-id].md
EXTRACT story requirements:
VALIDATE story is in development status:
/sdd:story-start firstGENERATE production code using DISCOVERED stack:
Frontend Components:
Backend Components:
Database Changes:
APPLY coding standards from coding-standards.md:
VERIFY generated code quality:
GENERATE unit tests using DISCOVERED test framework:
Test Framework Detection:
CREATE test cases covering:
APPLY DISCOVERED testing patterns:
ORGANIZE tests logically:
GENERATE integration tests for:
CREATE test scenarios covering:
USE DISCOVERED integration testing tools:
PARSE acceptance criteria from story file
GENERATE browser test file using DISCOVERED browser testing framework:
Framework-Specific Paths:
tests/Browser/[StoryId]Test.php (Dusk/Playwright)tests/e2e/[story-id].spec.js (Playwright/Cypress)tests/browser/test_[story_id].py (Playwright/Selenium)spec/features/[story_id]_spec.rb (Capybara)CREATE test methods for each acceptance criterion:
INCLUDE browser test patterns:
RUN unit tests using DISCOVERED commands:
npm test, vendor/bin/pest, pytest, go testRUN integration tests:
RUN browser tests:
ANALYZE test results:
RUN linter using DISCOVERED tool:
vendor/bin/pint, npm run lint, black, gofmtUPDATE Implementation Checklist in story file:
[x] Feature implementation (when core functionality complete)[x] Unit tests (when unit test suite passes)[x] Integration tests (when integration tests pass)[x] Browser tests (when browser tests pass)[x] Error handling (when error scenarios are handled)[x] Loading states (when UI loading states implemented)[x] Performance optimization (when performance requirements met)[x] Accessibility (when accessibility features implemented)[x] Security review (when security checks pass)[x] Documentation (when inline docs complete)ADD progress log entry:
NOTE implementation decisions:
โ
IMPLEMENTATION COMPLETE
============================
Story: [story-id] - [Title]
Stack: [Technologies Used]
Generated Files:
๐ Production Code:
- [list of production files with paths]
๐งช Unit Tests:
- [list of unit test files]
๐ Integration Tests:
- [list of integration test files]
๐ Browser Tests:
- [list of browser test files]
Test Results:
โ
Unit Tests: [X/X passed]
โ
Integration Tests: [X/X passed]
โ
Browser Tests: [X/X passed]
โ
Linting: Passed
Coverage: [X%]
Key Implementation Decisions:
- [Decision 1]
- [Decision 2]
Next Steps:
1. /sdd:story-save to commit implementation
2. /sdd:story-review to move to code review
3. Manual testing in browser at [URL]
INPUT:
/sdd:story-implement STORY-AUTH-001
PROCESS:
โ Loading project context from /docs/project-context/
โ Detected stack: Laravel 12 + Livewire 3 + Tailwind CSS 4 + Pest 4
โ Reading story: /docs/stories/development/STORY-AUTH-001.md
โ Story: Implement Login Form
โ Generating Livewire component...
โ Generating unit tests...
โ Generating feature tests...
โ Generating browser tests...
โ Running tests: vendor/bin/pest
โ All tests passing โ
โ Running linter: vendor/bin/pint
โ Code formatted โ
โ Updating story file...
OUTPUT:
โ
IMPLEMENTATION COMPLETE
============================
Story: STORY-AUTH-001 - Implement Login Form
Stack: Laravel 12, Livewire 3, Tailwind CSS 4, Alpine.js, Pest 4
Generated Files:
๐ Production Code:
- app/Livewire/Auth/LoginForm.php
- resources/views/livewire/auth/login-form.blade.php
- app/Http/Controllers/Auth/LoginController.php
๐งช Unit Tests:
- tests/Unit/Livewire/LoginFormTest.php
๐ Integration Tests:
- tests/Feature/Auth/LoginTest.php
๐ Browser Tests:
- tests/Browser/Auth/LoginFormTest.php
Test Results:
โ
Unit Tests: 8/8 passed
โ
Feature Tests: 5/5 passed
โ
Browser Tests: 4/4 passed
โ
Linting: Passed
Coverage: 92%
Key Implementation Decisions:
- Used wire:model.live for real-time validation
- Implemented rate limiting (5 attempts per minute)
- Added remember me functionality with 30-day expiry
- Used Livewire validation attributes for clean code
Next Steps:
1. /sdd:story-save to commit implementation
2. /sdd:story-review to move to code review
3. Manual testing in browser at https://ccs-todo.test/login
INPUT:
/sdd:story-implement STORY-PROFILE-002
PROCESS:
โ Loading project context
โ Detected stack: React 18 + TypeScript + Vite + Jest + Playwright
โ Reading story: /docs/stories/development/STORY-PROFILE-002.md
โ Story: User Profile Settings
โ Generating React components...
โ Generating custom hooks...
โ Generating unit tests...
โ Generating integration tests...
โ Generating Playwright tests...
โ Running tests: npm test
โ All tests passing โ
โ Running linter: npm run lint
โ Code formatted โ
โ Updating story file...
OUTPUT:
โ
IMPLEMENTATION COMPLETE
============================
Story: STORY-PROFILE-002 - User Profile Settings
Stack: React 18, TypeScript, Redux Toolkit, Vite, Jest, Playwright
Generated Files:
๐ Production Code:
- src/components/ProfileSettings.tsx
- src/components/ProfileSettings.module.css
- src/hooks/useProfileSettings.ts
- src/store/slices/profileSlice.ts
- src/api/profileApi.ts
๐งช Unit Tests:
- src/components/ProfileSettings.test.tsx
- src/hooks/useProfileSettings.test.ts
- src/store/slices/profileSlice.test.ts
๐ Integration Tests:
- src/tests/integration/profile.test.tsx
๐ Browser Tests:
- tests/e2e/profile-settings.spec.ts
Test Results:
โ
Unit Tests: 15/15 passed
โ
Integration Tests: 6/6 passed
โ
Browser Tests: 7/7 passed
โ
Linting: Passed
Coverage: 88%
Key Implementation Decisions:
- Implemented optimistic updates for better UX
- Added debounced auto-save (500ms delay)
- Used React.memo to prevent unnecessary re-renders
- Implemented form validation with Zod schema
Next Steps:
1. /sdd:story-save to commit implementation
2. /sdd:story-review to move to code review
3. Manual testing in browser at http://localhost:5173/profile
INPUT:
/sdd:story-implement STORY-API-003
PROCESS:
โ Checking for /docs/project-context/ directory
โ Directory not found
OUTPUT:
โ ๏ธ Project Context Missing
==========================
Cannot generate implementation without project context.
The /docs/project-context/ directory does not exist.
This directory defines your technical stack and coding standards,
which determines what code to generate.
Please run: /sdd:project-init
This will create:
- /docs/project-context/technical-stack.md (defines your stack)
- /docs/project-context/coding-standards.md (defines your standards)
- /docs/project-context/development-process.md (defines your workflow)
After initialization, run /sdd:story-implement again.
INPUT:
/sdd:story-implement STORY-CART-004
PROCESS:
โ Loading project context
โ Detected stack: Django 5 + HTMX + Tailwind CSS + Pytest
โ Reading story: /docs/stories/development/STORY-CART-004.md
โ Generating Django views...
โ Generating templates...
โ Generating unit tests...
โ Generating integration tests...
โ Running tests: pytest
โ 2 tests failed โ
โ Analyzing failures...
โ Fixing cart total calculation...
โ Re-running tests: pytest
โ All tests passing โ
โ Updating story file...
OUTPUT:
โ
IMPLEMENTATION COMPLETE
============================
Story: STORY-CART-004 - Shopping Cart
Stack: Django 5, HTMX, Tailwind CSS, Pytest, Playwright
Generated Files:
๐ Production Code:
- shop/views/cart.py
- shop/templates/cart/index.html
- shop/templates/cart/_item.html
- shop/models/cart.py
- shop/forms/cart.py
๐งช Unit Tests:
- shop/tests/test_cart_model.py
- shop/tests/test_cart_views.py
๐ Integration Tests:
- shop/tests/test_cart_integration.py
๐ Browser Tests:
- tests/browser/test_cart.py
Test Results:
โ
Unit Tests: 12/12 passed (2 fixed)
โ
Integration Tests: 5/5 passed
โ
Browser Tests: 8/8 passed
โ
Linting: Passed
Coverage: 95%
Key Implementation Decisions:
- Used Decimal for currency to avoid floating point errors
- Implemented HTMX for partial updates (no page reload)
- Added optimistic locking for concurrent cart updates
- Used Django signals for cart total recalculation
Issues Fixed During Implementation:
- Cart total calculation had rounding error
- Missing CSRF token in HTMX request
Next Steps:
1. /sdd:story-save to commit implementation
2. /sdd:story-review to move to code review
3. Manual testing in browser at http://localhost:8000/cart
IF story found in /docs/stories/backlog/:
- SUGGEST running /sdd:story-start first
- EXPLAIN that story must be moved to development
- OFFER to start story automatically
IF story found in /docs/stories/review/ or /docs/stories/qa/:
- WARN about modifying reviewed code
- ASK for confirmation to proceed
- IF confirmed: Generate code
- IF declined: Exit gracefully
IF tests fail after 3 fix attempts:
- SHOW detailed error output
- SUGGEST manual debugging steps
- OFFER to save partial implementation
- MARK implementation as incomplete in story file
IF required packages not installed:
- DETECT missing dependencies from imports
- LIST missing packages
- SUGGEST installation command for DISCOVERED package manager
- OFFER to continue without those features
IF files already exist at generation paths:
- SHOW list of conflicting files
- ASK: Overwrite, skip, or merge?
- IF overwrite: Backup existing files first
- IF skip: Generate only non-conflicting files
- IF merge: Attempt intelligent merge
/sdd:story-start - Begin development before implementing/sdd:story-save - Commit implementation after completion/sdd:story-review - Move to code review after implementation/sdd:story-continue - Resume implementation if interrupted/sdd:project-init - Initialize project context first