跳到正文

適用版本:Cowork 0.1.41 · 適用於所有 Cowork 使用者

檢視 Markdown

技能示例 ​

三個可以直接照抄改用的完整技能:一個只用文字寫成,一個在網站上工作,一個執行腳本。要用的話,跟 AI 說「建立這個技能」並貼上進去,或者把資料夾存進工作區的 .agents/skills/。

按價格表核對發票 ​

只用文字寫的做法,加一個參考檔案。適用於任何「拿文件和一張清單對比」的檢查。

text
check-invoices/
├── SKILL.md
└── references/
    └── prices.csv
markdown
---
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.mjs
markdown
---
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}`);
}

腳本的更多說明見 技能怎麼寫。

下一步 ​

適用於 Micromeet Cowork 0.1.41 · build 261111110020