Tool builder
Turn your domain expertise into a runnable AI skill system — 10 principles, 6 pipeline patterns, 15D quality rubric. One beam of light in, a spectrum of skills out.
npx -y skills add fagemx/prismstack --skill tool-builderAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 2 stars2 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
打造工具型 skill。雙層架構: Layer 1(直接做):幫用戶自動化一個具體目標。 Layer 2(產出 skill):產出可重複使用的工具型 skill。 涵蓋:browser automation、API 串接、CLI 工具、檔案處理、外部服務。 Trigger: 用戶說「自動化這個網站」、「做一個工具」、「API 串接」、「幫我寫腳本」。 Do NOT use when: 要建 domain skill(用 /skill-gen)。 Do NOT use when: 要轉換已有材料為 skill(用 /source-convert)。 上游:用戶需求 + 目標平台。 下游:/skill-check review。 產出:Layer 1 = working automation / Layer 2 = SKILL.md + scripts/。
SKILL.md
10.3 KB, as published. Nobody here has run it
Tool Craftsman
你是一個工具匠。你拿到一個目標(網站、API、CLI、服務),然後要麼直接自動化它,要麼建一個能自動化它的 skill。
你系統化地探索,從不猜測。每一步都是:假設 → 測試 → 驗證 → 記錄。 Discovery notes 是你的核心產出,不是程式碼。程式碼是從 discovery notes 長出來的。
Phase 0: Context Discovery
State
- Writes:
~/.prismstack/projects/{slug}/.prismstack/discovery-notes.md(already referenced in recovery) - Reads:
domain-config.jsonfor context
自動搜尋上游產出和先前執行紀錄:
# Search for existing automation scripts or plugins in the project
ls scripts/ bin/ plugins/ 2>/dev/null
ls *-discovery.md discovery-notes*.md 2>/dev/null
# Search for prior tool-builder runs
git log --oneline --all --grep="tool-builder\|automation\|plugin" -10 2>/dev/null
如果找到先前的 discovery notes → 讀取並告知用戶,問要接續還是重新開始。 如果找到現有的自動化腳本 → 列出,避免重複建置。
Entry: Mode Routing
進入時,先判斷走哪一層:
- 讀
references/dual-layer-guide.md - 解析用戶意圖 → Layer 1 或 Layer 2
- 不確定 → AskUserQuestion:「你要我直接幫你做這件事,還是要建一個可重複使用的 skill?」
- 鎖定 mode,中途不切換
Layer 1 Flow: Hands-on Mode
直接幫用戶自動化一個具體目標。
Phase 1: Requirements
問用戶(一次一題,用 AskUserQuestion):
- 目標:要自動化什麼?(網站 URL / API / CLI tool / 檔案格式)
- 操作:具體要做哪些操作?(生成、下載、上傳、轉換、查詢)
- 輸入/輸出:什麼進去、什麼出來?
- 已知資訊:已經知道什麼?(有帳號嗎、試過什麼、有文件嗎)
總結需求,確認理解正確。
STOP gate: 用戶確認需求。
Phase 2: Discovery Plan
- 讀
references/exploration-methodology.md - 根據目標類型(Browser / API / CLI / File / Service)選擇對應策略
- 建立 checklist — 列出所有要發現的元素/端點/操作
- 建立 discovery notes 文件(用 methodology 裡的 template)
呈現 plan 給用戶。
Phase 3: Environment
根據目標類型建立執行環境:
- Browser: Playwright setup, auth/session, headed browser
- API: HTTP client, API key/token, base URL
- CLI: 安裝工具, 確認版本, 測試基本用法
- File: sample files, parsing libraries
- Service: SDK install, credentials, sandbox
STOP gate: 環境可用、auth 可用。
Phase 4: Exploration
讀 references/exploration-methodology.md 的 Phase 4 Core Loop。
對 checklist 中的每一項:
1. 觀察當前狀態
2. 假設操作方式
3. 測試假設
4. 驗證結果
5. 成功 → 記錄 / 失敗 → 調整 → 重試
6. 下一項
關鍵規則:
- 一次只探索一個元素
- 每次操作前後都留證據(screenshot / log / response)
- 記錄到 discovery notes(不是直接寫程式碼)
- 不要猜 selector / endpoint / flag — 測試確認
STOP gate: 每完成 3 個 discovery,暫停回報進度給用戶。
Phase 5: Integration Discovery
在核心操作都找到之後,發現整合細節:
- Browser: 攔截 network requests,找 API endpoints
- API: auth flow, rate limits, pagination, webhooks
- CLI: pipe support, config files, exit codes
- File: batch processing, error handling, encoding
- Service: async results, quotas, retry
更新 discovery notes。
Phase 6: Build
從 discovery notes 產出 working code:
- 讀 discovery notes(不是從記憶中回想)
- 逐步建構(不要一次寫完)
- 每寫一個功能就測試
- 產出:working script / plugin / automation code
Phase 7: Verify
端到端測試:
- 從零開始執行(不依賴探索時的狀態)
- 驗證每個步驟都能正確完成
- 測試 error cases(網路錯誤、auth 過期、格式錯誤)
- 如果失敗 → 回到 Phase 4 重新探索失敗的部分
STOP gate: 測試結果呈現給用戶。
Layer 2 Flow: Meta Mode
產出一個可重複使用的工具型 skill。
Phase 1: Skill Design
問用戶(用 AskUserQuestion):
- 類型:什麼類型的工具 skill?(browser / API / CLI / file / service)
- 範圍:這個 skill 要能處理哪些目標?(特定一類 vs 通用)
- 使用者:誰會用這個 skill?在什麼場景下?
- 產出:skill 執行完要產出什麼?
STOP gate: 用戶確認 skill 設計方向。
Phase 2: Structure Design
- 讀
references/exploration-methodology.md— 這是 skill 的方法論基礎 - 讀
references/dual-layer-guide.md— 確認 Layer 2 產出規格 - 設計 skill 結構:
- SKILL.md 的 phases(基於 7-Phase methodology 但客製化)
- references/ 要放什麼(target-specific gotchas, templates)
- scripts/ 要放什麼(exploration scripts, verification scripts)
Phase 3: Generate
產出完整 skill:
-
SKILL.md — 目標 ~150 行,上限 200 行
- YAML frontmatter(name, version, description, allowed-tools)
- Role identity
- Mode routing(如果有多種操作模式)
- Phase-by-phase 流程 + STOP gates
- Gotchas(至少 3 條)
- Anti-sycophancy
- Completion format
-
references/ — 外部化的知識
- target-specific 的 gotchas 和 patterns
- exploration templates
- verification checklists
-
scripts/(如果需要)
- exploration script templates
- verification scripts
STOP gate: 呈現產出的 SKILL.md 給用戶 review。列出自己的疑慮,不要說「看起來不錯」。
Phase 4: Quality Check
對產出的 skill 跑 /skill-check design(7Q)inline:
- Trigger 準確度
- 姿勢鎖定
- 流程外部化
- Gotchas 密度
- 自由度控制
- 骨架 vs 細節
- 輸出可接下一步
PASS(≥ 5/7)→ 繼續。FAIL → 修正重跑。
Phase 5: Wire Into Stack
- 確認 skill 放在正確的 repo/目錄
- 更新 routing skill(如果存在)
- 驗證 artifact flow
STOP gate: 確認 wiring 完成。
Gotchas
- Claude 猜 selector 而不是測試 — 你覺得你知道 selector 是什麼?不,你不知道。Screenshot +
page.evaluate測試才算數。每一個 selector 都必須實測驗證。 - Claude 寫 API call 不先測 — 不要寫一個完整的 API wrapper 然後才發現 auth 格式錯了。一個 endpoint 一個 endpoint 地測。
- Claude 一次建完所有東西 — 不要寫 200 行然後跑一次。一個功能一個功能地建,每個都測過才加下一個。
- Claude 忘記記錄 discovery — Discovery notes 是核心 artifact。每找到一個東西就記錄。不記錄 = 沒找到。
- Claude 跳過 verify — Phase 7 不是可選的。「我覺得應該能跑」不算驗證。跑一次,看結果。
Anti-Sycophancy
禁止:
- "This automation looks solid" — 跑 verify 了嗎?
- "The selectors should work" — 測試了嗎?
- "This API wrapper is complete" — 每個 endpoint 都試過了嗎?
- "探索完成" — checklist 都打勾了嗎?
強制動作:
- 每說「成功」之前,必須有對應的測試證據(screenshot / response / output)
- 每說「完成」之前,必須跑過 Phase 7
中斷恢復
如果 skill 執行中斷(用戶取消、context 超限、錯誤):
- 偵測狀態: Discovery notes 文件是核心狀態指標。搜尋工作目錄中的
discovery-notes*.md或*-discovery.md - 恢復點:
- 如果 discovery notes 存在且有 checklist → 讀取,從最後一個未完成(未打勾)的項目繼續
- 如果有產出的 script/plugin 但未驗證 → 從 Phase 7(Verify)繼續
- 如果有完整的 SKILL.md(Layer 2)但未 wire → 從 Phase 5(Wire Into Stack)繼續
- 什麼都沒有 → 從 Phase 1 開始
- 不重做: 不重問已確認的需求、不重新探索已記錄在 discovery notes 中的元素
- 通知用戶: 告知找到的 discovery notes 狀態,確認繼續或重新開始
Automation Quality Score (Layer 1)
| Check | 0 | 1 | 2 |
|---|---|---|---|
| Works end-to-end | Fails at some step | Works with manual intervention | Fully automated, no human step |
| Error handling | Crashes on unexpected input | Some error messages | Graceful handling + clear error messages |
| Discovery documented | No notes | Partial notes | Complete discovery notes with tested: YES for each element |
| Reproducible | Only works once/sometimes | Usually works | Consistent across multiple runs |
Pass threshold: 5/8.
Skill Quality Score (Layer 2)
Use the same generation quality checklist as /skill-gen: references/generation-quality-checklist.md equivalent.
Score the produced skill on Trigger Precision, Role Lock, Operational Gotchas, Workflow Wiring.
Pass threshold: 5/8.
Completion
Completion 萃取
報告 STATUS 前,回顧用戶在工具搭建過程中的輸入。
萃取 4 種信號(expertise / correction / preference / benchmark)到 domain-config.json。
詳見 shared/methodology/context-accumulation-guide.md。
大部分 session 不需要萃取。
STATUS: DONE
- Mode: Layer {1|2}
- Target: {target description}
- Artifacts:
- {list of files produced with paths}
- Verified: {YES/NO + test results summary}
- 推薦下一步: /skill-check review tool-builder