brownfield

v1.0.0

Bootstrap spec-kit for existing codebases — auto-discover architecture and adopt SDD incrementally.

Community extension — Independently maintained. Use at your own discretion. Learn more

spec-kit-brownfield

A Spec Kit extension that bootstraps Specification-Driven Development for existing codebases — auto-discover architecture, generate a tailored constitution, and incrementally migrate features into the SDD workflow.

Problem

Spec Kit's specify init creates generic templates that don't fit established projects. Teams with existing codebases face friction adopting SDD:

  • Generic constitution doesn't reflect actual tech stack, architecture, or conventions
  • Templates reference placeholder paths instead of real project modules
  • Multi-module projects (monorepos) get no guidance on code boundaries
  • No way to bring existing features into the SDD workflow retroactively
  • Manual constitution creation is tedious and error-prone for large codebases

Solution

The Brownfield Bootstrap extension adds four commands for adopting spec-kit in existing projects:

CommandPurposeModifies Files?
/speckit.brownfield.scanAuto-discover project structure, tech stack, frameworks, and architecture patternsNo — read-only
/speckit.brownfield.bootstrapGenerate spec-kit configuration tailored to the existing codebaseYes — creates/updates constitution, templates, AGENTS.md
/speckit.brownfield.validateVerify bootstrap output matches actual project structure and conventionsNo — read-only
/speckit.brownfield.migrateIncrementally adopt SDD for existing features with reverse-engineered specsYes — creates spec.md, plan.md, tasks.md for existing features

Installation

specify extension add --from https://github.com/Quratulain-bilal/spec-kit-brownfield/archive/refs/tags/v1.0.0.zip

How It Works

Phase 1: Discover

/speckit.brownfield.scan analyzes your codebase to build a project profile:

Project Profile
├── Tech Stack: TypeScript (68%), Python (32%)
├── Frontend: React 18, Vite, TailwindCSS
├── Backend: FastAPI, SQLAlchemy, PostgreSQL
├── Architecture: Frontend + Backend (separated)
├── Modules: client/, server/, shared/
├── Testing: Jest (frontend), pytest (backend)
├── CI/CD: GitHub Actions
├── Branch Pattern: feat/*, fix/*, chore/*
└── Conventions: kebab-case (frontend), snake_case (backend)

Phase 2: Configure

/speckit.brownfield.bootstrap generates spec-kit configuration from the profile:

  • Constitution: Rules derived from actual codebase conventions — not generic boilerplate
  • Spec template: Project-specific sections (e.g., "Database Migrations" for ORM projects)
  • Plan template: Module-aware implementation phases (e.g., frontend/backend split)
  • Tasks template: Real test commands and build steps from your actual toolchain
  • AGENTS.md: Agent boundaries for multi-module projects

Phase 3: Verify

/speckit.brownfield.validate checks that configuration matches reality:

  • Verifies all directory references actually exist
  • Confirms mentioned frameworks are in dependency files
  • Samples files to validate naming convention rules
  • Detects drift if project has changed since bootstrap

Phase 4: Migrate

/speckit.brownfield.migrate brings existing features into SDD:

  • Reverse-engineers spec.md from code behavior and test cases
  • Reconstructs plan.md from actual implementation patterns
  • Generates tasks.md with all tasks marked complete
  • Identifies gaps: missing tests, error handling, documentation

Workflow

specify init                         ← Initialize spec-kit (if not already done)
       │
       ▼
/speckit.brownfield.scan             ← Discover tech stack and architecture
       │
       ▼
/speckit.brownfield.bootstrap        ← Generate tailored configuration
       │
       ▼
/speckit.brownfield.validate         ← Verify configuration accuracy
       │
       ▼
/speckit.brownfield.migrate          ← Bring existing features into SDD
       │
       ▼
/speckit.specify                     ← Start new features with project-aware templates

Supported Project Types

TypeDetection
MonolithSingle source tree, one entry point
MonorepoWorkspace config, packages/ or apps/ directories
MicroservicesMultiple Dockerfiles, service directories
Frontend + BackendSeparate client//server/ directories
Library/Packagesetup.py, lib/ directory, published package config

Supported Tech Stacks

CategoryDetected
LanguagesTypeScript, JavaScript, Python, Go, Java, Rust, C#, Ruby, PHP
FrontendReact, Vue, Angular, Svelte, Next.js, Nuxt
BackendExpress, FastAPI, Django, Spring, Rails, Gin, ASP.NET
DatabasesPostgreSQL, MySQL, MongoDB, SQLite, Redis
Package managersnpm, yarn, pnpm, pip, Poetry, Go modules, Cargo, Maven, Gradle
CI/CDGitHub Actions, GitLab CI, CircleCI, Jenkins
TestingJest, pytest, Go test, JUnit, RSpec, PHPUnit

Hooks

The extension registers an optional hook:

  • after_init: Offers to scan the project after specify init to auto-detect conventions

Design Decisions

  • Scan before bootstrap — configuration is always derived from actual codebase analysis, never guessed
  • Confirm before writing — bootstrap and migrate always show a plan and wait for approval
  • Merge, don't replace — if constitution or templates already exist, merge changes rather than overwriting
  • Mark migrated specs — reverse-engineered specs include status: migrated to distinguish from fresh specs
  • Gap reporting — migrate command actively identifies missing tests, error handling, and documentation
  • Module-aware — all commands understand monorepo and multi-module project structures

Requirements

  • Spec Kit >= 0.4.0
  • Git >= 2.0.0

Related

  • Issue #1436 — Brownfield Bootstrap: SDD Workflow for Existing Projects (30+ reactions)

License

MIT

Stats

25 stars

Version

1.0.0
Updated 19 days ago

Install

Using the Specify CLI

specify extension add brownfield --from https://github.com/Quratulain-bilal/spec-kit-brownfield/archive/refs/tags/v1.0.0.zip

License

MIT