agentleFS
tammaitammai/bigin-skills/skills/write-tests/SKILL.md

write-tests

Skill1 starsChanged 37 days agoMITView on GitHub

Writes scoped, style-matched tests for one file or function, or tests for PRD acceptance criteria (`FR-3/AC-2`) at the lowest tier that can observe each, E2E only where needed. Triggers: 'write tests for X', 'generate unit tests', 'e2e test for FR-3/AC-2'.

76 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use close-spec, design-with-images 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

    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 5 projects that use this

  • dzhngSkill

    design-with-images

    Explore UI and visual design with image generation, then iterate the real implementation against the user-selected concept. Use when brainstorming visual directions, offering mockup variants, or implementing an approved generated design; do not stop at the mockups or the first code approximation.

    Also in 5 projects that use this

  • transitive-bullshitSkill

    compare-screenshots

    Compare screenshots against the intended design, distinguishing approved references from historical baselines. Use for iterative implementation matching, before/after visual review, objective image telemetry, or checking a lone capture for flat, empty, or badly framed content.

    Also in 5 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 5 projects that use this

  • wolverin0Skill

    audit-decisions

    Standardize remediation decisions, baseline-policy entries, and legal-review banners for accepted, deferred, or policy-blocked audit findings.

    Also in 4 projects that use this

  • rhnfzlSkill

    explore-unknowns

    Walk the user through mapping the unknowns of a task before, during, and after they build it, and hand them a four-quadrant map (settled ground, open decisions, taste, and landmines) they keep. Reach for this eagerly whenever a request is ambiguous or underspecified, the codebase or domain is unfamiliar, the user will "know it when they see it", a reference implementation must be understood before porting, a build-queue or architecture-changing task is about to start, a mid-build deviation needs capturing, or a finished change needs buy-in or verified understanding before merge. Trigger even when the skill is not named: "do a blindspot pass", "find my unknown unknowns", "interview me about this change", "brainstorm the approach for a task I am about to build", "help me scope this", "what am I missing here", "plan this before I build", "I know nothing about X in this codebase". When a territory profile is present it reads memory and the graph first and feeds the map into the build pipeline; without one it degrades to a plain general map. Not for trivial or mechanical tasks with clear acceptance criteria, single-fact lookups, pure debugging of a known symptom, or pure code review, those have their own tools. Do not use it to run the build itself; the map is the deliverable and implementation remains a separate task, whether it has not started or is already underway.

    Also in 5 projects that use this

  • +5 more from dzhng

The file

We split this skill into the rules it gives an agent

