AGENT SKILL

api-contract-validator

Validate API integration code against API contracts and schemas. Use when implementing, refactoring, reviewing, or debugging code that calls REST, GraphQL, gRPC, SDK, or webhook APIs, especially when OpenAPI specs, GraphQL schemas, protobufs, SDK types, TypeScript interfaces, Pydantic models, or documented request/response contracts are available.

License 许可
MIT
最近更新
2026-08-24
Stars
★ 17
Forks
1

01 前言 Front Matter

name
api-contract-validator
description
Validate API integration code against API contracts and schemas. Use when implementing, refactoring, reviewing, or debugging code that calls REST, GraphQL, gRPC, SDK, or webhook APIs, especially when OpenAPI specs, GraphQL schemas, protobufs, SDK types, TypeScript interfaces, Pydantic models, or documented request/response contracts are available.

02 资源文件 3

03 SKILL.md 正文

API Contract Validator

Validate API integration code against explicit or inferred contracts. Focus on request shape, response handling, authentication, error handling, version compatibility, and runtime safety.

When to use

Use this skill when working with:

  • REST clients, GraphQL clients, gRPC clients, SDKs, webhook handlers, or typed API wrappers
  • OpenAPI or Swagger specs, JSON Schema, GraphQL schemas, protobufs, SDK documentation, TypeScript types, Pydantic models, or API docs
  • API bugs involving 4xx or 5xx responses, missing fields, unexpected response shapes, auth failures, or schema drift
  • dependency upgrades that may change an API or SDK contract

Do not invent contract requirements. If no formal contract exists, clearly label findings as inferred from code, docs, tests, examples, or observed payloads.

Workflow

1. Locate the contract

Search for likely contract sources:

  • openapi.json, openapi.yaml, swagger.json, swagger.yaml
  • *.schema.json, schema.graphql, *.gql, *.proto
  • SDK type declarations, TypeScript interfaces, generated clients, Pydantic models, dataclasses, or typed response models
  • API docs, README files, examples, tests, fixtures, and recorded payloads

If multiple versions exist, identify which version the implementation uses.

2. Locate API integration code

Find request construction and response handling:

  • Python: requests, httpx, aiohttp, SDK clients
  • JavaScript and TypeScript: fetch, axios, generated clients, SDK clients
  • Go: http.Client, generated clients, SDK clients
  • GraphQL queries and mutations
  • webhook parsing and signature verification

Trace from the public method or handler to the boundary where data leaves or enters the system.

3. Validate requests

Check:

  • required fields, path params, query params, headers, and auth material
  • field names, types, enum values, nullability, formats, constraints, and defaults
  • content type, accept headers, serialization, date/time formats, pagination, idempotency keys, and retry-safe behavior
  • SDK method names, parameter order, version compatibility, and generated type usage

4. Validate responses and errors

Check:

  • success response fields are accessed safely and typed correctly
  • nullable or optional fields are handled explicitly
  • pagination, partial success, empty responses, and async job states are handled
  • documented 4xx and 5xx responses are handled with meaningful error behavior
  • webhook payloads validate signatures, event types, idempotency, and replay behavior where relevant

5. Report findings

Use this format:

# API Contract Validation Report

## Summary
- Status: PASS | WARNINGS | FAIL
- Contract sources: <files or docs used>
- Coverage: <what was validated and what was not>

## Critical findings
- `file:line` - <contract violation>
  - Expected: <contract requirement>
  - Actual: <implementation behavior>
  - Fix: <specific change>

## Warnings
- `file:line` - <risk or likely mismatch>
  - Evidence: <why this matters>
  - Fix: <specific change or verification>

## Info
- `file:line` - <optional improvement>

## Unvalidated assumptions
- <anything inferred rather than verified against a contract>

Severity guide

  • Critical: likely runtime failure, data loss, auth failure, missing required field, invalid type, unhandled documented error, webhook signature risk, or breaking version mismatch
  • Warning: incomplete defensive handling, deprecated field or endpoint, weak validation, optional field assumptions, missing test coverage for contract behavior
  • Info: clarity, typing, docs, and maintainability improvements

Principles

  • Prefer exact file references and concrete fixes.
  • Validate against the project’s existing patterns before recommending new abstractions.
  • Distinguish verified contract violations from inferred risks.
  • Do not hide uncertainty. State what needs a live API call, fixture, or upstream doc to confirm.

04 同仓库更多 Skills

danchamorro
danchamorro/pi-agent-toolkit

1password-developer

Work with 1Password developer features including SSH key management, the SSH agent, 1Password Environments for secrets injection, and the op CLI. Use this skill whenever the user mentions 1Password, op CLI, 1Password SSH agent, 1Password Environments, secret references, op run, op inject, or wants to manage SSH keys through 1Password, secure .env files with 1Password, or inject secrets at runtime. Also trigger when the user wants to stop storing plaintext secrets on disk or asks about securing developer credentials.

★ 17
danchamorro
danchamorro/pi-agent-toolkit

plan-reviewer

Use when creating, refining, or reviewing implementation plans, migration plans, refactoring proposals, feature plans, implementation trackers, or committable phase plans; especially when turning a rough plan into executable phases or checking whether a plan is concrete, testable, safe, dependency-aware, and suitable for parallel work.

★ 17
danchamorro
danchamorro/pi-agent-toolkit

brainstorm

Interview the user relentlessly about a plan or design until reaching shared understanding, resolving each branch of the decision tree. Use when user wants to stress-test a plan, get grilled on their design, or mentions "brainstorm".

★ 17
danchamorro
danchamorro/pi-agent-toolkit

youtube-video-context

Use this skill whenever the user gives a YouTube URL and asks to summarize, digest, analyze, extract transcript/context, decide whether a video is worth watching, or understand what a video is about. Prefer the summarize CLI for YouTube/video context instead of web search. Use Codex as the default summarize backend when possible, and use the local Whisper large-v3 model for transcription fallback. Do not use this for ordinary web pages; use the installed web-access tools for webpage research.

★ 17
danchamorro
danchamorro/pi-agent-toolkit

thermos

Launch both thermo-nuclear review subagents in parallel. Use for thermos, double thermo review, or combined bug/security and code-quality branch audits.

★ 17
danchamorro
danchamorro/pi-agent-toolkit

thermo-nuclear-review

Comprehensive security and correctness audit of a branch's changes. Use for thermo nuclear, thermonuclear, or deep review requests, or branch/PR diff audits focused on bugs, breaking changes, security issues, devex regressions, and feature-gate leaks.

★ 17