agentleFS
theseus-runtheseus-run/theseus/.agents/skills/testing-patterns/SKILL.md

testing-patterns

Skill1 starsChanged 6 months agoMITView on GitHub

Use when adding, refactoring, reviewing, or debugging tests in Theseus, especially package-local test placement, characterization tests, Effect service tests, fixtures, mocks, and deciding how broad verification should be.

44 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use intelligent-routing, bash-linux 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.
  • SKB3002Skill

    intelligent-routing

    Automatic agent selection and intelligent task routing. Analyzes user requests and automatically selects the best specialist agent(s) without requiring explicit user mentions.

    Also in 5 projects that use this

  • xenitV1Skill

    bash-linux

    Bash/Linux terminal patterns. Critical commands, piping, error handling, scripting. Use when working on macOS or Linux systems.

    Also in 6 projects that use this

  • xenitV1Skill

    red-team-tactics

    Red team tactics principles based on MITRE ATT&CK. Attack phases, detection evasion, reporting.

    Also in 6 projects that use this

  • ChrisWilesSkill

    formik-patterns

    Formik form handling with validation patterns. Use when building forms, implementing validation, or handling form submission.

    Also in 3 projects that use this

  • SKB3002Skill

    nextjs-react-expert

    React and Next.js performance optimization from Vercel Engineering. Use when building React components, optimizing performance, eliminating waterfalls, reducing bundle size, reviewing code for performance issues, or implementing server/client-side optimizations.

    Also in 3 projects that use this

  • adybaSkill

    safe-workflow

    SAFe Agentic Workflow orchestrator. Teaches the full SAFe methodology adapted for AI agents: pattern discovery, exit states, quality gates, agent personas, and specs-driven development. Use when setting up a project with SAFe workflow, understanding the multi-agent methodology, or coordinating work across agent personas. Triggers: "SAFe workflow", "agent workflow", "safe harness", "specs-driven", "exit states", "quality gates", "multi-agent workflow".

    Also in 3 projects that use this

  • +4 more from xenitV1

The file

Show its rules and text

We split this skill into the rules it gives an agent

28 rules. 0 are common, 20 are distinctive, and 8 are very specific to this project.

  • 0

    Common

    Most of the 29 edited versions we read keep these.

  • 20

    Distinctive

    This author's own choices. Worth a look.

  • 8

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Use this skill for deciding what to test, where tests belong, and how broad verification should be.

    line 8
  2. Very specific:

    Do not use this skill for web-only packages/icarus-web testing unless the user explicitly asks to cover web.

    line 10
  3. Distinctive:

    Put tests near the package that owns the behavior.

    line 14
  4. Very specific:

    Prefer package-local src//*.test.ts or src//*.test.tsx patterns already used by the package.

    line 15
  5. Distinctive:

    Keep reusable test helpers under a package-local test utility module.

    line 16
  6. Very specific:

    Keep Effect at the boundary of the test.

    line 37
  7. Distinctive:

    Prefer test layers and fake services over global mutation.

    line 38
  8. Distinctive:

    Keep typed expected failures in the error channel when that is the contract being tested.

    line 39
  9. Distinctive:

    Test defect paths separately from expected domain failures.

    line 40
  10. Distinctive:

    When a service requires time, randomness, IDs, storage, or a language model, inject a deterministic test service instead of relying on …

    line 41
  11. Very specific:

    Import test APIs from bun:test.

    line 45
  12. Distinctive:

    Prefer direct assertions for small units and table tests for closed protocol variants.

    line 46
  13. Distinctive:

    Use mocks and spies only at process or dependency boundaries.

    line 47
  14. Distinctive:

    Keep snapshots for stable rendered output or protocol artifacts.

    line 48
  15. Distinctive:

    Avoid broad root test runs while iterating when a package-local test reproduces the issue.

    line 49
  16. Distinctive:

    Keep fixtures small and local until multiple tests need the same object.

    line 54
  17. Very specific:

    Use constructors or builders for protocol variants with required defaults.

    line 55
  18. Distinctive:

    Do not make a shared fixture so configurable that each test has to mentally execute a framework.

    line 56
  19. Distinctive:

    Run the narrowest useful test during iteration.

    line 60
  20. Very specific:

    Run bun run typecheck when changing public types, package exports, Effect environments, schemas, or cross-package signatures.

    line 61
  21. Distinctive:

    Run broader tests when behavior crosses package boundaries or when a refactor moves ownership.

    line 62
  22. Very specific:

    Do not add broad runtime/server/web E2E tests without explicit user confirmation or an explicit wiring-proof request.

    line 65
  23. Distinctive:

    Do not add tests only around mocks while leaving the real behavior unexercised.

    line 71
  24. Distinctive:

    Do not hide flaky timing with sleeps.

    line 72
  25. Distinctive:

    Do not test through the server when the owning primitive can be tested directly.

    line 73
  26. Distinctive:

    Do not create one giant integration test for several unrelated behaviors.

    line 74
  27. Distinctive:

    Do not use broad E2E as the first proof for behavior that has a clear owner.

    line 75
  28. Distinctive:

    Do not leave TODO comments for obvious missing tests.

    line 76

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

