Test driven development

From laurynas-biveinis/dotfiles · View interactive version

Test driven development is an AI agent skill from the GitHub repository laurynas-biveinis/dotfiles. Red-green TDD iteration process for testable codebases. You MUST use this when starting a new feature, bugfix, or behavior change that can be exercised by tests. Drives one failing test, minimal pass, refactor cycle, validated by ./check.sh at every step.

How to use this skill

Skill file

Test-Driven Development

With the smallest possible iteration steps, use red-green TDD as follows:

  1. Ultrathink about the full scope of the task. Analyze what needs to be done,

ask the user any clarifying questions to fully understand it. Follow the

YAGNI (You Ain't Gonna Need It) principle and do NOT design functionality not

asked for, but feel free to note it and ask the user for feedback. Only then

design. Strive for simplicity. For any non-trivially sized plan, write it to

a scratch plan file.

  1. Run ./check.sh to ensure you are starting from a clean baseline.
  2. Write user-facing documentation for the feature or for any behavior changes

by a bugfix.

  1. Run ./check.sh to confirm the baseline after the documentation changes.
  2. Write ONE failing test for the smallest bit of functionality or a minimal bug

testcase. Tests are NOT allowed to access internal APIs or internal state of

the module being tested. If that precludes testing, ultrathink about making

the design more testable. NEVER write multiple tests at once. Feel free to

note any useful missing tests in the plan.

  1. Run ./check.sh to observe the expected test failure.
  2. Write the minimal code to make the test pass. Make sure to follow DRY (Don't

Repeat Yourself) principle: extract common functionality into reusable

functions or modules. If you find yourself writing similar code twice,

refactor it. Do not add obvious comments.

  1. Run ./check.sh to confirm the test passes now.
  2. Refactor the code if needed, one smallest possible refactoring at a time.
  3. Run ./check.sh to confirm the refactoring did not break the code.
  4. Go back to the refactoring step until you no longer see any good

refactorings.

  1. If the code change is at a logical commit size (see Commit Guidelines in

CLAUDE.md), invoke review-changes to inspect, fix, track, and repeat until

the original changes converge. Present its report and created off-path

tracking records. If it returns incomplete, resolve or surface the blocker

before advancing. During a fix owned by an already-active review-changes

loop, return to that loop for the next inspection instead of recursively

invoking it; all preceding TDD steps still apply. Skip review for routine

mechanical changes (comments, formatting, simple renames).

  1. Repeat for the next iteration.
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.