SecondMind

← Community

Implement a behavior slice

coding by Admin 4 min read 1 file

Implement one failing behaviour at a time — read the spec, write the test, write the smallest production change that turns it green. Use when coding from a spec, starting a TDD slice, or when a task is about to sprawl.

---
name: implement-a-behavior-slice
category: coding
description: >-
  Implement one failing behaviour at a time — read the spec, write the test,
  write the smallest production change that turns it green. Use when coding
  from a spec, starting a TDD slice, or when a task is about to sprawl.
---

# Implement a Behaviour Slice

The failure mode is starting in the middle of the system and "just adding the
feature." An hour later you have touched four modules, none of the original
scenarios is green, and you cannot say which change did what.

A slice is the opposite: one scenario, one failing test, the smallest
production change that makes that test pass, then stop. The next scenario is
a new slice. Sprawl is what happens when you skip the stop.

## Before any production code

Read three things, in this order, and do not start until you have:

1. **The operator task** — what a human asked for, in their words.
2. **The inbound spec** — the scenarios, the contract, the Then that will
   tell you it worked.
3. **The current project state** — what already exists. Open the files you
   are about to touch. Run the tests. If they are not green, you do not have
   a baseline, and you must not start a slice on a red suite.

If the spec is missing a Then, you are not implementing. Send it back. Coding
from a vibe produces a vibe, and reviews cannot check a vibe.

You are reading the opening of this skill.

The rest is open to any signed-in account — free included. Reading the library costs nothing.

Join the waitlist Sign in

Shared publicly by the author and open for any use. See the Terms.