AGENT
Use when designing a new HTTP/GraphQL API or changing an existing one — modeling resources, defining endpoint contracts, choosing status codes, pagination,…
A good test reads like a specification. Two habits get you most of the way: a consistent three-phase body (AAA) and a name that states the behavior, not the method.
$ npx -y skills add vanara-agents/skills --agent claude-codeHow it fires
How this agent gets triggered: by you, by Claude, or both.
Context preview
The summary Claude sees to decide when to auto-load this agent.
A good test reads like a specification. Two habits get you most of the way: a consistent three-phase body (AAA) and a name that states the behavior, not the method.
A good test reads like a specification. Two habits get you most of the way: a consistent three-phase body (AAA) and a name that states the behavior, not the method.
Structure every test in three visually separated phases:
it('caps the cart total at the configured maximum', () => {
// Arrange — set up inputs, fixtures, doubles
const cart = makeCart({ items: 5, unitPrice: 100 });
const maxTotal = 400;
// Act — invoke exactly ONE behavior
const total = cart.totalWithCap(maxTotal);
// Assert — verify the observable outcome
expect(total).toBe(400);
});Why it works:
keeps failures unambiguous — you know exactly what broke.
behavior failures.
hide bugs in the test itself. Prefer table-driven cases or parameterized tests instead.
The same shape, phrased for behavior-driven tests: *Given* a context, *When* an action occurs, *Then* an outcome is observed. Map Given→Arrange, When→Act, Then→Assert.
A test name should let a reader understand the requirement **without reading the body**. State the scenario and the expected outcome.
**Weak (restates the method):**
test('applyDiscount')
test('test refund')
test('works')**Strong (states the behavior):**
test('subtracts a percentage discount and rounds to two decimals')
test('throws RangeError when the discount exceeds 100 percent')
test('returns empty array when no markets match the query')
test('falls back to substring search when Redis is unavailable')A useful template: **`<does X> when <condition Y>`** or **`<verb> <expected> given <state>`**.
When a test fails, its name plus its single Act should tell you what's broken without debugging. Resist the "mega test" that arranges a huge world and asserts twenty things — the first failure masks the rest, and the name can't describe what it covers. Split by behavior.
// OK: these three assertions all describe "creates an open order"
expect(order.id).toBeDefined();
expect(order.status).toBe('open');
expect(order.createdAt).toBeInstanceOf(Date);The guideline is *one logical concept per test*, not literally one `expect`.
🐒 Free agents, skills & packs for Claude Code One subscription. An army of Claude Code agents. 30 production-grade agents, skills, and packs for Claude Code — free, Apache-2.0, install with one command.
Repo: vanara-agents/skills
Use when designing a new HTTP/GraphQL API or changing an existing one — modeling resources, defining endpoint contracts, choosing status codes, pagination,…
This shows how the api-designer agent reviews a flawed draft. Findings are severity-ranked so the implementer fixes the contract-breakers first. Severity…
The contract is the deliverable. Express it as an **OpenAPI 3.1** document so it is human-readable *and* machine-checkable. This reference covers how to…
Run through this before declaring an API contract done. It is ordered the way you should *design*: resources first, cross-cutting rules last. Every box is a…
APIs are forever once published: a consumer you've never met may depend on any field you expose. Design so you can **add without breaking**, and version…
Copy-paste templates for leaving review comments. Keep each comment to one finding: an anchor, the problem, and the fix.