用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/RunnerQuan/SAFE-Agent --skill api-design命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
Find doctors with Healthgrades - search providers, read reviews, and check credentials
Presentation creation, editing, and analysis. When Claude needs to work with presentations (.pptx files) for: (1) Creating new presentations, (2) Modifying or editing content, (3) Working with layouts, (4) Adding comments or speaker notes, or any other presentation tasks.
基于RFM模型和回归算法的客户生命周期价值(LTV)预测分析工具,支持电商和零售业务的客户价值预测。使用时需要客户交易数据、订单历史或消费记录,自动进行RFM特征工程、回归建模和价值预测。
基于 SOC 职业分类
正在显示 SKILL.md
| name | api-design |
| description | Design resource-oriented APIs following patterns from "API Design Patterns" by JJ Geewax (Google) |
This skill helps you design consistent, scalable, and flexible APIs following the patterns from "API Design Patterns" by JJ Geewax and Google's API Improvement Proposals (AIP).
Resource-Oriented Design: APIs are built around resources (nouns), not actions (verbs). A small set of standard methods operate on these resources.
"The fundamental building blocks of an API are individually-named resources and the relationships and hierarchy that exist between them."
Resources (Nouns)
/users, /orders, /products/users/{id}/profile/user-accounts not /userAccountsFields
snake_case for JSON field names: created_at, user_idemail_address not just emailconfiguration not configMethods
POST /orders/{id}:cancelHierarchy Rules
Example Structure
/projects/{project_id}
/projects/{project_id}/databases/{database_id}
/projects/{project_id}/databases/{database_id}/tables/{table_id}
Resource Names
projects/my-project/databases/main/tables/usersdatabases/main/tables/usersStandard Field Types
| Type | Format | Example |
|---|---|---|
| Timestamps | RFC 3339 | 2024-01-15T10:30:00Z |
| Durations | Seconds with 's' suffix | 3600s |
| Money | Object with currency | {"amount": "10.00", "currency": "USD"} |
| Bytes | Base64 encoded | SGVsbG8gV29ybGQ= |
Default Values
false0""[]null as a meaningful defaultResource IDs
{
"name": "projects/my-project/users/abc123",
"id": "abc123",
"display_name": "John Doe"
}
| Method | HTTP | Request Body | Response | Idempotent |
|---|---|---|---|---|
| List | GET | None | Collection | Yes |
| Get | GET | None | Resource | Yes |
| Create | POST | Resource | Resource | No* |
| Update | PUT/PATCH | Resource | Resource | Yes |
| Delete | DELETE | None | Empty | Yes |
*Create can be idempotent with client-provided IDs
List Method
GET /users?page_size=25&page_token=xyz
Response:
{
"users": [...],
"next_page_token": "abc"
}
Get Method
GET /users/123
Create Method
POST /users
Content-Type: application/json
{
"display_name": "Jane Doe",
"email": "jane@example.com"
}
Update Method (Full)
PUT /users/123
Content-Type: application/json
{
"display_name": "Jane Smith",
"email": "jane.smith@example.com"
}
Delete Method
DELETE /users/123
Partial Update (PATCH) Use field masks to specify which fields to update:
PATCH /users/123?update_mask=display_name,email
Content-Type: application/json
{
"display_name": "New Name",
"email": "new@example.com"
}
Partial Retrieval Use field masks to limit response fields:
GET /users/123?read_mask=display_name,email
For operations that don't map to standard CRUD:
POST /orders/123:cancel
POST /documents/456:publish
POST /emails/789:send
POST /users/123:deactivate
Custom Method Rules
For operations that take significant time:
Initial Request
POST /databases/123:backup
Response (Operation)
{
"name": "operations/backup-xyz",
"done": false,
"metadata": {
"@type": "type.googleapis.com/BackupMetadata",
"progress_percent": 0
}
}
Poll for Status
GET /operations/backup-xyz
Completed Response
{
"name": "operations/backup-xyz",
"done": true,
"response": {
"@type": "type.googleapis.com/Backup",
"name": "backups/backup-123"
}
}
For repeated scheduled operations:
{
"name": "jobs/nightly-backup",
"schedule": "0 0 * * *",
"job_config": {
"backup_type": "FULL"
},
"last_run": {...},
"next_run_time": "2024-01-16T00:00:00Z"
}
Execute immediately
POST /jobs/nightly-backup:run
For resources that exist exactly once per parent:
/users/123/profile (not /users/123/profiles)
/users/123/settings
/projects/456/config
Reference resources by their full name:
{
"name": "orders/123",
"customer": "users/456",
"items": [
{"product": "products/789", "quantity": 2}
]
}
For many-to-many relationships with metadata:
/groups/123/memberships/456
{
"name": "groups/123/memberships/456",
"user": "users/789",
"role": "ADMIN",
"joined_at": "2024-01-01T00:00:00Z"
}
For simple many-to-many without metadata:
POST /groups/123:addMember
{
"user": "users/789"
}
POST /groups/123:removeMember
{
"user": "users/789"
}
Handle dynamic types with discriminators:
{
"name": "notifications/123",
"type": "EMAIL",
"email_config": {
"recipient": "user@example.com",
"subject": "Hello"
}
}
Or using @type field:
{
"@type": "type.googleapis.com/EmailNotification",
"recipient": "user@example.com"
}
POST /files/123:copy
{
"destination_parent": "folders/456"
}
POST /files/123:move
{
"destination_parent": "folders/789"
}
Batch Get
GET /users:batchGet?ids=123,456,789
Batch Create/Update/Delete
POST /users:batchCreate
{
"requests": [
{"user": {"display_name": "User 1"}},
{"user": {"display_name": "User 2"}}
]
}
Atomicity: Batch operations should be atomic (all succeed or all fail).
Delete multiple resources matching criteria:
POST /logs:purge
{
"filter": "timestamp < '2023-01-01'"
}
Returns a long-running operation for tracking.
For high-volume data ingestion without addressing:
POST /metrics:write
{
"entries": [
{"name": "cpu_usage", "value": 0.75},
{"name": "memory_usage", "value": 0.60}
]
}
Request
GET /users?page_size=25&page_token=eyJvZmZzZXQiOjI1fQ
Response
{
"users": [...],
"next_page_token": "eyJvZmZzZXQiOjUwfQ",
"total_size": 150
}
Rules
total_size when feasibleGET /users?filter=status="ACTIVE" AND created_at>"2024-01-01"
Filter Syntax
=, !=, <, >, <=, >=AND, OR, NOThas(), contains()* for partial matchingExport
POST /databases/123:export
{
"destination": "gs://bucket/exports/",
"format": "CSV"
}
Import
POST /databases/123:import
{
"source": "gs://bucket/data.csv",
"format": "CSV"
}
Both return long-running operations.
URL Versioning
/v1/users
/v2/users
Header Versioning
GET /users
API-Version: 2024-01-01
Compatibility Rules
{
"name": "users/123",
"display_name": "John Doe",
"delete_time": "2024-01-15T10:00:00Z",
"expire_time": "2024-02-15T10:00:00Z"
}
Restore
POST /users/123:undelete
Use client-provided request IDs:
POST /orders
X-Request-Id: unique-request-123
Content-Type: application/json
{...}
Server stores request ID and returns cached response on retry.
Dry-run mode for validation without execution:
POST /users?validate_only=true
{
"display_name": "Test User"
}
Returns validation errors without creating the resource.
Track change history:
GET /documents/123/revisions
GET /documents/123@revision=5
{
"name": "documents/123",
"revision_id": "5",
"revision_create_time": "2024-01-15T10:00:00Z",
"content": "..."
}
Idempotency Keys
POST /payments
Idempotency-Key: payment-abc-123
Retry Strategies
API Keys
GET /users
X-API-Key: your-api-key
Bearer Tokens (OAuth 2.0)
GET /users
Authorization: Bearer eyJhbGciOiJSUzI1NiIs...
Request Signing For sensitive operations, sign requests with timestamps to prevent replay attacks.
| Code | Meaning | When to Use |
|---|---|---|
| 200 | OK | Successful GET, PUT, PATCH |
| 201 | Created | Successful POST creating resource |
| 204 | No Content | Successful DELETE |
| 400 | Bad Request | Invalid request syntax |
| 401 | Unauthorized | Missing/invalid authentication |
| 403 | Forbidden | Valid auth but no permission |
| 404 | Not Found | Resource doesn't exist |
| 409 | Conflict | Resource state conflict |
| 429 | Too Many Requests | Rate limit exceeded |
| 500 | Internal Error | Server-side failure |
| 503 | Service Unavailable | Temporary overload |
{
"error": {
"code": 400,
"status": "INVALID_ARGUMENT",
"message": "Display name is required",
"details": [
{
"@type": "type.googleapis.com/FieldViolation",
"field": "display_name",
"description": "Field is required"
}
]
}
}
:verb syntaxDesign a new API
/api-design
Help me design an API for a task management system with users, projects, and tasks.
Review existing API
/api-design
Review this API endpoint design and suggest improvements following best practices.
Add a feature to existing API
/api-design
How should I add soft deletion to my existing users API?