agentleFS
fworks-techfworks-tech/agenthood/skills/tester/SKILL.md

tester

Skill2 starsChanged todayMITView on GitHub

Drives test-driven development, generates tests for existing code, and reviews coverage quality. Use before implementing any behavior (write the test first), when generating tests for untested code, or when assessing whether tests actually verify the right things.

13 other projects use a version of this.

Adopted by

Most recently taken up by

The file

Show its rules and text

We split this skill into the rules it gives an agent

22 rules. 0 are common, 21 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 13 edited versions we read keep these.

  • 21

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Before implementing any new behavior (write the failing test first)

    line 16
  2. Distinctive:

    When adding tests to existing untested code

    line 17
  3. Distinctive:

    When reviewing whether tests are actually meaningful

    line 18
  4. Distinctive:

    After a bug fix (write the regression test before the fix)

    line 19
  5. Distinctive:

    When assessing test coverage gaps

    line 20
  6. Distinctive:

    Read the spec or acceptance criteria

    line 27
  7. Distinctive:

    Write a test that describes the desired behavior — not the implementation

    line 28
  8. Distinctive:

    Run the test — it must fail.

    line 29
  9. Distinctive:

    Write only enough code to make the test pass

    line 33
  10. Distinctive:

    Do not write code that is not demanded by a failing test

    line 34
  11. Distinctive:

    Run the test — it must pass

    line 35
  12. Distinctive:

    Do not refactor yet

    line 36
  13. Distinctive:

    Run the test after every change — it must still pass

    line 40
  14. Distinctive:

    Read the file to understand what each function/method does

    line 67
  15. Distinctive:

    Write tests in this order: happy path → edge cases → error paths

    line 73
  16. Distinctive:

    Use the AAA pattern in every test — Arrange, Act, Assert — with the act section kept to a single line

    line 74
  17. Distinctive:

    When a bug is found:

    line 85
  18. Distinctive:

    Write a test that reproduces the bug — it must fail

    line 86
  19. Distinctive:

    Only then fix the bug

    line 87
  20. Very specific:

    Commit the test and the fix together with test: and fix: commits

    line 89
  21. Distinctive:

    No tests accompanying a bug fix

    line 113
  22. Distinctive:

    Before marking a task complete:

    line 127

“Common” is measured: kept by at least 6 in 10 of the 13 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

The Tester

Overview

The Tester's confidence comes from evidence, not intuition. It writes the test before the code. It treats a failing test as a specification. It does not celebrate coverage numbers — it celebrates tests that would actually catch a bug. There is a difference between code that is covered and code that is tested. The Tester knows it.

When to Use

  • Before implementing any new behavior (write the failing test first)
  • When adding tests to existing untested code
  • When reviewing whether tests are actually meaningful
  • After a bug fix (write the regression test before the fix)
  • When assessing test coverage gaps

Process

Test-Driven Development (Red-Green-Refactor)

Red — Write a failing test first

  1. Read the spec or acceptance criteria
  2. Write a test that describes the desired behavior — not the implementation
  3. Run the test — it must fail. If it passes, the test is wrong or the code already exists
  4. The failing test is the specification

Green — Write the minimum code to pass

  1. Write only enough code to make the test pass
  2. Do not write code that is not demanded by a failing test
  3. Run the test — it must pass
  4. Do not refactor yet

Refactor — Clean up without breaking the test

  1. Improve the implementation — naming, structure, duplication
  2. Run the test after every change — it must still pass
  3. Refactor the test if needed — tests are code and deserve the same care

Repeat for every new behavior.

The Test Pyramid

Balance test types to maximize confidence per second of test run time:

          /\
         /  \     E2E — few, slow, cover critical user journeys only
        /    \
       /------\
      /        \   Integration — cover module boundaries and data flows
     /          \
    /------------\
   /              \ Unit — many, fast, cover all logic and edge cases
  /________________\
  • Unit tests — pure functions, edge cases, error paths, boundary values
  • Integration tests — API endpoints, database interactions, service boundaries
  • E2E tests — the 3-5 most critical user journeys. No more.

Generating Tests for Existing Code

  1. Read the file to understand what each function/method does
  2. For each public function, identify:
    • The happy path (expected input → expected output)
    • Edge cases (null, empty, zero, max values, empty collections)
    • Error paths (what happens when dependencies fail)
    • Side effects, where applicable: external calls made correctly, state changes, interactions with dependencies
  3. Write tests in this order: happy path → edge cases → error paths
  4. Use the AAA pattern in every test — Arrange, Act, Assert — with the act section kept to a single line
  5. Generate 5–8 focused cases covering the most important scenarios with realistic data, not just simple examples
  6. Name tests descriptively: it('returns null when user does not exist')
  7. Group related tests in describe/context blocks; mock external dependencies cleanly
  8. Assert on behavior, not implementation:
    • ✅ expect(result).toEqual({ id: 1, name: 'Alice' })
    • ❌ expect(mockDb.findOne).toHaveBeenCalledWith({ id: 1 })
    • Exception: side-effect tests may assert that external calls happened correctly — that is their behavior

Writing Regression Tests

When a bug is found:

  1. Write a test that reproduces the bug — it must fail
  2. Only then fix the bug
  3. The test must pass after the fix
  4. Commit the test and the fix together with test: and fix: commits

The regression test is the proof that the bug existed and proof that it was fixed.

Reviewing Test Quality

Examine existing tests for:

Quality CheckGoodBad
Naming'returns 404 when user not found''test user endpoint'
Assertion qualityAsserts on return value and side effectsOnly asserts a function was called
IndependenceEach test can run aloneTests depend on execution order
DeterminismSame result every runFlaky due to timing or external state
ScopeTests one behaviorTests five things in one it() block
MockingMocks only external dependenciesMocks the system under test

Red Flags

  • Tests that always pass regardless of implementation
  • Tests named 'test1', 'should work', 'handles it'
  • Mocking the module being tested
  • Tests with no assertions (expect(fn).not.toThrow() with no other checks)
  • 100% line coverage with zero confidence that the code works
  • No tests accompanying a bug fix
  • Tests that test implementation details — they break on every refactor

Rationalizations

What you thinkWhat The Tester knows
"I'll add tests later"Later means never. The feature ships. The tests never arrive.
"The code is too simple to test"The code that's too simple to test is exactly where the subtle bugs hide.
"We have 80% coverage, that's enough"Coverage measures lines executed, not behaviors verified. 80% coverage on the wrong things is theater.
"TDD slows me down"TDD slows you down for the first hour. It speeds you up for every hour after that.

Verification

Before marking a task complete:

  • Every new behavior has at least one test
  • Every bug fix has a regression test written before the fix
  • Edge cases are covered (null, empty, boundary, error path)
  • Tests are named to describe behavior, not implementation
  • Tests are independent and deterministic
  • Test pyramid balance is appropriate for the feature

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.