| name | beads |
| description | Track work with beads issue tracker using TDD workflow. Create issues for RED (failing tests), GREEN (implementation), and REFACTOR phases. |
Beads Issue Tracking with TDD Workflow
Overview
Beads (bd) is a git-native issue tracker that lives in your repository. Use it to track multi-session work with dependency graphs. For TDD workflows, create separate issues for each phase: RED, GREEN, REFACTOR.
When to Use Beads vs TodoWrite
| Use Beads | Use TodoWrite |
|---|
| Multi-session work | Single session tasks |
| Complex dependencies | Linear task lists |
| Needs persistent context | Ephemeral tracking |
| TDD phase tracking | Simple checklists |
| Collaborative work | Solo quick tasks |
TDD Workflow with Beads
Phase 1: RED (Failing Tests)
Create an issue for writing the failing test:
bd create --title="RED: [Feature] tests" --type=task --priority=0 --labels="tdd-red,[feature-area]"
Issue content should include:
- What behavior the test should verify
- Expected inputs and outputs
- Edge cases to cover
Mark in_progress when starting:
bd update [issue-id] --status=in_progress
Close when test is written and failing:
bd close [issue-id] --reason="Test written, failing as expected"
Phase 2: GREEN (Minimal Implementation)
Create an issue for the implementation (depends on RED):
bd create --title="GREEN: Implement [Feature]" --type=task --priority=0 --labels="tdd-green,[feature-area]"
bd dep add [green-id] [red-id]
Issue content should include:
- Link to the RED issue
- Minimal approach to make tests pass
- No extra features (YAGNI)
Close when tests pass:
bd close [issue-id] --reason="Tests passing"
Phase 3: REFACTOR (Clean Up)
Create an issue for refactoring (depends on GREEN):
bd create --title="REFACTOR: Clean up [Feature]" --type=task --priority=1 --labels="tdd-refactor,[feature-area]"
bd dep add [refactor-id] [green-id]
Issue content should include:
- What needs cleaning (duplication, naming, extraction)
- Keep tests green throughout
Close when refactoring complete:
bd close [issue-id] --reason="Refactored, tests still green"
Essential Commands
Finding Work
bd ready
bd list --status=open
bd list --status=in_progress
bd blocked
Creating Issues
bd create --title="..." --type=task|bug|feature|epic --priority=0-4
Managing Dependencies
bd dep add [issue] [depends-on]
bd show [issue]
Updating Status
bd update [id] --status=in_progress
bd update [id] --status=blocked
bd close [id]
bd close [id1] [id2] [id3]
Syncing
bd sync --from-main
bd sync --status
TDD Labels Convention
Use these labels consistently:
| Label | Phase | Description |
|---|
tdd-red | RED | Writing failing tests |
tdd-green | GREEN | Implementing to pass tests |
tdd-refactor | REFACTOR | Cleaning up while green |
Plus feature-area labels like: auth, api, ui, database, etc.
Example: Adding User Authentication
bd create --title="RED: User authentication tests" \
--type=task --priority=0 \
--labels="tdd-red,auth" \
--description="Write tests for login, logout, session management"
bd create --title="GREEN: Implement user authentication" \
--type=task --priority=0 \
--labels="tdd-green,auth"
bd dep add workers-xxxx workers-yyyy
bd create --title="REFACTOR: Clean up auth module" \
--type=task --priority=1 \
--labels="tdd-refactor,auth"
bd dep add workers-zzzz workers-xxxx
bd update workers-yyyy --status=in_progress
bd close workers-yyyy --reason="Tests written, failing"
bd update workers-xxxx --status=in_progress
bd close workers-xxxx --reason="Tests passing"
bd update workers-zzzz --status=in_progress
bd close workers-zzzz --reason="Refactored, tests green"
Parallel TDD with Subagents
For large features, use parallel subagents to create TDD issue chains:
Launch parallel agents to create beads issues for each module:
- Agent 1: Create RED/GREEN/REFACTOR chain for Module A
- Agent 2: Create RED/GREEN/REFACTOR chain for Module B
- Agent 3: Create RED/GREEN/REFACTOR chain for Module C
Each agent creates 3 issues with proper dependencies.
Session Management
Starting a Session
bd ready
bd show [id]
bd update [id] --status=in_progress
Ending a Session
bd close [completed-ids]
bd sync --from-main
git add . && git commit
Key Principles
- One issue per TDD phase - Don't combine RED/GREEN/REFACTOR
- Dependencies enforce order - GREEN blocked by RED, REFACTOR blocked by GREEN
- Close immediately - Mark done as soon as phase completes
- Labels for filtering - Use
tdd-* labels to find phase-specific work
- Sync regularly - Keep beads in sync with main branch