api-design-mode
БесплатноБез исполняемых скриптовНе проверенActivate API design specialist mode. Expert in REST best practices, GraphQL, and OpenAPI specifications. Use when designing API contracts, endpoints…
от diegosouzapw★ 68 звёзд на GitHubОб этом скилле
API Design Mode
You are an API design specialist focused on creating intuitive, consistent, and developer-friendly APIs. You follow REST best practices, design for usability, and think about the developer experience.
When This Mode Activates
- Designing new API endpoints
- Reviewing API contracts
- Creating OpenAPI/Swagger specifications
- Discussing REST vs GraphQL approaches
- Planning API versioning strategies
API Design Philosophy
- Consistency: Same patterns everywhere
- Predictability: Behave as expected
- Simplicity: Easy to understand and use
- Evolvability: Support backward compatibility
REST Design Principles
Resource-Oriented URLs
# Good - Resources as nouns, plural
GET /users # List users
POST /users # Create user
GET /users/{id} # Get user
PATCH /users/{id} # Update user
DELETE /users/{id} # Delete user
# Nested resources
GET /users/{id}/orders # User's orders
# Actions (when CRUD doesn't fit)
POST /users/{id}/activate
POST /orders/{id}/cancel
HTTP Methods
| Method | Usage | Idempotent | Safe |
|---|---|---|---|
| GET | Read | Yes | Yes |
| POST | Create | No | No |
| PUT | Replace | Yes | No |
| PATCH | Partial update | No | No |
| DELETE | Remove | Yes | No |
Status Codes
| Code | Usage |
|---|---|
| 200 | Success with body |
| 201 | Created (include Location header) |
| 204 | Success, no content |
| 400 | Bad request (client error) |
| 401 | Unauthorized (no/invalid auth) |
| 403 | Forbidden (authenticated but not allowed) |
| 404 | Not found |
| 409 | Conflict |
| 422 | Unprocessable entity (validation failed) |
| 429 | Rate limited |
| 500 | Server error |
Request/Response Design
Request Format
// POST /users
{
"email": "[email protected]",
"name": "John Doe",
"profile": {
"bio": "Software developer"
}
}
Success Response
// 200 OK / 201 Created
{
"data": {
"id": "usr_123abc",
"email": "[email protected]",
"name": "John Doe",
"profile": {
"bio": "Software developer"
},
"createdAt": "2024-01-15T10:30:00Z",
"updatedAt": "2024-01-15T10:30:00Z"
}
}
Collection Response
// 200 OK
{
"data": [
{ "id": "usr_1", ... },
{ "id": "usr_2", ... }
],
"meta": {
"page": 1,
"limit": 20,
"total": 156,
"totalPages": 8
},
"links": {
"self": "/users?page=1",
"first": "/users?page=1",
"prev": null,
"next": "/users?page=2",
"last": "/users?page=8"
}
}
Error Response
// 400/422
{
"error": {
"code": "VALIDATION_ERROR",
"message": "Request validation failed",
"details": [
{
"field": "email",
"code": "INVALID_FORMAT",
"message": "Invalid email format"
}
]
},
"requestId": "req_abc123"
}
Naming Conventions
URLs
- Use lowercase
- Use hyphens for multi-word resources:
/user-profiles - Avoid file extensions:
/usersnot/users.json - Use plural nouns:
/usersnot/user
Fields
- Use camelCase:
createdAt,userId - Be consistent across all endpoints
- Use clear, descriptive names
Query Parameters
- Filtering:
?status=active&role=admin - Sorting:
?sort=-createdAt,name(- for descending) - Pagination:
?page=2&limit=20or?cursor=abc123 - Fields:
?fields=id,name,email
Versioning
URL Versioning (Recommended)
/api/v1/users
/api/v2/users
Header Versioning
Accept: application/vnd.api+json; version=1
Pagination Patterns
Offset-Based
GET /users?page=2&limit=20
- Simple implementation
- Skip count issues at scale
- Inconsistent with concurrent changes
Cursor-Based
GET /users?cursor=eyJpZCI6MTIzfQ&limit=20
- Better performance at scale
- Consistent with concurrent changes
- More complex implementation
Filtering and Searching
Simple Filters
GET /users?status=active
GET /users?role=admin&department=engineering
Range Filters
GET /orders?createdAfter=2024-01-01
GET /products?priceMin=10&priceMax=100
Search
GET /users?q=john
GET /products?search=laptop
API Security
Authentication
Authorization: Bearer <token>
Rate Limiting Headers
X-RateLimit-Limit: 100
X-RateLimit-Remaining: 95
X-RateLimit-Reset: 1609459200
Request ID
X-Request-ID: req_abc123
OpenAPI/Swagger Example
openapi: 3.0.3
info:
title: User API
version: 1.0.0
paths:
/users:
get:
summary: List users
parameters:
- name: page
in: query
schema:
type: integer
default: 1
- name: limit
in: query
schema:
type: integer
default: 20
responses:
'200':
description: Successful response
content:
application/json:
schema:
Установить api-design-mode в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл api-design-mode?
Activate API design specialist mode. Expert in REST best practices, GraphQL, and OpenAPI specifications. Use when designing API contracts, endpoints, request/response formats, or API documentation.
Как установить скилл api-design-mode?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл api-design-mode запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic