agentleFS
jhonatan-oliveiradevjhonatan-oliveiradev/agent-skills/skills/testing-integration-boundaries/SKILL.md

testing-integration-boundaries

Skill1 starsChanged 3 months agoMITView on GitHub

Use when code crosses a database, filesystem, queue, network API, process, or module boundary and isolated tests cannot prove serialization, persistence, protocol, or failure behavior.

The file

We split this skill into the rules it gives an agent

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

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    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 boundary that can actually break.

    line 9
  2. Distinctive:

    Use the real dependency when it is local and controllable: a real database engine, filesystem, queue, or service instance.

    line 14
  3. Distinctive:

    If a fake represents an external service, keep its contract narrow and periodically verify it against the real provider or an explicit …

    line 23

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

Core principle

Test the boundary that can actually break. Prefer a narrow integration test with the real controllable dependency over a broad system test or a mock that merely repeats your assumptions.

Boundary workflow

  1. Name the boundary and its contract: request/response shape, persisted state, message schema, file format, transaction semantics, or side effect.
  2. Identify which behavior belongs to your code and which belongs to the dependency. The test should prove the interaction between them, not re-test either implementation exhaustively.
  3. Use the real dependency when it is local and controllable: a real database engine, filesystem, queue, or service instance. Use a faithful fake or dedicated test environment only when the real dependency cannot reasonably run in the test environment.
  4. Trigger the boundary through the smallest public entry point that exercises the integration.
  5. Assert on observable outcomes: stored rows, emitted messages, parsed responses, returned errors, committed/rolled-back state, or externally visible side effects.
  6. Exercise representative failure behavior where the contract requires it: malformed data, unavailable dependency, timeout, duplicate delivery, constraint violation, partial write, retry, or rollback.
  7. Isolate test data and cleanup. A test must not depend on execution order or residue left by another test.

Mocking rule

A mock is useful for an interaction you intentionally do not want to integrate in this test. It is not evidence that your production serializer, driver, schema, query, HTTP client, or database constraint works.

If a fake represents an external service, keep its contract narrow and periodically verify it against the real provider or an explicit contract test.

High-value boundaries

Prioritize code that:

  • serializes or deserializes data;
  • writes or reads persistence;
  • crosses process or network boundaries;
  • publishes or consumes events;
  • relies on transactions or consistency guarantees;
  • translates external errors into product behavior.

Verification

A passing integration test should let you answer: “What real boundary behavior did this prove that a unit test could not?” If the answer is only that a mock received a call, move the evidence closer to the real boundary.

References

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.