Python REST API Validator skill for Claude and Codex
A runnable Python script that calls one endpoint and fails loudly if the status code, required headers, or JSON shape differ from what you expect, ready to…
Install it once and Claude or Codex runs it for you. When your request matches, your AI loads the skill, asks for anything it is missing, and works through the template itself. Prefer to fill it in by hand? See the full prompt template.
Download the skill (.zip) · View SKILL.md
When it is used
Use when an endpoint's status code, headers, and JSON body need an automated check that can run in CI or as a smoke test after each deploy. Do not use for load testing, full contract test suites across many endpoints, or mocking an API. Related topics: coding, python.
What it will ask you for
- Base URL (free text, e.g. "https://api.example.com")
- Endpoint path (free text, e.g. "/v1/resource")
- HTTP method (choose one: GET, POST, PUT, DELETE, PATCH)
- Expected status code (number from 100 to 599)
- Request headers (optional) (longer free text)
- Required response headers (optional) (longer free text)
- JSON Schema for the body (optional) (longer free text)
- Request body (optional) (longer free text)
How it works
- Write one function that sends the request and returns a list of failure strings, so the script works both imported and from the command line.
- Check the status code first, then each required header, then parse the body and validate it against the schema when one is given.
- Read tokens and secrets from environment variables, with a clear error when a required one is missing.
- Print every failure with expected and actual values and exit non-zero on any failure, so CI marks the run red.
- Add a usage comment naming the pip packages and the run command, then confirm the script runs against the example inputs.
What you get
One python code fence with the complete script (imports, validator function, command-line entry point), followed by a single line with the command to run it.
What it watches out for
- Stopping at the first failed check, which hides the other failures and makes the user re-run the script several times.
- Hard-coding a bearer token in the file, which ends up committed to version control.
- Treating a 3xx redirect as a failure when the client follows redirects by default, so the expected code never matches.
How to install
Claude.ai and the Claude desktop app
- Download the skill .zip.
- Open Settings, then Capabilities, and find Skills.
- Choose Upload skill and select the .zip.
- Ask Claude for help with the task. It loads the skill when your request matches.
Claude Code
- Download the skill .zip.
- Unzip it into ~/.claude/skills/ (or .claude/skills/ inside a project).
- Start a new session. Claude Code loads the skill when your request matches.
Codex
- Download the skill .zip.
- Unzip it into ~/.agents/skills/ (or .agents/skills/ inside a project).
- Codex picks it up on its own. Type $ and the skill name to use it, or just ask for the task.
Cursor
- Download the Cursor rule (.mdc).
- Save it in .cursor/rules/ inside your project.
- Cursor's agent applies the rule when your request matches its description.
AGENTS.md (Codex, Cursor, and other coding agents)
- Copy the AGENTS.md section.
- Paste it into AGENTS.md at the root of your repository, creating the file if needed.
- Coding agents that read AGENTS.md follow it when your request fits.