Complete guide to the development phase of BMad Method. Use this phase to implement features with complete context-engineered stories.
Platform: Desktop IDEs (Cursor, Claude Code, Windsurf, etc.) Duration: Ongoing throughout development Input: Sharded PRD and Architecture from planning phase Output: Implemented code, updated stories, QA validations
Development phase is entirely story-driven. Stories contain ALL implementation context, eliminating the need to re-read PRD or architecture. SM creates stories, Dev implements, QA reviews - repeat until complete.
.bmad-core/ installed in projectSM (Story Creation) → Dev (Implementation) → QA (Review)
↓ ↓
[if QA FAIL/CONCERNS]
↓
Dev (Address Feedback)Option A: Load Individual Agents
.bmad-core/agents/sm.md, .bmad-core/agents/dev.md, .bmad-core/agents/qa.md in IDEOption B: Load Team
.bmad-core/agent-teams/team-ide-minimal.yaml if IDE supportsOption C: Configure IDE Rules
.cursorrules.claude/.windsurfrules*agent sm
*draftSM Workflow:
.bmad-core/core-config.yamldocs/stories/ for completed stories, finds next from PRDdocs/prd/epic-X.md)Story Structure:
# Epic 1.1: User Authentication
**Status**: Draft
## Story
As a user, I want to register an account, so that I can access the application.
## Acceptance Criteria
1. User can register with email and password
2. Email validation performed
3. Password strength enforced (min 8 characters, 1 uppercase, 1 number)
4. Confirmation email sent
5. User redirected to dashboard after registration
## Tasks
- [ ] Task 1: Create user model
- [ ] Subtask 1.1: Define User schema
- [ ] Subtask 1.2: Add validation rules
- [ ] Subtask 1.3: Create migration
- [ ] Task 2: Implement registration endpoint
- [ ] Subtask 2.1: Create POST /api/register route
- [ ] Subtask 2.2: Add validation middleware
- [ ] Subtask 2.3: Hash password with bcrypt
- [ ] Task 3: Write tests
- [ ] Subtask 3.1: Unit tests for User model
- [ ] Subtask 3.2: Integration tests for registration endpoint
## Dev Notes
[Source: docs/architecture/tech-stack.md#backend-framework]
Use Express.js for API routes. Use bcrypt for password hashing.
[Source: docs/architecture/data-models.md#user-model]
User model should include: id, email, password (hashed), createdAt, updatedAt.
[Source: docs/architecture/rest-api-spec.md#authentication]
POST /api/register expects { email: string, password: string }
Returns { user: User, token: string }
[Source: docs/stories/1.0.setup.md#lessons-learned]
Database connection already configured in config/database.js.
### Testing
Location: tests/integration/auth.test.js
Framework: Jest with Supertest
Requirements: Test successful registration, invalid email, weak password, duplicate email
## Dev Agent Record
*(Dev updates this section only)*
## QA Review
*(QA updates this section only)*Output: docs/stories/1.1.user-authentication.md with complete context
*agent dev
*develop-storyDev Workflow:
Critical Dev Rules:
Dev Agent Record Updates:
## Dev Agent Record
**Agent Model Used**: claude-sonnet-4
**Debug Log**: .ai/debug-log.md#story-1.1
**Completion Notes**:
- Implemented User model with Sequelize ORM
- Added bcrypt hashing with salt rounds = 10
- Created registration endpoint with validation middleware
- Implemented email validation using validator.js
- Added comprehensive test suite with 85% coverage
**File List**:
- Created: src/models/User.js
- Created: src/routes/auth.js
- Created: src/middleware/validation.js
- Created: tests/integration/auth.test.js
- Modified: src/app.js (added auth routes)
**Change Log**:
| Date | Version | Description | Author |
|------|---------|-------------|--------|
| 2024-01-15 | 1.0 | Initial implementation | Dev Agent |*agent qa
*reviewQA Workflow:
Optional QA Tasks:
*test-design # Design test scenarios
*trace # Requirements traceability
*risk-profile # Risk assessment
*nfr-assess # Non-functional requirements validation*agent qa
*gateGate Decisions:
PASS: All quality criteria met, ready for production
## QA Review
**Gate Decision**: PASS
**Rationale**:
- All acceptance criteria satisfied
- Test coverage: 85% (target: 80%)
- Code quality standards met
- No security vulnerabilities found
- Performance requirements met
**Status Update**: DoneCONCERNS: Issues found but not blocking
## QA Review
**Gate Decision**: CONCERNS
**Rationale**:
- Missing input validation on optional email field
- Test coverage: 75% (target: 80%)
- Can proceed with monitoring
**Issues**:
1. Add validation for optional profile email field
2. Increase test coverage to 80%
**Status Update**: Review (for minor fixes)FAIL: Critical issues, must address
## QA Review
**Gate Decision**: FAIL
**Rationale**:
- Security vulnerability: Password stored in plain text
- Missing authentication middleware
- No error handling for failed registration
**Critical Issues**:
1. **SECURITY**: Passwords must be hashed with bcrypt (not done)
2. **MISSING**: Authentication middleware not implemented
3. **ERROR HANDLING**: No try-catch blocks, app crashes on errors
**Status Update**: InProgress (Dev must fix)WAIVED: Issues waived by stakeholder
## QA Review
**Gate Decision**: WAIVED
**Rationale**:
- Performance slightly below target (220ms vs 200ms)
- Stakeholder decision: Acceptable for MVP
- Documented for future improvement
**Waived Issues**:
1. Registration response time: 220ms (target: 200ms)
**Status Update**: Done (with waiver)Output: docs/qa/1.1-user-authentication-qa-gate.md
If gate decision is FAIL or CONCERNS:
*agent dev
*review-qaDev Addresses Feedback:
QA Re-reviews: Repeat Step 4-5 until PASS
*agent sm
*draftSM creates next story (2.1, 2.2, etc.) and cycle repeats.
Dev implements tasks in order, one at a time:
Stories contain complete context - no re-reading needed:
Every story goes through QA gate:
Problem: Story creation fails - missing architecture
Solution: Ensure architecture is sharded (*agent po → *shard-doc)
Problem: Dev can't find required files
Solution: Check devLoadAlwaysFiles in core-config.yaml
Problem: QA gate always FAIL Solution: Review architecture coding standards, adjust expectations
Problem: Story too large Solution: SM should break into smaller stories (< 8 tasks)