agentleFS
hudrazinehudrazine/velkross/skills/tdd/SKILL.md

tdd

Skill1 starsChanged 5 months agoMITView on GitHub

Apply practical, language-agnostic test-driven development when implementing observable behavior, reproducing and fixing bugs, or changing untested code where executable examples can guide the design. Use a small List → Red → Green → Refactor loop, with regression-first, characterization-first, refactoring, and spike-then-test variants. Do not use strict TDD for visual-only styling, exploratory work before behavior is understood, mechanical migrations, or documentation-only changes unless tests clarify a real contract or risk.

194 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use capture-learning-tools, design-frontend-dev and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • The-Vibe-CompanySkill

    capture-learning-tools

    Turn technical conversations, bugs, CI failures, review comments,

    Also in 5 projects that use this

  • The-Vibe-CompanySkill

    design-frontend-dev

    Clean Impeccable frontend design skill. Use when the user wants to

    Also in 5 projects that use this

  • tristanphvnSkill

    ketchup-video

    Catch the user up like /keel:ketchup, with a short silent video of slides for what happened and the waiting calls as text under it. Use for /keel:ketchup-video.

    Also in 14 projects that use this

  • jaydubya818Skill

    figure-it-out

    Use when novel or multi-phase work needs an auditable workflow and no narrower playbook fits.

    Also in 54 projects that use this

  • jaydubya818Skill

    principle-laziness-protocol

    Apply when a refactor is adding wrappers or abstractions instead of simplifying.

    Also in 45 projects that use this

  • +2 more from The-Vibe-Company
  • +5 more from jaydubya818

The file

Show its rules and text

We split this skill into the rules it gives an agent

34 rules. 0 are common, 34 are distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 186 edited versions we read keep these.

  • 34

    Distinctive

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Treat this as a design discipline, not merely a requirement to write tests first.

    line 14
  2. Distinctive:

    Behavior change: Use the full List → Red → Green → Refactor loop.

    line 20
  3. Distinctive:

    Exploration: Run the smallest useful spike when an SDK, algorithm, or external behavior is unknown.

    line 24
  4. Distinctive:

    Before starting a cycle:

    line 29
  5. Distinctive:

    Run the narrowest relevant existing tests to establish a known baseline.

    line 33
  6. Distinctive:

    Create or infer a short test list of observable behaviors, including important boundaries and failures.

    line 34
  7. Distinctive:

    Do not introduce a new test framework when the repository already provides a practical one.

    line 37
  8. Distinctive:

    If the baseline is already failing, separate pre-existing failures from failures introduced by the change.

    line 39
  9. Distinctive:

    Write test-list items as behavior:

    line 41
  10. Distinctive:

    Do not write implementation tasks such as “add an if statement,” “use a regex,” or “mock the service.” Add discoveries to the list instead …

    line 49
  11. Distinctive:

    Write one focused executable example with one primary reason to fail.

    line 55
  12. Distinctive:

    Run the narrowest relevant command and inspect the failure.

    line 65
  13. Distinctive:

    If the test passes immediately, do not force a Red by damaging working code.

    line 67
  14. Distinctive:

    keep the change local and straightforward

    line 75
  15. Distinctive:

    avoid unrelated cleanup and speculative options

    line 76
  16. Distinctive:

    add only scaffolding required to reach the tested behavior

    line 78
  17. Distinctive:

    run the focused test, then relevant nearby tests

    line 79
  18. Distinctive:

    Use the Green state to:

    line 87
  19. Distinctive:

    delete premature or obsolete abstractions

    line 94
  20. Distinctive:

    Do not change observable behavior during Refactor.

    line 96
  21. Distinctive:

    Do not code every imagined case in advance.

    line 108
  22. Distinctive:

    Use unit tests for pure rules, parsing, validation, formatting, and state transitions.

    line 114
  23. Distinctive:

    Use integration tests for persistence semantics, transactions, serialization, file systems, framework wiring, and external adapters.

    line 115
  24. Distinctive:

    Use component tests for rendered UI behavior and interaction state.

    line 116
  25. Distinctive:

    Use end-to-end tests sparingly for critical flows or contracts that lower levels cannot establish confidently.

    line 117
  26. Distinctive:

    Avoid duplicating the same assertion at every level unless the risk justifies it.

    line 119
  27. Distinctive:

    Test observable outcomes such as returned values, errors, persisted state, emitted events, rendered behavior, and meaningful side effects.

    line 121
  28. Distinctive:

    Use mocks, fakes, or stubs at slow, unstable, nondeterministic, destructive, or externally controlled boundaries.

    line 123
  29. Distinctive:

    Keep tests repeatable and independent.

    line 125
  30. Distinctive:

    Use precise assertions by default.

    line 127
  31. Distinctive:

    When a practical automated test cannot be written or run:

    line 131
  32. Distinctive:

    Keep the production change as small as possible.

    line 135
  33. Distinctive:

    Do not silently skip, disable, weaken, or rewrite an effective test merely to obtain Green.

    line 139
  34. Distinctive:

    no temporary special case violates the known contract

    line 150

