Agent skill · Frontend

API Contracts Generator

Génère des contrats API cohérents entre Frontend (Next.js) et Backend (NestJS) avec types synchronisés, validation standardisée et error handling uniforme. À utiliser lors de la création d'APIs, DTOs, types frontend/backend, ou quand l'utilisateur mentionne "API", "DTO", "types", "contract", "validation", "frontend-backend", "synchronisation".

majiayu000github.com/majiayu000GitHub ↗
claude-codecan modify filesMIT
Install
npx skills add majiayu000/claude-skill-registry --skill api-contracts --agent claude-code

Same command for any agent — swap --agent for codex, cursor, copilot.

Facts
Files in the skill folder: 2
SKILL.md size: 19 KB
Bundled scripts: none
Allowed tools: ReadWriteEditGlobGrepBash
Path: skills/api/api-contracts/SKILL.md
Open the folder on GitHub →
Where it comes from
Stars: 534
Language: HTML

Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.

Review
written from the skill's own SKILL.md · Aug 5, 2026

What it does

Generates a coherent API contract between Frontend (Next.js) and Backend (NestJS) ensuring synchronized types, standardized validation, and uniform error handling. It targets tasks around APIs, DTOs, frontend/backend types, and related validation synchronisation.

How it works

  • Establishes Backend DTOs (NestJS) with request/response structures, validation via class-validator, and Swagger decorators for documentation.
  • Defines Response DTOs including nested DTOs and pagination DTOs, with examples and type consistency.
  • Integrates Controller code samples showing how DTOs connect to handlers and how API responses are shaped.
  • Outlines Frontend Type strategy: options to generate types from Backend Swagger (openapi-typescript), share types in a monorepo, or manually duplicate types; includes validation rules on the frontend mirroring backend constraints.
  • Provides Frontend Validation with Zod that must EXACTLY match backend rules (e.g., length limits, required fields).
  • Describes Server Action flow (Frontend → Backend) with input validation, API call, cache revalidation, and error handling patterns.
  • Includes API Client code demonstrating authentication, request/response handling, and error translation to a unified error type.
  • Specifies Backend and Frontend error handling formats and a translation layer for user-friendly messages.

When to use it

Use when creating APIs, DTOs, or frontend/backend types, or when the user mentions terms like "API", "DTO", "types", "contract", "validation", "frontend-backend", or "synchronisation" to ensure consistent contracts across layers.

What it can touch

  • Backend: DTOs, Controller references, pagination DTOs, example code, and validation decorators.
  • Frontend: Types synchronization approaches, Zod schemas, and server-action/client API patterns.
  • Server/API error handling formats and translation helpers.

Caveats

  • License: MIT
  • Rules require frontend and backend validation to align exactly; the provided examples enforce consistent validation definitions across both sides.
  • The skill assumes Swagger/OpenAPI-based type generation or shared types in a monorepo; exact source integration depends on project setup.
From the SKILL.md

# API Contracts Generator ## 🎯 Mission Garantir une **communication parfaite** entre Frontend (Next.js) et Backend (NestJS) via des contrats API cohérents, types synchronisés et validation standardisée. ## 🏗️ Philosophie des API Contracts ### Le Problème Dans un projet full-stack, les erreurs de communication Frontend ↔ Backend sont fréquentes : - ❌ Types incohérents (backend attend `clubId`, frontend envoie `id`) - ❌ Validations divergentes (backend accepte 100 chars, frontend 50) - ❌ Erreurs non standardisées (format différent selon l'endpoint) - ❌ Documentation obsolète (Swagger non à jour) ### La Solution : API Contracts Un **API Contract** définit le contrat entre frontend et backend : - ✅ **DTOs Backend** : Structure des requêtes/réponses avec validation - ✅ **Types Frontend** : TypeScript synchronisés avec le backend - ✅ **Validation cohérente** : Mêmes règles backend et frontend - ✅ **Error format standard** : Format uniforme pour toutes les erreurs - ✅ **Documentation auto** : Swagger généré depuis le code ### Architecture de Communication ``` Frontend (Next.js) ↓ Server Action (avec types) ↓ Validation Zod ↓ fetch/axios Backend (NestJS) ↓ Controller (avec DTOs) ↓ Valida

What's inside
Steps it walks through
  1. 🎯 Mission
  2. 🏗️ Philosophie des API Contracts
  3. Le Problème
  4. La Solution : API Contracts
  5. Architecture de Communication
  6. 📦 1. Backend DTOs (NestJS)
  7. Request DTOs (Input)
  8. Response DTOs (Output)
  9. Pagination DTO (Standard)
  10. Controller Integration
  11. 🎨 2. Frontend Types (Next.js)
  12. Stratégie de Synchronisation
  13. Validation Frontend avec Zod
  14. 🔗 3. Server Actions (Frontend → Backend)
Ships with 1 file
  • metadata.json
Commands it runs
Install openapi-typescript
npm install --save-dev openapi-typescript
Generate types from backend Swagger
npx openapi-typescript http://localhost:3000/api-json -o src/types/api.ts
More from claude-skill-registry
All skills →
About this skill
What does the API Contracts Generator skill do?

Génère des contrats API cohérents entre Frontend (Next.js) et Backend (NestJS) avec types synchronisés, validation standardisée et error handling uniforme. À utiliser lors de la création d'APIs, DTOs, types frontend/backend, ou quand l'utilisateur mentionne "API", "DTO", "types", "contract", "validation", "frontend-backend", "synchronisation".

How do I install it?

Run `npx skills add majiayu000/claude-skill-registry --skill api-contracts --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.

Where does this skill come from?

From majiayu000/claude-skill-registry, a repository with 534 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.

Is a popular skill a good skill?

Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.

Keep going