documentation
13
总安装量
5
周安装量
#24361
全站排名
安装命令
npx skills add https://github.com/srstomp/pokayokay --skill documentation
Agent 安装分布
claude-code
3
trae
2
antigravity
2
windsurf
2
codex
2
Skill 文档
Documentation
Create clear, maintainable technical documentation.
Documentation Types
âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
â DOCUMENTATION LANDSCAPE â
âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ¤
â â
â README API DOCS ARCHITECTURE â
â âââââââââââââââ âââââââââââââââ âââââââââââââââ â
â â First â â Endpoint â â ADRs â â
â â impression â â reference â â System â â
â â Quick start â â Examples â â design â â
â âââââââââââââââ âââââââââââââââ âââââââââââââââ â
â â
â USER GUIDES CODE DOCS DIAGRAMS â
â âââââââââââââââ âââââââââââââââ âââââââââââââââ â
â â How-to â â JSDoc â â Mermaid â â
â â Tutorials â â Inline â â Architectureâ â
â â Workflows â â comments â â Flows â â
â âââââââââââââââ âââââââââââââââ âââââââââââââââ â
â â
âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
Selection Guide
| Type | When to Use | Audience |
|---|---|---|
| README | Project entry point | All users |
| API Docs | Endpoint reference | Developers |
| ADR | Major decisions | Team/future devs |
| User Guide | Task completion | End users |
| Code Docs | Implementation | Contributors |
Core Principles
1. Documentation as Code
Docs live with code, version with code, review with code.
â
Docs in repo alongside source
â
Markdown for portability
â
Generated docs from source (OpenAPI, JSDoc)
â
CI checks for doc freshness
2. Audience-First Writing
Write for who’s reading, not what you know.
â
README: "I just found this repo"
â
API Docs: "How do I call this endpoint?"
â
ADR: "Why was this decision made?"
â
Guide: "How do I accomplish X?"
3. Maintainability Over Completeness
Less accurate docs are worse than no docs.
â
Link to source of truth
â
Automate what changes often
â
Date and version sensitive content
â Duplicate information across docs
README Essentials
A good README answers in order:
- What â What is this? (1-2 sentences)
- Why â Why should I care? (value proposition)
- How â How do I use it? (quick start)
- More â Where do I learn more? (links)
Minimal README Structure
# Project Name
One-line description of what this does.
## Quick Start
\`\`\`bash
npm install project-name
\`\`\`
\`\`\`javascript
import { thing } from 'project-name';
thing.doSomething();
\`\`\`
## Documentation
- [Full API Reference](./docs/api.md)
- [Contributing Guide](./CONTRIBUTING.md)
## License
MIT
README Anti-Patterns
â No description at all
â Wall of badges before content
â Jumping to API docs before quick start
â Outdated installation instructions
â Screenshots that don't match current UI
API Documentation Pattern
Structure per Endpoint
## Create User
Creates a new user account.
\`\`\`http
POST /api/v1/users
\`\`\`
### Request
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| email | string | Yes | User email address |
| name | string | Yes | Display name |
| role | string | No | Default: "user" |
\`\`\`json
{
"email": "user@example.com",
"name": "Jane Doe"
}
\`\`\`
### Response
**201 Created**
\`\`\`json
{
"id": "usr_123",
"email": "user@example.com",
"name": "Jane Doe",
"createdAt": "2024-01-15T10:30:00Z"
}
\`\`\`
### Errors
| Code | Description |
|------|-------------|
| 400 | Invalid email format |
| 409 | Email already exists |
OpenAPI Integration
When OpenAPI spec exists, generate docs from it:
# Generate markdown from OpenAPI
npx @redocly/cli build-docs openapi.yaml -o docs/api.html
# Or use inline references
See [OpenAPI spec](./openapi.yaml) for complete API reference.
Architecture Decision Records (ADRs)
When to Write an ADR
Write an ADR when:
- Choosing between significant alternatives
- Making decisions hard to reverse
- Establishing patterns the team should follow
- Future developers will ask “why?”
ADR Format
# ADR-001: Use PostgreSQL for Primary Database
## Status
Accepted | Proposed | Deprecated | Superseded by ADR-XXX
## Context
What is the issue? What forces are at play?
## Decision
What is the change being proposed/adopted?
## Consequences
What are the positive/negative outcomes?
ADR Numbering
docs/adr/
âââ 0001-use-postgresql.md
âââ 0002-adopt-typescript.md
âââ 0003-api-versioning-strategy.md
âââ README.md (index of decisions)
Diagrams with Mermaid
Flowchart
flowchart TD
A[Start] --> B{Is user logged in?}
B -->|Yes| C[Show dashboard]
B -->|No| D[Show login]
D --> E[Validate credentials]
E -->|Valid| C
E -->|Invalid| D
Sequence Diagram
sequenceDiagram
participant U as User
participant A as API
participant D as Database
U->>A: POST /login
A->>D: Verify credentials
D-->>A: User data
A-->>U: JWT token
Entity Relationship
erDiagram
USER ||--o{ ORDER : places
ORDER ||--|{ LINE_ITEM : contains
PRODUCT ||--o{ LINE_ITEM : "ordered in"
Documentation Workflow
1. New Feature Documentation
Feature PR should include:
âââ README updates (if user-facing)
âââ API docs (if new endpoints)
âââ ADR (if significant decision)
âââ Code comments (if complex logic)
2. Keeping Docs in Sync
# In PR template or CI
Documentation checklist:
- [ ] README updated if behavior changed
- [ ] API docs match implementation
- [ ] ADR written for architectural changes
- [ ] Examples tested and working
3. Documentation Review
Check for:
- Accuracy (does it match the code?)
- Completeness (all parameters documented?)
- Clarity (would a new dev understand?)
- Examples (do they work?)
Code Documentation
JSDoc Pattern
/**
* Creates a new user in the system.
*
* @param {Object} userData - User creation data
* @param {string} userData.email - Unique email address
* @param {string} userData.name - Display name
* @param {string} [userData.role='user'] - User role
* @returns {Promise<User>} Created user object
* @throws {ValidationError} If email format invalid
* @throws {ConflictError} If email already exists
*
* @example
* const user = await createUser({
* email: 'jane@example.com',
* name: 'Jane Doe'
* });
*/
async function createUser(userData) { ... }
When to Comment
// â
Explain WHY, not WHAT
// Rate limit is 100/min per Stripe docs, with buffer for retries
const RATE_LIMIT = 80;
// â
Explain non-obvious behavior
// Sort descending because UI shows newest first
items.sort((a, b) => b.date - a.date);
// â Don't state the obvious
// Increment counter by 1
counter++;
Checklist
README
- Clear one-line description
- Quick start works (tested)
- Installation instructions current
- Links to deeper docs
API Docs
- All endpoints documented
- Request/response examples
- Error codes explained
- Authentication documented
ADRs
- Decision rationale clear
- Alternatives considered
- Consequences listed
- Linked from index
General
- No duplicate information
- Examples tested
- Links working
- Dates/versions noted
References:
- references/readme-guide.md â README templates, section patterns, badges
- references/api-docs.md â API documentation patterns, OpenAPI integration
- references/adr-guide.md â Architecture Decision Record format and workflow
- references/diagrams.md â Mermaid diagram patterns for common scenarios
Templates:
- assets/README-template.md â Starter README template
- assets/ADR-template.md â Architecture Decision Record template