api-doc-writer
Skill1 starsChanged 4 months agoMITView on GitHub
Use when writing or revising product-facing API interface documentation, especially for backend REST APIs that need a concise Chinese contract document with business rules, common API conventions, per-endpoint request/response details, combined request examples, and error code explanations. Trigger when the user asks for 接口文档, API 文档, 接口说明, Feishu/Lark API docs, or to rewrite implementation-heavy notes into a pure API contract.
In this repository14 other files it gives its agents.
- autonomous-multi-agent-developmentSkill
- design-doc-to-ui-feishu-docSkill
- design-doc-to-ui-figma-replicaSkill
- design-doc-to-ui-negative-caseSkill
- design-doc-to-uiSkill
- design-doc-to-ui-visual-auditSkill
- enforce-engineering-disciplineSkill
- feishu-block-surgerySkill
- frontend-design-codexSkill
- goal-prompt-builderSkill
- photo-review-workflowSkill
- smart-searchSkill
- subagent-model-routerSkill
- svg-board-generatorSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
23 rules. About 0 are common, 19 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈19
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 10
Use this skill when the task is to produce or revise an API interface document for product, frontend, QA, or integration readers.
- Distinctive: line 17
Do not use this for implementation plans, backend design docs, code review reports, or internal debugging writeups.
- Distinctive: line 21
Always use this top-level order:
- Very specific: line 34
If code is available, verify field names and response shape from DTO/controller/tests, not from guesses.
- Distinctive: line 38
Start with a one-paragraph purpose statement.
- Distinctive: line 39
Add "业务规则" as a table.
- Distinctive: line 44
Keep environment-specific values clearly marked as examples or default test values.
- Distinctive: line 56
If the API falls back and still returns success, describe that behavior in business rules instead of inventing an error code.
- Distinctive: line 59
Remove implementation file paths, class names, service names, Feign/client names, database table plans, test commands, build output, and …
- Distinctive: line 60
Verify examples contain only fields that the API actually returns.
- Distinctive: line 61
Check that no internal-only field, duplicated semantic field, placeholder token, private URL, account, or credential appears in the final …
- Distinctive: line 66
Do not include backend file paths, modified file lists, compile commands, unit test commands, deployment notes, or internal call chains in …
- Distinctive: line 67
Do not expose internal-only fields.
- Very specific: line 68
Do not duplicate field semantics.
- Very specific: line 69
Do not say "temporarily fixed", "not fully launched", or "not yet counted" when the client contract is a display rule.
- Distinctive: line 70
Do not split examples into separate "成功用例", "失败用例", and "Curl 请求命令" sections.
- Distinctive: line 71
Do not invent request/response fields, status codes, or error codes.
- Very specific: line 72
Do not include real access tokens, cookies, private account IDs, customer data, or private URLs.
- Distinctive: line 76
When returning the document in chat or Markdown, output exactly these sections:
- Distinctive: line 111
When publishing to Feishu/Lark:
- Distinctive: line 113
Use tables for rules, parameters, response fields, and error codes.
- Distinctive: line 114
Use code blocks for curl and JSON examples.
- Distinctive: line 115
After update, fetch or search the remote document to confirm obsolete headings and removed fields are not still present.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
API Doc Writer
Trigger Conditions
Use this skill when the task is to produce or revise an API interface document for product, frontend, QA, or integration readers.
Typical inputs:
- Existing backend code, controller/service implementation, OpenAPI notes, PRD, design notes, or a finished endpoint.
- A request to write a Feishu/Lark document, Markdown API document, or interface specification.
- Feedback that the current document contains too much backend implementation detail or that examples/fields need to be simplified.
Do not use this for implementation plans, backend design docs, code review reports, or internal debugging writeups.
Required Document Structure
Always use this top-level order:
- 功能说明
- 接口通用说明
- 单个接口说明
- 错误码说明
For multiple endpoints, repeat endpoint subsections under "3. 单个接口说明"; do not create a separate top-level section per endpoint.
Workflow
- Collect the public contract.
- Identify endpoint name, method, public path, base URL or environment URL, auth requirement, request headers, query/body parameters, response wrapper, data fields, and error codes.
- If code is available, verify field names and response shape from DTO/controller/tests, not from guesses.
- Separate public behavior from backend implementation details.
- Write "1. 功能说明".
- Start with a one-paragraph purpose statement.
- Add "业务规则" as a table.
- Include only rules that affect client behavior, display, validation, permission, limits, fallback, or user-visible semantics.
- Write "2. 接口通用说明".
- Include protocol, default base URL if known, request/response format, authentication method, response wrapper, unit conventions, pagination conventions, and common headers.
- Keep environment-specific values clearly marked as examples or default test values.
- Write "3. 单个接口说明".
- For each endpoint include:
- Basic info table: interface name, method, path, full example URL, login requirement.
- Request parameters split by Header, Query, Path, and Body. Write "无" for absent parameter groups.
- Response field table for
datafields, with type and client-facing meaning. - A single "请求示例" subsection that combines curl command and scenario responses.
- For each endpoint include:
- Write "4. 错误码说明".
- Provide a table with code, meaning, trigger scenario, and client handling suggestion.
- Include auth errors, validation errors, permission errors, and service errors only when they can occur for this API.
- If the API falls back and still returns success, describe that behavior in business rules instead of inventing an error code.
- Final pass.
- Remove implementation file paths, class names, service names, Feign/client names, database table plans, test commands, build output, and backend verification notes unless the user explicitly asks for an engineering appendix.
- Verify examples contain only fields that the API actually returns.
- Check that no internal-only field, duplicated semantic field, placeholder token, private URL, account, or credential appears in the final document.
Hard Rules
- The document is an API contract, not an implementation report.
- Do not include backend file paths, modified file lists, compile commands, unit test commands, deployment notes, or internal call chains in the default output.
- Do not expose internal-only fields. If a field only explains how the server made a decision and the client does not need it, omit it.
- Do not duplicate field semantics. If
limitBytesalready communicates the effective quota, do not also expose fields likemember,limitType, oractionunless the real API returns them and the client has a use for them. - Do not say "temporarily fixed", "not fully launched", or "not yet counted" when the client contract is a display rule. Prefer client-facing wording such as "when this field is
-1, the client should not display the detailed value". - Do not split examples into separate "成功用例", "失败用例", and "Curl 请求命令" sections. Merge them under one "请求示例" subsection.
- Do not invent request/response fields, status codes, or error codes. Mark unknowns as "待确认" only if they cannot be discovered.
- Do not include real access tokens, cookies, private account IDs, customer data, or private URLs. Use placeholders such as
{access_token},{domain}, and{id}.
Output Contract
When returning the document in chat or Markdown, output exactly these sections:
# <接口文档标题>
## 1. 功能说明
### 1.1 业务规则
## 2. 接口通用说明
### 2.1 通用响应结构
## 3. 单个接口说明
### 3.1 <接口名称>
#### 3.1.1 基本信息
#### 3.1.2 请求参数
#### 3.1.3 响应字段
#### 3.1.4 请求示例
## 4. 错误码说明The "请求示例" subsection must include:
- one curl command;
- at least one success response;
- relevant failure responses such as unauthenticated, missing/invalid parameter, permission denied, or service exception when applicable.
Feishu/Lark Notes
When publishing to Feishu/Lark:
- Preserve the same four-section structure.
- Use tables for rules, parameters, response fields, and error codes.
- Use code blocks for curl and JSON examples.
- After update, fetch or search the remote document to confirm obsolete headings and removed fields are not still present.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

