hello-api

GitHub

提供 REST API 和 GraphQL 端点的构建、修改与审查规范,涵盖资源设计、HTTP 语义、请求验证、统一响应格式、版本管理及限流保护等最佳实践。

skills/hello-api/SKILL.md hellowind777/helloagents

Trigger Scenarios

需要设计或实现新的 API 接口 对现有 API 代码进行重构或审查

Install

npx skills add hellowind777/helloagents --skill hello-api -g -y
More Options

Use without installing

npx skills use hellowind777/helloagents@hello-api

指定 Agent (Claude Code)

npx skills add hellowind777/helloagents --skill hello-api -a claude-code -g -y

安装 repo 全部 skill

npx skills add hellowind777/helloagents --all -g -y

预览 repo 内 skill

npx skills add hellowind777/helloagents --list

SKILL.md

Frontmatter
{
    "name": "hello-api",
    "description": "构建、修改或审查 REST API、GraphQL 端点、webhook、中间件、请求\/响应处理、API 版本管理、限流或分页时使用。"
}

API 相关代码必须遵循以下规范。

编码前

先确定资源模型和端点契约,再写代码。

RESTful 设计

  • 资源命名:复数名词 /users,嵌套 /users/:id/posts
  • HTTP 方法语义:GET 读、POST 创建、PUT 全量更新、PATCH 部分更新、DELETE 删除
  • 状态码准确:200 成功、201 创建、204 无内容、400 参数错误、401 未认证、403 无权限、404 不存在、409 冲突、422 验证失败、500 服务端错误

请求验证

  • 入参验证在 controller 层,使用 schema 验证库(zod、joi、ajv)
  • 验证类型、范围、格式、必填
  • 文件上传限制大小和类型
  • 请求体大小限制

响应格式

  • 统一成功响应:{ data, meta? }
  • 统一错误响应:{ error: { code, message, details? } }
  • 列表接口必须分页:?page=1&limit=20 或 cursor-based
  • 支持排序:?sort=created_at&order=desc
  • 过滤参数白名单

版本与保护

  • API 版本化:URL 前缀 /v1/ 或 header
  • 限流保护:按 IP/用户/API key
  • 超时设置:所有外部调用设超时
  • CORS:明确允许的 origin,不用 *

交付检查

  • 状态码准确反映操作结果
  • 所有入参已验证
  • 列表接口有分页
  • 错误响应格式统一
  • 有限流保护

Version History

  • 79c0b48 Current 2026-08-20 08:25

Same Skill Collection

skills/commands/auto/SKILL.md
skills/commands/loop/SKILL.md
skills/hello-data/SKILL.md
skills/hello-errors/SKILL.md
skills/hello-perf/SKILL.md
skills/hello-security/SKILL.md
skills/hello-test/SKILL.md
skills/hello-ui/SKILL.md
skills/hello-write/SKILL.md
skills/_meta/SKILL.md
skills/commands/ask/SKILL.md
skills/commands/clean/SKILL.md
skills/commands/commit/SKILL.md
skills/commands/help/SKILL.md
skills/commands/init/SKILL.md
skills/commands/plan/SKILL.md
skills/commands/prd/SKILL.md
skills/commands/qa/SKILL.md
skills/commands/test/SKILL.md
skills/hello-arch/SKILL.md
skills/hello-debug/SKILL.md
skills/hello-reflect/SKILL.md
skills/hello-subagent/SKILL.md
skills/helloagents/SKILL.md
skills/qa-review/SKILL.md

Metadata

Files
0
Version
79c0b48
Hash
28fa6a10
Indexed
2026-08-20 08:25

- 위키
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-26 10:46
浙ICP备14020137号-1 $방문자$