new-api-spec

new-api-spec is a skill for Claude Code, Codex from kint4/autoframe. It costs 41 tokens per session (704 once invoked), scanned A, original, MIT.

A generator for Playwright tests that call an API, which is a program interface used by software to exchange data. It creates cases for successful requests, errors, authentication failures, and invalid input.

In plain words
What is it for?
Use it with an endpoint and HTTP methods such as GET or POST to create a test file that checks status codes, response shapes, authentication, and invalid requests.
Why use it?
It provides a consistent starting point for checking both API responses and the data structure returned by an endpoint.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/kint4/autoframe/new-api-spec
Any agent
npx skills add kint4/autoframe --skill new-api-spec
Clone the repo
git clone --depth 1 https://github.com/kint4/autoframe

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for new-api-spec

README.md
[![agentmods](https://agentmods.dev/badge/skills/kint4/autoframe/new-api-spec.svg)](https://agentmods.dev/skills/kint4/autoframe/new-api-spec)
Your own site
<a href="https://agentmods.dev/skills/kint4/autoframe/new-api-spec"><img src="https://agentmods.dev/badge/skills/kint4/autoframe/new-api-spec.svg" alt="Measured on agentmods" height="20"></a>
Per session 41 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 704 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00041 $0.00704
Opus 5 $0.00020 $0.00352
Sonnet 5 $0.00008 $0.00141
Haiku 4.5 $0.00004 $0.00070

Measured 3d ago against content hash adc2639b899a, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

new-api-spec scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

2. **Probe the endpoint first** (one `curl` per case) to learn its real semantics before
.claude/skills/new-api-spec/SKILL.md · 62 lines

How it starts

The opening of the file, as written. The whole thing — 62 lines — stays where its author put it; the contents beside it link to each section on GitHub.

/new-api-spec — Generate an API Test File

Type: API Description: Generates a Playwright API test file for a given endpoint, covering success, error, auth failure, and invalid input with response schema validation.


Input Format

The user provides:

  • An endpoint path (e.g. /api/users)
  • The HTTP methods to cover (GET / POST / PUT / DELETE)
  • Optionally, the expected response shape and auth requirement

Ask up to 3 clarifying questions if the schema or auth model is unclear.

Output Format

An API test file at tests/api/[feature-name]/[feature].api.spec.ts following the API conventions in CLAUDE.md:

  • Imports test, expect from @playwright/test
  • Uses the request fixture
  • Validates status code and response schema with toMatchObject
  • Uses process.env.API_TOKEN for auth — never hardcoded
  • Covers success, error, auth failure (401), and invalid input (400)

Step-by-Step Instructions

  1. Read the API test conventions in CLAUDE.md.
  2. Probe the endpoint first (one curl per case) to learn its real semantics before writing assertions. Two common deviations from the template:
    • Some APIs always answer HTTP 200 and embed the real status in the body (e.g. {"responseCode": 405}). Assert on the body field, and note the quirk in a comment at the top of the spec.
    • Some APIs serve JSON with a text/html content type — use JSON.parse(await response.text()) instead of response.json() if parsing fails.
  3. Match the API's actual auth model. Bearer tokens are the template default, but not universal — if auth is credential-based (e.g. a verifyLogin endpoint), the "auth failure" case is wrong/missing credentials, not a missing header.
  4. Determine the feature folder (kebab-case) and file name with the .api.spec.ts suffix.
  5. For each method, generate tests covering:
    • Success — valid request → expected status + schema (toMatchObject).
    • Auth failure — no/invalid token → 401 (or the API's credential-failure equivalent).
    • Invalid input — bad payload → 400.
    • Error/edge — not found, conflict, unsupported method, etc., as relevant.
  6. Read auth tokens and URLs from environment variables only. Use data/factories/ for request payloads that need realistic data.
  7. Group tests in a test.describe('[Endpoint] API') block.
  8. Save to tests/api/[feature-name]/[feature].api.spec.ts.
  9. Suggest /api-coverage to see overall API coverage.

Read the full file on GitHub · 62 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 62 lines · 41 tokens per session scan A adc2639b899a

Subscribe to this mod's changes

new-api-spec is a skill published in the GitHub repository kint4/autoframe (6 stars, last pushed 2mo ago), licensed MIT. It adds 41 tokens to every session and 704 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.