360 Secure SkillHub
360 安全技能中心

Http Api

核心功能:规范HTTP/JSON API的资源建模、HTTP语义(幂等性、缓存)、统一机器可读错误格式,提供OpenAPI示例、分页/过滤模式等。典型场景:新接口设计、PR评审、团队对齐REST类规范。不涉及OAuth、GraphQL、长期版本兼容(需配合api-compat),可确保API易调用,错误场景可测试且一致,新手仅靠文档即可调用。

codenova58
codenova58
热度 56.58
最近更新 2026-05-11 17:37:27
分类:开发依赖:纯提示词应用场景:API 集成 / 代码审查

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add http-api
Metadata
name
http-api
description
Shape HTTP/JSON APIs—resources and verbs, error payloads, pagination, idempotency, and docs. Use when designing new endpoints, reviewing PRs, or aligning teams on REST-ish conventions (versioning lifecycle is a separate concern).

HTTP API

Design and review HTTP-facing APIs (usually JSON): predictable URLs, honest status codes, and errors clients can build on—without duplicating everything your api-compat skill covers for long-lived versioning policy.

Scope

  • Modeling: nouns/resources, collections, actions when RPC-style is clearer than fake REST.
  • HTTP semantics: which methods, idempotency, caching headers when relevant.
  • Errors: stable machine-readable codes, correlation ids, avoid leaking internals.
  • DX: examples, OpenAPI snippets, consistent pagination/filter patterns.

Out of scope (hand off)

  • OAuth/OIDC protocol details → identity-focused skills.
  • GraphQL-only schema design → graphql-schema skill.
  • Multi-year deprecation policy and client migration programs → pair with api-compat.

Review order

  1. Read paths — Can a client navigate the domain without guessing?
  2. Write safety — Retries safe? Duplicate submits handled?
  3. Errors — One shape everywhere; 4xx vs 5xx honest.
  4. Evolution — Document what may change vs what is stable (compat details in api-compat).

Smells

  • Status 200 with {error: ...}; every POST returns 200; unbounded list endpoints; secrets in error bodies.

Done when

  • A new engineer can call the API from docs alone; failure cases are testable and consistent.