“Common” is measured: kept by at least 6 in 10 of the 186 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

TDD

Implement software through short feedback loops that make each behavior and design decision observable.

List → Red → Green → Refactor → Repeat

Treat this as a design discipline, not merely a requirement to write tests first. Preserve the user's requested workflow and apply the strongest test-driven feedback that fits the task.

Choose the Operating Mode

Choose the mode before editing production code.

  • Behavior change: Use the full List → Red → Green → Refactor loop.
  • Bug fix: Reproduce the reported failure with a regression test, then make the smallest fix.
  • Untested existing code: Capture relevant current behavior with a characterization test, then add a failing test for the desired change.
  • Pure refactoring: Establish relevant Green coverage and refactor in small steps. Do not manufacture a failing test when observable behavior must not change.
  • Exploration: Run the smallest useful spike when an SDK, algorithm, or external behavior is unknown. Keep or discard the spike deliberately, then test the stable behavior before treating production work as complete.
  • Non-behavioral work: Skip strict TDD for visual-only styling, mechanical migrations, generated output, and documentation-only changes unless an executable check protects a real contract or risk.

Prepare

Before starting a cycle:

  1. Identify the target behavior and useful observation boundary.
  2. Inspect nearby code and tests for the established framework, naming, fixtures, doubles, and commands.
  3. Run the narrowest relevant existing tests to establish a known baseline.
  4. Create or infer a short test list of observable behaviors, including important boundaries and failures.
  5. Choose the smallest next example that will clarify the contract or force useful generalization.

Do not introduce a new test framework when the repository already provides a practical one.

If the baseline is already failing, separate pre-existing failures from failures introduced by the change. Continue only when the relevant behavior can still be isolated and verified; never report a pre-existing failure as a new Red or Green result.

Write test-list items as behavior:

- accepts a valid identifier
- rejects an empty identifier with a stable error code
- preserves metadata when updating a record

Do not write implementation tasks such as “add an if statement,” “use a regex,” or “mock the service.” Add discoveries to the list instead of expanding the current cycle.

Run the Cycle

Red: Prove the Behavior Is Missing

Write one focused executable example with one primary reason to fail. Multiple assertions are acceptable when they describe one coherent observable result.

Prefer tests with:

  • a specification-like name
  • minimal relevant setup
  • explicit input and expected outcome
  • assertions on public behavior or meaningful side effects
  • failure output that explains the unmet contract

Run the narrowest relevant command and inspect the failure. Proceed only when it fails because the behavior is missing or wrong, not because of syntax, imports, setup, fixtures, or an assertion that never ran.

If the test passes immediately, do not force a Red by damaging working code. Determine whether the test is weak, the behavior already exists, or the reproduction conditions are incomplete. Strengthen the test, mark the behavior complete, or investigate the missing precondition as appropriate.

