fernandoteixxeira/stark-bank-challenge/tdd

Claude Code and agent skill by fernandoteixxeira/stark-bank-challenge

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Use when driving code with tests, deciding what to test next, choosing test doubles, or diagnosing a test suite that passes without proving anything. Covers the red-green-refactor cycle, triangulation, boundary tests, and verification traps.

Install

npx vskill@latest install fernandoteixxeira/stark-bank-challenge/tdd

SKILL.md

The same SKILL.md was published earlier as fernandoteixxeira/stark-bank-challenge/tdd.

TDD

Write the test first, watch it fail, make it pass, then clean up.

This skill covers the discipline. For which layer gets which kind of test see hexagonal-architecture; for test naming see java-conventions; for what makes a test readable see clean-code.

The Cycle

  1. Red. Write one failing test for behaviour that does not exist yet. Run it. Watch it fail, and read the failure message.
  2. Green. Write the least code that passes. Ugly is allowed here.
  3. Refactor. Clean up with the test green. Change structure, never behaviour.

The order is the whole technique. Writing the test after the code produces a test shaped by the implementation you already have, which is exactly the test least able to find a fault in it.

Watch It Fail — the Step That Gets Skipped

A test that has never failed proves nothing. It might be asserting on the wrong object, matching nothing, or passing vacuously.

Before trusting any green test, make it red on purpose. Break the production code, confirm the test catches it, restore. If it stays green, the test is decoration.

This matters most for tests whose subject is a rule rather than a value:

java
// Passes. Proves nothing: if no class matches `that()`, the rule is vacuously true.
noClasses().that().haveSimpleNameEndingWith("Gateway")
.should().dependOnClassesThat().resideInAnyPackage("com.example.sdk..");

The check is mechanical: introduce the violation, see the rule fail, remove it. Same for a guard clause, a validation, a permission check. If you never saw it reject, you do not know it rejects.

One Behaviour Per Test

A test names one guarantee and asserts it. When a test needs "and" in its name, it is two tests.

Arrange, act, assert — in that order, with the act as a single line. If the act is hard to isolate, the design is telling you something.

Triangulation

Do not generalise from one example. One test can be passed by return 5;. Add the second, differing case and the fake answer collapses.

Generalise when the second case forces it, not before.

Boundaries Are Where Faults Live

For any range, test the edges, not the middle. Below the low bound, at the low bound, at the high bound, above the high bound.

State inclusivity explicitly in the test, because it is the assumption most often wrong and most silently wrong:

java
@Test
void shouldReachBothBoundsBecauseTheyAreInclusive() {
Set<Integer> drawn = manyRuns().map(Subject::draw).collect(toSet());
assertThat(drawn).contains(LOW, HIGH); // fails the day a bound turns exclusive
}

A test that only asserts isBetween(LOW, HIGH) still passes when HIGH becomes unreachable. Assert reachability, not just containment.

Do Not Verify a Library With Itself

When the thing under test is "the library produces valid X", asserting with the same library's validator proves only that it agrees with itself.

Verify against an independent oracle: your own implementation of the rule, a published test vector, or a second library. If your domain already implements the rule to protect its invariants, that implementation is the oracle, and pointing the library's output at it is a real test.

The same trap appears whenever the assertion is derived from the code under test. If the expected value is computed by calling the thing being tested, the test is a tautology.

Test Doubles

Pick the weakest double that does the job.

DoubleIsUse when
dummyfiller, never calleda parameter must exist
stubreturns canned answersthe test needs the collaborator to say something
fakeworking, simplified implementationthe collaborator has real behaviour worth exercising
spyrecords what it receivedthe call itself is the outcome
mockasserts on calls, fails on mismatchthe interaction is the contract

Prefer stubs and fakes. A mock asserts on how the code works and breaks on refactoring; a stub asserts on what it produces and survives it. Reach for a mock only when the interaction is genuinely the thing being specified — that a message was published, that a payment was not charged twice.

A hand-written double is often clearer than a mocking framework, and it fails at compile time when the interface changes rather than at run time.

Do not mock what you do not own. Mocking a third-party SDK asserts your belief about that SDK, and your belief is the thing most likely to be wrong. Wrap it behind your own interface, double the interface, and cover the wrapper with a test that exercises the real thing.

Test Behaviour, Not Implementation

Assert observable outcomes: return values, state visible through the public API, calls that cross a boundary that matters.

Do not assert on private methods, field values, call order that does not matter, or the number of times something was invoked when the count is incidental. Those tests fail on refactoring, which teaches the team to distrust the suite and delete tests to make the build green.

The test is a client of the code. If it needs access no real client would have, that is a design signal, not a reason to widen visibility.

What Not to Test

  • The framework. It has its own suite.
  • Generated code, record accessors, plain delegation with no rule.
  • The same rule at three layers. Test it where it is enforced.
  • Log statements, unless the log is a contract someone parses.

Coverage is a smoke detector, not a goal. It shows what is definitely untested; it says nothing about whether what is covered was ever really checked.

When a Bug Escapes

Reproduce it as a failing test first. That test is the proof it was real, the proof it is fixed, and the guard against it coming back. Fixing first and testing after loses all three.

Review Checklist

  • Each test names one guarantee and reads as an example of it.
  • Every test has been seen to fail for the right reason.
  • No rule-shaped test is vacuous: the violation has been introduced and caught.
  • Ranges are tested at their edges, with inclusivity asserted.
  • No assertion is derived from the code under test.
  • Doubles are the weakest kind that works; no third-party type is mocked.
  • Nothing asserts on private state or incidental call counts.

Security

  • Security scanPassed, 90 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
0

Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/fernandoteixxeira/stark-bank-challenge/tdd/badge)](https://verified-skill.com/skills/fernandoteixxeira/stark-bank-challenge/tdd)

Something wrong with this skill or its page? Tell us.