参考文档
reference-docs
by anderskev
Reference documentation patterns for API and symbol documentation. Use when writing reference docs, API docs, parameter tables, or technical specifications. Triggers on reference docs, API reference, function reference, parameters table, symbol documentation.
安装
claude skill add --url https://github.com/openclaw/skills文档
Reference Documentation Patterns
Reference documentation is information-oriented - helping experienced users find precise technical details quickly. This skill provides patterns for writing clear, scannable reference pages.
Dependency: Always use this skill in conjunction with docs-style for core writing principles.
Purpose and Audience
- Who: Experienced users seeking specific information
- Goal: Quick lookup of technical details
- Mode: Not for learning, for looking up
- Expectation: Brevity, consistency, completeness
Document Structure Template
Use this template when creating reference documentation:
---
title: "[Symbol/API Name]"
description: "One-line description of what it does"
---
# [Name]
Brief description (1-2 sentences). State what it is and its primary purpose.
## Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `param1` | `string` | Yes | What this parameter controls |
| `param2` | `number` | No | Optional behavior modification. Default: `10` |
## Returns
| Type | Description |
|------|-------------|
| `ReturnType` | What the function returns and when |
## Example
```language
import { symbolName } from 'package';
// Complete, runnable example showing common use case
const result = symbolName({
param1: 'realistic-value',
param2: 42
});
console.log(result);
// Expected output: { ... }
Related
- RelatedSymbol - Brief description
- AnotherSymbol - Brief description
## Writing Principles
### Brevity Over Explanation
- State facts, not rationale
- Avoid "why" - save that for Explanation docs
- Cut unnecessary words
**Do:**
```markdown
Returns the user's display name.
Avoid:
This function is useful when you need to get the user's display name
because it handles all the edge cases for you automatically.
Scannable Tables, Not Prose
Do:
| Name | Type | Description |
|------|------|-------------|
| `userId` | `string` | Unique user identifier |
| `options` | `Options` | Configuration object |
Avoid:
The first parameter is `userId`, which should be a string containing
the unique user identifier. The second parameter is `options`, which
is an Options object containing the configuration.
Consistent Format Across Entries
All reference pages for similar items should follow identical structure:
- Same heading order
- Same table columns
- Same code example format
- Same related links section
Every Example Must Be Runnable
- Include all imports
- Show complete, working code
- Use realistic values (not "foo", "bar", "test123")
- Include expected output when helpful
Code Example Patterns
Show Common Use Case First
## Example
### Basic Usage
```typescript
const user = await getUser('user-123');
console.log(user.name);
With Options
const user = await getUser('user-123', {
includeMetadata: true,
fields: ['name', 'email', 'role']
});
### Include Setup and Context
```markdown
```typescript
import { Client } from '@example/sdk';
// Initialize client (required once per application)
const client = new Client({ apiKey: process.env.API_KEY });
// Now use the function
const result = await client.users.list();
### Use Realistic Values
**Do:** `userId: 'usr_a1b2c3d4'`
**Avoid:** `userId: 'foo'`
**Do:** `email: 'jane.smith@company.com'`
**Avoid:** `email: 'test@test.com'`
## Parameter Documentation Patterns
### Required vs Optional
Clearly indicate which parameters are required:
```markdown
| Name | Type | Required | Default | Description |
|------|------|----------|---------|-------------|
| `apiKey` | `string` | Yes | - | Your API key |
| `timeout` | `number` | No | `30000` | Request timeout in ms |
| `retries` | `number` | No | `3` | Number of retry attempts |
Complex Types
For object parameters, document the shape:
## Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `options` | `UserOptions` | No | Configuration options |
### UserOptions
| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `includeDeleted` | `boolean` | No | Include soft-deleted users |
| `fields` | `string[]` | No | Fields to return |
| `limit` | `number` | No | Maximum results (default: 100) |
Enum Values
Document allowed values clearly:
| Name | Type | Values | Description |
|------|------|--------|-------------|
| `status` | `string` | `active`, `pending`, `suspended` | User account status |
Return Value Documentation
Simple Returns
## Returns
`User` - The requested user object, or `null` if not found.
Complex Returns
## Returns
| Property | Type | Description |
|----------|------|-------------|
| `data` | `User[]` | Array of user objects |
| `pagination` | `Pagination` | Pagination metadata |
| `total` | `number` | Total matching records |
Error Conditions
## Errors
| Error | Condition |
|-------|-----------|
| `NotFoundError` | User does not exist |
| `UnauthorizedError` | Invalid or expired API key |
| `RateLimitError` | Too many requests |
API Reference Specifics
HTTP Endpoints
## Endpoint
```http
GET /api/v1/users/{userId}
Path Parameters
| Name | Type | Description |
|---|---|---|
userId | string | The user's unique identifier |
Query Parameters
| Name | Type | Required | Description |
|---|---|---|---|
fields | string | No | Comma-separated list of fields |
Headers
| Name | Required | Description |
|---|---|---|
Authorization | Yes | Bearer token |
X-Request-ID | No | Request tracking ID |
Response
{
"id": "usr_a1b2c3d4",
"name": "Jane Smith",
"email": "jane@company.com"
}
## Component/Props Reference
For UI components:
```markdown
## Props
| Prop | Type | Default | Description |
|------|------|---------|-------------|
| `variant` | `'primary' \| 'secondary'` | `'primary'` | Visual style |
| `size` | `'sm' \| 'md' \| 'lg'` | `'md'` | Button size |
| `disabled` | `boolean` | `false` | Disable interactions |
| `onClick` | `() => void` | - | Click handler |
## Slots
| Name | Description |
|------|-------------|
| `default` | Button content |
| `icon` | Icon to display before text |
Related Links Section
Always include links to related content:
## Related
- [createUser](/reference/create-user) - Create a new user
- [updateUser](/reference/update-user) - Modify user properties
- [deleteUser](/reference/delete-user) - Remove a user
- [User Authentication Guide](/guides/authentication) - How authentication works
Checklist for Reference Pages
Before considering a reference page complete:
- Title matches the symbol/API name exactly
- Description is one clear sentence
- All parameters documented with types
- Required vs optional clearly marked
- Default values specified for optional parameters
- Return type and structure documented
- At least one complete, runnable example
- Example uses realistic values
- Related pages linked
- Format matches other reference pages in the docs
相关 Skills
文档共著
by anthropics
围绕文档、提案、技术规格、决策记录等写作任务,按上下文收集、结构迭代、读者测试三步协作共创,减少信息遗漏,写出更清晰、经得起他人阅读的内容。
✎ 写文档、方案或技术规格时容易思路散、信息漏,它用结构化共著流程帮你高效传递上下文、反复打磨内容,还能从读者视角做验证。
内部沟通
by anthropics
按公司常用模板和语气快速起草内部沟通内容,覆盖 3P 更新、状态报告、领导汇报、项目进展、事故复盘、FAQ 与 newsletter,适合需要统一格式的团队沟通场景。
✎ 按公司偏好的模板快速产出状态汇报、领导更新和 FAQ,既省去反复改稿,也让内部沟通更统一、更专业。
平面设计
by anthropics
先生成视觉哲学,再落地成原创海报、艺术画面或其他静态设计,输出 .png/.pdf,强调构图、色彩与空间表达,适合需要高完成度视觉成品的场景。
✎ 做海报、插画或静态视觉稿时,用它能快速产出兼顾美感与版式的PNG/PDF成品,原创设计更省心,也更适合规避版权风险。
相关 MCP 服务
by nirholas
免费的加密新闻聚合 MCP,汇集 Bitcoin、Ethereum、DeFi、Solana 与 altcoins 资讯源。
by ProfessionalWiki
让 Large Language Model 客户端无缝连接任意 MediaWiki 站点,可创建、更新、搜索页面,并通过 OAuth 2.0 安全管理内容。
by roomi-fields
Automate Google NotebookLM — Q&A with citations, audio, video, content generation