Skill站外收录 @skilllib/skill-2014279367386411010
write-docs
以代码为核心,用简洁直接的表达撰写 tldraw SDK 文档,通过示例优先、渐进复杂的方式帮助开发者快速理解 API 用法,保持语气自信自然,避免冗余描述与 AI 风格化表述,确保内容准确可扫描。
文档处理 AI 技能
Skills.MD
# Writing tldraw SDK documentation
## The tldraw voice
Write like a colleague walking someone through code they know well. Confident, casual, code-first.
**Characteristic patterns:**
> Have five minutes? Run this command...
> That's pretty much it!
> Let's add local persistence by passing a `persistenceKey` prop...
> Need to create some shapes? Use [Editor#createShapes](?). Need to delete them? Use [Editor#deleteShapes](?).
**What makes it work:**
- Direct address with "you" and "let's"
- Questions as transitions ("Need to create some shapes?")
- Exclamations that feel natural, not forced ("That's pretty much it!")
- Jump straight to code, explain around it
- Short sentences between code blocks
### Confidence without hedging
State facts. Don't soften them.
```
// Good
The Editor class is the main way of controlling tldraw's editor.
// Bad
The Editor class can be used to control tldraw's editor.
```
### Density over exposition
Real tldraw docs are code-heavy. A section might be 20 lines of code with 2 sentences of explanation. Don't pad with prose.
## Avoid AI tells
These break trust instantly:
- **Hollow claims**: "plays a crucial role", "serves as a testament to"
- **Trailing gerunds**: "...ensuring optimal performance"
- **Formulaic transitions**: "Moreover,", "Furthermore,", "It's important to note"
- **Promotional language**: "robust", "seamless", "empowers developers"
- **Three-item lists**: Real writing has 2, 4, 7 items
- **Passive voice**: "can be achieved by" — just show how
- **Conversational asides**: "(or whatever)", "(if you want)", "(just saying)"
## Mechanics
- **Sentence case headings**: "Custom shapes" not "Custom Shapes"
- **Active voice**: "The store validates records"
- **Present tense**: "The migration system transforms"
- **Contractions**: it's, we've, you'll, don't
## Frontmatter
```yaml
---
title: Feature name
status: published
author: steveruizok
date: 3/22/2023
order: 1
keywords:
- keyword1
- keyword2
---
```
## MDX components
### API links
Use `[ClassName](?)` or `[ClassName#methodName](?)` for API references:
```markdown
The [Editor](?) class has many methods. Use [Editor#createShapes](?) to create shapes.
```
### Code highlighting
Use `<FocusLines>` to highlight specific lines:
```markdown
<FocusLines lines={[2,6,10]}>
\`\`\`tsx
import { Tldraw } from 'tldraw'
import { useSyncDemo } from '@tldraw/sync'
\`\`\`
</FocusLines>
```
### Images
```markdown
<Image
src="/images/api/events.png"
alt="A diagram showing an event being sent to the editor."
title="Caption text here."
/>
```
### Tables for API documentation
Use tables for listing methods, options, or properties:
```markdown
| Method | Description |
| ------------------------ | ---------------------------------------------- |
| [Editor#screenToPage](?) | Convert a point in screen space to page space. |
| [Editor#pageToScreen](?) | Convert a point in page space to screen space. |
```
```markdown
| Value | Description |
| --------- | ---------------------------------------------------- |
| `default` | Sets the initial zoom to 100%. |
| `fit-x` | The x axis will completely fill the viewport bounds. |
```
## Code examples
Show code early, explain around it. Don't build up to code with paragraphs of context.
### Realistic, minimal
```tsx
// Good: Real shape, real values
editor.createShapes([
{
type: 'geo',
x: 0,
y: 0,
props: { geo: 'rectangle', w: 100, h: 100 },
},
])
// Bad: Placeholder nonsense
editor.createShape({ type: 'example-type', props: { prop1: 'value1' } })
```
### Context when needed
Full components are fine when showing integration patterns:
```tsx
export default function App() {
return (
<div style={{ position: 'fixed', inset: 0 }}>
<Tldraw persistenceKey="example" />
</div>
)
}
```
Minimal snippets when showing a single API:
```tsx
editor.setFocusedGroup(groupId)
```
## Structure
### Overview first
1-2 paragraphs establishing what and why before diving into how.
### Progressive complexity
Start with the common case. Add complexity incrementally. Put edge cases later.
### Link to examples
End sections with links to relevant examples:
```markdown
> For an example of how to create custom shapes, see our [custom shapes example](/examples/shapes/tools/custom-shape).
```
Or in a section:
```markdown
---
See the [tldraw repository](https://github.com/tldraw/tldraw/tree/main/apps/examples) for examples of how to use tldraw's Editor API.
```
## Priorities
1. **Accuracy** — Code must work. API refs must be correct.
2. **Clarity** — Understand on first read.
3. **Brevity** — Say it once, move on.
4. **Scannability** — Short paragraphs, clear headers, lots of code.
评论 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
举报「write-docs」
举报信息仅审核团队可见,同一资产 24 小时内仅可举报一次