contrato-api

contrato-api is a command for Claude Code from doncheli/don-cheli-sdd. It costs 19 tokens per session (1,752 once invoked), scanned A, original, Apache-2.0.

An API integration specification that defines requests, responses, errors, retries, webhooks, and idempotency for REST or GraphQL services.

In plain words
What is it for?
Use it to design contracts for APIs and webhooks, including integrations such as payments or product catalogues.
Why use it?
It makes integrations with external platforms more predictable when requests fail, repeat, or arrive as events.

Command for Claude Code

Written for Claude Code: installed under .claude/. Also seen: positional $N argument.

Part of the don-cheli-sdd plugin — 28 skills, 115 commands, 1 agent shipped together

Good fit Use it to design contracts for APIs and webhooks, including integrations such as payments or product catalogues.

Compare 6 commands from other repositories ↓
Install with agentmods
npx agentmods add commands/doncheli/don-cheli-sdd/contrato-api
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.

Clone the repo
git clone --depth 1 https://github.com/doncheli/don-cheli-sdd

Made for: Claude Code.

Or install don-cheli-sdd, the plugin that ships this one along with the rest of its 28 skills, 115 commands, 1 agent.

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

README.md
[![agentmods](https://agentmods.dev/badge/commands/doncheli/don-cheli-sdd/contrato-api.svg)](https://agentmods.dev/commands/doncheli/don-cheli-sdd/contrato-api)
Your own site
<a href="https://agentmods.dev/commands/doncheli/don-cheli-sdd/contrato-api"><img src="https://agentmods.dev/badge/commands/doncheli/don-cheli-sdd/contrato-api.svg" alt="Measured on agentmods" height="20"></a>
Per session 19 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,752 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.00019 $0.01752
Opus 5 $0.00010 $0.00876
Sonnet 5 $0.00004 $0.00350
Haiku 4.5 $0.00002 $0.00175

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

Security

Grade A, and why

contrato-api 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 4d 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.

scripts/.claude/commands/dc/contrato-api.md · 224 lines

How it starts

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

/dc:contrato-api

Objetivo

Diseñar contratos de API completos (REST o GraphQL), definir webhooks, planificar manejo de errores y reintentos para asegurar la resiliencia de integraciones con plataformas externas.

Uso

/dc:contrato-api <descripción de la integración>
/dc:contrato-api --tipo rest "Integración con Stripe para pagos"
/dc:contrato-api --tipo graphql "API de catálogo de productos"
/dc:contrato-api --tipo webhook "Recibir eventos de Shopify"

Diferencia con /dc:planificar-tecnico

Aspecto planificar-tecnico contrato-api
Alcance Blueprint completo de una feature Solo el contrato de API/integración
Profundidad Contrato básico (request/response) Contrato completo (errores, reintentos, webhooks, idempotencia)
Cuándo Después de spec Cuando la integración es el foco principal

Output para API REST

## Contrato API: Integración de Pagos con Stripe

### Endpoints

#### POST /api/v1/pagos
**Propósito:** Crear un cobro
**Auth:** Bearer token (JWT)
**Rate limit:** 100 req/min por usuario
**Idempotencia:** Sí (header `Idempotency-Key`)

**Request:**
```json
{
  "monto": 5000,          // centavos, min: 100, max: 99999900
  "moneda": "USD",        // ISO 4217
  "cliente_id": "uuid",
  "metodo_pago_id": "pm_xxx",
  "descripcion": "Pedido #1234",
  "metadata": {}          // opcional, max 50 keys
}

Responses:

Status Significado Body
201 Cobro creado { id, status, monto, stripe_id, created_at }
400 Datos inválidos { error, field, message }
402 Pago rechazado { error, decline_code, message }
409 Idempotency conflict { error, original_id }
429 Rate limit { error, retry_after }
500 Error interno { error, request_id }

Headers de respuesta:

X-Request-Id: uuid          // Para soporte/debugging
X-RateLimit-Remaining: 95
X-RateLimit-Reset: 1616544000

Webhooks (recibir desde Stripe)

POST /api/v1/webhooks/stripe

Verificación: HMAC-SHA256 con Stripe-Signature header Tolerancia de timestamp: 300 segundos (5 min) Respuesta esperada: 200 OK (body vacío) en < 5s

Eventos soportados:

Evento Acción Idempotente
payment_intent.succeeded Marcar pedido como pagado
payment_intent.payment_failed Notificar al usuario
charge.refunded Procesar reembolso
charge.dispute.created Alertar al equipo

Procesamiento:

1. Verificar firma HMAC
2. Parsear evento
3. Verificar idempotencia (event.id en tabla processed_events)
4. Responder 200 INMEDIATAMENTE
5. Procesar en cola async (no bloquear respuesta)
6. Registrar en audit log

Manejo de Errores

Errores del cliente (4xx):

{
  "error": {
    "tipo": "validation_error",
    "mensaje": "El monto debe ser mayor a $1.00",
    "campo": "monto",
    "codigo": "MONTO_INVALIDO"
  }
}

Errores del servidor (5xx):

{
  "error": {
    "tipo": "internal_error",
    "mensaje": "Error procesando el pago",
    "request_id": "req_abc123"
  }
}

Códigos de error consistentes:

Código Significado HTTP
MONTO_INVALIDO Monto fuera de rango 400
MONEDA_NO_SOPORTADA Moneda no en whitelist 400
PAGO_RECHAZADO Tarjeta rechazada 402
DUPLICADO Idempotency conflict 409
RATE_LIMIT Demasiadas requests 429
STRIPE_ERROR Error de comunicación con Stripe 502

Política de Reintentos

Estrategia: Exponential backoff con jitter

Read the full file on GitHub · 224 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. 4d ago First seen · 224 lines · 19 tokens per session scan A 12926b6d640e

Subscribe to this mod's changes

contrato-api is a command published in the GitHub repository doncheli/don-cheli-sdd (57 stars, last pushed 28d ago), licensed Apache-2.0. It adds 19 tokens to every session and 1,752 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-09-03.