Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIDeepSeekDeepSeekMuseMuse+23 more

    Spring Boot TDD Workflow

    by william Harris

    1

    Brief — the feature is specified (goal, inputs, success criteria, error cases) and approved before a line of code exists.

    $9

    Secure checkout via Stripe

    Money-back guarantee

    Converts to your local currency at checkout

    Security scanned

    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 asking: “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 asking: “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 asking: “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 asking: “Set up the five-gate TDD loop for our Spring Boot project”

    Spring Boot TDD Workflow

    Spring Boot TDD Workflow

    Example session with this skill installed

    Add a coupon feature to my Spring Boot shop: customers enter a code at checkout and get 10% off the order total. Use the TDD workflow — I don't want untested code this time.

    • Read your context and instructions
    • Compiled the spring boot tdd

    Gate 1 — Brief

    Feature: Coupon discount at checkout.

    Goal: a valid code takes 10% off the order total, exactly once.

    Success: total 100.00 → 90.00 with code SAVE10.

    Error cases: unknown code (no discount, clear message), expired code, and a coupon applied twice (must never stack). Brief approved — no code written yet.

    Gate 2 — Plan

    Three tasks, each naming its test first:

    1. CouponService.applyCoupon — unit test: a valid code discounts the total by 10%
    2. Double-apply guard — unit test: applying the same coupon twice discounts only once
    3. Checkout endpoint — @WebMvcTest with MockMvc: POST /checkout with a code returns the discounted total

    Gate 3 — Red

    Task 1's test is written and run: it fails because CouponService doesn't exist yet — the right reason. Task 2's test is written next, and it exposes a real bug in the naive design before any production code ships:

    expected: <90.00> but was: <81.00>
    

    100.00 discounted twice at 10% is 81.00. The red test just caught the double-discount bug on paper, where it costs nothing.

    Gate 4 — Green

    Minimal implementation: CouponService applies the discount once and marks the coupon redeemed on the order; a second apply is a no-op. All three tests pass. Nothing extra was built.

    Gate 5 — Review gate

    tdd_gate.py pairing check:

    100/100. Every new class (CouponService, the CheckoutController changes, CouponRepository) has a paired test with real assertions. Two-pass review: pass 1 (correctness) — discount math uses BigDecimal with scale 2 and HALF_UP rounding; pass 2 (edge cases) — the expired-code path is covered by a test, and an unknown code returns the agreed message.

    Done — and this time "done" is mechanical, not a promise.

    Connects securely to your tools. The creator never sees your data.

    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 to run the gate script. Only works with Spring Boot projects using Maven or Gradle.

    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

    1. 1

      Connect your agent to the Agensi MCP

      Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup

    2. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before buying a skill.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill goes through the trust checks below.

    Security scanned

    Checked by our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    Money-back guarantee

    Doesn't do what its page promises? You get your money back.

    Trust & safety

    Security scan

    Security scan passed today

    Software
    Python 3.8+

    Permissions

    Terminal / Shell
    Read Files
    Write Files

    File Scopes

    src/main/java/**
    src/test/java/**
    Listedtoday

    What's inside

    Frequently Asked Questions

    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.

    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.

    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.

    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.

    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.

    New in Code Quality & Review

    Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Code Quality & Review.