agentleFS
omidnwomidnw/my-skills/skills/behavioral-testing/SKILL.md

behavioral-testing

Skill0 starsChanged 9 days agoMITView on GitHub

Use when changing executable behavior or writing unit, integration, or API tests. Select the smallest meaningful test layer, prove changed outcomes and boundaries, and run targeted checks. Browser E2E authoring belongs to e2e-test-authoring.

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

6 rules. About 0 are common, 5 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈5

    Distinctive · estimate

    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:

    Read project instructions, package scripts, CI configuration, nearby tests and the implementation's callers.

    line 15
  2. Distinctive:

    Write a small case list: trigger, expected observable result, relevant failure/boundary, and suitable layer.

    line 18
  3. Very specific:

    Use explicit arrange/act/assert, independent cases and deterministic clocks/randomness where relevant.

    line 21
  4. Distinctive:

    Use isolated local/test storage and disposable fixtures.

    line 23
  5. Distinctive:

    Run the changed cases and applicable existing quality checks, then affected callers if a shared contract changed.

    line 24
  6. Distinctive:

    Do not add trivial implementation-mirroring tests or demand 100% coverage.

    line 29

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “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

Behavioral testing

Purpose

Protect the changed contract with tests that would catch an incorrect implementation, not tests that merely mirror it.

When to use

Behavior changes, regression fixes, and unit/integration/API test authoring. Project test conventions override these defaults.

Preconditions

Read project instructions, package scripts, CI configuration, nearby tests and the implementation's callers. Identify the runner and target environment; do not install a second framework by default.

Workflow

  1. Write a small case list: trigger, expected observable result, relevant failure/boundary, and suitable layer.
  2. Unit: isolate business decisions and transformations. Integration: prove component/persistence boundaries. API: exercise the actual HTTP route, validation, authentication, authorization and response contract. E2E: reserve for essential user journeys; use the E2E skill.
  3. For a bug, write a regression that fails on the original behavior for the expected reason. For new behavior, make a focused failing test when the existing harness supports it. Implement the smallest change and observe the test pass; do not report red/green evidence you did not run.
  4. Use explicit arrange/act/assert, independent cases and deterministic clocks/randomness where relevant. Mock external boundaries, not the decision under test. Assert outcomes rather than private call order.
  5. API case selection: valid request; invalid body/query/params; unauthenticated and forbidden role/ownership; not found; conflict; pagination limits; relevant side effects and rollback. Select cases affected by the endpoint, not an exhaustive template for every change.
  6. Use isolated local/test storage and disposable fixtures. Verify persistence through an independent read when that is the contract. Clean up only owned data, including after failure.
  7. Run the changed cases and applicable existing quality checks, then affected callers if a shared contract changed. If no harness exists, choose a compatible minimal setup within scope or document the blocker and concrete cases left unverified.

Rules

  • One case proves one outcome; several assertions may establish that outcome.
  • A route unit test with mocked guards is not evidence that HTTP authentication works.
  • Do not add trivial implementation-mirroring tests or demand 100% coverage. Prioritize business risk and regressions.
  • Snapshot updates require inspected, intentional changes. Test failures use test-failure-triage.

Common mistakes

Mocking everything; testing only the happy path; shared mutable fixtures; asserting a status without payload/side effects; treating skipped tests as passed.

Validation

Record the command and actual result. Confirm the regression detects the original defect when feasible, tests are independent, and no test touched shared or production data. State missing coverage explicitly.

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.