agentleFS
albkuealbkue/my-skill/skills/backend-testing/SKILL.md

backend-testing

Skill0 starsChanged 32 days agoMITView on GitHub

Create practical backend tests. Use when asked to write unit tests, integration tests, API tests, database tests, Kafka tests, contract tests, or regression tests, or to plan what tests a change needs. Use the right framework for the stack (JUnit/Mockito/Testcontainers for Spring, pytest for FastAPI, Go testing). Do NOT use for finding where to focus during a review (backend-code-review) or general implementation help (backend-job / software-internship).

6 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

7 rules. 0 are common, 5 are distinctive, and 2 are very specific to this project.

  • 0

    Common

    Most of the 4 edited versions we read keep these.

  • 5

    Distinctive

    This author's own choices. Worth a look.

  • 2

    Very specific

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

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

    Read the my-skill plugin's docs/workflow-profile.md.

    line 31
  2. Very specific:

    Test framework and existing test conventions (JUnit 5 + Mockito, pytest, Go testing, Testcontainers?).

    line 47
  3. Distinctive:

    Prefer meaningful behavioral tests over chasing a coverage percentage.

    line 60
  4. Distinctive:

    Avoid brittle tests tied to implementation details (internal method order, exact log text, private state).

    line 61
  5. Distinctive:

    Every suite must include negative and failure-path tests, not just happy paths.

    line 62
  6. Distinctive:

    No network calls, no shared mutable state between tests.

    line 63
  7. Distinctive:

    Never invent team test conventions.

    line 64

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

Backend Testing

Purpose

Turn untested backend code into meaningfully tested backend code: choose the right test type per risk, name concrete cases, and generate runnable tests that won't rot.

When to use

  • Writing tests for services, controllers, repositories, Kafka producers/consumers, or scheduled jobs.
  • Planning the test strategy for a new feature or a bug fix.
  • Covering a regression before a fix ships.
  • Deciding what to mock vs. what to run for real (Testcontainers, in-memory DB, embedded Kafka).

When not to use

  • Reviewing someone else's test quality → backend-code-review.
  • Contract design for inter-service tests → api-design for the contract, backend-testing for the test.
  • Implementation of the feature being tested → backend-job or software-internship.

Context intake

  • The repository's existing test framework and conventions (detect, don't impose) and what risk class the change is (auth/money/data vs cosmetic). Detect or confirm before starting (ask at most what is genuinely needed):
  • Which context: one of the contexts defined in docs/workflow-profile.md ("Contexts")? Read docs/active-context.md first: if Current names a context set within the last day, use it, apply its rules, and do not ask. Otherwise fall back to the active roles and projects in docs/workflow-profile.md; ask when it could be two different contexts.
  • What is the desired output: a plan, code, a review, tests, documentation, a deployment plan, or research notes? Confirm if ambiguous.

Workflow

  1. Read the my-skill plugin's docs/workflow-profile.md. If it is missing, contradicts this request, or was last updated more than ~3 months ago, confirm or update it with Sothy before applying any role, project, or stack assumptions.
  2. Identify code under test, dependencies, framework, and existing conventions. Match the conventions; don't introduce a competing style.
  3. Enumerate test cases in classes: happy path, input validation, failure paths, edge cases, concurrency, security/authorization.
  4. For each dependency, decide: real (integration), fake (in-memory), or mock (unit) — and justify briefly.
  5. Generate test code: deterministic, isolated, descriptive names (given/when/then style), one behavior per test.
  6. Give the commands to run the tests locally and in CI.
  7. Identify remaining coverage gaps — the cases that would still be untested and their risk.

Adaptation rules

  • Framework follows the repo: JUnit/Mockito/Testcontainers, pytest, Go testing, JS - never introduce a competing style.
  • Personal/thesis projects: pytest-first, lighter integration setups; ML experiment "tests" assert seeded metric ranges, not exact values.
  • Same suite-shape rule everywhere: happy + validation + failure + edge + concurrency/security.

Inputs needed

  • The code under test (method, class, endpoint) and its dependencies.
  • Test framework and existing test conventions (JUnit 5 + Mockito, pytest, Go testing, Testcontainers?).
  • What the code should do — expected behavior, not implementation details.
  • Which integration points exist (PostgreSQL, Redis, Kafka) and whether the team runs real ones in tests.

Output contract

  • Test objective — what behavior this test suite protects.
  • Test cases — table or list, grouped by happy/validation/failure/edge/concurrency/security.
  • Test code — complete, runnable test classes/functions.
  • Mocks/fixtures — what's faked, how, and why.
  • Commands to run tests — local + CI.
  • Coverage gaps — what remains untested and the residual risk.

Rules and constraints

  • Prefer meaningful behavioral tests over chasing a coverage percentage; never generate coverage-farming tests.
  • Avoid brittle tests tied to implementation details (internal method order, exact log text, private state).
  • Every suite must include negative and failure-path tests, not just happy paths.
  • No network calls, no shared mutable state between tests; clean data setup/teardown.
  • Never invent team test conventions; if unknown, state the assumption and ask.
  • Match the module's existing framework versions.

Quality checklist

  • Negative and failure-path cases included.
  • Tests deterministic, isolated, behavior-named.
  • Real/fake/mock choice justified per dependency.
  • Run commands given for local + CI.

Examples

  1. Request: "Write tests for my Spring Boot service method that places an order." Behavior: Cases: valid order, invalid quantity, out-of-stock failure, concurrent duplicate request (idempotency), payment-gateway timeout. Unit tests with Mockito for the payment client, integration test with Testcontainers PostgreSQL for persistence. Full output format.
  2. Request: "Test the Kafka consumer that updates order status." Behavior: Cases: valid event, duplicate event (idempotent no-op), malformed payload → DLQ/retry boundary, out-of-order events. Embedded/Testcontainers Kafka consumer test + a unit test of the handler. Include poison-pill test and the run commands.

Lessons learned

Record improvements after real usage (maintained via continuous-improvement). Format:

  • <date> -- <what happened> -> <change made to this SKILL.md>

(empty -- entries appear after real usage)

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.