封面

微软开源 Skill Recorder:用一次录屏,让 AI Agent 学会你的操作

引言:教 AI 做事,不再靠写提示词

当你教同事做一个复杂操作时,会怎么说?“打开这个网站 → 点这个按钮 → 填这几个字段 → 提交”。但如果你要"教" AI Agent 呢?传统做法是手写一大段提示词,或者反复调试 Agent 的行为。

微软 Skill Recorder 给出了另一种思路:你亲自做一次,AI 看一遍,自己学会

2026 年 8 月 4 日更新的微软新开源项目 Skill Recorder(github.com/microsoft/skill-recorder),就是这样一款桌面工具:录下你在屏幕上的操作(含语音解说),用 GitHub Copilot CLI 自动"还原"成一份结构化步骤文档,直接生成一个 AI Agent 可复用的 Skill 或 Automation

GitHub 上线即爆火:⭐ 1481 | fork 154 | TypeScript。

一、它能做什么?一句话总结

把你做事的全过程,变成 AI 能重复执行的技能。

你录制一次"在内部系统里提了一个报销单",Copilot 分析后生成 SKILL.md 或 Automation,之后 AI Agent 看到类似任务就能自动执行——从提交一份报销,变成提交所有报销。

二、完整工作流:录 → 分析 → 生成

🔴 第一步:录(Record)

⌘⇧R(Mac)或 Ctrl+Shift+R(Windows)开始录屏,随后台静默工作,支持:

  • 窗口跟踪:记录活跃应用、窗口切换
  • 浏览器 URL:macOS 下抓取当前页面地址
  • 屏幕视频:Chromium 录制,只保留画面有变化时的帧(节省空间)
  • 剪贴板预览:短文本复制内容用于关联步骤
  • 语音解说(可选):用本地 Whisper 模型(~252MB)实时转写,不上云

⚠️ 录制时不录密码、Token、密钥——官方有隐私提示,Analyze 时数据才发往 GitHub 云端。

🧠 第二步:分析(Analyze)

点击"Analyze",Copilot CLI 接入,基于录屏事件时间线和截图,重建出一个整体意图(Intent)+ 有序步骤列表(Ordered Steps)

