api-contract-tester
Skill0 starsChanged 2 months agoMITView on GitHub
Guides agents through validating REST/HTTP API endpoints against expected request/response contracts, status codes, and JSON schemas.
In this repository49 other files it gives its agents.
- bug-reproducerSkill
- claim-checkerSkill
- command-failure-diagnoserSkill
- config-risk-reviewerSkill
- csv-validatorSkill
- deployment-checklist-makerSkill
- diff-reviewerSkill
- factual-summarizerSkill
- field-extractorSkill
- database-migration-helperSkill
- security-vulnerability-fixerSkill
- git-commit-stagerSkill
- git-conflict-resolverSkill
- github-actions-debuggerSkill
- github-issue-triagerSkill
- github-pr-creatorSkill
- github-pr-reviewerSkill
- go-code-qualitySkill
- go-lint-and-vetSkill
- go-testingSkill
- json-schema-converterSkill
- lint-and-typecheckSkill
- meaning-preserving-editorSkill
- meeting-notes-to-actionsSkill
- minimal-bug-fixSkill
- option-comparatorSkill
- py-code-qualitySkill
- py-lint-and-typecheckSkill
- py-testingSkill
- readme-writerSkill
- regression-test-writerSkill
- release-notes-drafterSkill
- repo-inspectorSkill
- research-briefSkill
- reversible-cleanup-plannerSkill
- rust-clippy-checkSkill
- rust-code-qualitySkill
- rust-testingSkill
- small-refactorSkill
- status-updateSkill
- step-by-step-tutorialSkill
- step-decomposerSkill
- tabular-analyzerSkill
- task-briefSkill
- test-runner-debuggerSkill
- ts-code-qualitySkill
- ts-lint-and-typecheckSkill
- ts-testingSkill
- skill-templateSkill
The file
We split this skill into the rules it gives an agent
10 rules. About 0 are common, 6 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 11
Verify that API routes fulfill their external contracts before deployment.
- Distinctive: line 14
Use this skill when:
- Very specific: line 20
Do not use for unit testing internal functions.
- Distinctive: line 28
If endpoint is missing: ask for target URL.
- Very specific: line 29
Default method to GET if unspecified.
- Distinctive: line 32
Follow these numbered actions:
- Very specific: line 38
Check if status matches expected_status.
- Distinctive: line 41
Verify required keys exist and match types.
- Very specific: line 46
If status code matches but payload is missing required schema keys: mark as CONTRACT_VIOLATION.
- Distinctive: line 74
Stop and ask the user when:
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
API Contract Tester
Validates HTTP/REST endpoints against contract specifications. Tests status codes, headers (Content-Type), and JSON response schema conformity using curl or test clients.
1. Purpose
Verify that API routes fulfill their external contracts before deployment.
2. When to Use
Use this skill when:
- Verifying newly implemented HTTP routes.
- Testing error responses (400, 401, 404, 429).
- Auditing response schema against OpenAPI / JSON Schema contracts.
3. When Not to Use
- Do not use for unit testing internal functions; use
test-runner-debugger.
4. Required Inputs
endpoint: URL path (e.g.http://localhost:3000/api/users).method: GET, POST, PUT, DELETE.expected_status: Expected HTTP status code (e.g. 200, 400).
5. Missing-Input Behavior
- If endpoint is missing: ask for target URL.
- Default method to
GETif unspecified.
6. Procedure
Follow these numbered actions:
- Action 1: Formulate Test Request
- Construct
curl -s -i -X <METHOD> <URL>.
- Construct
- Action 2: Execute Request
- Capture HTTP status code, headers, and body.
- Action 3: Validate Status & Headers
- Check if status matches
expected_status. - Check
Content-Type: application/json.
- Check if status matches
- Action 4: Validate Body Schema
- Verify required keys exist and match types.
- Action 5: Emit Contract Report
- Format per Section 8.
7. Decision Rules
- If status code matches but payload is missing required schema keys: mark as
CONTRACT_VIOLATION.
8. Output Format
Emit the report using this template:
### API Contract Test Report: [METHOD] [Endpoint]
- **Status**: [PASSED | FAILED | CONTRACT_VIOLATION]
- **HTTP Code**: [Observed] (Expected: [Expected])
- **Content-Type**: `[Header]`
#### Payload Validation
- [x] Status code matches contract
- [x] Response body valid JSON
- [x] Required keys present: `[keys]`9. Verification Checklist
- HTTP status code matches expected.
- Content-Type header verified.
- Response body matches schema.
10. Common Failures and Recovery
| Failure Symptom | Cause | Recovery Action |
curl: (7) Failed to connect | Server not running | Start local test server before executing curl. |
11. Stop or Escalation Conditions
Stop and ask the user when:
- Endpoint triggers destructive live external actions (e.g. real credit card charges).
12. Examples
Example 1: Successful Execution
Input:
Endpoint: http://localhost:3000/health
Method: GET
Expected: 200Output:
### API Contract Test Report: GET /health
- **Status**: PASSED
- **HTTP Code**: 200 (Expected: 200)
- **Content-Type**: `application/json; charset=utf-8`
#### Payload Validation
- [x] Status code matches contract
- [x] Response body valid JSON (`{"status":"ok"}`)
- [x] Required keys present: `status`Example 2: Ambiguous or Missing Input
Input:
Test API.Output:
### API Contract Test Report: Halted - Missing Endpoint
- **Status**: Halted
Please provide the API endpoint URL and expected HTTP status code.Example 3: Expected Final Output
Output:
### API Contract Test Report: POST /api/login
- **Status**: PASSED
- **HTTP Code**: 401 (Expected: 401)
- **Content-Type**: `application/json`Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

