agentleFS
remix-runremix-run/remix-store/.agents/skills/testing-practices/SKILL.md

testing-practices

Skill218 starsChanged 7 days agoMITView on GitHub

Write, review, or refactor tests that maximize confidence per maintenance cost. Use for test strategy, unit/integration/browser/E2E tests, fixtures, mocks, flaky tests, skipped tests, brittle assertions, or deciding what behavior deserves coverage.

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

Show its rules and text

We split this skill into the rules it gives an agent

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

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈16

    Distinctive · estimate

    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:

    Test the normal path and the important failure/edge states—not every branch.

    line 19
  2. Distinctive:

    Do not impose fixed percentages.

    line 30
  3. Distinctive:

    Avoid asserting private state, helper calls, component names, generated classes, exact serialization, incidental DOM nesting, query text, …

    line 40
  4. Distinctive:

    Do not mock code owned by the unit under test merely to make setup easier.

    line 46
  5. Distinctive:

    Prefer a small fake server, in-memory adapter, or injected dependency over module-level mock webs.

    line 48
  6. Distinctive:

    If fixture setup starts reimplementing production behavior, move the test outward or simplify the seam.

    line 50
  7. Distinctive:

    create state per test and clean it up.

    line 59
  8. Distinctive:

    never depend on execution order or another test’s output.

    line 60
  9. Distinctive:

    keep live-service smoke tests separate from required deterministic tests.

    line 62
  10. Distinctive:

    never perform real destructive or billable actions without explicit approval.

    line 63
  11. Distinctive:

    Prefer Arrange–Act–Assert without nested ceremony.

    line 71
  12. Distinctive:

    Keep scenario-specific values and overrides in the test.

    line 73
  13. Distinctive:

    Do not add tests for trivial framework/library behavior already guaranteed elsewhere.

    line 75
  14. Distinctive:

    Do not use code-coverage targets as a goal.

    line 76
  15. Distinctive:

    Validation: Run the narrow test first, then the repository’s relevant full checks.

    line 88
  16. Distinctive:

    When reviewing a suite, prioritize false confidence, implementation coupling, flaky synchronization, skipped tests, and missing critical …

    line 90

≈ “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

Testing Practices

Optimize for confidence per unit of maintenance, not test count or line coverage:

The more tests resemble how software is used, the more confidence they provide.

“Write tests. Not too many. Mostly integration.” Integration means multiple owned units exercising a real contract together; exact labels matter less than useful, reliable failures.

Choose the test from the risk

  1. Name the regression that would matter to a user or consumer.
  2. Identify the public boundary where that regression is observable.
  3. Choose the lowest-cost test that faithfully crosses that boundary.
  4. Test the normal path and the important failure/edge states—not every branch.
TestUse whenExercise
Static analysisBaseline; run checks per repository policy and change riskTypes, lint, schemas, builds
UnitDense pure logic or combinatorial casesPublic input/output; real cheap collaborators
IntegrationDefault for application behaviorReal owned modules across HTTP, rendering, storage, routing, or state boundaries
UI integrationBehavior needs rendered UI but not a full appReal rendering, state, and user events
Real browserBehavior depends on browser APIs or browser/runtime integrationDOM, focus, navigation, browser events
E2EA few critical journeys or runtime wiring risksApp through public UI/API with as little substitution as practical

Do not impose fixed percentages. A parser, UI app, and distributed service need different shapes.

Test contracts, not construction

Assert what a real user or developer consumer can observe:

  • status, headers, response body, persisted state;
  • accessible roles/names, visible content, navigation, focus, disabled/loading/error state;
  • documented callback/module output or side effect.

Avoid asserting private state, helper calls, component names, generated classes, exact serialization, incidental DOM nesting, query text, or asset hashes unless one is itself a documented contract. A good refactor that preserves behavior should usually preserve the test.

For UI, interact through the rendered DOM. Prefer role/name/label, then stable text, then a test ID when no user-facing locator exists. CSS/XPath selectors are a last resort. Use retrying/web-first assertions for asynchronous UI rather than sleeps.

Keep real code inside the boundary

  • Do not mock code owned by the unit under test merely to make setup easier.
  • Substitute external, destructive, nondeterministic, slow, or unavailable boundaries: payment, email, clocks, random values, third-party APIs.
  • Prefer a small fake server, in-memory adapter, or injected dependency over module-level mock webs.
  • Model both success and meaningful failure responses at the boundary.
  • If fixture setup starts reimplementing production behavior, move the test outward or simplify the seam.

A mock interaction assertion is valid only when the interaction is the public contract. Otherwise assert the resulting behavior.

Make failures trustworthy

Tests must be deterministic, isolated, and independently runnable:

  • control time, randomness, network, external data, and environment;
  • create state per test and clean it up;
  • never depend on execution order or another test’s output;
  • synchronize on promises, events, or observable state—not arbitrary delays;
  • keep live-service smoke tests separate from required deterministic tests;
  • never perform real destructive or billable actions without explicit approval.

Do not skip or quarantine tests as routine maintenance. Do not keep placeholder tests for speculative or abandoned behavior; tests may lead implementation when they specify an approved contract. A flaky test is a defect: fix its synchronization/isolation or delete it if it protects no meaningful contract.

Keep the suite small and readable

  • One test should express one behavior, though it may contain several assertions proving that behavior.
  • Name tests as use cases: action/condition → observable result.
  • Prefer Arrange–Act–Assert without nested ceremony.
  • Share mechanics (app creation, valid fixture builders, external boundary adapters), not the facts central to the scenario.
  • Keep scenario-specific values and overrides in the test.
  • Accept small duplication when abstraction would hide intent.
  • Do not add tests for trivial framework/library behavior already guaranteed elsewhere.
  • Do not use code-coverage targets as a goal. Review important use-case coverage instead.

Required review

Before finishing, verify:

  1. Regression: What real breakage makes this test fail?
  2. Boundary: Does it use a public/user-observable contract?
  3. Sensitivity: Would a behavior-preserving refactor still pass? Would the intended bug fail?
  4. Fidelity: Are owned collaborators real where practical?
  5. Determinism: Are external data, time, randomness, and async completion controlled?
  6. Value: Is this behavior important and not already proven more effectively elsewhere?
  7. Validation: Run the narrow test first, then the repository’s relevant full checks.

When reviewing a suite, prioritize false confidence, implementation coupling, flaky synchronization, skipped tests, and missing critical journeys over raw test or coverage counts.

Sources

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.