意图:提交季度差旅报销单
步骤:
1. 打开内部 OA 系统(https://oa.internal.company.com)
2. 点击「费用报销」→「新建报销」
3. 选择费用类型「差旅」
4. 填写出发地、目的地、交通工具、金额
5. 上传发票图片
6. 提交并记录报销单号

用户可以随时修改、编辑这些步骤,直到读起来"对味"。

✨ 第三步:生成(Create)

从审核通过的步骤出发,一键生成两类产物:

产物 说明 输出文件
Skill SKILL.md 格式,Agent 按需调用 .md 文件
Automation 带触发器(定时 / 事件),Agent 自动化执行 automation.json

生成的 Skill 优先使用 Agent 原生工具(gh CLI、web_fetch 等),而非回放 UI 点击——所以录制"提交一份表单",学会后能提交所有表单。

三、核心技术架构

3.1 目录结构一览

skill-recorder/
├── common/                    # 共享核心类型与逻辑
│   ├── analysis.ts            # ★ 分析结果结构(Intent + Steps)
│   ├── skill.ts               # ★ SKILL.md 结构定义
│   ├── events.ts             # 录制事件类型
│   ├── frames.ts             # 帧处理
│   └── config.ts             # 配置
├── electron/
│   ├── recorder/
│   │   └── controller.ts      # ★ 录制状态机(核心控制器)
│   ├── collectors/            # 各类采集器
│   │   ├── active-window.ts   # macOS 窗口跟踪
│   │   ├── clipboard.ts       # 剪贴板
│   │   └── url-provider.ts    # URL 捕获
│   ├── describer/
│   │   └── describer.ts      # ★ Copilot CLI 驱动分析
│   ├── skillbuilder/
│   │   └── builder.ts        # ★ 生成 SKILL.md 的 Copilot Agent
│   └── automationbuilder/
│       └── builder.ts        # ★ 生成 Automation.json 的 Copilot Agent
├── evals/                     # 评测套件(10 个真实场景)
├── electron/video/recorder.ts # 屏幕视频录制
└── electron/narration/       # 本地 Whisper 语音转写

3.2 录制状态机(RecorderController)

核心逻辑在 electron/recorder/controller.ts,是一个严格序列化的状态机,防止 UI、托盘、快捷键、麦克风和退出事件之间竞态:

export class RecorderController {
  private state: RecorderState = "idle"; // "idle" | "recording"
  private transition: RecorderStatus["transition"] = "none";
  private operations = Promise.resolve();  // 队列锁,禁止并发

  // 关键方法
  async start(options?: StartOptions): Promise<StartResult>
  async stop(): Promise<StopResult>          // 保存
  async discard(): Promise<DiscardResult>    // 丢弃
  async setMicrophoneEnabled(enabled: boolean, deviceId?: string)
}

状态流转idlestartingrecordingfinishingprocessingidle

所有状态变更经由 EventBus 发布,UI 实时响应,录制的每一帧事件都持久化到本地磁盘。

3.3 Copilot CLI 驱动的分析(Describer)

点击"Analyze"后,electron/describer/describer.ts 驱动多轮 Copilot CLI 对话:

// Describer 核心流程
private async createLive(sessionId: string): Promise<LiveSession> {
  const tools = createDescriberTools({
    sessionDir: dir,
    startedAt: meta.startedAt,
    extractor: buildExtractor(dir),      // 从录屏提取关键帧
    onSubmit: (s) => { holder.submission = s; }  // 提交结果
  });

  const client = await this.ensureClient();  // GitHub Copilot CLI
  const copilot = await client.createSession({
    systemMessage: { mode: "append", content: DESCIBER_INSTRUCTIONS },
    tools,                                   // 读帧、读事件、读剪贴板
    availableTools: tools.map(t => t.name),
  });

  await copilot.sendAndWait("Analyze this recording...");
  return { sessionId, holder, copilot };
}

Describer 使用 有视觉能力(vision-capable)的模型 处理截图帧,自动识别"做了什么操作 + 操作了哪个界面元素"。

3.4 Skill 生成(SkillBuilder)

生成的 SKILL.md 结构化定义在 common/skill.ts,核心字段:

interface SkillSpec {
  name: string;              // 技能名
  intent: string;            // 总体意图描述
  steps: SkillStep[];        // 有序步骤列表
  trigger?: string;          // 触发条件
  tools?: string[];          // 偏好工具
}

SkillBuilder 调用 Copilot CLI,工具集包括:

  • get_analysis:读取 Describer 生成的分析结果
  • get_timeline:读取事件时间线(窗口切换、URL、剪贴板)
  • propose_skill_plan:提出 Skill 计划供用户审核
  • render_skill:最终渲染 SKILL.md 文件

3.5 Automation 生成(AutomationBuilder)

与 SkillBuilder 类似,但输出为 automation.json,包含触发器(定时 / 事件):

interface AutomationPlan {
  name: string;
  intent: string;
  trigger: {
    type: "schedule" | "event";
    schedule?: { cron?: string; naturalLanguage?: string };
  };
  steps: AutomationStep[];
}

导出路径为 ~/.copilot/automations/{name}/automation.json,用户可导入 Microsoft Scout / Copilot Cowork / Copilot Studio。

四、隐私设计:敏感数据不离本机

阶段 数据流向
录制中 全部本地,不上云
点击 Analyze 后 事件时间线 + 截图帧 + 语音转写文本 → GitHub 云端
Skill/Automation 生成 文件存本地(~/.copilot/skills/~/.copilot/automations/

官方明确建议:录制时不要输入密码、不要复制 Token、不要口述密钥

五、本地开发指南

Skill Recorder 以**源码发布(Source Release)**方式分发,一行命令拉取 Node.js 运行时并从源码构建,全程本地化。

环境要求:Node.js 24

# macOS / Ubuntu
commit="<release-commit-id>"
curl -fsSL "https://raw.githubusercontent.com/microsoft/skill-recorder/$commit/install.sh" \
  | SKILL_RECORDER_COMMIT="$commit" bash

# Windows PowerShell
$commit="<release-commit-id>"
$env:SKILL_RECORDER_COMMIT=$commit
irm "https://raw.githubusercontent.com/microsoft/skill-recorder/$commit/install.ps1" | iex

开发模式(修改源码):

git clone https://github.com/microsoft/skill-recorder
cd skill-recorder
npm ci
npm run compliance:licenses   # 许可证检查
npm run dev                   # Vite 热重载 + Electron

运行评测:

npm run eval           # 评测 Describer(10 个 fixture 场景)
npm run eval:builder   # 评测 Skill/Automation 生成质量

六、评测场景一览

项目内置 10 个真实场景评测套件(evals/scenarios/):

场景 描述
directory-lookup 查询员工通讯录
expense-report 提交差旅报销单
invoice-extract 从发票 PDF 提取结构化数据
lead-to-crm 将线索录入 CRM 系统
release-notes 汇总 PR 生成发版说明
research-compile 研究 + 编译成报告
web-to-spreadsheet 网页数据写入表格
irrelevant-detour 测试 Agent 识别无关操作
windows-deploy Windows 平台自动化部署

评测框架支持评分脚本(score.ts),验证 Skill 能否真正泛化——录制一个表单提交,学会后能提交其他表单。

七、适用场景

适合:

  • 企业内部系统的操作教学(OA、ERP、CRM)
  • 重复性高的桌面工作流程自动化
  • 团队内部建立操作 SOP,AI 帮忙执行

局限:

  • 依赖 GitHub Copilot CLI(需要 Copilot 订阅)
  • macOS 为主要目标,Windows 11 兼容
  • 复杂决策类任务仍需人工审核生成的结果

八、总结:比写提示词更自然的 AI 教法

传统 Agent 调教 = 写 Prompt → 试跑 → 看效果 → 改 Prompt → 循环

Skill Recorder 的思路 = 演示一次 → Copilot 自动归纳 → 生成可复用技能

从"让 AI 理解我的意图"变成"让 AI 看我做一遍",本质上把人类操作经验翻译成 Agent 可执行的自然语言技能文档。结合 SkillOpt 这类文档自我进化框架,AI 技能的迭代速度将远超纯手写提示词。

MIT 协议,免费商用,有 GitHub Copilot 的开发者可以立刻上手体验。


本文基于 github.com/microsoft/skill-recorder 仓库(1481 ⭐,TypeScript,MIT License)源码分析整理。

Logo

Agent 垂直技术社区,欢迎活跃、内容共建。

更多推荐