agentleFS
kishormorolkishormorol/promptalias/write-tests/SKILL.md

write-tests

Skill1 starsChanged 3 months agoMITView on GitHub

Write tests for code that already works. Use when the user asks for tests — "write tests for X", "write a test for X", "write a unit test for X", "write a regression test for X", "write an integration test for X", "add tests to X", "add a test to X", "add unit tests to X", "add a regression test to X", "add test coverage", "test this", "cover X with tests", "what isn't covered", "unit tests for X", "does this have tests". Use it for any request to test existing behaviour rather than change it.

79 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

9 rules. 0 are common, 8 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 74 edited versions we read keep these.

  • 8

    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 tests for: $ARGUMENTS.

    line 9
  2. Distinctive:

    If it names nothing, default to the uncommitted diff.

    line 10
  3. Very specific:

    If the user asked a question about coverage ("does this have tests", "what isn't covered"), answer it: list what is covered and what is …

    line 13
  4. Distinctive:

    Read the code before testing it, and read the existing tests to learn the project's framework, layout, naming, and assertion style.

    line 20
  5. Distinctive:

    Test the behaviour, not the implementation.

    line 24
  6. Distinctive:

    Run the suite. A new test that has never failed has not been checked.

    line 28
  7. Distinctive:

    Leave the code under test as you found it.

    line 36
  8. Distinctive:

    If the code is already covered, say so plainly instead of writing a duplicate.

    line 44
  9. Distinctive:

    If a new test exposes a real bug, keep the test and do not fix the code here.

    line 45

“Common” is measured: kept by at least 6 in 10 of the 74 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 tests for: $ARGUMENTS. If that is empty, test what the user's last message names. If it names nothing, default to the uncommitted diff; if the tree is clean, the last commit; if neither exists or this is not a git repository, ask which code to test.

If the user asked a question about coverage ("does this have tests", "what isn't covered"), answer it: list what is covered and what is not, with file:line. Write nothing, and offer to write the missing tests. If they asked for the tests to be run rather than written, run them and report the result.

How to work

  1. Read the code before testing it, and read the existing tests to learn the project's framework, layout, naming, and assertion style. Match them. If there are no tests yet, use the runner the language ships or the one the project's tooling already implies, and say which. A new test dependency needs a reason stated out loud.
  2. Test the behaviour, not the implementation. A test that asserts on internal calls breaks on every refactor and catches nothing.
  3. Cover, in this order: the ordinary path, the boundaries (empty, one, many, maximum), and each error the code claims to handle.
  4. Run the suite. A new test that has never failed has not been checked. Make each one fail once for the right reason: break the behaviour it pins with a small edit to the code, watch it fail, then undo that edit by hand and check the file is back exactly as it was. Never undo it with git checkout, git restore or git stash: those throw away the user's uncommitted work. Run the suite again at the end.

Rules

  • Leave the code under test as you found it. The temporary edit in step 4 is the only exception, and it must be gone before you report. If a test cannot be written without changing the code, say so and say why — that is a design finding worth reporting, not a licence to edit.
  • One behaviour per test, named for the behaviour it pins down.
  • Unit tests: no sleeps, no dependence on wall-clock time, no live services. Fixtures instead. When the user asks for an integration test, use a local or disposable service and bounded waits.
  • If the code is already covered, say so plainly instead of writing a duplicate.
  • If a new test exposes a real bug, keep the test and do not fix the code here. Mark it as an expected failure the way the project does, with a comment naming the bug, so the suite stays usable and the evidence stays in. Where the project has no way to mark one, keep the failing test and put that first in your report.

Report back

State what you covered, what you deliberately left uncovered and why, and the exact test command with its summary line (passed, failed, skipped). Confirm each new test was seen failing. If a test found a real bug, report the bug with its failing output rather than adjusting the test until it passes. If you could not run the suite, say so and why.

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.