技能示例
三个可以直接照抄改用的完整技能:一个只用文字写成,一个在网站上工作,一个运行脚本。要用的话,跟 AI 说「创建这个技能」并粘贴进去,或者把文件夹存进工作区的 .agents/skills/。
按价格表核对发票
只用文字写的做法,加一个参考文件。适用于任何「拿文档和一张清单对比」的检查。
text
check-invoices/
├── SKILL.md
└── references/
└── prices.csvmarkdown
---
name: check-invoices
description: 把供应商发票和约定价格表对一遍,列出每一行对不上的项目。
在要核对、检查或对账发票、供应商账单时使用。
---
# 核对发票
## 输入与结果
- 输入:附上的或工作区里的发票(PDF 或 Excel)。
- 价格表:references/prices.csv(列:item_code、item_name、unit_price)。
- 结果:工作区里的 mismatches.csv,列为
invoice_file、item_code、invoiced_price、agreed_price、difference。
## 做法
1. 读每张发票,取出每一行:物品编号、数量、单价。
2. 在 references/prices.csv 里查每个物品编号。
3. 单价相差超过 0.01,或物品编号不在价格表里(agreed_price 留空),算对不上。
4. 写出 mismatches.csv。在对话里说明核对了几张发票、几行、对不上几行。
5. 只读。不要修改或移动发票。
## 代表性检查
发票里物品 A-100 单价 12.50,价格表里 A-100 是 12.00,这一行出现在
mismatches.csv 里,difference 为 0.50。核对的行数等于所有发票行数之和。从网站导出本月订单
在你已登录的网站上工作的做法。适用于没有导出按钮的系统里的任何定期导出。
markdown
---
name: export-orders
description: 把订单网站上本月的订单导出成 CSV。在要本月订单、导出订单或订单列表时使用。
---
# 导出订单
## 输入与结果
- 输入:在 Cowork 标签页里打开并已登录的订单网站。
- 结果:工作区里的 orders-YYYY-MM.csv,列为
order_no、date、customer、total、status。
## 做法
1. 打开订单列表,筛选到本月。
2. 读完所有分页,不只是第一页。
3. 写出 CSV。日期用 YYYY-MM-DD,金额写纯数字。
4. 只读:绝不点保存、删除、提交,也不改任何字段。
5. 出现登录或验证页面时,停下来告诉我是哪个页面。
## 代表性检查
CSV 的行数等于网站上显示的本月结果数。如果每个月都要跑、清单又很长,跟 AI 说「为这个写一个爬取脚本」:更快,也能从断点继续。见 爬取脚本。
按类型统计文件(命令)
输入 /count-files 就直接运行脚本、不经过 AI 的技能。适用于不需要判断的快速、精确的小事。
text
count-files/
├── SKILL.md
└── scripts/
└── run.mjsmarkdown
---
name: count-files
description: 按文件类型统计工作区里的文件数量。
entry: scripts/run.mjs
x-shortcut:
run: scripts/run.mjs
---
# 统计文件
输入 /count-files 会在这台电脑上运行 scripts/run.mjs,输出工作区里每种类型的文件数量。js
// scripts/run.mjs — stdin is JSON { args, sessionId, workspace }.
import { readdirSync } from 'node:fs';
import { extname, join } from 'node:path';
let raw = '';
for await (const chunk of process.stdin) raw += chunk;
const { workspace } = raw ? JSON.parse(raw) : {};
if (!workspace) throw new Error('Choose a workspace first.');
const counts = {};
const walk = (dir) => {
for (const entry of readdirSync(dir, { withFileTypes: true })) {
if (entry.name.startsWith('.')) continue;
const path = join(dir, entry.name);
if (entry.isDirectory()) walk(path);
else {
const type = extname(entry.name).toLowerCase() || '(none)';
counts[type] = (counts[type] ?? 0) + 1;
}
}
};
walk(workspace);
for (const [type, count] of Object.entries(counts).sort((a, b) => b[1] - a[1])) {
console.log(`${type}\t${count}`);
}脚本的更多说明见 技能怎么写。