Regardless of what you plan for your existing project you want to start agentic coding with, producing contextual artifacts for agents is of the highest importance.
If using Claude Code - it is recommended to use the document-project task with the architect to systematically produce important key artifacts for your codebase.
Optionally you can product context information and understanding for your repo utilizing web agents like Gemini. If its already in github, you can provide the project URL in gemini and use the agents to help analyze or document the project with the team fullstack or the architect specific gem.
If your project is too large, you can also flatten your codebase - which can make it easier to upload or use with some tools. You can read more about the optional tool in the Flattener Guide
Brownfield development refers to adding features, fixing bugs, or modernizing existing software projects. Unlike greenfield (new) projects, brownfield work requires understanding existing code, respecting constraints, and ensuring new changes integrate seamlessly without breaking existing functionality.
If you have just completed an MVP with BMad, and you want to continue with post-MVP, its easier to just talk to the PM and ask it to work with you to create a new epic to add into the PRD, shard out the epic, update any architecture documents with the architect, and just go from there.
Starting in the Web Option (potentially save some cost but a potentially more frustrating experience):
npx bmad-method flattenStarting in an IDE with large context and good models (Its important to use quality models for this process for the best results)
Best for: Large codebases, monorepos, or when you know exactly what you want to build
Best for: Smaller codebases, unknown systems, or exploratory changes
In Gemini Web (with your flattened-codebase.xml uploaded):
@pm
*create-brownfield-prd
The PM will:
Key Advantage: The PRD identifies which parts of your monorepo/large codebase actually need documentation!
Still in Gemini Web, now with PRD context:
@architect
*document-project
The architect will:
The architect creates:
docs/architecture.mdFor example, if you say "Add payment processing to user service":
Best Approach - Gemini Web with 1M+ Context:
dist/agents/architect.txt*document-projectThe architect will generate comprehensive documentation of everything.
1. Create Brownfield PRD:
@pm
*create-brownfield-prd
The PM agent will:
How PM Agent Gets Project Context:
Key Prompts You'll Encounter:
2. Create Brownfield Architecture:
@architect
*create-brownfield-architecture
The architect will:
For Single Epic Without Full PRD:
@pm
*create-brownfield-epic
Use when:
For Single Story:
@pm
*create-brownfield-story
Use when:
@po
*execute-checklist-po
The PO ensures:
Shard your docs: In your IDE
@po
shard docs/prd.md
@po
shard docs/architecture.md
Follow the Enhanced IDE Development Workflow
Even if you think you know the codebase:
document-project to capture current stateThe brownfield templates specifically look for:
Brownfield changes should:
In brownfield projects, the Test Architect (Quinn) becomes your safety net against breaking existing functionality. Unlike greenfield where you're building fresh, brownfield requires careful validation that new changes don't destabilize what already works.
The Test Architect addresses unique brownfield complexities:
| Challenge | How Test Architect Helps | Command |
|---|---|---|
| Regression Risks | Identifies which existing features might break | *risk |
| Legacy Dependencies | Maps integration points and hidden dependencies | *trace |
| Performance Degradation | Validates no slowdown in existing flows | *nfr |
| Coverage Gaps | Finds untested legacy code that new changes touch | *design |
| Breaking Changes | Detects API/contract violations | *review |
| Migration Safety | Validates data transformations and rollback plans | *risk + *review |
CRITICAL FOR BROWNFIELD - Run These First:
# 1. RISK ASSESSMENT (Run IMMEDIATELY after story creation)
@qa *risk {brownfield-story}
# Identifies: Legacy dependencies, breaking changes, integration points
# Output: docs/qa/assessments/{epic}.{story}-risk-{YYYYMMDD}.md
# Brownfield Focus:
# - Regression probability scoring
# - Affected downstream systems
# - Data migration risks
# - Rollback complexity
# 2. TEST DESIGN (After risk assessment)
@qa *design {brownfield-story}
# Creates: Regression test strategy + new feature tests
# Output: docs/qa/assessments/{epic}.{story}-test-design-{YYYYMMDD}.md
# Brownfield Focus:
# - Existing functionality that needs regression tests
# - Integration test requirements
# - Performance benchmarks to maintain
# - Feature flag test scenarios
Monitor Integration Health While Coding:
# 3. REQUIREMENTS TRACING (Mid-development checkpoint)
@qa *trace {brownfield-story}
# Maps: New requirements + existing functionality preservation
# Output: docs/qa/assessments/{epic}.{story}-trace-{YYYYMMDD}.md
# Brownfield Focus:
# - Existing features that must still work
# - New/old feature interactions
# - API contract preservation
# - Missing regression test coverage
# 4. NFR VALIDATION (Before considering "done")
@qa *nfr {brownfield-story}
# Validates: Performance, security, reliability unchanged
# Output: docs/qa/assessments/{epic}.{story}-nfr-{YYYYMMDD}.md
# Brownfield Focus:
# - Performance regression detection
# - Security implications of integrations
# - Backward compatibility validation
# - Load/stress on legacy components
Comprehensive Brownfield Review:
# 5. FULL REVIEW (When development complete)
@qa *review {brownfield-story}
# Performs: Deep analysis + active refactoring
# Outputs:
# - QA Results in story file
# - Gate file: docs/qa/gates/{epic}.{story}-{slug}.yml
The review specifically analyzes:
# 6. GATE STATUS UPDATE (After addressing issues)
@qa *gate {brownfield-story}
# Updates: Quality gate decision after fixes
# Output: docs/qa/gates/{epic}.{story}-{slug}.yml
# Brownfield Considerations:
# - May WAIVE certain legacy code issues
# - Documents technical debt acceptance
# - Tracks migration progress
The Test Architect uses enhanced risk scoring for brownfield:
| Risk Category | Brownfield Factors | Impact on Gate |
|---|---|---|
| Regression Risk | Number of integration points × Age of code | Score ≥9 = FAIL |
| Data Risk | Migration complexity × Data volume | Score ≥6 = CONCERNS |
| Performance Risk | Current load × Added complexity | Score ≥6 = CONCERNS |
| Compatibility Risk | API consumers × Contract changes | Score ≥9 = FAIL |
Quinn enforces additional standards for brownfield:
| Scenario | Commands to Run | Order | Why Critical |
|---|---|---|---|
| Adding Feature to Legacy Code | *risk → *design → *trace → *review |
Sequential | Map all dependencies first |
| API Modification | *risk → *design → *nfr → *review |
Sequential | Prevent breaking consumers |
| Performance-Critical Change | *nfr early and often → *review |
Continuous | Catch degradation immediately |
| Data Migration | *risk → *design → *trace → *review → *gate |
Full cycle | Ensure data integrity |
| Bug Fix in Complex System | *risk → *trace → *review |
Focused | Prevent side effects |
Scenario-Specific Guidance:
Legacy Code Modernization
*risk to map all dependencies*design to plan strangler fig approach*trace frequently to ensure nothing breaks*review with focus on gradual migrationAdding Features to Monolith
*risk identifies integration complexity*design plans isolation strategies*nfr monitors performance impact*review validates no monolith degradationMicroservice Extraction
*risk maps service boundaries*trace ensures functionality preservation*nfr validates network overhead acceptable*gate documents accepted trade-offsDatabase Schema Changes
*risk assesses migration complexity*design plans backward-compatible approach*trace maps all affected queries*review validates migration safetyDocument:
@qa *risk on draft stories to identify integration risks@qa *design to plan regression test strategy@qa *trace to verify coverage@qa *nfr to monitor performance impact@qa *review validates integration safety@qa *risk assesses modernization complexity@qa *design plans parallel testing approach@qa *trace after each increment@qa *gate to track technical debt acceptancecreate-brownfield-story for focused fix@qa *risk to identify side effect potential@qa *design output@qa *trace to map affected functionality@qa *review for comprehensive validation@qa *risk identifies breaking change potential@qa *design creates contract test strategy@qa *trace maps all API consumers@qa *nfr validates response times@qa *review ensures no breaking changesSolution: Re-run document-project with more specific paths to critical files
Solution: Update generated documentation with your specific conventions before planning phase
Solution: Use create-brownfield-story instead of full workflow
Solution: Provide more context during PRD creation, specifically highlighting integration systems
# Document existing project
@architect *document-project
# Create enhancement PRD
@pm *create-brownfield-prd
# Create architecture with integration focus
@architect *create-brownfield-architecture
# Quick epic creation
@pm *create-brownfield-epic
# Single story creation
@pm *create-brownfield-story
Note: Short forms shown below. Full commands: *risk-profile, *test-design, *nfr-assess, *trace-requirements
# BEFORE DEVELOPMENT (Planning)
@qa *risk {story} # Assess regression & integration risks
@qa *design {story} # Plan regression + new feature tests
# DURING DEVELOPMENT (Validation)
@qa *trace {story} # Verify coverage of old + new
@qa *nfr {story} # Check performance degradation
# AFTER DEVELOPMENT (Review)
@qa *review {story} # Deep integration analysis
@qa *gate {story} # Update quality decision
Do you have a large codebase or monorepo?
├─ Yes → PRD-First Approach
│ └─ Create PRD → Document only affected areas
└─ No → Is the codebase well-known to you?
├─ Yes → PRD-First Approach
└─ No → Document-First Approach
Is this a major enhancement affecting multiple systems?
├─ Yes → Full Brownfield Workflow
│ └─ ALWAYS run Test Architect *risk + *design first
└─ No → Is this more than a simple bug fix?
├─ Yes → *create-brownfield-epic
│ └─ Run Test Architect *risk for integration points
└─ No → *create-brownfield-story
└─ Still run *risk if touching critical paths
Does the change touch legacy code?
├─ Yes → Test Architect is MANDATORY
│ ├─ *risk → Identify regression potential
│ ├─ *design → Plan test coverage
│ └─ *review → Validate no breakage
└─ No → Test Architect is RECOMMENDED
└─ *review → Ensure quality standards
Brownfield development with BMad Method provides structure and safety when modifying existing systems. The Test Architect becomes your critical safety net, using risk assessment, regression testing, and continuous validation to ensure new changes don't destabilize existing functionality.
The Brownfield Success Formula:
*risk before codingRemember: In brownfield, the Test Architect isn't optional - it's your insurance policy against breaking production.