Testing Patterns

Use this skill for deciding what to test, where tests belong, and how broad verification should be. Use the bun-test skill for Bun test runner mechanics.

Do not use this skill for web-only packages/icarus-web testing unless the user explicitly asks to cover web.

Placement

  • Put tests near the package that owns the behavior.
  • Prefer package-local src/**/*.test.ts or src/**/*.test.tsx patterns already used by the package.
  • Keep reusable test helpers under a package-local test utility module. Do not leak helpers into public exports unless they are intended public test utilities.
  • Cross-package behavior should be tested at the lowest package that can observe it. Use server-level tests only for real wiring, persistence, transport, or runtime assembly.

What Needs Tests

  • New runtime behavior needs focused tests.
  • Runtime behavior owners need isolated tests by default. Effect DI should be used to cut the graph and replace dependencies with fake layers/services.
  • Services with behavior need direct tests: registries, stores, parsers, dispatch loops, satellite rings, tool execution boundaries, persistence adapters, and protocol serializers.
  • Systems should test command/control/event/lifecycle behavior.
  • Projections should test derivation from stored events.
  • Sinks should test curation and side effects.
  • Tool/model catalog modules should test selection and hydration.
  • Codecs should test _tag round trips and unknown boundary handling.
  • Constructors for exported protocol variants need tests when they apply defaults, normalize input, or enforce invariants.
  • Boundary adapters that translate external/provider data into internal data need focused tests for the translation shape.
  • Pure type surfaces and thin barrels do not need runtime tests unless they contain constructors or behavior.
  • Refactors of working behavior should start with characterization tests when the current behavior is not already pinned down.

Effect Tests

  • Keep Effect at the boundary of the test. Build the program, provide test layers, then run with Effect.runPromise or the repo's existing test helper.
  • Prefer test layers and fake services over global mutation.
  • Keep typed expected failures in the error channel when that is the contract being tested.
  • Test defect paths separately from expected domain failures.
  • When a service requires time, randomness, IDs, storage, or a language model, inject a deterministic test service instead of relying on ambient behavior.

Bun Test Style

  • Import test APIs from bun:test.
  • Prefer direct assertions for small units and table tests for closed protocol variants.
  • Use mocks and spies only at process or dependency boundaries. Prefer fake services for domain logic.
  • Keep snapshots for stable rendered output or protocol artifacts. Avoid snapshots for logic that would be clearer as explicit assertions.
  • Avoid broad root test runs while iterating when a package-local test reproduces the issue.

Fixtures

  • Name fixtures by the behavior they support, not by incidental data shape.
  • Keep fixtures small and local until multiple tests need the same object.
  • Use constructors or builders for protocol variants with required defaults. Do not duplicate _tag literals and default fields across tests.
  • Do not make a shared fixture so configurable that each test has to mentally execute a framework.

Verification Scope

  • Run the narrowest useful test during iteration.
  • Run bun run typecheck when changing public types, package exports, Effect environments, schemas, or cross-package signatures.
  • Run broader tests when behavior crosses package boundaries or when a refactor moves ownership.
  • Narrow package integration tests are allowed when they prove local assembly of a few services.
  • Do not add broad runtime/server/web E2E tests without explicit user confirmation or an explicit wiring-proof request.
  • In reviews, missing tests are findings. Either add the test, defer it explicitly, or explain why the changed surface is type-only.

Anti-Patterns

  • Do not add tests only around mocks while leaving the real behavior unexercised.
  • Do not hide flaky timing with sleeps; inject clocks or await deterministic signals.
  • Do not test through the server when the owning primitive can be tested directly.
  • Do not create one giant integration test for several unrelated behaviors.
  • Do not use broad E2E as the first proof for behavior that has a clear owner.
  • Do not leave TODO comments for obvious missing tests; either write them or call out the gap.

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.