Backend testing

From Dadmin88/hermes-profile-packs · View interactive version

Backend testing is an AI agent skill from the GitHub repository Dadmin88/hermes-profile-packs. Build backend tests at the right layer to prove domain behavior, API contracts, persistence interactions, authorization, and important failure paths without brittle implementation coupling.

How to use this skill

Skill file

Backend Testing

Use when implementing or changing server-side behavior and the work needs evidence that the backend contract remains correct.

Procedure

  1. Read the project's test conventions and run the relevant existing tests first when practical so pre-existing failures are not mistaken for regressions.
  2. List the behaviors the change can affect: domain invariants, API responses, persistence, transactions, authorization, retries, external integrations, migrations, and failure handling.
  3. Choose the cheapest test layer that proves each behavior:
  1. Prefer testing through stable public behavior rather than private method calls, incidental SQL shape, logging text, or other implementation details unless those details are themselves the contract.
  2. Use realistic infrastructure where semantics matter. A mock database cannot prove transaction, constraint, query, or migration behavior; a mock HTTP client cannot prove an actual wire contract. Use fakes or mocks when they deliberately isolate a dependency and the missing realism is not what the test is meant to prove.
  3. Cover the important negative paths: invalid input, unauthenticated and unauthorized access, missing resources, conflicts, dependency failures, retries, partial failure, and boundary values relevant to the change.
  4. Make fixtures deterministic, minimal, and independent. Control time, randomness, identifiers, network access, and global state where they otherwise make tests flaky.
  5. Add a regression test for a bug before or with the fix whenever the failure can be reproduced automatically.
  6. Run focused tests during development, then the broader relevant suite before completion. Record the exact validation commands and any intentionally untested risk in the handoff.
  7. Use coverage reports to locate unexercised risk, not as an arbitrary percentage target. A high number does not compensate for missing assertions or missing failure cases.

Decision rules

Quality gate

Testing is sufficient when the changed behavior and its material failure modes are proven at appropriate layers, tests are deterministic and maintainable, the relevant suite passes, and remaining untested risk is explicit.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.