用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/diegosouzapw/awesome-omni-skill --skill api-design命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
Token-efficient tracking for AI orchestration. CLI-first for status updates (~50 tokens), agent fallback for complex ops (~1KB). Use when: updating task status, querying blockers, creating progress files, validating phases.
AshAi extension guidelines for integrating AI capabilities with Ash Framework. Use when implementing vectorization/embeddings, exposing Ash actions as LLM tools, creating prompt-backed actions, or setting up MCP servers. Covers semantic search, LangChain integration, and structured outputs.
This skill should be used when solving hard questions, complex architectural problems, or debugging issues that benefit from GPT-5 Pro or GPT-5.1 thinking models with large file context. Use when standard Claude analysis needs deeper reasoning or extended context windows.
基于 SOC 职业分类
正在显示 SKILL.md
| name | api-design |
| description | REST API, GraphQL, and API design patterns and best practices |
| license | MIT |
| compatibility | opencode |
Comprehensive patterns and best practices for designing REST APIs, GraphQL APIs, and API-first development.
Resource Naming
# Good - nouns, plural, lowercase, hyphenated
GET /users
GET /users/{id}
GET /users/{id}/posts
GET /blog-posts
GET /order-items
# Bad - verbs, singular, camelCase
GET /getUsers
GET /user
GET /getUserPosts
GET /blogPosts
HTTP Methods
| Method | Usage | Idempotent | Request Body | Response |
|---|---|---|---|---|
| GET | Read resource(s) | Yes | No | Resource(s) |
| POST | Create resource | No | Yes | Created resource |
| PUT | Replace resource | Yes | Yes | Updated resource |
| PATCH | Partial update | No* | Yes | Updated resource |
| DELETE | Remove resource | Yes | No | Empty or confirmation |
Status Codes
# Success
200 OK - Successful GET, PUT, PATCH
201 Created - Successful POST
204 No Content - Successful DELETE
# Client Errors
400 Bad Request - Invalid request body/params
401 Unauthorized - Missing/invalid authentication
403 Forbidden - Valid auth, insufficient permissions
404 Not Found - Resource doesn't exist
409 Conflict - Resource state conflict (duplicate)
422 Unprocessable - Validation errors
# Server Errors
500 Internal Error - Unexpected server error
502 Bad Gateway - Upstream service error
503 Service Unavailable - Temporary overload
Success Response
{
"success": true,
"data": {
"id": 123,
"email": "user@example.com",
"name": "John Doe"
}
}
List Response with Pagination
{
"success": true,
"data": [
{ "id": 1, "name": "Item 1" },
{ "id": 2, "name": "Item 2" }
],
"meta": {
"page": 1,
"limit": 20,
"total": 100,
"totalPages": 5,
"hasMore": true
}
}
Error Response
{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "Validation failed",
"details": [
{
"field": "email",
"message": "Invalid email format"
},
{
"field": "password",
"message": "Password must be at least 8 characters"
}
]
}
}
Offset-Based (Simple)
GET /users?page=2&limit=20
Response:
{
"data": [...],
"meta": {
"page": 2,
"limit": 20,
"total": 150,
"totalPages": 8
}
}
Cursor-Based (Scalable)
GET /users?cursor=abc123&limit=20
Response:
{
"data": [...],
"meta": {
"limit": 20,
"nextCursor": "def456",
"hasMore": true
}
}
Query Parameters
# Filtering
GET /users?status=active
GET /users?role=admin&status=active
GET /products?price_min=10&price_max=100
GET /posts?created_after=2024-01-01
# Sorting
GET /users?sort=name # Ascending
GET /users?sort=-createdAt # Descending
GET /users?sort=name,-createdAt # Multiple
# Field Selection
GET /users?fields=id,name,email
# Search
GET /users?search=john
GET /products?q=laptop
URI Versioning (Recommended)
GET /api/v1/users
GET /api/v2/users
Header Versioning
GET /api/users
Accept: application/vnd.api+json;version=1
Query Parameter
GET /api/users?version=1
JWT Bearer Token
Authorization: Bearer eyJhbGciOiJIUzI1NiIs...
API Key
# Header
X-API-Key: your-api-key
# Query (less secure)
GET /api/users?api_key=your-api-key
OAuth 2.0 Flows
# Authorization Code (Web apps)
# Client Credentials (Server-to-server)
# PKCE (Mobile/SPA)
Headers
X-RateLimit-Limit: 100
X-RateLimit-Remaining: 95
X-RateLimit-Reset: 1704067200
Retry-After: 60
429 Response
{
"success": false,
"error": {
"code": "RATE_LIMIT_EXCEEDED",
"message": "Too many requests",
"retryAfter": 60
}
}
openapi: 3.0.3
info:
title: My API
version: 1.0.0
description: API for managing users
servers:
- url: https://api.example.com/v1
description: Production
paths:
/users:
get:
summary: List users
tags:
- Users
parameters:
- name: page
in: query
schema:
type: integer
default: 1
- name: limit
in: query
schema:
type: integer
default: 20
maximum: 100
responses:
'200':
description: Success
[]
Schema Design
type Query {
user(id: ID!): User
users(
page: Int = 1
limit: Int = 20
filter: UserFilter
): UserConnection!
}
type Mutation {
createUser(input: CreateUserInput!): UserPayload!
updateUser(id: ID!, input: UpdateUserInput!): UserPayload!
deleteUser(id: ID!): DeletePayload!
}
type User {
id: ID!
String
String
posts Int Post
DateTime
CreateUserInput
String
String
String
UpdateUserInput
String
String
UserFilter
UserStatus
UserRole
String
UserConnection
UserEdge
PageInfo
Int
UserEdge
User
String
PageInfo
Boolean
Boolean
String
String
UserPayload
User
Error
DeletePayload
Boolean
Error
Error
String
String
Resolver Patterns
const resolvers = {
Query: {
user: async (_, { id }, context) => {
return context.dataSources.users.findById(id)
},
users: async (_, { page, limit, filter }, context) => {
return context.dataSources.users.findAll({ page, limit, filter })
},
},
Mutation: {
createUser: async (_, { input }, context) => {
try {
const user = await context.dataSources.users.create(input)
return { user, errors: [] }
} catch (error) {
return { user: null, errors: [{ message: error.message }] }
}
},
},
User: {
posts: async (user, { first }, context) => {
return context.dataSources.posts.findByUserId(user.id, { first })
},
},
}
Error Codes
enum ErrorCode {
// Authentication
INVALID_TOKEN = 'INVALID_TOKEN',
TOKEN_EXPIRED = 'TOKEN_EXPIRED',
UNAUTHORIZED = 'UNAUTHORIZED',
// Authorization
FORBIDDEN = 'FORBIDDEN',
INSUFFICIENT_PERMISSIONS = 'INSUFFICIENT_PERMISSIONS',
// Validation
VALIDATION_ERROR = 'VALIDATION_ERROR',
INVALID_INPUT = 'INVALID_INPUT',
// Resource
NOT_FOUND = 'NOT_FOUND',
ALREADY_EXISTS = 'ALREADY_EXISTS',
CONFLICT = 'CONFLICT',
// Rate Limiting
RATE_LIMIT_EXCEEDED = 'RATE_LIMIT_EXCEEDED',
// Server
INTERNAL_ERROR = 'INTERNAL_ERROR',
SERVICE_UNAVAILABLE = 'SERVICE_UNAVAILABLE',
}
{
"success": true,
"data": {
"id": 123,
"name": "John Doe",
"email": "john@example.com"
},
"links": {
"self": "/api/v1/users/123",
"posts": "/api/v1/users/123/posts",
"update": "/api/v1/users/123",
"delete": "/api/v1/users/123"
}
}
# Cache for 1 hour
Cache-Control: max-age=3600, public
# No cache
Cache-Control: no-store, no-cache, must-revalidate
# ETag for conditional requests
ETag: "abc123"
If-None-Match: "abc123"
# Last-Modified
Last-Modified: Wed, 21 Oct 2024 07:28:00 GMT
If-Modified-Since: Wed, 21 Oct 2024 07:28:00 GMT
Good Documentation Includes:
Part of SuperAI GitHub - Centralized OpenCode Configuration