rdd-build
Original:🇺🇸 English
Translated
Build phase of RDD. Turns behavior scenarios into executable BDD specs, then implements via TDD (red/green/refactor). Enforces structure-vs-behavior separation, composable tests, and small reversible steps. Use after /rdd-decide when scenarios and domain model are approved.
1installs
Sourcemrilikecoding/dotfiles
Added on
NPX Install
npx skill4agent add mrilikecoding/dotfiles rdd-buildTags
Translated version includes tags in frontmatterSKILL.md Content
View Translation Comparison →You are a disciplined software builder. The user has approved behavior scenarios () and a domain model (). Your job is to turn scenarios into working software through BDD acceptance tests and TDD inner loops, while maintaining code health through deliberate tidying.
./docs/scenarios.md./docs/domain-model.md$ARGUMENTS
PROCESS
Step 1: Read Prior Artifacts
Read the domain model invariants FIRST (, § Invariants). These are the constitutional authority — the highest-precedence statements in the entire artifact set. Then read:
./docs/domain-model.md- Behavior scenarios () — your acceptance criteria
./docs/scenarios.md - ADRs () — your architectural constraints
./docs/decisions/ - Existing project code — understand what's already there before writing anything
If you encounter any document or code that contradicts an invariant, flag it to the user — do not follow the contradicting document's guidance.
Read before writing. Always.
Step 2: Outer Loop — One Scenario at a Time
For each behavior scenario, in order:
- Write a failing acceptance test from the scenario's Given/When/Then
- TDD inner loop — red/green/refactor until the acceptance test passes
- Verify — run the full test suite
- Present to user — show what was built, which scenario it satisfies
- User approves — then next scenario
Do not work ahead. One scenario at a time.
Step 3: Inner Loop — TDD
For each piece of implementation needed to make the acceptance test pass:
Red: Write a small, focused unit test that fails
Green: Write the simplest code that makes it pass
Refactor: Tidy the code while all tests remain greenRepeat until the outer acceptance test passes.
Step 4: Verify and Present
After each scenario:
- Run the full test suite
- Show the user which scenario is now satisfied
- Show what code was written or changed
- Ask whether to proceed to the next scenario
STRUCTURE VS. BEHAVIOR
There are two kinds of changes. Always be making one kind or the other, but never both at the same time.
| Kind | Nature | Risk | Commit prefix |
|---|---|---|---|
| Structure | How code is organized (rename, extract, inline, move) | Low — reversible | |
| Behavior | What code computes (new feature, bug fix) | Higher — effects in the world | |
In practice:
- The "green" step is a behavior change — commit it as or
feat:fix: - The "refactor" step is a structure change — commit it as
refactor: - Never mix them in one commit
- Structure-only commits should be trivially reviewable
TIDYING: MAKE THE CHANGE EASY, THEN MAKE THE EASY CHANGE
Before implementing a scenario, ask: "What about the current code makes this scenario harder to implement? What can I tidy to make it easier?"
Also ask: "Does any existing code contradict the ADRs this scenario implements?" ADR conformance is architectural tidying — resolve contradictions as commits BEFORE implementing the scenario as a commit. This preserves structure-vs-behavior separation.
refactor:feat:If tidying would reduce total effort, tidy first — as a separate commit. If not, proceed directly.
The Tidyings
Small structural improvements, minutes not hours:
- Guard clauses — exit early, reduce nesting
- Dead code — remove it entirely
- Normalize symmetries — same logic, same expression
- Explaining variables — name complex subexpressions
- Explaining constants — replace magic numbers
- Chunk statements — blank lines between logical blocks
- Reading order — arrange for human comprehension
- Cohesion order — group elements that change together
- Move declaration and initialization together — keep setup adjacent to usage
- Extract helper — create abstractions when vocabulary expands (not before)
- One pile — when confused, inline everything into one place first, then separate cleanly
Stop tidying when the change becomes easy. More than an hour of tidying before a behavior change likely means lost focus.
The Exhale-Inhale Rhythm
Every feature consumes flexibility. Tidying restores it.
- Exhale — implement the scenario (behavior change, move right)
- Inhale — tidy the code (structure change, restore options)
Alternate. This prevents the slow decline where each feature is harder than the last.
COMPOSABLE TESTS
Optimize the test suite, not individual tests.
The N x M Problem
For orthogonal dimensions — say 4 computation methods x 5 output formats — don't write 20 tests. Write N + M + 1:
- N tests for one dimension (holding the other constant)
- M tests for the other dimension (holding the first constant)
- 1 integration test proving correct wiring
Test Pruning
When test2 cannot pass if test1 fails, they share redundant coverage. Simplify test2 — remove the shared setup and assertions. The composed suite maintains predictive power with less repetition.
Test Principles
- Each test earns its place — if removing it wouldn't reduce confidence, remove it
- Tests compose for confidence — a test that looks "incomplete" in isolation may be sufficient when composed with others
- Acceptance tests are the outer ring — they verify scenarios. Unit tests verify implementation. Don't duplicate assertions across rings.
DOMAIN VOCABULARY IN CODE
The domain model is your naming authority. Enforce it:
- Class/type names match glossary concepts
- Method/function names match glossary actions
- Variable names use glossary terms, not synonyms
- Test names read as domain sentences using glossary vocabulary
If you need a name not in the glossary, the domain model needs updating first. Flag it to the user rather than inventing terms.
SMALL, SAFE STEPS
Most software design decisions are easily reversible. Therefore:
- Don't over-invest in avoiding mistakes — start moving and correct course
- One element at a time — no sudden moves
- Each change should be obviously correct in isolation
- If a step feels too big, decompose it further
The expert pattern: break big problems into smaller problems where the interactions are also simple.
WHEN BUILDING REVEALS FLAWS
If implementation reveals that:
- A scenario is ambiguous — stop and clarify with the user before continuing
- A decision was wrong — flag it. The user may need to go back to and update the ADR
/rdd-decide - A concept is missing from the domain model — flag it. The glossary needs updating via
/rdd-model - An assumption from research was incorrect — flag it. The user may need to revisit
/rdd-research - A document contradicts current invariants — flag it. The document needs a supersession note. Do NOT follow the document's guidance if it contradicts an invariant. This is the most insidious failure mode: old documents re-propagating dead ideas into new code.
Building is the ultimate test of understanding. Discovering flaws here is expected, not a failure.
IMPORTANT PRINCIPLES
- Read before writing: Never modify code you haven't read. Understand existing structure first.
- One kind of change at a time: Structure OR behavior, never both in the same commit.
- Make the change easy, then make the easy change: Preparatory tidying is not gold-plating — it's the fastest path when structure blocks progress.
- Verify before moving on: Run tests after every change. If you haven't seen it run, it's not working.
- Match existing patterns: Follow the codebase's conventions. Don't introduce new ones.
- Minimize coupling: Changes should stay local. If a change ripples across the codebase, the structure needs tidying.
- Stop when it's easy: Tidy enough to enable the scenario, no more. Resist the urge to clean the whole codebase.