Brownfield Workflow: Bringing SDD to Existing Codebases
Note: All summarization sections in this guide should use the 10-point summary template from SKILL.md, with feature status tracking when applicable.
Note: All summarization sections in this guide should use the 10-point summary template from SKILL.md, with feature status tracking when applicable.
**Note:** All summarization sections in this guide should use the **10-point summary template** from SKILL.md, with feature status tracking when applicable.
Use this workflow when:
For new projects from scratch, see [Greenfield Workflow](greenfield.md).
Brownfield SDD respects and builds upon existing code:
Choose the appropriate analysis depth based on your needs:
**Workflow Overview:**
**Command:**
/speckit.brownfield**Purpose**: Initialize brownfield workflow and analyze existing code
**Example prompt to give user:**
/speckit.brownfield Analyze this codebase at moderate depth, focusing on:
- Current architecture and design patterns
- Technology stack and dependencies
- API structure and data models
- Coding standards and conventions**For different depths:**
# Surface analysis
/speckit.brownfield Perform a surface-level analysis of this codebase
# Deep analysis
/speckit.brownfield Perform a deep analysis including technical debt,
edge cases, and architectural decision rationale**What this produces:**
**After this step - Summarize the analysis report:**
Use the **10-point summary template** from SKILL.md to present the codebase analysis.
**Example enhanced summary:**
## β
Brownfield Analysis Completed - Here's What Just Happened
### π― Key Decisions Made
1. **Microservices architecture identified (5 services)** - Rationale: Modular design allows independent feature development
2. **TypeScript with strict mode across codebase** - Rationale: Strong type safety culture; maintain this in new features
3. **Event-driven communication via RabbitMQ** - Rationale: Async messaging pattern; new features should follow this pattern
### π What Was Generated
- Codebase analysis report: Architecture patterns, tech stack, coding standards, technical debt assessment
### π Important Items to Review
1. **65% test coverage (target: 80%)** - New features should increase coverage; plan for testing investment
2. **Some services lack error handling** - When adding features, prioritize services with weak error handling
3. **API documentation needs updates** - Document new endpoints comprehensively as part of feature work
### β οΈ Watch Out For
- **Redux state management complexity** - How to avoid: Consider simpler state solutions for new features or plan Redux refactor
- **RabbitMQ dependency** - How to avoid: Ensure local RabbitMQ setup for development; document in constitution
### π What This Enables Next
- **Option 1:** Run `specify init --here --force` to set up SDD - Best if: Analysis looks complete
- **Option 2:** Deep dive into specific services - Best if: Need more architectural details
- **Option 3:** Analyze dependencies and integration points - Best if: Planning complex feature integration
π **Feature Status:** Analyzing existing codebase (No SDD features yet)
Progress: Analysis complete β Next: Initialize SDD infrastructure
**Your options:** [A] Initialize SDD [B] Deep dive specific areas [C] Analyze dependencies [D] Adjust analysis depth**Command:**
specify init --here --ai claude
# or for non-empty directories
specify init --here --force --ai claude**Purpose**: Set up SDD infrastructure without disrupting existing code
**What happens:**
**Command:**
/speckit.analyze-codebase**Purpose**: Create constitution that reflects existing architecture and principles
**Approach**: Hybrid (automated + interactive)
**Example interaction:**
AI: Based on my analysis, I observe these patterns:
- RESTful API design with Express.js
- PostgreSQL with Sequelize ORM
- JWT authentication
- MVC architecture
- React frontend with Redux
Should the constitution include these as established patterns? [Y/n]
User: Yes, but we're planning to migrate from Redux to Zustand
AI: Understood. I'll document Redux as current state with Zustand as future direction.**Example prompt to give user:**
/speckit.analyze-codebase Generate a constitution that:
- Documents existing architecture patterns
- Acknowledges current tech stack
- Maintains consistency with existing code style
- Notes any planned migrations or changes**After this step - Summarize constitution.md:**
Read `.speckit/constitution.md` and present a summary highlighting:
**Example summary:**
## Constitution Generated from Existing Code β
I've created constitution.md based on the existing codebase patterns:
**Architectural Principles:**
- Microservices: Each service owns its domain and database
- API-first: All inter-service communication via RESTful APIs
- Event-driven: Async operations via RabbitMQ message queues
- Stateless services: Session state in Redis, not in-memory
**Technology Standards:**
- TypeScript with strict mode for type safety
- Express.js for API servers
- PostgreSQL for relational data, Redis for caching
- Docker containers, Kubernetes orchestration
**Coding Conventions:**
- Repository pattern for data access
- Service layer for business logic
- Controller layer for API endpoints
- DTOs for request/response validation (Joi schemas)
**Testing Standards:**
- Minimum 80% code coverage (current: 65%)
- Unit tests with Jest
- Integration tests for API endpoints
- E2E tests for critical user flows
**Planned Evolution:**
- Migrate from Redux to Zustand (frontend state management)
- Adopt OpenAPI 3.0 for API documentation
- Implement distributed tracing (Jaeger)
**Next Step:** Choose artifact generation strategy (Step 4)
Would you like to:
A) Proceed to choose documentation strategy
B) Refine any principles
C) Add additional constraints**Interactive decision point** - Ask user which approach:
Generate constitution.md only, use for new features going forward**Best for**: Teams wanting to adopt SDD for future work only
Generate constitution.md and high-level specs for existing major features**Best for**: Documentation backfill while starting new SDD work
Generate constitution, specifications, and technical plans for all existing features**Best for**: Complete SDD adoption, compliance documentation, legacy modernization
- Constitution for all code
- Full specs for 2-3 core features
- Baseline specs for remaining features**Best for**: Balanced documentation without overwhelming effort
**Command after user chooses:**
/speckit.reverse-engineer [option-chosen]**Example prompts:**
# Constitution only
/speckit.reverse-engineer constitution-only
# Mixed approach
/speckit.reverse-engineer mixed --core-features authentication,user-management,api-gatewayIf user chose Options B, C, or D in Step 4:
**Command:**
/speckit.reverse-engineer**Purpose**: Generate SDD artifacts for existing features
**Example prompt to give user:**
/speckit.reverse-engineer Document the authentication system:
- User registration and login flows
- JWT token management
- Password reset functionality
- OAuth integration**What this produces:**
.speckit/
βββ features/
βββ existing/
βββ 001-authentication/
β βββ specify.md # Reverse-engineered requirements
β βββ plan.md # Current implementation details
βββ 002-user-management/
βββ 003-api-gateway/**After this step - Summarize reverse-engineered specs:**
Read the generated specs for documented features and present a summary highlighting:
**Example summary:**
## Existing Features Documented β
I've reverse-engineered specifications for 3 core features:
**1. Authentication System (001-authentication/):**
- User registration with email verification
- Login with JWT tokens (15-minute access, 7-day refresh)
- Password reset via email
- OAuth providers: Google, GitHub
- Rate limiting: 5 failed attempts = 15-minute lockout
**2. User Management (002-user-management/):**
- CRUD operations for user profiles
- Role-based access control (User, Admin, Super Admin)
- User search and filtering
- Bulk operations (export, deactivate)
- Admin endpoints for user impersonation
**3. API Gateway (003-api-gateway/):**
- Request routing to microservices
- Authentication middleware
- Rate limiting (100 req/minute per user)
- Request/response logging
- Error handling and retry logic
**Integration Points Identified:**
- All features use shared PostgreSQL database
- Redis for session storage and rate limiting
- RabbitMQ for async notifications
- Shared authentication middleware
**Gaps to Address:**
- Payment processing workflow incomplete (45% documented)
- Background job system not yet documented
- Admin dashboard missing specifications
**Next Step:** Optionally validate reverse-engineering with `/speckit.validate-reverse-engineering`, then proceed to Step 6 to specify your new feature
Would you like to:
A) Validate the reverse-engineering accuracy
B) Document additional existing features
C) Proceed to specify new feature (Step 6)**Note**: Validation commands are proposed enhancements to spec-kit. If commands are not yet available, you can perform manual validation by reviewing generated specs against actual code, using code search to verify completeness, cross-checking constitution principles with actual patterns, or creating custom validation scripts.
**When to use**: After documenting existing features, before adding new features
**Purpose**: Verify that reverse-engineering work is accurate, complete, and traceable
This optional step allows you to request validation of the reverse-engineering work to ensure quality before proceeding with new feature development.
**Command:**
/speckit.validate-reverse-engineering**Purpose**: Verify that generated specs match actual code behavior and implementation
**Example prompt to give user:**
/speckit.validate-reverse-engineering Check:
- Do API specs match actual endpoints and contracts?
- Are data models accurately documented?
- Do workflows reflect actual business logic?
- Are technical plans consistent with implementation?**What this validates:**
**Example validation report:**
β Authentication API: 12/12 endpoints documented accurately
β User Management: Missing 3 admin endpoints
β Data Models: 8/8 models match database schema
β Payment Processing: Workflow partially documented (60% coverage)
Issues Found:
1. Admin endpoints not documented in user-management specs
2. Payment refund workflow missing from specifications
3. Database migration history not captured
Recommendations:
- Run /speckit.reverse-engineer for admin endpoints
- Document payment refund process
- Add migration history to technical plan**Command:**
/speckit.coverage-check**Purpose**: Report documentation coverage and identify gaps
**Example prompt to give user:**
/speckit.coverage-check Report:
- Percentage of codebase documented
- Undocumented features and modules
- Files without corresponding specs
- API endpoint coverage**What this reports:**
**Example coverage report:**
Overall Coverage: 68%
Feature Coverage:
β Authentication: 100% (fully documented)
β User Management: 90% (admin section partial)
β Payment Processing: 45% (significant gaps)
β Reporting: 0% (not documented)
β API Gateway: 85% (rate limiting not documented)
File Coverage:
- Documented: 45 files
- Undocumented: 21 files
- Total: 66 files
Undocumented Features:
1. Reporting system (src/reports/)
2. Background job processing (src/jobs/)
3. Email templates (src/templates/email/)
4. Admin dashboard (src/admin/)
Priority: Document payment processing and reporting next**Command:**
/speckit.validate-constitution**Purpose**: Verify that constitution principles match actual code patterns
**Example prompt to give user:**
/speckit.validate-constitution Check for:
- Stated patterns vs actual code patterns
- Tech stack completeness
- Contradictions between principles and code
- Coding standards accuracy**What this validates:**
**Example validation report:**
Constitution Accuracy: 85%
β Design Patterns:
- MVC architecture: Correctly identified
- Repository pattern: Correctly documented
β Technology Stack Issues:
- Constitution says "Redux" but code uses Zustand
- Missing dependency: bull (job queue)
- Outdated: PostgreSQL 12 (actually using 14)
β Coding Standards:
- ESLint rules match actual .eslintrc
- Naming conventions accurate
β Architecture Principles:
- Constitution mentions "microservices" but codebase is monolithic
- Claims "stateless API" but sessions are used
Recommendations:
- Update constitution to reflect Zustand usage
- Add bull to tech stack inventory
- Clarify architecture: monolithic with service-oriented design
- Document session usage or migrate to stateless auth**Command:**
/speckit.trace [feature-name]**Purpose**: Map specifications to source code bidirectionally
**Example prompt to give user:**
/speckit.trace authentication
/speckit.trace Show mapping between payment specs and implementation**What this shows:**
**Example traceability report:**
Feature: Authentication
Specifications:
- .speckit/features/existing/001-authentication/specify.md
- .speckit/features/existing/001-authentication/plan.md
Implementation Files:
β src/auth/login.ts (documented)
β src/auth/register.ts (documented)
β src/auth/jwt.ts (documented)
β src/auth/password-reset.ts (documented)
β src/auth/oauth-providers.ts (NOT in specs)
β src/middleware/auth-middleware.ts (documented)
Database Models:
β src/models/User.ts (documented)
β src/models/Session.ts (documented)
API Routes:
β POST /api/auth/login (documented)
β POST /api/auth/register (documented)
β POST /api/auth/logout (documented)
β POST /api/auth/reset-password (documented)
β GET /api/auth/oauth/:provider (NOT in specs)
Issues:
- OAuth integration implemented but not documented
- Consider adding to specifications or marking as deprecated
Traceability Score: 85% (11/13 components mapped)Complete validation workflow after reverse-engineering:
# Step 1: Validate accuracy of reverse-engineering
/speckit.validate-reverse-engineering
# Review validation report - found 3 missing admin endpoints
# and incomplete payment workflow
# Step 2: Check coverage metrics
/speckit.coverage-check
# Coverage is 68% - reporting system and background jobs not documented
# Decision: Document payment processing now, defer reporting for later
# Step 3: Fill identified gaps
/speckit.reverse-engineer Document payment processing including:
- Payment refund workflow
- Admin endpoints for user management
# Step 4: Validate constitution accuracy
/speckit.validate-constitution
# Found tech stack mismatch (Redux vs Zustand)
# Update constitution.md manually to reflect actual tech stack
# Step 5: Check traceability for critical features
/speckit.trace authentication
/speckit.trace payment-processing
# OAuth integration not documented - add to specs
/speckit.reverse-engineer Document OAuth integration in authentication
# Step 6: Final validation
/speckit.validate-reverse-engineering
# All critical features now validated β
# Step 7: Generate validation report for team
/speckit.validation-reportYou can skip validation if:
Always validate if:
**Command:**
/speckit.specify**Purpose**: Define new feature to add to existing codebase
**Example prompt to give user:**
/speckit.specify Add a user notification system that:
- Sends email and in-app notifications
- Allows users to configure notification preferences
- Integrates with existing authentication
- Supports notification templates**After this step - Summarize specify.md:**
Follow the same summarization approach as greenfield (see [Greenfield Workflow Step 3](greenfield.md#step-3-create-the-specification)). Highlight:
**Example summary:**
## New Feature Specification Created β
I've generated specify.md for the notification system:
**Core Features:**
- Email notifications via existing SMTP service
- In-app notification center with real-time updates
- User preference management (per-notification-type settings)
- Template-based notifications with variable substitution
**Integration Requirements:**
- Must use existing authentication/authorization
- Leverage current PostgreSQL database
- Integrate with RabbitMQ for async delivery
- Reuse existing email service configuration
**Success Criteria:**
- Notifications delivered within 5 seconds
- Support 10,000 concurrent users
- 99.9% delivery success rate
- GDPR-compliant preference storage
**Next Step:** Run `/speckit.integration-plan` to plan integration with existing code
Would you like to:
A) Proceed to integration planning
B) Refine requirements
C) Add more integration constraints**Command:**
/speckit.integration-plan**Purpose**: Plan how new feature integrates with existing code
**Example prompt to give user:**
/speckit.integration-plan How should the notification system integrate with:
- Existing user authentication
- Current database schema
- Email service configuration
- Frontend routing and components**What this produces:**
**After this step - Summarize integration-plan:**
Present a summary highlighting:
**Example summary:**
## Integration Plan Created β
I've created an integration plan for the notification system:
**Integration Points:**
1. **Authentication:** Reuse JWT middleware for API authentication
2. **Database:** Add `notifications` and `notification_preferences` tables to existing PostgreSQL
3. **Message Queue:** Create new RabbitMQ exchange `notifications` with routing keys
4. **Email Service:** Use existing `EmailService` class, extend with template support
**Required Modifications to Existing Code:**
1. **User Model:** Add `notification_preferences` relationship (non-breaking)
2. **Auth Middleware:** No changes needed (reuse as-is)
3. **Email Service:** Extend with `sendTemplatedEmail()` method
4. **Frontend:** Add NotificationCenter component, integrate with existing layout
**Task Sequencing:**
- Phase 1: Database migrations and models (2 days)
- Phase 2: Backend notification service (3 days)
- Phase 3: RabbitMQ integration (2 days)
- Phase 4: Frontend components (3 days)
- Phase 5: Testing and integration (2 days)
**Dependencies:**
- Must complete database migrations before backend service
- Email template service before notification delivery
- Backend API before frontend components
**Risks & Mitigation:**
- **Risk:** RabbitMQ queue overload during high traffic
**Mitigation:** Implement rate limiting and queue monitoring
- **Risk:** Email service rate limits
**Mitigation:** Batch emails, implement retry logic
- **Risk:** Database schema conflicts
**Mitigation:** Review schema with DBA, use Sequelize migrations
**Next Step:** Run `/speckit.tasks` to break down into actionable tasks
Would you like to:
A) Proceed to task breakdown
B) Adjust integration approach
C) Address specific risks first**Command:**
/speckit.tasks**Purpose**: Break down implementation considering integration
**Enhanced for brownfield**: Tasks include integration steps
**After this step - Summarize tasks.md:**
Follow the same summarization approach as greenfield (see [Greenfield Workflow Step 5](greenfield.md#step-5-break-down-into-tasks)). Additionally highlight:
**Command:**
/speckit.implement**Purpose**: Build the feature with integration awareness
Initializes brownfield analysis workflow
**Usage:**
/speckit.brownfield [surface|moderate|deep]**Examples:**
/speckit.brownfield
/speckit.brownfield deep
/speckit.brownfield Analyze this Express.js API focusing on routing patternsDeep dive analysis and constitution generation
**Usage:**
/speckit.analyze-codebase [focus-areas]**Examples:**
/speckit.analyze-codebase
/speckit.analyze-codebase Focus on API design and data models
/speckit.analyze-codebase Include security patterns and authentication flowsGenerate SDD artifacts from existing code
**Usage:**
/speckit.reverse-engineer [strategy] [options]**Strategies:**
**Examples:**
/speckit.reverse-engineer constitution-only
/speckit.reverse-engineer mixed --core-features auth,payments
/speckit.reverse-engineer fullPlan new feature integration with existing code
**Usage:**
/speckit.integration-plan [context]**Examples:**
/speckit.integration-plan
/speckit.integration-plan Consider backward compatibility requirements
/speckit.integration-plan Minimize changes to existing database schema.speckit/
βββ constitution.md # Existing patterns & principles**Pros:**
**Cons:**
**Best for:** Small teams, simple codebases, new feature focus
.speckit/
βββ constitution.md
βββ features/
βββ existing/
βββ 001-auth/
β βββ specify.md # High-level overview
βββ 002-api/
βββ specify.md**Pros:**
**Cons:**
**Best for:** Medium-sized teams, moderate complexity, documentation backfill
.speckit/
βββ constitution.md
βββ features/
βββ existing/
βββ 001-auth/
β βββ specify.md # Detailed requirements
β βββ plan.md # Implementation details
β βββ architecture.md # Design decisions
βββ 002-api/
βββ ...**Pros:**
**Cons:**
**Best for:** Large teams, complex systems, regulated industries, legacy modernization
.speckit/
βββ constitution.md # All existing code
βββ features/
βββ existing/
β βββ 001-core-auth/ # Full specs for 2-3 key features
β βββ specify.md
β βββ plan.md
β βββ architecture.md
βββ new/
βββ 001-notifications/ # Standard SDD for new work**Pros:**
**Cons:**
**Best for:** Most brownfield scenarios, pragmatic teams
# Don't try to document everything at once
# Pick one new feature to add using SDD
specify init --here --ai claude
/speckit.brownfield surface
/speckit.analyze-codebase
/speckit.specify Add password strength indicator
/speckit.integration-plan
/speckit.tasks
/speckit.implementYour constitution should acknowledge current architecture:
## Existing Architecture Principles
- RESTful API design with Express.js (maintain)
- PostgreSQL with Sequelize ORM (maintain)
- JWT authentication (maintain)
- React frontend with Redux (migrating to Zustand)
## New Feature Guidelines
- Follow existing REST conventions
- Integrate with current auth system
- Use Sequelize for data access
- Prefer Zustand for new state management## Constitution Version History
### v1.0 - Initial (2024-01-15)
- Documented existing patterns
- Established code quality baselines
### v1.1 - First New Feature (2024-02-01)
- Added notification system principles
- Defined event-driven patterns
### v1.2 - Tech Stack Evolution (2024-03-15)
- Documented Redux β Zustand migration
- Updated state management guidelinesBrownfield implementations need extra testing:
## Integration Test Requirements
- Verify compatibility with existing auth
- Test database migration rollback
- Validate API backward compatibility
- Check frontend routing integrationBefore adding new features, validate your reverse-engineering work:
# After reverse-engineering existing features
/speckit.validate-reverse-engineering
# Review report, identify inaccuracies
/speckit.coverage-check
# Check coverage percentage, find gaps
/speckit.validate-constitution
# Ensure constitution matches reality
/speckit.trace authentication
# Verify traceability for critical features
# Fix any identified issues before proceeding
/speckit.reverse-engineer --fill-gaps [missed-features]**Benefits:**
Use SDD to track and plan debt reduction:
## Known Technical Debt
- Auth system lacks rate limiting β Plan in 002-security-hardening
- Database queries not optimized β Address in 003-performance
- No input validation on older endpoints β Fix in 004-validation# Setup
cd existing-app
specify init --here --force --ai claude
# Workflow
/speckit.brownfield moderate
/speckit.analyze-codebase Focus on payment processing and user auth
/speckit.reverse-engineer constitution-only
/speckit.specify Add subscription management feature
/speckit.integration-plan Consider existing payment gateway integration
/speckit.tasks
/speckit.implement# Setup
cd legacy-system
specify init --here --ai claude
# Workflow
/speckit.brownfield deep --include-tech-debt
/speckit.analyze-codebase Document all major subsystems
/speckit.reverse-engineer full
# Review all generated specs
/speckit.specify Modernize authentication to OAuth 2.0
/speckit.integration-plan Migration strategy with zero downtime
/speckit.tasks
/speckit.implement# Setup
cd monolith
specify init --here --ai claude
# Workflow
/speckit.brownfield moderate
/speckit.analyze-codebase Focus on notification subsystem
/speckit.reverse-engineer mixed --core-features notifications
/speckit.specify Extract notifications as independent microservice
/speckit.integration-plan API contracts and message queues
/speckit.tasks Include data migration and API versioning
/speckit.implement# Setup (existing compliant system needs documentation)
cd production-app
specify init --here --ai claude
# Workflow
/speckit.brownfield deep
/speckit.analyze-codebase Include security controls and data handling
/speckit.reverse-engineer full --compliance-mode
# Generate comprehensive documentation for audit**Problem**: Generated constitution suggests patterns that don't match existing code
**Solution**:
**Example Fix**:
## Current State (Maintain)
- Class-based React components
- Redux for state management
## Future Direction (New Features)
- Functional components with hooks
- Zustand for state management
## Migration Strategy
- Maintain existing code as-is
- New features use modern patterns
- Refactor opportunistically**Problem**: Large codebase with dozens of features, overwhelming to document all
**Solution**:
**Example Approach**:
# Start minimal
/speckit.reverse-engineer constitution-only
# Add core features only
/speckit.reverse-engineer Document just authentication and payment processing
# Add more as you go
# When working on user-profile feature next month:
/speckit.reverse-engineer Document user profile management**Problem**: `/speckit.integration-plan` doesn't identify all integration points
**Solution**:
**Example**:
/speckit.integration-plan Consider:
- Database schema changes (users table, notifications table)
- Existing API routes (/api/users)
- Authentication middleware
- Frontend routing (React Router)
- Email service configuration
- Background job processing**Problem**: Existing code has quality issues, constitution documents them
**Solution**:
**Example Constitution Section**:
## Current Code Quality Issues
- Inconsistent error handling
- Missing input validation in older endpoints
- No automated testing for legacy features
## Quality Improvement Plan
- New features: 100% test coverage required
- When modifying existing code: Add tests for modified functions
- Quarterly: Address one legacy area with full testing
## New Feature Standards
- Full unit and integration test coverage
- Input validation on all endpoints
- Consistent error handling with error codes**Problem**: `/speckit.validate-reverse-engineering` shows specs don't match actual code
**Solution**:
**Example**:
# Initial validation shows issues
/speckit.validate-reverse-engineering
# Report: "User Management: Missing 3 admin endpoints"
# Fix the gap
/speckit.reverse-engineer Document admin endpoints in user management:
- POST /api/admin/users/:id/suspend
- POST /api/admin/users/:id/restore
- DELETE /api/admin/users/:id/permanent-delete
# Re-validate
/speckit.validate-reverse-engineering
# Report: "User Management: All endpoints documented β"**Problem**: `/speckit.coverage-check` shows <50% coverage
**Solution**:
**Example**:
# Check coverage
/speckit.coverage-check
# Report: "Overall Coverage: 45%"
# Decide on strategy
# Option A: Acceptable for constitution-only approach
# Option B: Need higher coverage for full artifact suite
# Fill gaps for features you'll work on
/speckit.reverse-engineer --fill-gaps payment-processing,reporting
/speckit.coverage-check
# Report: "Overall Coverage: 68%"**Problem**: `/speckit.validate-constitution` shows contradictions between principles and code
**Solution**:
**Example**:
# Validate constitution
/speckit.validate-constitution
# Report: "Constitution says 'Redux' but code uses Zustand"
# Fix: Update constitution to match reality
# Edit .speckit/constitution.md:
# Change: "Redux for state management"
# To: "Zustand for state management (migrated from Redux in v2.0)"
# Re-validate
/speckit.validate-constitution
# Report: "Constitution Accuracy: 95% β"**Problem**: `/speckit.trace` shows orphaned code or orphaned specs
**Solution**:
**Example**:
# Check traceability
/speckit.trace authentication
# Report: "OAuth integration implemented but not documented"
# Fix: Document the orphaned code
/speckit.reverse-engineer Document OAuth integration in authentication
# Or if OAuth should be removed:
# Update specs to mark OAuth as deprecated
# Add to technical debt list| Command | Purpose | When to Use | |---------|---------|-------------| | `specify init --here --force` | Initialize in existing project | First step in brownfield | | `/speckit.brownfield` | Analyze codebase | After init, before constitution | | `/speckit.analyze-codebase` | Deep analysis & constitution | After brownfield analysis | | `/speckit.reverse-engineer` | Generate artifacts for existing code | Documenting existing features | | `/speckit.validate-reverse-engineering` | Verify spec accuracy | After reverse-engineering, before new work | | `/speckit.coverage-check` | Check documentation coverage | After reverse-engineering | | `/speckit.validate-constitution` | Verify constitution consistency | After constitution generation | | `/speckit.trace [feature]` | Map specs to code | Any time, for traceability | | `/speckit.specify` | Define new feature | After constitution, start new work | | `/speckit.integration-plan` | Plan integration | After specify, before tasks | | `/speckit.tasks` | Break down implementation | After integration planning | | `/speckit.implement` | Execute tasks | Final implementation step |