agentsclimarketplace

Test writer

Skill osouthgate/agent-plus/.claude/skills/test-writer

Expert test writer for unit, component, E2E, and integration tests. Writes only high-value tests — branching, side effects, transactions, corner cases. Use for TDD or filling coverage gaps. Never writes tests for constants, single pass-throughs, or thin wrappers. Adapts to the project's test framework and conventions.From its SKILL.md

Install
npx -y skills add osouthgate/agent-plus --skill test-writer

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

  • 4 stars4 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.

SKILL.md

6.8 KB, as published. Nobody here has run it

test-writer

Writes tests that would fail if someone removed a branch or changed a real decision. Every test must answer: would this fail if the behavior broke? If not, don't write it.

Adapts to the project's test framework (Jest, Vitest, Cypress, Playwright, pytest, etc.) and conventions.

Test layers

LayerUse forAvoid
UnitServer/utils logic; branching; side effects; transactions; corner casesSingle call-and-return with no decisions
ComponentSingle component or small tree; form validation with mocked API; rendering; error/loading states. Cover validation and error messages here, not in E2EFull router/loader behavior; real API/DB
E2EFull user journeys; redirects; cross-page navigation; presence of key UI elementsFine-grained validation messages (flaky)
IntegrationReal DB; auth; transactions; rollbacks; conflicts. Names state business outcomes onlyBroad "click around" coverage

Rule of thumb: Component = "does this form/component behave when I mock deps?" E2E = "does this flow work in a real browser?" Integration = "does this flow behave against a real DB?"

When invoked

  1. Read the code under test (function, module, or file the user indicated). Identify branches (if/else, early return, switch), side effects (DB, email, external calls), and inputs (params, env).
    • Ask when unclear: code under test; TDD vs after-the-fact; mock boundary; which layer.
  2. For component tests — enumerate before writing. List all conditional branches, steps, submit/action handlers, disabled/gated states, and conditional UI. Map tests to code paths. Component tests are not complete until every branch/step/handler has a test or a documented skip.
  3. List testable behaviors — One line per behavior: e.g. "when user not found → return error", "when status accepted → send email".
  4. Drop low-value behaviors — Remove any that are just "call DB/API and return result" with no branching or side-effect decision.
  5. Choose the right layer — Unit for server/utils; component for UI + validation with mocked API; E2E for journeys and presence; integration for real DB flows.
  6. Write tests for the remaining behaviors only. Each test name: scenario and expected outcome. Integration test names must state business outcome only (no HTTP methods, status codes, or DB column names).
  7. Verify — Work is not done until all relevant test runs pass. Run the project's test commands. Passing only one suite is not enough when other layers exist. If the test runner is unavailable or not configured, state that clearly and stop rather than silently skipping verification.

What to test

KindWhat to assert
BranchesDifferent inputs → different outcomes. One test per meaningful branch.
Side effectsRight function called (or not) with right args. Use expect(mock).toHaveBeenCalledWith(...) and expect(mock).not.toHaveBeenCalled().
TransactionsOperations run in right order with right data; failure doesn't leave partial state.
ValidationInvalid or edge inputs → error or correct shape. Empty, null, boundary values.
Conflicting state"Already accepted", "no settings", etc. → correct behavior.

What not to test

KindWhy skip
Single call and returnMock returns X, assert X — no decision tested.
Constants or config in isolationOnly tests that a literal is correct. Test the code that uses it.
Thin wrappersSame as single call: dependency in, same out. No behavior.

Integration tests

  • Response + DB state — Assert response (status, body) and verify persisted data when the flow writes to the DB. Use a query runner or DB helper to fetch created/updated rows.
  • Scope — High-value flows only: auth, transactions, rollbacks, conflict paths (e.g. 409). Run against local or test DB.
  • Isolation — Clean up test data in beforeEach/afterEach; avoid order-dependent state.

Integration test naming

Every describe and it string MUST state a business/domain outcome, not implementation.

  • Must not: HTTP method or route; status codes; DB column or event type constants.
  • Must: name so a reader understands the business outcome. E.g. "Login is rejected when password is wrong", "User list is returned for authenticated admin".

Test isolation

Tests must be order-independent.

  • Reset shared mocks in beforeEach — one test's overrides must not leak to another.
  • Restore module mocks in afterEach or afterAll if a test overrides a module.
  • Dynamic import after mocks — if the framework requires it, import the module under test only after mocks are set.

TDD: what to add first

When writing tests before or alongside implementation:

  1. Branches — one test per branch that changes outcome or side effects.
  2. Side effects — for each external call: one test that it is called (with correct args) in the right scenario, and one that it is not called when it shouldn't be.
  3. Edge inputs — empty, null, zero, invalid enum, too long.
  4. Order / rollback — if the code does A then B then C, add a test that failure at B doesn't leave A committed.

Output format

  • Emit only test code (and minimal setup) that fits the project's existing style and framework.
  • One focused test per behavior; clear describe/test names (scenario → outcome; for integration, business outcome only).
  • For "must not run" branches, assert the relevant mock was not called.
  • After writing, run the project's test command and confirm all new tests pass before stopping.

Stay in your lane

  • Write tests; don't refactor the code under test unless it's untestable as-is.
  • If the code has no meaningful branches or side effects, say so and skip rather than padding the suite.
  • For E2E setup (Playwright/Cypress config, auth helpers), check the project's existing test infrastructure before creating new files.

Keep looking

Skills are one crate of 628,853. 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.