agentleFS
drafaeldrafael/coding-harness/skills/write-tests/SKILL.md

write-tests

Skill1 starsChanged 7 months agoMITView on GitHub

Write unit, integration, component, and end-to-end tests for code. Use when the user asks to "write tests", "add tests", "add test coverage", or "create test cases" for functions, services, components, CLIs, or user flows.

33 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use audit-choices, close-spec 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.
  • dzhngSkill

    audit-choices

    Audit the choices an implementing agent made, not its diff — a pure decision audit that traces the session's history into a choices ledger, changes no code, and never blocks an unsupervised run. Working code still embeds architecture the user never chose; surface it because future work inherits it. Use when the user wants to review the decisions the AI made on their behalf, before merging or committing AI-implemented work, when integrating a delegated subagent's pass, or when a fix "works" but might be a point fix.

    Also in 3 projects that use this

  • dzhngSkill

    close-spec

    When a spec under specs/<feature>/ is done shipping (a write-spec build, or any planned task that produced a spec), archive it to specs/done/ and rewrite it from a build-plan into a durable rationale — the why, the principles, the invariants — pointing back to the real code for the how. Use when implementation has landed and the plan no longer matches what shipped, or the user says a feature/spec is finished. Pairs with [write-spec](../write-spec/SKILL.md) (the plan this closes) and [review](../review/SKILL.md) (run before closing).

    Also in 3 projects that use this

  • LucasMatuszewskiSkill

    audit-agents

    Audit and maintain agent configuration files (.claude/agents, AGENTS.md, CLAUDE.md, agent-memory). Checks for duplicates, outdated info, naming conflicts, wrong technical facts, and files over 200 lines. Fixes all issues and commits.

    Also in 3 projects that use this

  • Halcyon666Skill

    write-skills

    Creates high-quality Agent Skills (SKILL.md files) that follow the open Agent Skills specification. Use when asked to create a skill, write a SKILL.md, package agent instructions, build a reusable capability, or turn a workflow into a shareable skill. Produces spec-compliant, concise, well-structured skills optimized for agent discovery and execution.

    Also in 3 projects that use this

  • isLinXuSkill

    eval-skills

    AI Agent Skill unit testing framework. A framework-agnostic toolkit for discovering, scaffolding, selecting, evaluating, and reporting on AI skills. Use this skill to assess skill quality before production, compare candidate skills on the same benchmark, enforce quality gates in CI/CD, and generate human-readable evaluation reports.

    Also in 3 projects that use this

  • TrecekSkill

    audit-tests

    Audit the test suite for useless tests, consolidation opportunities, over-mocking, weak assertions, and other test quality issues. Use when user says "audit tests", "audit test suite", "review tests", or "test quality check". Generates an improvement plan in temp/ with explanations for each proposed change.

    Also in 3 projects that use this

  • +6 more from dzhng

The file

Show its rules and text

We split this skill into the rules it gives an agent

16 rules. 0 are common, 15 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 31 edited versions we read keep these.

  • 15

    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:

    Write the appropriate unit, integration, component, and end-to-end tests: $ARGUMENTS

    line 9
  2. Distinctive:

    Follow these steps in order:

    line 13
  3. Distinctive:

    Follow repository coverage thresholds and use coverage to identify consequential gaps rather than gaming a universal percentage

    line 33
  4. Distinctive:

    Test cohesive units through the smallest stable public or package boundary.

    line 41
  5. Very specific:

    Follow the AAA pattern (Arrange / Act / Assert) — use blank lines to separate phases, never write // Arrange comments

    line 43
  6. Distinctive:

    Use descriptive test names that explain the scenario being tested

    line 44
  7. Distinctive:

    Keep each test focused on one behaviour.

    line 45
  8. Distinctive:

    Test real interactions among application-owned components and controlled dependencies such as in-process APIs, test databases, sandboxes, …

    line 48
  9. Distinctive:

    Do not contact production or uncontrolled live third-party services by default

    line 49
  10. Distinctive:

    Verify data flow across meaningful layer boundaries

    line 50
  11. Distinctive:

    Keep critical cross-boundary flows in E2E tests and lower-level edge cases in faster tests

    line 55
  12. Distinctive:

    Avoid over-mocking — if a mock replicates production logic, use a real object instead

    line 60
  13. Distinctive:

    Use factories or builders for complex test data.

    line 61
  14. Distinctive:

    Ensure tests are isolated — no shared mutable state between cases

    line 62
  15. Distinctive:

    Async code: use the framework's async test utilities.

    line 65
  16. Distinctive:

    UI: test rendered output, keyboard navigation, and ARIA semantics where relevant

    line 67

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

Write Tests

Write the appropriate unit, integration, component, and end-to-end tests: $ARGUMENTS

Process

Follow these steps in order:

  1. Understand the project's test conventions
    • Identify the language, runtime, package boundary, and every test runner relevant to the requested tests
    • Inspect dependencies, imports, runner configuration, package scripts, setup files, CI commands, and representative existing tests
    • Load every matching language and runner reference that exists:
      • references/junit.md
      • references/typescript.md
      • references/vitest.md
      • references/jest.md
      • references/node-test.md
      • references/bun-test.md
      • references/playwright.md
    • In monorepos and migrations, determine runner ownership per package and test file; do not assume one runner governs the repository
    • Repository conventions and installed-version behavior override greenfield defaults
  2. Analyse the code under test
    • Identify the public interface and critical business logic
    • Map dependencies and external interactions
    • Note error conditions, edge cases, and validation rules
    • Follow repository coverage thresholds and use coverage to identify consequential gaps rather than gaming a universal percentage
  3. Plan the test strategy
    • Decide which levels are needed: unit, integration, end-to-end
    • List what to mock or stub, and why
    • Prioritise business-critical paths first
  4. Write unit tests
    • Test cohesive units through the smallest stable public or package boundary; tests do not need to map one-to-one to functions or methods
    • Cover relevant happy paths, edge cases, boundary conditions, and error/exception paths
    • Follow the AAA pattern (Arrange / Act / Assert) — use blank lines to separate phases, never write // Arrange comments
    • Use descriptive test names that explain the scenario being tested
    • Keep each test focused on one behaviour; avoid assertions on unrelated state
  5. Write integration tests
    • Test real interactions among application-owned components and controlled dependencies such as in-process APIs, test databases, sandboxes, or contract servers
    • Do not contact production or uncontrolled live third-party services by default
    • Verify data flow across meaningful layer boundaries
    • Cover failure modes and partial failures, not just the happy path
  6. Write component or end-to-end tests when needed
    • Exercise observable user behavior through framework-supported test APIs
    • Keep critical cross-boundary flows in E2E tests and lower-level edge cases in faster tests
    • Preserve accessibility, isolation, cleanup, and supported runtime/browser coverage
  7. Mocking and test data
    • Mock external dependencies to keep unit tests fast and deterministic
    • Avoid over-mocking — if a mock replicates production logic, use a real object instead
    • Use factories or builders for complex test data; keep setup out of assertion code
    • Ensure tests are isolated — no shared mutable state between cases
  8. Apply applicable specialist concerns
    • Async code: use the framework's async test utilities; test both resolution and rejection
    • Security: cover auth checks, input validation, and access control boundaries
    • UI: test rendered output, keyboard navigation, and ARIA semantics where relevant

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.