kiro-rails: Command for Claude Code

.claude/commands/review-api-contracts.md

review-api-contracts is a command for Claude Code from sourjya/kiro-rails. It costs 27 tokens per session (2,906 once invoked), scanned A, original, MIT.

An audit of the agreements between an API and the programs that use it, including response formats, errors, HTTP status codes, and shared types. An API is a defined way for software systems to exchange requests and data.

In plain words
What is it for?
Use it when adding or changing REST routes, GraphQL schemas, request or response formats, API versions, or externally published endpoints.
Why use it?
It helps catch inconsistent or breaking changes before they confuse clients, break the frontend, or make errors difficult for software to handle.

Command for Claude Code

Written for Claude Code: installed under .claude/.

This is sourjya/kiro-rails's own configuration. It tells Claude Code how to work on kiro-rails itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything kiro-rails configures →

Reuse

Borrowing it

Nothing to install: this file belongs to sourjya/kiro-rails. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/sourjya/kiro-rails/main/.claude/commands/review-api-contracts.md
Clone the repo
git clone --depth 1 https://github.com/sourjya/kiro-rails

Made for: Claude Code.

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 review-api-contracts

README.md
[![agentmods](https://agentmods.dev/badge/commands/sourjya/kiro-rails/review-api-contracts/github.svg)](https://agentmods.dev/commands/sourjya/kiro-rails/review-api-contracts)
Your own site
<a href="https://agentmods.dev/commands/sourjya/kiro-rails/review-api-contracts"><img src="https://agentmods.dev/badge/commands/sourjya/kiro-rails/review-api-contracts/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 review-api-contracts

Your own site · 80×15
<a href="https://agentmods.dev/commands/sourjya/kiro-rails/review-api-contracts"><img src="https://agentmods.dev/badge/commands/sourjya/kiro-rails/review-api-contracts.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 27 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,906 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.00027 $0.02906
Opus 5 $0.00014 $0.01453
Sonnet 5 $0.00005 $0.00581
Haiku 4.5 $0.00003 $0.00291

Measured 9d ago against content hash e1bc2d357b6d, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

review-api-contracts 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 9d 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.

.claude/commands/review-api-contracts.md · 179 lines

How it starts

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

Before scanning, read docs/decisions/ ADRs and any API design docs if they exist. Use documented contract decisions (intentional envelope exceptions, versioning strategy) to distinguish intentional design from accidental inconsistency.

Act as a principal-level API architect and backend engineer performing a comprehensive API contract quality audit.

Your mission is not to verify that endpoints return data. It is to determine whether the API surface is consistent, predictable, and safe to evolve - whether a consumer can rely on stable contracts, whether errors are machine-parseable, whether breaking changes are detectable before deployment, and whether cross-cutting concerns are applied uniformly. An API that works today but cannot be changed without breaking unknown consumers is a liability.


Activation Triggers

Run this review when:

  • New API endpoints or routes are added
  • API versioning changes or a new API version is introduced
  • A feature adds or modifies request/response schemas
  • GraphQL schema changes (new types, resolvers, or queries)
  • Before publishing an API to external consumers
  • At feature-complete or sprint-end review checkpoints

Review Objectives

Identify:

  1. Response envelope consistency. Every endpoint must return responses through a uniform envelope structure. Flag endpoints that return raw arrays, bare scalars, or inconsistent top-level keys. Check whether success responses use the same wrapper shape (data, meta, links, or equivalent) across all resources. Flag where pagination metadata, request IDs, or timestamps appear in some responses but not others. A consumer should never need to guess the response shape based on which endpoint they called.

  2. Error schema uniformity (RFC 7807). All error responses must follow a single, machine-parseable schema - preferably RFC 7807 Problem Details (type, title, status, detail, instance). Flag endpoints that return ad hoc error shapes, plain strings, HTML error pages, or framework default error bodies. Check whether validation errors include a errors or violations array with per-field detail. Flag where the same HTTP status code produces different error body shapes depending on the endpoint or error path.

Read the full file on GitHub · 179 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. 9d ago First seen · 179 lines · 27 tokens per session scan A e1bc2d357b6d

Subscribe to this mod's changes

review-api-contracts is a command published in the GitHub repository sourjya/kiro-rails (9 stars, last pushed 1mo ago), licensed MIT. It adds 27 tokens to every session and 2,906 once invoked, about $0.0001 per session on Opus 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-08-31.