Agent 技能
即插即用的技能,適用於 Claude Code、Codex 等 agent 環境。
TypeSafe agent 技能讓你的 AI 程式設計 agent 完整掌握 TypeSafe API:三種問題型別、架構模式,以及組織評估的最佳實踐。
安裝
在終端裡執行這兩條命令:
claude plugin marketplace add typesafe-ai/skills
claude plugin install typesafe@typesafe-ainpx skills add typesafe-ai/skills --skill typesafe-ai出現提示時選擇你的 agent。安裝預設只對當前專案生效;加 -g 可全域性安裝。
把下面這段提示詞貼上進你的程式設計 agent:
Install the TypeSafe skill. If you're in Claude Code, run `claude plugin marketplace add typesafe-ai/skills`, then `claude plugin install typesafe@typesafe-ai`. If you're in another agent, run `npx skills add typesafe-ai/skills --skill typesafe-ai` and select your agent. Use one installation method. You can read the skill directly at https://github.com/typesafe-ai/skills/blob/main/skills/typesafe-ai/SKILL.md (raw: https://raw.githubusercontent.com/typesafe-ai/skills/main/skills/typesafe-ai/SKILL.md). Then use the TypeSafe skill when working on this project.讀 GitHub 上的 SKILL.md,或直接獲取原始 Markdown。手動安裝時,把整個 skills/typesafe-ai 目錄(含其中的參考檔案)複製到你的 agent 的 skills 目錄。
只選一種安裝方式,避免出現重複副本。
更新
Claude Code 外掛執行:
claude plugin marketplace update typesafe-ai
claude plugin update typesafe@typesafe-ai
重啟 Claude Code,或執行 /reload-plugins 載入更新。想啟用自動更新,開啟 /plugin,選擇 Marketplaces → typesafe-ai → Enable auto-update。
用 skills.sh 安裝的,執行 npx skills update。手動複製的,用 GitHub 上的最新版本替換整個技能目錄。
示例提示詞
在提示詞裡點名這個技能 —— 比如「use the TypeSafe skill」—— 在任何 agent 裡都管用,所以下面每條提示詞都這麼寫。用 Claude Code 外掛時,你也可以直接呼叫 /typesafe:typesafe-ai。
-
可以先從頭腦風暴式的提示詞入手,幫你找出專案裡最適合用 TypeSafe 的地方。
Using the TypeSafe skill, explore the project and find opportunities for using intelligent judgement to stand in for complex parsing or other fragile code. -
你也可以建立一個 API 金鑰,讓 agent 通過跑一些便宜的測試查詢,自己找出使用 TypeSafe 的最佳方式。
Using the TypeSafe skill, run some experiments using the TypeSafe API key that I've exported to `TYPESAFE_API_KEY`. Propose changes based on the most promising results. -
把你的 agent 指向某個具體的 cookbook,來解決你程式碼庫裡的某個問題;或者指向 cookbooks 索引,問它有沒有和你專案裡相似的模式。
Using the TypeSafe skill, analyze my code and see if there are any applicable cookbooks (https://console.typesafe.ai/docs/cookbooks) that show how I could refactor my code to be less fragile or complex.
良好的 vibe coding 原則
- 先和你的 agent 聊清楚,把上面的示例提示詞當作起點。
- 實現之前先審閱方案,確認它講得通。
- 把常量(問題和閾值)集中放在一處,方便審閱。agent 寫問題並不擅長,做好和它一起改的準備。
- 不要照單全收它的斷言;讓 agent 驗證自己的假設。
常見問題
agent 沒有使用這個技能
用 Claude Code 外掛時,呼叫 /typesafe:typesafe-ai。在其它 agent 裡,讓它「use the TypeSafe skill」。如果還是沒載入,確認安裝器指向的是你在用的 agent,然後重啟 agent。
路由表現和預期不符
檢查問題和閾值。有可能閾值設得太高(導致漏判),也可能設得太低(導致誤判)。你可能還需要把問題改得更具體些。
到處都在用置信度閾值
如果你只想選出最佳選項,只需要選置信度最高的那個(而不是設一個置信度閾值)。如果你心裡有特定的統計算法,那大概應該用機率而不是置信度。
TypeSafe 程式碼不好審閱
人最該審閱的是問題和 TypeSafe 程式碼裡用到的閾值常量。它們應該定義在同一個程式碼檔案裡,這樣不用到處翻就能找到。
agent 編造請求或響應欄位
技能版本太舊會導致這個問題。按上面的安裝方式更新它,再重試。