API REST

VérifiéSûr

Construire des API REST prêtes pour la production avec une conception contract-first, une authentification sécurisée, des tests robustes et des runbooks de déploiement.

Spar Skills Guide Bot
DeveloppementIntermédiaire
06/08/2026
Claude CodeCursorCodex
#rest-api#api-design#openapi#authentication#deployment

Recommandé pour

Synthèse automatique

Ce skill accompagne un workflow de bout en bout pour concevoir, sécuriser, tester et livrer une API REST, du contrat OpenAPI jusqu'au runbook de déploiement.

Points forts

  • Impose une approche contract-first : ressources, schémas, codes de statut et formats d'erreur sont définis dans OpenAPI avant tout handler.
  • Structure la mémoire projet dans ~/rest-api/ avec des dossiers séparés pour contrats, décisions d'architecture, plans de test et runbooks.
  • Couvre les sujets souvent négligés : authentification et autorisation par ressource, migrations rétrocompatibles, pagination, observabilité et checklist de pré-release.
  • Fournit une table de référence modulaire qui permet de ne charger que les fichiers pertinents à la tâche en cours.

Limites

  • Aucun code prêt à l'emploi ni dépendance à un framework : le skill reste méthodologique et ne génère pas d'implémentation exécutable.
  • Suppose que l'utilisateur accepte la surcharge d'un workflow formalisé (contrats, ADR, runbooks), peu adapté à un prototype jetable.
  • Le contenu détaillé se trouve dans des fichiers annexes (api-contract.md, auth-and-security.md, etc.) qu'il faut lire séparément pour obtenir les règles précises.
Quand l'utiliser

À utiliser lorsqu'on démarre une nouvelle API REST ou qu'on doit durcir une API existante avant sa mise en production.

Quand l'éviter

À éviter pour un script jetable, une API GraphQL/gRPC, ou lorsqu'on cherche uniquement du code d'implémentation prêt à coller.

Analyse de sécurité

Sûr
Score qualité85/100

The skill provides architectural guidance, design rules, and best practices for building REST APIs. It does not instruct destructive actions, exfiltration, obfuscation, or use of undeclared external tools. It explicitly states no external endpoints are called by default and no secrets are stored automatically. The only file system activity mentioned is local memory under ~/rest-api/.

Aucun point d'attention détecté

Comment cette analyse est faite

Exemples

Design a new API from scratch
I need to build a REST API for a multi-tenant invoicing service. Start with the OpenAPI contract, define the error shapes and pagination, then walk me through auth and the test plan before we write any handlers.
Harden an existing API
Our existing REST API has auth checks scattered inside controllers and no rate limiting. Audit it against the security rules of this skill and propose a plan for resource-level authorization and failure-path handling.
Pre-release readiness gate
We're shipping v2 of our REST API next week. Run the deployment checklist: schema migration backward compatibility, contract validation tests, observability metrics, and the runbook for known failure modes.

name: REST API slug: rest-api version: 1.0.0 homepage: https://clawic.com/skills/rest-api description: Build production-ready REST APIs with contract-first design, secure auth, robust testing, and deployment runbooks. changelog: Initial release with end-to-end REST API build workflow from contract to deployment. metadata: {"clawdbot":{"emoji":"🌐","requires":{"bins":[]},"os":["linux","darwin","win32"]}}

Setup

On first use, read setup.md for integration behavior and memory initialization.

When to Use

Use this skill when the user wants to design, implement, secure, test, and ship a REST API from scratch or harden an existing API for production.

This skill covers contract-first design, endpoint conventions, authentication and authorization, persistence strategy, test plans, observability, and release checklists.

Architecture

Working memory lives in ~/rest-api/. See memory-template.md for structure and status behavior.

~/rest-api/
├── memory.md                     # HOT: active API project context
├── contracts/                    # WARM: OpenAPI specs and compatibility notes
├── decisions/                    # WARM: ADR-style technical decisions
├── tests/                        # WARM: test plans and quality gates
├── operations/                   # WARM: runbooks and incident notes
└── archive/                      # COLD: closed projects and old versions

Quick Reference

Load only what is needed for the current API task.

| Topic | File | |-------|------| | Setup and activation behavior | setup.md | | Memory schema | memory-template.md | | Contract-first design | api-contract.md | | Endpoint conventions and errors | endpoint-design.md | | Auth and API security controls | auth-and-security.md | | Data model and migrations | persistence-and-migrations.md | | Test strategy and telemetry | testing-and-observability.md | | Pre-release readiness gate | deployment-checklist.md |

Core Rules

1. Start From the Contract, Not the Controller

Define resources, payload schemas, status codes, and error shapes in OpenAPI before writing handlers.

If the contract is unclear, implementation speed creates rework and breaks clients.

2. Keep Endpoint Semantics Predictable

Use stable naming, plural resources, and correct HTTP methods. Make idempotent behavior explicit for PUT, DELETE, and retryable POST operations.

Predictable semantics reduce client bugs and support safer retries.

