id = "api-design" name = "API Design & Specification" description = "Design a REST API from requirements: endpoints, request/response schemas, auth, error handling, and OpenAPI spec." category = "engineering" tags = ["api", "design", "openapi", "engineering"] [i18n.zh] name = "API 设计与规范" description = "从需求出发设计 REST API:端点、请求/响应结构、认证、错误处理,输出 OpenAPI 规范。" [[parameters]] name = "requirements" description = "Feature or product requirements the API needs to satisfy" param_type = "string" required = true [[parameters]] name = "tech_stack" description = "Technology stack and any existing API conventions" param_type = "string" required = false default = "" [[steps]] name = "resource_model" prompt_template = """ You are an API architect. From the requirements below, identify the core resources and their relationships: 1. List every resource (noun) 2. Define attributes and types for each 3. Map relationships (one-to-many, many-to-many) 4. Identify which resources need CRUD vs. action-oriented endpoints Requirements: {{requirements}} Tech stack / conventions: {{tech_stack}} """ [[steps]] name = "endpoint_design" prompt_template = """ Design the full set of REST endpoints based on the resource model. For each endpoint specify: - Method + path - Path/query parameters - Request body schema (JSON) - Success response schema + status code - Error responses (4xx, 5xx) - Auth requirement - Idempotency and side-effect notes Resource model: {{resource_model}} """ depends_on = ["resource_model"] [[steps]] name = "openapi_spec" prompt_template = """ Write a complete OpenAPI 3.1 YAML specification for the API designed above. Include: - info block with title, version, description - All paths with operations - Reusable schemas in components/schemas - Security schemes - Example request/response bodies Endpoint design: {{endpoint_design}} """ depends_on = ["endpoint_design"] [i18n.zh-TW] name = "API 設計與規格" description = "從需求出發設計 REST API:端點、請求/回應結構、認證、錯誤處理,輸出 OpenAPI 規格。" [i18n.ja] name = "API 設計と仕様策定" description = "要件から REST API を設計:エンドポイント、リクエスト/レスポンススキーマ、認証、エラー処理、OpenAPI 仕様を出力。" [i18n.ko] name = "API 설계 및 명세" description = "요구사항에서 REST API 설계: 엔드포인트, 요청/응답 스키마, 인증, 오류 처리, OpenAPI 명세 생성." [i18n.de] name = "API-Design & Spezifikation" description = "REST-API aus Anforderungen entwerfen: Endpunkte, Request-/Response-Schemas, Auth, Fehlerbehandlung, OpenAPI-Spezifikation." [i18n.es] name = "Diseño y especificación de API" description = "Diseña una API REST a partir de requisitos: endpoints, esquemas de petición/respuesta, autenticación, errores y especificación OpenAPI." [i18n.fr] name = "Conception et spécification d'API" description = "Concevoir une API REST à partir des besoins : endpoints, schémas requête/réponse, auth, gestion des erreurs et spécification OpenAPI."