stand-api-test

Write and review HTTP contract tests against a deployed gateway with real Keycloak sessions.

10|9|Updated May 22, 2026
One-click install
npx skills add https://github.com/constructorfabric/insight --skill stand-api-test-constructorfabric
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: stand-api-test
Source: https://github.com/constructorfabric/insight/tree/main/.claude/skills/stand-api-test
Command: npx skills add https://github.com/constructorfabric/insight --skill stand-api-test-constructorfabric

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Writing HTTP contract tests against a deployed Insight stand requires knowing which persona session to use, which status codes each service actually returns, and how to keep the read-only stand clean — this Skill encodes all of those rules so tests assert real behavior instead of spec boilerplate. ## Core Features & Use Cases - Operation catalogue and coverage gate: Maintains a single catalogue of gateway-routed operations and reconciles observed requests against it to close endpoint coverage gaps. - Persona and status-code discipline: Guides the choice of caller session (admin operator, realm admin, other tenant, service client) and enforces per-test status assertions such as identity 404 versus analytics 403 for out-of-scope persons. - Scratch-resource policy and xfail handling: Enforces API-only row creation with tracked scratch names and leak detection, and marks known product defects as strict xfails rather than softened assertions. - Use Case: When adding a new /api/identity endpoint, use this Skill to register the operation, pick the right seeded persona, write one test per status code, and verify the coverage gate passes. ## Quick Start Write a contract test for the new identity endpoint under tests/stand/api/ following the stand-api-test conventions and run the coverage gate.

Frequently Asked Questions about stand-api-test

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write HTTP contract tests against a deployed API gateway?

Add the operation to the catalogue in operations.py, choose the caller session that matches the access scenario, and write one test per status code covering success, validation 400, path-parse 400, 404, 415, and scope refusals. Assert codes from handler behavior, never from the OpenAPI document.

How do I choose which user session to use in API integration tests?

Pick the session based on what the test proves: a lead client for ordinary callers, admin_operator_session for admin-gated routes, realm_admin_session to assert a 403 refusal, other_tenant_session for tenancy checks, and service_client for internal S2S routes. Declare every seeded person with requires_seed markers.

Should an API return 403 or 404 for resources outside the caller's scope?

It depends on the service's deliberate contract: identity person routes return 404 so the refusal does not confirm the person exists, while analytics visible-set gates return 403. Assert whichever code the handler implements, reading the code rather than the spec.

How do I handle known product bugs in contract test suites?

Keep asserting the correct contract and mark the test with a strict xfail whose reason names current and expected behavior. Strict mode makes the case XPASS-fail once fixed, retiring the marker automatically instead of hiding regressions.

Can contract tests create test data directly in the database?

No. Rows must be created through the API and deleted afterward, never via a database connection, because the suite exercises only the deployed path. Every scratch row uses a tracked scratch name so the leak detector fails the session if anything survives.

Why does a 401 sweep not prove endpoint authentication coverage?

A gateway rejects unauthenticated requests at the edge before routing, so even nonexistent paths return 401. The sweep only proves refusal; per-service modules must show the same catalogued URL serves something to an authenticated session.