Green: Satisfy the Current Contract

Make the smallest honest production change that satisfies the current example and preserves established behavior.

During Green:

  • keep the change local and straightforward
  • avoid unrelated cleanup and speculative options
  • tolerate temporary duplication when it keeps the step small
  • add only scaffolding required to reach the tested behavior
  • run the focused test, then relevant nearby tests

A narrow hardcoded implementation may be used as a temporary TDD step when the current example intentionally leaves the general rule unknown. Add the next example that forces generalization. Do not finish with a hardcoded special case when the known contract is broader.

Refactor: Improve Structure While Green

Improve production and test code only while the relevant tests pass.

Use the Green state to:

  • clarify names and boundaries
  • remove meaningful duplication
  • simplify branching and state
  • separate decisions from effects
  • improve test readability and setup
  • delete premature or obsolete abstractions

Do not change observable behavior during Refactor. If a behavior change becomes necessary, return to the test list and begin a new Red cycle.

Repeat Deliberately

Mark the completed item, record new discoveries, and choose the next example. Prefer this progression when it teaches the design something useful:

  1. regression for a reported bug
  2. simplest representative behavior
  3. a second example that defeats a special-case implementation
  4. important boundary or failure
  5. state transition or integration edge

Do not code every imagined case in advance. Stop when the requested contract is implemented, material risks have proportionate coverage, and remaining gaps are explicit.

Choose the Test Boundary

Choose the narrowest boundary that observes the real behavior with fast, stable, maintainable feedback. Do not default mechanically to the smallest function or to end-to-end testing.

  • Use unit tests for pure rules, parsing, validation, formatting, and state transitions.
  • Use integration tests for persistence semantics, transactions, serialization, file systems, framework wiring, and external adapters.
  • Use component tests for rendered UI behavior and interaction state.
  • Use end-to-end tests sparingly for critical flows or contracts that lower levels cannot establish confidently.

Avoid duplicating the same assertion at every level unless the risk justifies it.

Test observable outcomes such as returned values, errors, persisted state, emitted events, rendered behavior, and meaningful side effects. Avoid private methods, incidental call order, internal structure, and intermediate values unless that interaction is itself the contract.

Use mocks, fakes, or stubs at slow, unstable, nondeterministic, destructive, or externally controlled boundaries. Prefer real collaborators when they are fast and reliable. Excessive internal mocking usually signals the wrong observation boundary or a dependency that should be made explicit.

Keep tests repeatable and independent. Control relevant clocks, randomness, identifiers, time zones, environment, shared state, network access, and concurrency. Introduce the smallest seam needed for control; do not begin with a broad rewrite merely to make code testable.

Use precise assertions by default. Keep snapshots small and intentional. Use coverage to find unexamined risk, not as a substitute for meaningful behavioral evidence.

Handle Verification Limits

When a practical automated test cannot be written or run:

  1. Explain the concrete limitation.
  2. Perform the strongest available deterministic check.
  3. Keep the production change as small as possible.
  4. Provide the exact test or command that should be run later when known.
  5. Report the remaining verification gap without presenting the work as fully proven.

Do not silently skip, disable, weaken, or rewrite an effective test merely to obtain Green. Change a test's expectation only when the intended contract changed.

Completion Contract

Finish only when:

  • the requested observable behavior is implemented
  • bug fixes have regression coverage when practical
  • relevant focused tests pass
  • broader checks have been run in proportion to the affected boundary and risk
  • refactoring has preserved Green
  • no temporary special case violates the known contract
  • deferred cases and verification gaps are explicit

Report concisely:

  1. the behavior implemented, fixed, or preserved
  2. the tests added or changed
  3. the commands run and their results
  4. any intentionally deferred case, remaining risk, or untested area

The goal is not maximal test count or coverage. Use small executable examples to reach a correct, maintainable change with credible evidence.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.