api-contract

api-contract is a skill for Claude Code from atretyak1985/swarmery. It costs 49 tokens per session (855 once invoked), scanned A, original, Apache-2.0.

A read-only check that compares an API entity across database tables, ORM models, validation schemas, route handlers, and SQL migrations. An API is the data contract through which parts of a program communicate.

In plain words
What is it for?
Use it to verify API response shapes, database-to-API alignment, and migration consistency.
Why use it?
It catches mismatched field names, data types, and optional values before different layers disagree or requests fail.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter.

Part of the core plugin — 37 skills, 8 commands, 13 agents shipped together

Good fit Use it to verify API response shapes, database-to-API alignment, and migration consistency.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/atretyak1985/swarmery/api-contract
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.

Any agent
npx skills add atretyak1985/swarmery --skill api-contract
Clone the repo
git clone --depth 1 https://github.com/atretyak1985/swarmery

Made for: Claude Code.

Or install core, the plugin that ships this one along with the rest of its 37 skills, 8 commands, 13 agents.

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 api-contract

README.md
[![agentmods](https://agentmods.dev/badge/skills/atretyak1985/swarmery/api-contract/github.svg)](https://agentmods.dev/skills/atretyak1985/swarmery/api-contract)
Your own site
<a href="https://agentmods.dev/skills/atretyak1985/swarmery/api-contract"><img src="https://agentmods.dev/badge/skills/atretyak1985/swarmery/api-contract/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for api-contract

Your own site · 80×15
<a href="https://agentmods.dev/skills/atretyak1985/swarmery/api-contract"><img src="https://agentmods.dev/badge/skills/atretyak1985/swarmery/api-contract.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 49 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 855 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00049 $0.00855
Opus 5.5 $0.00020 $0.00342
Sonnet 5.5 $0.00010 $0.00171
Haiku 4.5 $0.00005 $0.00085

Measured 1mo ago against content hash b5e57b9e5e09, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

api-contract scanned grade A with 0 findings 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 1mo 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.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/core/skills/api-contract/SKILL.md · 66 lines

How it starts

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

Purpose

Detects field-name, type, and nullable/optional mismatches across the layers defining an API entity: the ORM schema (apps/<mainApp>/src/lib/db/schema.ts), the Zod schema, the route handler's JSON response, and the SQL migrations in the infrastructure repo. Examples use Drizzle and Flyway-style migrations — adapt to the project's stack (project.json -> stack.db). Read-only: fixes go to @implementation-agent or a developer.

Rules (never violate)

  • Read-only skill (Read, Grep, Glob) — never auto-fix a mismatch; refuse if asked.
  • Every finding cites file:line and carries a severity; findings below 80% confidence are marked [LOW-CONFIDENCE].
  • The report contains zero placeholder text and ends with CONTRACT-ISSUES: {entity} | CRITICAL: {n} | HIGH: {n} | MEDIUM: {n} | LOW: {n}.
  • A field name that differs between layers is this skill's job; a naming convention preference belongs to code-standards.
  • Do not flag Zod .optional() vs ORM .default(), migration-tool bookkeeping tables, or vendored/generated files; wire-protocol fields keep UPPER_SNAKE_CASE.
  • Stop and ask on an ORM type with no Zod equivalent, or >10 Critical findings in one entity.

Resources

  • Read resources/verification-procedure.md when running a check — the 7-step procedure, output template, severity criteria, self-check, escalation, and failure modes.
  • Read resources/worked-example-device.md when you need a full end-to-end example with real code across all four layers.

How to use

What it does

Checks that one API entity means the same thing in every layer: it reads the ORM table, the Zod schema, the route handler's JSON response, and the SQL migration, then compares them field by field and reports every mismatch with a file:line citation, a severity, and a suggested fix. It never edits code.

When to use it

  • You added, renamed, or retyped an ORM column and want to know what drifted.
  • You changed a route handler's response shape or wrote a new Zod schema.
  • A SQL migration landed and the ORM table definition needs verification.

Read the full file on GitHub · 66 lines

Files

What ships with it

2 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 1mo ago First seen · 66 lines · 49 tokens per session scan A b5e57b9e5e09

Subscribe to this mod's changes

api-contract is a skill published in the GitHub repository atretyak1985/swarmery (7 stars, last pushed today), licensed Apache-2.0. It adds 49 tokens to every session and 855 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

Other skills, from other repositories

azure-postgres-ts

Connect to Azure Database for PostgreSQL Flexible Server from Node.js/TypeScript using the pg (node-postgres) package. Use for PostgreSQL queries, connection pooling, transactions, and Microsoft Entra ID (passwordless) authentication. Triggers: "PostgreSQL", "postgres", "pg client", "node-postgres", "Azure PostgreSQL…

microsoft/skills · 94 tokens

k2

Build and troubleshoot Cloudflare K2 or K2 Streams durable logs. Use for stream setup, producing from Workers or HTTP, configuring retention and inputs, and consuming through subscriptions.

cloudflare/skills · 38 tokens

clickhouse-js-node-coding

Write idiomatic application code with the ClickHouse Node.js client (@clickhouse/client). Use this skill whenever a user is building against the Node.js client — configuring the client, pinging, inserting rows in JSON or raw formats, selecting and parsing results, binding query parameters, managing sessions and…

ClickHouse/agent-skills · 89 tokens

database-patterns

Database design and migration patterns for Alembic migrations, schema design (SQL/NoSQL), and database versioning. Use when creating migrations, designing schemas, normalizing data, managing database versions, or handling schema drift.

yonatangross/orchestkit · 49 tokens

cloudflare-hyperdrive

Cloudflare Hyperdrive for Workers-to-database connections with pooling and caching. Use for PostgreSQL/MySQL, Drizzle/Prisma, or encountering pool errors, TLS issues, connection refused.

secondsky/claude-skills · 45 tokens

database-rds-devops

Database-level data-plane diagnostics for Aurora MySQL and Aurora PostgreSQL. Executes predefined read-only health check queries via RDS Data API to analyze buffer pool, connections, locks, replication, storage, performance, and index efficiency. Requires the rds-aidba MCP server for database-internal access beyond…

aws/tools-for-devops-agent · 75 tokens