# Spring Boot TDD Workflow

> AI agents write Spring Boot code fast — and ship it untested. This skill forces a disciplined five-gate loop (brief → plan → red → green → review gate) so every Service, Controller, and Repository ships with a paired test and real assertions.

Spring Boot TDD Workflow is a paid AI agent skill on Agensi by william Harris, in Code Quality & Review. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: $9 (one-time purchase)
- Creator: [william Harris](https://www.agensi.io/creators/william-harris)
- Category: [Code Quality & Review](https://www.agensi.io/skills/code-quality-review)
- Version: 1.0
- Last updated: 2026-12-03
- Security: scan passed (2026-12-03); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/spring-boot-tdd-workflow
- Tags: code-review, testing, java, spring-boot, tdd, test-driven-development, workflow, junit

## What it does

- Forces a feature brief before any code is written
- Plans tasks test-first, naming the failing test before the implementation
- Requires a red test that fails for the right reason, then minimal green code
- Specializes each gate for Spring Boot slices: @WebMvcTest, @DataJpaTest, MockMvc, Testcontainers
- Scores test pairing 0–100 with tdd_gate.py, a dependency-free checker with CI-friendly exit codes
- Refuses "done" at the review gate until every class has a paired test with real assertions

## Who it's for

- **Spring Boot developers coding with AI agents:** Features that arrive with tests, not promises — every class paired with a real test Try: "Add a coupon feature to my Spring Boot shop using the TDD workflow"
- **Solo builders shipping with AI assistance:** A mechanical gate that stops untested code from shipping Try: "Build this feature test-first and don't call it done until the gate passes"
- **Engineering leads enforcing test discipline:** Proof that every Service, Controller, and Repository has a paired test Try: "Run the TDD gate on this module and fix the missing tests"
- **Teams adopting AI coding tools:** A repeatable brief → plan → red → green → review loop for all agent-written code Try: "Set up the five-gate TDD loop for our Spring Boot project"

## About this skill

### Spring Boot TDD Workflow

**AI agents write Spring Boot code fast — and ship it untested. This skill makes that impossible.**

It forces a disciplined loop: a feature brief before any code, a task plan that names its test first, a red test that must fail for the right reason, minimal green code, and a mechanical review gate that refuses "done" until every Service, Controller, and Repository has a paired test with real assertions.

#### The five gates

1. **Brief** — the feature is specified (goal, inputs, success criteria, error cases) and approved before a line of code exists.
2. **Plan** — work is broken into small tasks; each task names the test that will prove it, and picks the right Spring Boot test slice.
3. **Red** — the test is written first and must fail for the right reason — proving the feature is genuinely missing, not that the test is broken.
4. **Green** — the minimal code that makes the test pass. No speculative features, no gold-plating.
5. **Review gate** — a mechanical check (`tdd_gate.py`) scores test pairing 0–100 and refuses "done" until every class is paired with a test containing real assertions. A two-pass review checklist catches what the script can't.

The workflow is specialized for Spring Boot test slices: `@WebMvcTest` for controllers, `@DataJpaTest` for repositories, MockMvc for HTTP behavior, Testcontainers for integration tests — with a test-slice guide telling the agent which slice fits which task.

#### Proof

Rehearsal-verified: an undisciplined sample project fails the gate at **50/100** with all planted gaps caught; the disciplined sample passes **100/100** with zero false positives.

#### What's inside

- **SKILL.md** — the five-gate workflow your agent follows
- **scripts/tdd_gate.py** — dependency-free pairing checker (0–100 score, CI-friendly exit codes)
- **Templates** — feature brief and task plan, fill-in ready
- **Reference** — test-slice guide, two-pass review checklist, worked examples, rehearsal notes
- **Sample projects** — undisciplined (50/100) and disciplined (100/100)

Inspired by the superpowers methodology (obra/superpowers, MIT), rebuilt for Spring Boot.

## Requires

- Python 3.8+

## Known limitations

Requires Python 3 to run the gate script. Only works with Spring Boot projects using Maven or Gradle.

## Technical details

Works on Spring Boot projects built with Maven or Gradle. The gate checker (scripts/tdd_gate.py) is dependency-free Python 3 (standard library only): it statically pairs production classes with test classes, verifies the tests contain real assertions (not empty or mock-only shells), and scores pairing 0–100 with CI-friendly exit codes. It complements — never replaces — your test runner: at the red and green gates the workflow has the agent run your actual JUnit 5 / Mockito / MockMvc / Testcontainers suite and read the results. The test-slice guide covers @WebMvcTest, @DataJpaTest, MockMvc, and Testcontainers. Requires Python 3.8+ for the gate script and terminal access for the agent.

## How to use this skill

1. Connect your AI agent to Agensi once: add the MCP server https://mcp.agensi.io/mcp/auth and sign in with your Agensi account (OAuth, no API key). Steps for Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and other agents: https://www.agensi.io/docs/mcp-setup
2. Ask your agent: "Use the Spring Boot TDD Workflow skill from Agensi" and describe your task.
3. Buy it on the listing or let your agent ask you first; your agent then loads it from Agensi when it needs it. Every paid skill has a money-back guarantee: https://www.agensi.io/docs/money-back-guarantee

## Frequently asked questions

### Does the gate actually run my tests?

Both parts work together. tdd_gate.py statically checks that every production class is paired with a test containing real assertions, and scores pairing 0–100. Separately, at the red and green gates the workflow has your agent run your real test suite (JUnit 5, Mockito, Testcontainers) and read the results — a red test must fail for the right reason, and green means the suite actually passes. The gate complements your test runner; it never replaces it.

### Maven or Gradle — which builds are supported?

Both. The workflow detects your build tool and runs tests the native way (./mvnw test or ./gradlew test), including targeted runs for a single test class during the red/green loop. The gate checker itself is build-tool agnostic — it reads your source and test trees directly.

### What about an existing project with few or no tests?

Run the gate first to get a baseline: it scores your current pairing and lists every unpaired class. Then apply the five-gate loop to new and changed code so coverage grows with every feature, and pair legacy classes incrementally — the score makes progress visible. You don't need a big-bang test-writing effort to start.

### How is this different from the Spring Boot Unit Test Generator?

The Unit Test Generator writes tests for code that already exists. TDD Workflow governs how new code gets built — brief, plan, red, green, review gate — so tests come first and "done" is enforced mechanically. They pair well: use the generator to backfill tests on legacy code, and this workflow for every new feature and bug fix.

### Can I use the gate in CI?

Yes. tdd_gate.py is a dependency-free Python script with CI-friendly exit codes: it exits non-zero when pairing falls below your threshold, so a pull request that adds an unpaired class fails the build. Add it as a step next to your normal test run in GitHub Actions, GitLab CI, or Jenkins.

---

Source: [Agensi](https://www.agensi.io), the marketplace of skills for AI agents. Any MCP-compatible agent (Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and more) connects at https://mcp.agensi.io/mcp/auth and signs in with an Agensi account; setup for every agent: https://www.agensi.io/docs/mcp-setup. Append .md to any skill, guide or docs address on agensi.io for its markdown version.
