agentleFS
KilimiaoSixKilimiaoSix/agent-skills/skills/api-doc-writer/SKILL.md

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.

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
  1. Distinctive:

    Use this skill when the task is to produce or revise an API interface document for product, frontend, QA, or integration readers.

    line 10
  2. Distinctive:

    Do not use this for implementation plans, backend design docs, code review reports, or internal debugging writeups.

    line 17
  3. Distinctive:

    Always use this top-level order:

    line 21
  4. Very specific:

    If code is available, verify field names and response shape from DTO/controller/tests, not from guesses.

    line 34
  5. Distinctive:

    Start with a one-paragraph purpose statement.

    line 38
  6. Distinctive:

    Add "业务规则" as a table.

    line 39
  7. Distinctive:

    Keep environment-specific values clearly marked as examples or default test values.

    line 44
  8. Distinctive:

    If the API falls back and still returns success, describe that behavior in business rules instead of inventing an error code.

    line 56
  9. Distinctive:

    Remove implementation file paths, class names, service names, Feign/client names, database table plans, test commands, build output, and …

    line 59
  10. Distinctive:

    Verify examples contain only fields that the API actually returns.

    line 60
  11. Distinctive:

    Check that no internal-only field, duplicated semantic field, placeholder token, private URL, account, or credential appears in the final …

    line 61
  12. Distinctive:

    Do not include backend file paths, modified file lists, compile commands, unit test commands, deployment notes, or internal call chains in …

    line 66
  13. Distinctive:

    Do not expose internal-only fields.

    line 67
  14. Very specific:

    Do not duplicate field semantics.

    line 68
  15. Very specific:

    Do not say "temporarily fixed", "not fully launched", or "not yet counted" when the client contract is a display rule.

    line 69
  16. Distinctive:

    Do not split examples into separate "成功用例", "失败用例", and "Curl 请求命令" sections.

    line 70
  17. Distinctive:

    Do not invent request/response fields, status codes, or error codes.

    line 71
  18. Very specific:

    Do not include real access tokens, cookies, private account IDs, customer data, or private URLs.

    line 72
  19. Distinctive:

    When returning the document in chat or Markdown, output exactly these sections:

    line 76
  20. Distinctive:

    When publishing to Feishu/Lark:

    line 111
  21. Distinctive:

    Use tables for rules, parameters, response fields, and error codes.

    line 113
  22. Distinctive:

    Use code blocks for curl and JSON examples.

    line 114
  23. Distinctive:

    After update, fetch or search the remote document to confirm obsolete headings and removed fields are not still present.

    line 115

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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:

  1. 功能说明
  2. 接口通用说明
  3. 单个接口说明
  4. 错误码说明

For multiple endpoints, repeat endpoint subsections under "3. 单个接口说明"; do not create a separate top-level section per endpoint.

Workflow

  1. 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.
  2. 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.
  3. 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.
  4. 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 data fields, with type and client-facing meaning.
      • A single "请求示例" subsection that combines curl command and scenario responses.
  5. 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.
  6. 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 limitBytes already communicates the effective quota, do not also expose fields like member, limitType, or action unless 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.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.