Skip to main content

api-field-descriptions

Patterns for writing clear, consistent API field descriptions including types, constraints, examples, and edge cases.

来源信息

仓库
majiayu000/claude-skill-registry-data
最近来源活动
2026年4月20日 18:32
检测到的 SKILL.md 语言
英语
星标
22
分支
8

安装方式

默认使用会先检查来源的 Prompt;你也可以切换为直接命令,或下载本地副本。

检查来源文件

决定是否安装前,请先阅读 SKILL.md,以及 SkillsMP 当前展示的配套文件。

文件资源管理器
2 个文件

正在显示 SKILL.md

SKILL.md
来源说明 · 只读预览
name
api-field-descriptions
description
Patterns for writing clear, consistent API field descriptions including types, constraints, examples, and edge cases.
trigger
- Writing API field documentation - Documenting request/response schemas - Creating data model documentation
skip_when
- Writing conceptual docs → use writing-functional-docs - Full API endpoint docs → use writing-api-docs
related
{"complementary":["writing-api-docs"]}
# API Field Descriptions Field descriptions are the most-read part of API documentation. Users scan for specific fields and need clear, consistent information. ## Field Description Structure Every field description answers: **What is it?** (purpose), **What type?** (data type), **Required?** (mandatory), **Constraints?** (limits/validations), **Example?** (valid data) ## Table Format (Preferred) ```markdown | Field | Type | Required | Description | |-------|------|----------|-------------| | id | uuid | — | The unique identifier of the Account | | name | string | Yes | The display name of the Account (max 255 chars) | | status | enum | — | Account status: `ACTIVE`, `INACTIVE`, `BLOCKED` | ``` **Note:** Use `—` for response-only fields (not applicable for requests). For nested objects: `status.code`, `status.description` --- ## Description Patterns by Type | Type | Pattern | Example | |------|---------|---------| | UUID | "The unique identifier of the [Entity]" | `id: uuid — The unique identifier of the Account` | | String | "[Purpose] (constraints)" | `code: string — The asset code (max 10 chars, uppercase, e.g., "BRL")` | | String (format) | "[Purpose] (format example)" | `email: string — Email address (e.g., "user@example.com")` | | Enum | "[Purpose]: `val1`, `val2`, `val3`" | `type: enum — Asset type: \`currency\`, \`crypto\`, \`commodity\`` | | Boolean | "If `true`, [what happens]. Default: `[value]`" | `allowSending: boolean — If \`true\`, sending permitted. Default: \`true\`` | | Integer | "[Purpose] (range)" | `scale: integer — Decimal places (0-18)` | | Timestamp | "Timestamp of [event] (UTC)" | `createdAt: timestamptz — Timestamp of creation (UTC)` | | Object (jsonb) | "[Purpose] including [fields]" | `status: jsonb — Status information including code and description` | | Array | "List of [what it contains]" | `operations: array — List of operations in the transaction` | --- ## Required vs Optional **In Requests:** - `Yes` = Must be provided - `No` = Optional - `Conditional` = Required in specific scenarios (explain in description) **In Responses:** Use `—` (response fields are always returned or null) --- ## Special Field Documentation | Pattern | Format | |---------|--------| | Default values | "Results per page. Default: 10" | | Nullable fields | "Soft deletion timestamp, or `null` if not deleted" | | Deprecated fields | "**[Deprecated]** Use `route` instead" | | Read-only fields | "**Read-only.** Generated by the system" | | Relationships | "References an Asset code. Must exist in the Ledger" | --- ## Writing Good Descriptions | Don't | Do | |-------|-----| | "The name" | "The display name of the Account" | | "Status info" | "Account status: `ACTIVE`, `INACTIVE`, `BLOCKED`" | | "A number" | "Balance version, incremented with each transaction" | | "The code" | "The asset code (max 10 chars, uppercase)" | | "The timestamp" | "Timestamp of creation (UTC)" | --- ## Quality Checklist - [ ] Description explains the field's purpose - [ ] Data type is accurate - [ ] Required/optional status is clear - [ ] Constraints documented (max length, valid values) - [ ] Default value noted (if optional) - [ ] Nullable behavior explained (if applicable) - [ ] Deprecated fields marked - [ ] Read-only fields indicated - [ ] Relationships to other entities clear - [ ] Example values realistic
在 GitHub 查看