用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/leroyguillaume/claude --skill api-conventions命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
基于 SOC 职业分类
正在显示 SKILL.md
| name | api-conventions |
| description | HTTP/RPC API conventions (dedicated DTOs, no domain models on the |
Applies to every HTTP/RPC surface, in any language or framework. The language skills restate the mechanics (which validation crate, which serde attribute) where they need to be concrete.
CreateXRequest / UpdateXRequest for inputs and XResponse for outputs
(using the language's idiomatic casing). One DTO per request and per
response; do not reuse a domain type "because the fields happen to match",
and do not share one DTO across create and update.validator crate in Rust, Pydantic
in Python) and convert explicitly between DTOs and domain models
(From/Into, a mapper, etc.). A handler's job is exactly: deserialise the
request DTO → validate → map to a domain model → call the domain/repository
layer → map the result into a response DTO.Serialize/Deserialize on entities) so binding one to the wire
fails to compile.camelCase, regardless of the language's
native casing. Apply it at the serialisation layer, not by renaming each
field: in Rust put #[serde(rename_all = "camelCase")] on every
request/response DTO (schemars honours it, so the OpenAPI schema matches
the wire). Path and query parameters keep the exact name of their URL
placeholder (do not camelCase a {job_id} segment).<entity>_id (→ <entity>Id
on the wire): creator_id, game_id — never a mix like created_by
alongside game_id. The referenced entity's own identifier stays id.
Pick the suffix convention once and apply it to every reference field.tag / the framework's equivalent)
and declare the tags up front with a description and a deliberate order
(e.g. Authentication, then the main resources). No operation ships
untagged.sqlx's .fetch()),
applying the page size as it goes. Pagination of the wire contract is
non-negotiable regardless of which the data layer uses. Use offset/limit
pagination on the wire:
page (1-based) and perPage (camelCase on the
wire). The boundary maps them to limit = perPage,
offset = (page - 1) * perPage for the data layer.perPage (e.g. default 50,
max 100): clamp/validate at the DTO layer so a client can never request an
unbounded page. Missing params fall back to the defaults.{ "items": [...], "page": 1, "perPage": 50, "total": 1234 } (total
being the unfiltered row count) so clients can compute the page count.