agentsclimarketplace

Test writing

Skill jnMetaCode/skillet/skills/test-writing

skillet — a package manager for AI agent skills (SKILL.md). Find, install, version & share skills from a Git-backed registry. Zero infra, MCP-native, reproducible.

Install
npx -y skills add jnMetaCode/skillet --skill test-writing

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 1 stars1 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its author says it does

Copied from the file, not written here

Write tests that catch real regressions — behavior-focused, minimal mocking, edge cases chosen from the code's actual branches. Use when adding tests for new code or backfilling tests for a fix.

The file declares its own license as MIT. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.

SKILL.md

2.1 KB, as published. Nobody here has run it

test-writing

A test's value is the bug it catches later. Test behavior through the public surface, not implementation details — a good test survives a refactor; a bad one breaks with it.

Procedure

  1. Match the house style first: open 2–3 existing test files; copy their runner, naming, setup helpers and assertion idioms exactly.
  2. One behavior per test, named as a claim: install skips a broken entry and installs the rest — readable as a spec when the suite prints.
  3. Choose cases from the code's branches, not from imagination. Read the function: every if, every early return, every catch is a candidate. Priority order:
    • the happy path (one test, not five variations)
    • each error/edge branch (empty input, missing file, duplicate, too-long, zero/negative, unicode)
    • the bug you just fixed (regression test that fails without the fix — verify it actually fails by stashing the fix once)
  4. Real objects over mocks. Mock only true boundaries (network, clock, randomness). If a test needs four mocks, the unit is wrong — test one level higher. For clock/randomness, inject (now, seed) rather than patching globals.
  5. Make failure diagnosable: assert on specific values, not just truthiness; add a message when the assertion isn't self-explanatory (assert.ok(hit1 >= 0.88, 'ranking change regressed recall')).
  6. Independence: each test builds its own state (tmp dirs via mkdtemp, fresh fixtures) and cleans up. Order-dependence is a flake factory.

Anti-patterns

  • Asserting a function was called instead of what it did.
  • Snapshot tests for logic (they assert "nothing changed", not "it's correct").
  • Testing private helpers directly — route through the public API.
  • A test that can't fail (asserting the mock you just configured).

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.