Tutorial Documentation Skill
This skill provides patterns for writing effective tutorials following the Diataxis framework. Tutorials are learning-oriented content where the reader learns by doing under the guidance of a teacher.
Purpose & Audience
Target readers:
- - Complete beginners with no prior experience
- Users who want to learn, not accomplish a specific task
- People who need a successful first experience with the product
- Learners who benefit from guided, hands-on practice
Tutorials are NOT:
- - How-To guides (which help accomplish specific tasks)
- Explanations (which provide understanding)
- Reference docs (which describe the system)
Core Principles (Diataxis Framework)
1. Learn by Doing, Not by Reading
Tutorials teach through action, not explanation. The reader should be doing something at every moment.
| Avoid | Prefer |
|---|
| "REST APIs use HTTP methods to..." | "Run this command to make your first API call:" |
| "Authentication is important because..." |
"Add your API key to authenticate:" |
| "The dashboard contains several sections..." | "Click
Create Project in the dashboard." |
2. Deliver Visible Results at Every Step
After each action, tell readers exactly what they should see. This confirms success and builds confidence.
CODEBLOCK0 bash
npm run dev
You should see:
Local: http://localhost:3000
Ready in 500ms
CODEBLOCK2
3. One Clear Path, Minimize Choices
Tutorials should not offer alternatives. Pick one way and guide the reader through it completely.
| Avoid | Prefer |
|---|
| "You can use npm, yarn, or pnpm..." | "Install the dependencies:" |
| "There are several ways to configure..." |
"Create a config file:" |
| "Optionally, you might want to..." | [Omit optional steps entirely] |
4. The Teacher Takes Responsibility
If the reader fails, the tutorial failed. Anticipate problems and prevent them. Never blame the reader.
CODEBLOCK3
5. Permit Repetition to Build Confidence
Repeating similar actions in slightly different contexts helps cement learning. Don't try to be efficient.
Tutorial Template
Use this structure for all tutorials:
CODEBLOCK4 bash
[command]
You should see:
[expected output]
[Brief confirmation of what this means]
## Step 2: [Create your first thing]
[Next action with clear instruction]
code
[code to add or modify]
CODEBLOCK7
Writing Principles
Title Conventions
- - Start with action outcomes: "Build your first...", "Create a...", "Deploy your..."
- Focus on what they'll make, not what they'll learn
- Be concrete: "Build a chat application" not "Learn about real-time messaging"
Step Structure
- 1. Lead with the action - don't explain before doing
- Show exactly what to type or click - no ambiguity
- Confirm success after every step - "You should see..."
- Keep steps small - one visible change per step
Managing Prerequisites
Tutorials are for beginners, so minimize prerequisites:
CODEBLOCK8
The "You should see" Pattern
This is the most important pattern in tutorial writing. Use it constantly:
CODEBLOCK9 bash
npm test
You should see:
PASS src/app.test.js
✓ renders welcome message (23ms)
Tests: 1 passed, 1 total
CODEBLOCK11
Handling Errors Gracefully
Anticipate failures and guide readers back on track:
CODEBLOCK12
Components for Tutorials
Frame Component for Screenshots
Show what success looks like:
CODEBLOCK13
Steps Component for Procedures
For numbered sequences within a step:
CODEBLOCK14
Callouts for Guidance
CODEBLOCK15
Code with Highlighted Lines
Draw attention to what matters:
CODEBLOCK16 javascript {3-4}
function App() {
return (
Hello, World!
Welcome to your first app.
);
}
CODEBLOCK17
Example Tutorial
See references/example-weather-api.md for a complete example tutorial demonstrating all principles above. The example builds a weather dashboard that fetches real API data.
Checklist for Tutorials
Before publishing, verify:
- - [ ] Title describes what they'll build, not what they'll learn
- [ ] Introduction shows the concrete end result
- [ ] Prerequisites are minimal (beginners don't have much)
- [ ] Every step produces visible output
- [ ] "You should see" appears after each significant action
- [ ] No choices offered - one clear path only
- [ ] No explanations of why things work (save for docs)
- [ ] Potential failures are anticipated with recovery guidance
- [ ] "What you've learned" summarizes concrete skills gained
- [ ] Next steps guide to continued learning
- [ ] Tutorial tested end-to-end by someone unfamiliar with it
When to Use Tutorial vs Other Doc Types
| User's mindset | Doc type | Example |
|---|
| "I want to learn" | Tutorial | "Build your first chatbot" |
| "I want to do X" |
How-To | "How to configure SSO" |
| "I want to understand" | Explanation | "How our caching works" |
| "I need to look up Y" | Reference | "API endpoint reference" |
Tutorial vs How-To: Key Differences
| Aspect | Tutorial | How-To |
|---|
| Purpose | Learning through doing | Accomplishing a specific task |
| Audience |
Complete beginners | Users with some experience |
|
Structure | Linear journey with one path | Steps to achieve a goal |
|
Choices | None - one prescribed way | May show alternatives |
|
Explanations | Minimal - action over theory | Minimal - focus on steps |
|
Success | Reader learns and gains confidence | Reader completes their task |
|
Length | Longer, more hand-holding | Shorter, more direct |
Related Skills
- - docs-style: Core writing conventions and components
- howto-docs: How-To guide patterns for task-oriented content
- reference-docs: Reference documentation patterns
- explanation-docs: Conceptual documentation patterns
教程文档技能
本技能提供遵循Diataxis框架编写有效教程的模式。教程是以学习为导向的内容,读者在教师的指导下通过实践来学习。
目的与受众
目标读者:
- - 完全没有经验的初学者
- 想要学习而非完成特定任务的用户
- 需要与产品建立良好初次体验的人
- 受益于引导式动手实践的学习者
教程不是:
- - 操作指南(帮助完成特定任务)
- 解释说明(提供理解)
- 参考文档(描述系统)
核心原则(Diataxis框架)
1. 在做中学,而非在读中学
教程通过行动而非解释来教学。读者应该时刻在做某事。
| 避免 | 推荐 |
|---|
| REST API使用HTTP方法来... | 运行此命令进行你的第一次API调用: |
| 身份验证很重要,因为... |
添加你的API密钥进行身份验证: |
| 仪表盘包含几个部分... | 在仪表盘中点击
创建项目。 |
2. 每一步都提供可见结果
每次操作后,告诉读者他们应该看到什么。这能确认成功并建立信心。
markdown
运行开发服务器:
bash
npm run dev
你应该看到:
Local: http://localhost:3000
Ready in 500ms
在浏览器中打开 http://localhost:3000。你应该看到一个显示Hello, World!的欢迎页面。
3. 一条清晰路径,最小化选择
教程不应提供替代方案。选择一种方式并引导读者完整走完。
| 避免 | 推荐 |
|---|
| 你可以使用npm、yarn或pnpm... | 安装依赖: |
| 有几种配置方式... |
创建配置文件: |
| 可选地,你可能想要... | [完全省略可选步骤] |
4. 教师承担责任
如果读者失败,那就是教程的失败。预见问题并预防它们。永远不要责怪读者。
markdown
确保你在运行此命令前位于项目目录中。
如果看到command not found,返回第2步验证安装。
5. 允许重复以建立信心
在略有不同的上下文中重复类似操作有助于巩固学习。不要追求效率。
教程模板
所有教程使用此结构:
markdown
title: 构建你的第一个[事物]
description: 通过构建一个可用的[事物]来学习[产品]的基础知识
构建你的第一个[事物]
在本教程中,你将构建一个[具体交付物]。完成后,你将拥有一个可用的[事物],它能[做某些可见的事情]。
本教程大约需要[X]分钟完成。
你将构建什么
[最终结果的截图或图表]
一个[具体交付物的简要描述],它:
前置条件
开始之前,请确保你有:
- - [最低要求1 - 如果需要,链接到安装指南]
- [最低要求2]
[前置条件]的新手?[链接到外部资源]有快速设置指南。
第1步:[设置你的项目]
[第一个操作 - 始终从能产生可见输出的内容开始]
bash
[命令]
你应该看到:
[预期输出]
[简要确认这意味着什么]
第2步:[创建你的第一个事物]
[带有清晰指令的下一个操作]
code
[要添加或修改的代码]
保存文件。你应该看到[可见变化]。
[防止常见错误的可选提示]
第3步:[继续构建]
[继续更多步骤,每个步骤产生可见输出]
第4步:[添加最后的部分]
[通过最后一步整合所有内容]
你现在应该看到[最终可见结果]。
[已完成项目的截图]
你学到了什么
在本教程中,你:
- - [具体技能1 - 他们现在能做什么]
- [具体技能2]
- [具体技能3]
下一步
既然你有了一个可用的[事物],你可以:
- - [教程2标题] - 通过[下一个学习目标]继续学习
- [操作指南] - 学习如何使用你的[事物]完成[特定任务]
- [概念页面] - 更深入地理解[概念]
写作原则
标题规范
- - 以行动结果开头:构建你的第一个...、创建一个...、部署你的...
- 关注他们将制作什么,而非他们将学到什么
- 要具体:构建一个聊天应用而非了解实时消息
步骤结构
- 1. 以行动为先 - 不要在行动前解释
- 精确显示要输入或点击的内容 - 不含糊
- 每一步后确认成功 - 你应该看到...
- 保持步骤简短 - 每步一个可见变化
管理前置条件
教程面向初学者,因此最小化前置条件:
markdown
前置条件
- - 一台装有macOS、Windows或Linux的电脑
- 一个文本编辑器(我们推荐VS Code)
- 15分钟时间
你不需要任何编程经验。本教程会在过程中解释一切。
你应该看到模式
这是教程写作中最重要的模式。要经常使用:
markdown
点击保存。你应该看到文件名旁边出现一个绿色对勾。
运行测试:
bash
npm test
你应该看到:
PASS src/app.test.js
✓ renders welcome message (23ms)
Tests: 1 passed, 1 total
优雅处理错误
预见失败并引导读者回到正轨:
markdown
如果看到Module not found,请确保你保存了第2步的文件。
返回第2步并验证导入语句完全匹配。
教程组件
截图框架组件
展示成功的样子:
markdown

步骤组件
用于步骤内的编号序列:
markdown
点击右上角的齿轮图标。
向下滚动到开发者设置。
点击创建新密钥并复制显示的值。
提示框
markdown
如果颜色在你的屏幕上看起来不同,不用担心。
我们将在下一步中自定义主题。
在继续之前确保保存了文件。
没有这个更改,下一步将无法工作。
你可以按Cmd+S(Mac)或Ctrl+S(Windows)快速保存。
带高亮行的代码
吸引注意力到重要内容:
markdown
javascript {3-4}
function App() {
return (
Hello, World!
Welcome to your first app.
);
}
示例教程
参见 references/example-weather-api.md 获取一个完整的示例教程,演示上述所有原则。该示例构建了一个获取真实API数据的天气仪表盘。
教程检查清单
发布前,验证:
- - [ ] 标题描述他们将构建什么,而非他们将学到什么
- [ ] 引言展示具体的最终结果
- [ ] 前置条件最少(初学者没有太多基础)
- [ ] 每一步都产生可见输出
- [ ] 每个重要操作后都有你应该看到
- [ ] 不提供选择 - 只有一条清晰路径
- [ ] 不解释为什么能工作(留给文档)
- [ ] 预见可能的失败并提供恢复指导
- [ ] 你学到了什么总结获得的具体技能
- [ ] 下一步引导继续学习
- [ ] 由不熟悉该教程的人进行端到端测试
何时使用教程与其他文档类型
| 用户心态 | 文档类型 | 示例 |
|---|
| 我想学习 | 教程 | 构建你的第一个聊天机器人 |
| 我想做X |
操作指南 | 如何配置SSO |
| 我想理解 | 解释说明 | 我们的缓存如何工作 |
| 我需要查找Y | 参考文档 | API端点参考 |
教程与操作指南:关键区别
完全初学者 | 有一定经验的用户 |
|
结构 | 线性旅程,一条路径 | 实现目标的步骤 |
|
选择 | 无 - 一种规定方式 | 可能展示替代方案 |
|
解释 | 最少 - 行动优先于理论 | 最少 - 关注步骤 |
|
成功 | 读者学习并获得信心 | 读者完成任务 |
|
长度 | 较长,更多手把手指导 | 较短,更直接 |
相关技能
-