Skip to content
Skills Library
Programming · Testing

api-test-generation

/api-test-generation

Use when writing or extending tests for API endpoints, whether for a new endpoint, a bug fix that needs a regression test, or a coverage gap. Produces tests that fail when the behaviour breaks, cover denial as well as success, and never carry real data or real secrets.

Licence
Apache-2.0
Last repository change
06.11.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
1
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 06.11.2026, without references to retired models or APIs.

Licence

Apache-2.0, otwarta: można używać i zmieniać, z zachowaniem licencji i informacji o zmianach.

What it does and when to use it

Use when writing or extending tests for API endpoints, whether for a new endpoint, a bug fix that needs a regression test, or a coverage gap. Produces tests that fail when the behaviour breaks, cover denial as well as success, and never carry real data or real secrets.

Original author description

Use when writing or extending tests for API endpoints, whether for a new endpoint, a bug fix that needs a regression test, or a coverage gap. Produces tests that fail when the behaviour breaks, cover denial as well as success, and never carry real data or real secrets.

How it works

  1. Required context
  2. The rules that bite
  3. Verify
  4. Escalate when
Original SKILL.md headings · 55 lines, 474 words
SKILL.md preview
---
name: api-test-generation
description: Use when writing or extending tests for API endpoints, whether for a new endpoint, a bug fix that needs a regression test, or a coverage gap. Produces tests that fail when the behaviour breaks, cover denial as well as success, and never carry real data or real secrets.
---

# API test generation

## Required context

1. `.agents/areas.json`: the area under test and its `verify` command.
2. `.agents/guardrails/code-style.md`: test naming and layout.
3. `.agents/guardrails/data-handling.md`: what may appear in a fixture.
4. `.agents/skills/secure-api-endpoint/SKILL.md` and, for tenant data,
   `.agents/skills/tenant-safe-change/SKILL.md`: the behaviours the tests must pin.
5. The sibling test file for the nearest endpoint: its fixtures, factories and helpers.

## The rules that bite

- **A test must fail when the behaviour breaks.** Prove it: revert or break the line under test,
  run the test, see it go red, restore. A test that stays green with the change reverted proves a
  path production never takes.
- **Cover the three outcomes**: authorization denied for the wrong caller, validation failure for
  bad input, and success. Most security regressions live in the first two.
- **Tenant data gets both sides**: same-tenant success and cross-tenant denial, running as the
  application role, never a role that bypasses isolation.
- **Call the API the way clients do.** Same URL prefix, same headers, same serialization. A test
  that calls an internal path or a different prefix tests something else.
- **Assert behaviour, not echo.** Do not assert that the code returns what the test just told the
  mock to return. Assert on the response the client sees and the state the database holds.
- **No real data.** Fixtures come from factories. Never copy a customer record, a real email or a
  production id into a test.
- **No real secrets, and no secret-shaped literals.** A fixture that needs a key shape builds it
  at runtime from obviously fake parts, so the secret scanner never flags the repository.
- **Deterministic.** Freeze time, seed randomness, and never call a real external service; stub it
  at the boundary. A flaky test is worse than a missing one, because it teaches people to re-run
  until green.
- **Runnable alone.** Every new test runs on its own by filter, so the author, the reviewer and the
  merger can all run exactly it.
- **One behaviour per test**, named for the behaviour, so a failure names what broke.

## Verify

```bash
<the area's test runner, filtered to the new tests>   # green
<the same, with the line under test broken>           # red, then restore
make verify
```

Then the area's `verify` command exactly as `.agents/areas.json` declares it. A suite whose count
moved needs matching assertions. Reviewer: `code-reviewer` (test honesty is in its lens).

## Escalate when

- The only way to reproduce a bug seems to be real customer data: ask for a redacted case.
- A test needs network access to a real service or a shared environment.
- You want to skip, quarantine or delete an existing failing test: that hides a signal someone
  relies on, and needs a person's decision and a work item.
- A shared fixture used by many tests has to change.

Versions

The database has no other skills named api-test-generation.

Database snapshot: 13.11.2026 · package version 9eba42f3d881 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 86write-tests
    Use when the user asks to write, add or extend tests for some code (unit tests, regression test for a bug, coverage of a new feature).
  • 86principle-test-behavior-not-implementation
    Apply when you write, change, or keep a test. Assert what the code's users can observe, so that the test fails when that behavior breaks and keeps passing when only the internals change.
  • 90regression-test-gen
    Suggests regression coverage scoped to changed stack behavior, grouped by test layer. Use when a bug fix, refactor or migration is understood and you need to decide which tests prove it stays fixed.
  • 90principle-test-behavior-not-implementation
    Use when writing or changing a test, or deciding whether one should stay. Check what callers can see through the interface they call, so the test breaks when behavior breaks and survives changes to internals alone.
  • 100api-test-suite-builder
    Use when the user asks to generate API tests, create integration test suites, test REST endpoints, or build contract tests.
  • 100testing
    This skill should be used when the user asks about "testing", "test coverage", "unit tests", "integration tests", "test organization", "test best practices", "flaky tests", "test isolation", "TDD", "regression tests", or needs guidance on test structure, coverage requirements, and test execution.

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.