Skill站外收录 @skilllib/skill-2014279404015267841
writing-documentation
面向技术文档的规范化编写与维护,涵盖 README、网站文档及技能说明,强调示例真实性验证、内容结构分层(教程/指南/参考/解释)、配置信息自动化呈现,以及术语、事件命名和代码引用的一致性管控。
文档处理 AI 技能
Skills.MD
# Writing Documentation
## When to Use This Skill
- Creating a new package README
- Writing website documentation (MDX)
- Creating or updating skills
- Reviewing documentation for quality
- Documenting Phase 7 of create-destination or create-source
## Prerequisites
- [understanding-flow](../understanding-flow/SKILL.md) - Architecture context
- [understanding-events](../understanding-events/SKILL.md) - Event naming rules
---
## Documentation Types
### Where Content Belongs
| Type | Purpose | Audience |
| ------------------ | --------------------------------------------- | --------------------------- |
| **Package README** | Installation, basic usage, API reference | Package users |
| **Website docs** | Guides, integration examples, detailed config | Integrators |
| **Skills** | Process knowledge, workflows | AI assistants, contributors |
### Divio Documentation Types
Keep these separate - don't mix tutorials with reference:
| Type | Purpose | User State |
| ---------------- | ------------------ | ----------------------------- |
| **Tutorial** | Learning | Studying, beginner |
| **How-To Guide** | Problem-solving | Working, knows what they need |
| **Reference** | Information lookup | Working, needs facts |
| **Explanation** | Understanding | Studying, needs context |
---
## Example Validation (CRITICAL)
### The Problem
AI-generated examples can be:
- Syntactically correct but use non-existent APIs
- Plausible-looking but don't match actual exports
- Outdated, referencing deprecated patterns
### Source of Truth Hierarchy
```text
TIER 1: apps/quickstart/
✓ Tested ✓ Compiled ✓ CI-validated
→ USE FOR: All code examples
TIER 2: packages/core/src/eventGenerator.ts
✓ Canonical events ✓ Real data structures
→ USE FOR: Event examples
TIER 3: packages/*/src/index.ts exports
✓ Actual public API
→ USE FOR: Verifying API names exist
TIER 4: Package READMEs & Website docs
⚠ May contain errors
→ VERIFY against Tier 1-3 before trusting
```
### Validation Checklist
Before publishing ANY code example:
- [ ] **API exists?** Check `packages/*/src/index.ts` exports
- [ ] **Pattern validated?** Compare against `apps/quickstart/`
- [ ] **Events canonical?** Use patterns from `eventGenerator.ts`
- [ ] **Example compiles?** TypeScript check passes
- [ ] **Imports correct?** Package names match actual packages
### Red Flags
| Red Flag | What It Indicates |
| -------------------------------------- | ----------------------------------- |
| API name not in package exports | Hallucinated or outdated API |
| Import path doesn't match package.json | Wrong package reference |
| Event name with underscore | Wrong format (should be space) |
| No imports shown | Context missing, harder to validate |
---
## DRY Patterns
### PropertyTable for Configuration
**When to use:** Any page documenting package configuration with Zod schemas.
```mdx
import { schemas } from '@walkeros/web-destination-gtag/dev';
<PropertyTable schema={schemas.settings} />;
;
```
**When NOT to use:**
- Pages without package configuration
- Reference tables (Logger API, CLI commands)
- Conceptual explanations
### Schema Exports (dev.ts)
Every destination/source should export schemas:
```typescript
// src/dev.ts
export * as schemas from './schemas';
export * as examples from './examples';
```
### Don't Duplicate
- Link to source files instead of copying type definitions
- Reference `apps/quickstart/` examples instead of writing from scratch
- Use PropertyTable instead of hardcoded markdown tables
---
## Quality Checklist
### Structure
- [ ] Follows appropriate Divio type (Tutorial/How-To/Reference/Explanation)
- [ ] Code example within first 100 words
- [ ] First example under 20 lines
- [ ] Uses `<details>` for advanced content
- [ ] Has "Next Steps" or "Related" section
### Content
- [ ] All event names use `"entity action"` format with space
- [ ] Flow config shown as primary usage pattern
- [ ] Examples are complete and copy-pasteable
- [ ] Includes imports in code examples
### AI Readability
- [ ] Clear semantic headers (H2, H3, H4 hierarchy - no skipped levels)
- [ ] Tables for structured data
- [ ] Links to source of truth TypeScript files
- [ ] Static fallback content alongside dynamic components
### Consistency
- [ ] Uses standard table formats
- [ ] Follows package/skill/website templates
- [ ] Terminology matches: walkerOS, collector, destination, source
---
## Templates
### Package README Template
````markdown
# @walkeros/[package-name]
[1-sentence description]
[Source Code](link) | [NPM](link) | [Documentation](link)
## Quick Start
```json
{
"version": 1,
"flows": {
"default": {
"web": {},
"[sources|destinations]": {
"[name]": {
"package": "@walkeros/[package-name]",
"config": { ... }
}
}
}
}
}
```
````
## Features
- **Feature 1**: Brief description
- **Feature 2**: Brief description
## Installation
```bash
npm install @walkeros/[package-name]
```
## Configuration Reference
| Name | Type | Description | Required | Default |
| ---- | ---- | ----------- | -------- | ------- |
## Examples
### Basic
[Simple example]
<details>
<summary>Advanced: Custom Mapping</summary>
[Complex example]
</details>
## Type Definitions
See [src/types.ts](./src/types.ts) for TypeScript interfaces.
## Related
- [Documentation](website/docs/...)
````
### Website Doc Template (MDX)
```mdx
---
title: [Title]
description: [SEO description]
sidebar_position: [N]
---
# [Title]
<PackageLink package="@walkeros/[package]" />
[1-sentence description]
## Quick Start
```json
// Flow config example (<15 lines)
````
## Features
- **Feature 1**: Description
## Installation
<Tabs>
<TabItem value="npm" label="npm">
```bash
npm install @walkeros/[package]
```
</TabItem>
</Tabs>
## Configuration
<PropertyTable schema={schemas.settings} />
## Next Steps
- [Related guide 1](/docs/...)
````mdx
---
## Priority Matrix
### Issue Classification
| Priority | Criteria | Action |
|----------|----------|--------|
| **P0 Critical** | Incorrect examples, wrong APIs, security issues | Fix immediately |
| **P1 High** | Missing PropertyTable, outdated domains, missing sections | Fix soon |
| **P2 Medium** | Inconsistent terminology, skipped headings | Plan to fix |
| **P3 Low** | Style issues, minor wording | Backlog |
---
## Non-Negotiables
### Event Naming
```text
CORRECT: "page view", "product add", "order complete" WRONG: "page_view",
"pageView", "PAGE VIEW"
```
````
### Package References
```text
CORRECT: `@walkeros/collector` (with backticks) WRONG: @walkeros/collector (no
backticks)
```
### Domain References
```text
CORRECT: `www.walkeros.io` or relative paths DO NOT USE: legacy domain
references
```
---
## Process
### For New Package Documentation
1. **Verify examples exist** in `apps/quickstart/` or create them first
2. **Write README** using template above
3. **Write website doc** using MDX template
4. **Run quality checklist**
5. **Verify all code examples** against Tier 1-3 sources
### For Documentation Updates
1. **Identify issue priority** using matrix above
2. **Check current state** against source of truth
3. **Make minimal changes** - don't over-engineer
4. **Verify examples still compile**
5. **Run quality checklist**
---
## Related
- [← Back to Hub](../../AGENT.md)
```
```
评论 0
还没有评论,来抢沙发。
相关内容
同类或同场景的收录内容
building-with-kafka-strimzi
在 Kubernetes 上构建基于 Apache Kafka 的事件驱动系统,支持高可靠的消息传递、事务性处理与精确一次语义,结合 Strimzi 运营商实现集群自动化管理,利用 Schema Registry 保障事件模式演进,适用于微服务间解耦通信与实时数据流处理场景。
站外数据与分析
609 0.0
personal-tool-builder
专注于从个人真实痛点出发快速构建实用工具,涵盖命令行程序、本地优先应用和自动化脚本的开发与演进,强调先满足自身需求再逐步扩展,通过持续自用打磨功能,避免过度设计,确保工具简洁有效且长期可维护。
站外商业与营销
196 0.0
threejs-lighting
实现三维场景中的光照与阴影控制,支持多种光源类型及环境光照明,提供从基础布光到高级阴影优化的完整方案,适用于需要真实感渲染或性能平衡的可视化项目。
站外效率工具
442 0.0
aggregation-helper
提供数据聚合场景的自动化辅助能力,涵盖 SQL 查询编写、统计分析建模、可视化方案设计及商业智能配置,支持从需求理解到生产级代码生成的全流程指导。
站外效率工具数据与分析
217 0.0
举报「writing-documentation」
举报信息仅审核团队可见,同一资产 24 小时内仅可举报一次