3. Enforce Security by Default

Require authentication on non-public endpoints, apply authorization checks at resource boundary, validate input strictly, and sanitize output.

Never rely on frontend validation as a security control.

4. Design for Failure Paths First

Specify error classes, timeout strategy, rate-limit behavior, and fallback expectations before scaling happy-path code.

APIs fail in production at edges, not in demos.

5. Make Data Changes Backward Compatible

Use additive schema migrations first, backfill data safely, and only remove old fields after client migration windows close.

Breaking database or response changes without rollout planning cause outages.

6. Test Contract, Behavior, and Operations

Cover OpenAPI contract validation, integration tests against real infrastructure, and end-to-end tests for critical user journeys.

Unit tests alone do not prove API reliability.

7. Ship With Observability and Runbooks

Expose request metrics, structured errors, trace identifiers, and health indicators. Document recovery steps for known failure modes.

If an API cannot be observed, it cannot be operated safely.

Common Traps

  • Building endpoints before defining response and error contracts -> incompatible clients and patchwork fixes.
  • Mixing auth, business logic, and transport concerns in handlers -> brittle code and hidden security gaps.
  • Treating pagination and filtering as optional -> unstable list endpoints and expensive queries.
  • Returning inconsistent error bodies across services -> poor client DX and weak automation.
  • Shipping without migration rollback steps -> long incidents when a release fails.

Security & Privacy

Data that leaves your machine:

  • None by default.

Data that stays local:

  • API project context and decisions under ~/rest-api/.

This skill does NOT:

  • Call undeclared external endpoints by default.
  • Store secrets automatically.
  • Modify infrastructure without explicit user instruction.

Related Skills

Install with clawhub install <slug> if user confirms:

  • backend - System design and backend architecture decisions.
  • auth - Authentication, session strategy, and credential safety.
  • http - HTTP protocol details and request-response behavior.
  • api - Third-party API integration references.

Feedback

  • If useful: clawhub star rest-api
  • Stay updated: clawhub sync

Du fichier au premier essai

Le téléchargement contient exactement le contenu affiché sur cette fiche. Cette copie peut différer de la dernière version du dépôt source.

Consulter la source et ses fichiers annexes

Ce téléchargement contient uniquement SKILL.md. Les scripts, références, modèles et dépendances éventuels ne sont pas inclus. Récupérez les fichiers nécessaires depuis la source en conservant leur arborescence avant de poursuivre.

1. Télécharger le fichier

Télécharger SKILL.md

Depuis la racine d’un projet de test, enregistrez le fichier sous .skill-downloads/rest-api-msh3uuay/SKILL.md, ou utilisez la commande suivante. Ce dossier sert à examiner la skill avant son installation.

Commande pour macOS/Linux ou WSL : un shell POSIX et curl sont nécessaires. Sous Windows sans WSL, utilisez le bouton de téléchargement et créez le dossier manuellement.

mkdir -p '.skill-downloads/rest-api-msh3uuay' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/rest-api-msh3uuay/download' --output '.skill-downloads/rest-api-msh3uuay/SKILL.md.part' && mv '.skill-downloads/rest-api-msh3uuay/SKILL.md.part' '.skill-downloads/rest-api-msh3uuay/SKILL.md'

2. Vérifier les prérequis

Lisez SKILL.md avant de l’utiliser. Si le fichier cite des scripts ou services externes, examinez-les et préparez les accès nécessaires dans votre environnement de test.

Extrait original : Setup

On first use, read setup.md for integration behavior and memory initialization.

Les plateformes de la fiche sont des indications du catalogue. Les chemins ci-dessous suivent la documentation des outils ; ils ne prouvent pas que cette skill y a été exécutée. Aucune version minimale de ces outils n’est attestée pour cette fiche.

3. Charger la skill

Le fichier ne fournit pas un en-tête name/description exploitable pour cette procédure native. Le téléchargement reste disponible pour lecture ; utilisez le mode manuel ci-dessous.

Mode manuel ou autre outil : joignez SKILL.md à une conversation, ou ouvrez-le dans un agent capable de lire les fichiers. Ajoutez les ressources annexes nécessaires. Il n’existe pas de dossier universel reconnu par tous les outils.

4. Faire un premier essai

Utilisez une entrée courte et fictive : un endpoint d’API, un petit document ou un brief d’interface. Dans une nouvelle conversation, joignez le fichier ou donnez son chemin à l’agent, puis adaptez cette demande :

Lis .skill-downloads/rest-api-msh3uuay/SKILL.md et applique ses instructions à cet exemple : [décrire une entrée de test]. Indique les fichiers, dépendances ou accès qui manquent. Produis le résultat demandé par la skill sans inventer de données ni exécuter de script non examiné.

Résultat attendu : une sortie correspondant aux instructions de la skill, ou une liste précise des prérequis manquants. Une simple confirmation de lecture ne valide pas le premier usage. Si une ressource externe est indisponible, ce parcours reste à tester.

Skills similaires