-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Description
Summary
I've created an extension command /speckit.brownfield-bootstrap that helps bring existing (brownfield) projects into the spec-kit SDD workflow. This extension addresses a gap in the current spec-kit toolchain: while specify init works great for greenfield projects, it creates generic templates that don't reflect the actual architecture, tech stack, and coding conventions of existing codebases.
The Problem
When teams want to adopt spec-kit's Specification-Driven Development workflow for their existing projects, they face several challenges:
- Generic templates don't fit: The standard
specify initcreates templates that don't reflect the project's actual tech stack, architecture patterns, or coding conventions - Manual constitution creation is tedious: Teams must manually analyze their codebase and create a constitution from scratch
- Multi-module projects are complex: Projects with Maven/Gradle multi-module, Monorepo structures need module-level guidance for code placement
- No reverse-engineering support: There's no automated way to extract architectural DNA from existing code
Brownfield Project Special Considerations
- Respect existing architecture: Don't try to "improve" existing architecture, accurately reflect it
- Tech stack lock: Brownfield project tech stack is established fact, constitution must anchor it
- Gradual introduction: SDD workflow should seamlessly integrate into existing development process
- Compatibility first: All generated code must be consistent with existing code style
- No code duplication: Before creating new classes and methods, must first search for existing ones, only create new code if nothing reusable exists
- Understand existing code: When understanding existing code is needed, use Repomix to generate/update skills for the project, command:
repomix --skill-generate
The Solution
The brownfield-bootstrap extension solves these problems by:
-
🔍 Automatic Project Discovery
- Scans project structure to identify tech stack, frameworks, and patterns
- Recognizes common architectural patterns (MVC, Hexagonal, Microservices, etc.)
- Extracts coding conventions from config files and code samples
-
📋 Multi-Module Project Support
- Full support for Maven/Gradle multi-module projects
- Node.js Monorepo with workspaces, Go Workspace, Rust Workspace, Python Monorepo
- Automatic module responsibility mapping and dependency analysis
- Code placement decision trees for each module
-
📄 Customized Constitution & Templates
- Generates project constitution reflecting actual project principles
- Creates templates adapted to specific tech stack and coding style
- Tech stack anchoring ensures consistency across all specs
-
🧪 TDD Enforcement
- Built-in Test-Driven Development discipline
- Red-Green-Refactor cycle embedded in all templates
Workflow Comparison
| Aspect | Greenfield (specify init) |
Brownfield (This Extension) |
|---|---|---|
| Starting Point | Empty project | Existing codebase |
| Tech Stack | You choose | Auto-detected and locked |
| Architecture | You design | Reverse-engineered |
| Templates | Generic | Project-specific |
| Constitution | Minimal | Comprehensive from code analysis |
| Multi-module | Basic | Full module mapping |
Example Usage
/speckit.brownfield-bootstrap
Or with specific focus:
/speckit.brownfield-bootstrap Focus on the user authentication module
The command generates:
.specify/memory/constitution.md- Project constitution with extracted principles.specify/templates/spec-template.md- Customized spec template.specify/templates/plan-template.md- Customized plan template.specify/templates/tasks-template.md- Customized tasks template
Repository
The extension is available at: https://github.com/wcpaxx/spec-kit-brownfield-extensions
Both English and Chinese versions are provided:
speckit.brownfield-bootstrap.md
Installation
Simply copy the command file to your AI tool's commands directory:
# For Claude Code
cp speckit.brownfield-bootstrap.md .claude/commands/
# For Cursor
cp speckit.brownfield-bootstrap.md .cursor/commands/Compatibility
- ✅ spec-kit v0.0.18+ (uses
/speckit.prefix) - ✅ Claude Code, Cursor, GitHub Copilot, Windsurf, and other AI coding tools
- ✅ All major project types (single module, multi-module, monorepo)
Discussion Points
- Would this be a valuable addition to the spec-kit ecosystem?
- Should this be considered for inclusion in the core spec-kit toolchain?
- Any suggestions for improving the project discovery or template generation?
Related
- Similar to the approach in spec-kit-extensions which provides workflows for bugfix, modify, refactor, etc.
- Complements the existing
specify initby handling the brownfield project use case
Looking forward to feedback from the spec-kit community! 🚀