10 rules. 0 are common, 6 are distinctive, and 4 are very specific to this project.

  • 0

    Common

    Most of the 71 edited versions we read keep these.

  • 6

    Distinctive

    This author's own choices. Worth a look.

  • 4

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Write tests for the unit named in the request.

    line 22
  2. Distinctive:

    Scope it: Only test the unit specified.

    line 29
  3. Distinctive:

    No unnecessary mocking: If the unit under test has no I/O (no DB, no network, no filesystem), do not mock anything — call it directly.

    line 41
  4. Very specific:

    One assertion concern per test case: Prefer table-driven tests (Go) or describe/it with one behavior per it (TS) over one giant test with …

    line 53
  5. Distinctive:

    Test framework/library internals (e.g.

    line 58
  6. Distinctive:

    Add snapshot tests unless explicitly asked.

    line 60
  7. Very specific:

    Leave TODO or skipped tests without flagging them explicitly.

    line 62
  8. Very specific:

    Read references/acceptance-to-e2e.md before writing anything on this path — it carries the resolution table, every refusal case, the …

    line 69
  9. Very specific:

    Stop rather than invent: No PRD, an absent ID, or a Status: withdrawn requirement (statuses are requirement-level.

    line 77
  10. Distinctive:

    Pick the lowest tier that can observe each criterion: Write an E2E spec only for a criterion that needs the running system.

    line 83

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

Authoring new test code only — not running an existing suite ("run the tests"), and not general testing-strategy questions.

Two paths, routed on what the request names:

The request namesPath
a file, function, component, or modulethe unit path below — the seven steps
a PRD requirement or criterion ID (FR-3, FR-3/AC-2), or a Given/When/Then criterion quoted inlinethe acceptance-criterion → E2E path at the end of this file

Unit path

Write tests for the unit named in the request. Before writing any test code:

  1. Find the style reference. Locate the nearest existing test file for this package/module (sibling *_test.go or *.test.ts). Match its structure, naming, and assertion style exactly. Do not invent a new pattern. If the repo has a scoped .claude/rules/testing.md in context, follow it too.
  2. Scope it. Only test the unit specified. Do not expand to cover unrelated functions "while you're in there."
  3. List edge cases before coding. Print a short bullet list of the cases you intend to cover (nil/empty input, boundary values, error paths, concurrency if relevant) and wait for confirmation if the list is longer than 5 items. When running as a spawned implementer (a subagent such as worker, with no user to answer), never wait: proceed with the list and include it in your return so the caller can review it. If edge cases were given in the request, use those as the minimum required set — add more only if obviously missing.
  4. No unnecessary mocking. If the unit under test has no I/O (no DB, no network, no filesystem), do not mock anything — call it directly. Only mock at actual I/O boundaries.
  5. TDD order for anything with business logic (not pure CRUD/plumbing): a. Write the test(s) first. b. Run them and show they fail for the RIGHT reason (not a compile error or missing import). c. Only then write/modify the implementation. d. Run the tests again and iterate until green — don't hand back failing or unrun tests.
  6. One assertion concern per test case. Prefer table-driven tests (Go) or describe/it with one behavior per it (TS) over one giant test with many unrelated assertions.
  7. Stop conditions — do NOT:
    • Test framework/library internals (e.g. "Vue re-renders on state change") — only test the unit's own logic.
    • Add snapshot tests unless explicitly asked.
    • Generate tests for generated code (openapi types, mocks).
    • Leave TODO or skipped tests without flagging them explicitly.

Report back with: which cases were covered, which were deliberately excluded and why, and the final test run output.

Acceptance-criterion → E2E path

Read references/acceptance-to-e2e.md before writing anything on this path — it carries the resolution table, every refusal case, the per-profile style discovery, and the run-reporting rule. The essentials:

  • docs/product/prd.md is a fixed, read-only contract. Resolve FR-n/AC-m by reading it; never write it, amend it, or renumber an ID. Quote the criterion into the spec verbatim, never paraphrased, and name its ID there — the same citation style as epic-workflow's step 2. FR-n with no /AC-m means every active criterion under that requirement.
  • Stop rather than invent. No PRD, an absent ID, or a Status: withdrawn requirement (statuses are requirement-level; criteria have none) or criterion → say which, and stop. Never reconstruct a criterion from a requirement title.
  • Find the repo's own E2E tree; never install one. "The repo's existing E2E style" means the target repo's, discovered from its .claude/rules/testing.md and its existing specs. If the repo has no E2E tier, report that, name the nearest tier it does have, and stop — no Playwright, no Cypress, no invented e2e/ directory.
  • Pick the lowest tier that can observe each criterion. Write an E2E spec only for a criterion that needs the running system; a criterion a unit, component or API/integration test can observe gets that test instead, in the repo's own tier and style. Never one E2E spec per criterion by default: the suite stays small and journey-shaped.
  • Never claim green on a spec you did not run. The unit path's TDD order (step 5) does not transfer intact: an E2E spec usually cannot be driven red-then-green locally. Attempt the run, then report its true state — passed, failed, or not run with what running it needs.
  • Then report as the unit path does: criteria covered by ID, each with the tier chosen and a one-line reason, criteria deliberately excluded and why, and the run output or the explicit statement that it was not run.

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.