---
name: build-vertical-slice
description: Implement the smallest end-to-end user-visible behavior using test-driven development and real system boundaries, then return reproducible acceptance evidence. Use after a spec identifies a concrete slice. Do not use for planning-only or review-only work.
license: Apache-2.0
metadata:
  compatibility: Codex, Kimi Code, and Grok Build; requires repository write and test execution access.
  author: Lei Huang
  version: "0.1.0"
  status: experimental
---

# Build Vertical Slice

Make one real user path work from edge to persistence and back before broadening the implementation.

## Workflow

1. Read the acceptance example and locate the closest end-user entry point.
2. Reproduce the missing behavior end to end. Record the exact command or interaction and observed failure.
3. Add an acceptance or integration test that fails for the intended reason.
4. Add focused unit or contract tests for complex logic and boundary behavior.
5. Implement the smallest coherent path through UI or API, domain logic, data, and external boundaries.
6. Run the new test, then relevant local suites, lint, type checks, build, and security or accessibility checks.
7. Exercise the end-user path again. Capture screenshots or traces for visual behavior.
8. Review the diff for unrelated changes, dead scaffolding, debugging output, migration safety, and rollback.

## TDD evidence

Preserve:

```yaml
acceptance_example: spec reference
red:
  command: exact command
  result: expected failing assertion or observed behavior
green:
  command: exact command
  result: passing output
refactor:
  change: simplification or none
  verification: exact command and result
```

If a failing test cannot be created first, explain why and capture the closest reliable reproduction. Never fabricate a red phase after implementation.

## Engineering rules

- Follow repository instructions and existing patterns unless evidence supports changing them.
- Prefer real boundaries; label fakes, mocks, stubs, and skipped integrations.
- Keep the slice narrow, but include its error, authorization, accessibility, observability, and migration obligations.
- Do not weaken assertions, disable checks, or update snapshots merely to obtain green.
- Fix directly related flaky, lint, or test failures rather than hiding them.

## Evidence packet

Lead with the user-visible outcome. List files changed, red-green-refactor evidence, end-to-end verification, full relevant checks, visual artifacts, and untested paths. Do not claim completion when the acceptance example remains unexercised.
