agentleFS
yezzzpyezzzp/agent-relay-protocol/skills/tests/SKILL.md

tests

Skill0 starsChanged 7 days agoMITView on GitHub

Decide the kind of test before writing any, using a six-step decision guide with generic patterns and the project's own rules; TDD for business rules; e2e only for listed user flows; and the tools that keep the suite honest (test-guard, test-run, test-health). Use before writing or changing a test, when fixing a bug found while testing, when tests are slow or flaky, or when asked whether a test is worth keeping.

17 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use comments and coverage.

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.
  • AnthropicSkill

    comments

    Review open NPRM comment periods, log decisions, track deadlines. Use when an NPRM has a comment window open and you need to surface deadlines, decide whether to file, or record a filing / not-filing / waived decision (--decide CMT-ID).

    Also in 3 projects that use this

  • PydanticSkill

    coverage

    Fetch coverage diff from Codecov for the current branch or a specific PR. Shows uncovered lines, patch coverage, and overall coverage change.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

3 rules. 0 are common, 3 are distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 17 edited versions we read keep these.

  • 3

    Distinctive

    This author's own choices. Worth a look.

  • 0

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    If you cannot fill it in, do not write the test.

    line 12
  2. Distinctive:

    Red: write the test and run it.

    line 25
  3. Distinctive:

    Green: write the least code that makes it pass.

    line 26

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

tests

Before any test, write one line

tier: unit (rule 2) · covers S3 · file: tests/test_discounts.py

If you cannot fill it in, do not write the test.

Decision order: stop at the first yes

#QuestionThen
1Can the code make the mistake impossible? (shared component, type, database constraint)Do that. No test.
2Does it compute or decide something? (money, stock, permissions, state changes, dates)Unit test, TDD.
3Does it depend on two actors, time or retries? (concurrency, idempotency, queues)Unit test against the real database, TDD. Never e2e.
4Is it about how it looks?ui-check. No test.
5Does it break a whole user flow listed in .arp/flows.toml?e2e tagged @flow <id>, plus @critical when that flow has critical = true (the integrator runs only @critical). Extend that flow's test before adding one.
6None of the above.No test. A break shows on the first click.

TDD

  1. Red: write the test and run it. It must fail, for the reason you expect.
  2. Green: write the least code that makes it pass.
  3. Refactor: clean up while it stays green.

A test that passes the moment it is written proves nothing. Fix the test.

Patterns

First look for this project's own cases: the business rules listed under ## Working charter in AGENTS.md, and the flows in .arp/flows.toml. Use the patterns below for anything they do not cover. They are generic on purpose and fit any product.

PatternFor exampleDecision
A calculationa discount, a tax, a commission, a due date, a balanceUnit, TDD (2)
A permissiona role must not see or change somethingUnit on the API (2). Hiding it in the UI is not the protection
A state changean item cannot go from cancelled back to activeUnit, TDD (2)
Two actors at oncetwo requests for the last unit, two people editing one recordUnit against the real database, TDD (3)
A retry or a duplicatean offline client resends, a webhook arrives twiceUnit with an idempotency key (3)
An external service failsthe provider times out or returns garbageUnit with a fake at the boundary (3), plus one manual sandbox run
A data transformationan import or an export, parsing a fileUnit on the function (2)
A double submita second click creates a second recordStructural (1): the shared button disables while pending, plus the idempotency unit test
An empty, long or loading statea blank page, cut-off textStructural (1) in the shared component, then ui-check
How it looksa repeated title, uneven spacing, dark modeui-check (4)
A flow wired wrongeach part works alone, but the screen calls the wrong endpointe2e @flow <id> (5): extend that flow's test
Simple create, read, update or deletea screen that edits one fieldNo test (6). ui-check for the look
A migrationa new column or indexNo test. The integrator rebuilds the database from migrations
Copya label or a typoNo test
A flaky testfails one run in tenFix the cause or delete it. Never add retries

Fix rule for bugs found while testing

KindFix
A business rulea unit test first, then the fix
A UI detaila structural fix in the shared component, no test
A broken flowan e2e test for that flow

Tools

CommandWhat it does
arp test-guardRuns inside the quick verify and the integrator. Fails on an e2e test with no @flow, an unknown flow, a flow over tests.e2e_per_flow, or configured retries. --baseline accepts today's offenders in an existing project, so only new ones fail.
arp test-run --tier <t> --runner session -- <cmd>Wraps a test command and records its results in the shared local database.
arp test-healthReport: cost, flaky tests, value, suspects, duplicates, trend. --all compares projects.
arp test-health --mutate <test>Checks a suspect with mutation testing. A test that no mutant breaks is a delete candidate, and the owner approves each deletion.
arp test-reportThe periodic report. Every tests.report_every_days (default 7), the session-start hook writes it in the background to ~/.local/share/agent-core/reports/<project>-<id>/ and the next session tells the owner what changed: new suspects, flaky tests. Publish the page as a private artifact when the owner wants to see it.

Adding a user flow

A flow is one sentence in .arp/flows.toml. Add one only for a new end-to-end path the owner cares about. The integration report shows it to them.

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.