taiwan-legal-plugin 完整教學
把 Claude Code 變成「會查台灣裁判書與法規」的法律助理 — 安裝、使用、設計理念、資安審查全套說明。
1. 專案定位
1.1 一句話總結
taiwan-legal-plugin 是一個 Claude Code plugin marketplace,讓 Claude 直接在 IDE / chat 中查詢三個台灣公開法律資料來源:裁判書、法規、(v0.2 預計)憲法法庭釋字。
1.2 它解決什麼問題?
法律研究者的常見痛點:
- 跳離工作流:寫意見書時要切到瀏覽器查 law.moj.gov.tw、judicial.gov.tw,逐字複製貼上
- AI 幻覺風險:直接問通用 LLM 法律問題,回答可能引用「不存在的判決」或「過時條文」
- 重複設定:每次研究都要重複講「我只看最高法院近 5 年民事判決」之類的研究範圍
taiwan-legal-plugin 的解法:
- Plugin 化:透過
/taiwan-legal:judgment-search等 slash command 直接在 Claude Code 內叫用,不離開工作環境 - Source-grounded:每筆結果都附
字號 + 法院 + 日期 + URL,AI 一律 verbatim 引用判決 / 條文,不做未經詢問的改寫 - Practice profile:
cold-start-interview一次設定研究預設值,其他 skill 自動載入
1.3 與類似工具的差異
| 比較對象 | 差異 |
|---|---|
| 通用 LLM (ChatGPT / Claude.ai 直接問) | 沒有 source-grounding,會產生幻覺判決 |
| Lawsnote / 法源法律網 (商業) | 付費;沒有 LLM 整合介面 |
| 自己 scrape judgment.judicial.gov.tw | 司法院有 F5 WAF;要自己處理反爬蟲;無 MCP 介面 |
| 直接呼叫 mcp-taiwan-legal-db | 沒有 skill 包裝;每次要手動寫 prompt 告知 LLM 怎麼引用 |
1.4 適合誰
- ✅ 律師 / 法務 / 訴代:需要快速查歷年判決趨勢、找特定字號全文、查條文最新版本
- ✅ 法律研究者 / 學者:做實證法學、判決趨勢分析、條文修法沿革整理
- ✅ 法律系學生:寫期末報告、準備國考、查指定判決
- ✅ Legal Tech 工程師:要把台灣法律資料接到自家產品 LLM workflow
- ❌ 一般民眾尋求法律意見:plugin 設計上明確拒絕提供法律建議;只給研究素材
2. 安裝指南
2.1 環境前提
| 元件 | 版本 | 說明 |
|---|---|---|
| Claude Code | 最新版 | 桌面 / VS Code / JetBrains 任一即可 |
| Python | 3.10 / 3.11 / 3.12 | 安裝底層 MCP server 用 |
| pip | 任意版本 | 套件安裝;建議用 uv 隔離 |
2.2 安裝步驟
步驟 1:在 Claude Code 內加入 marketplace
1/plugin marketplace add github:lawchat-oss/taiwan-legal-plugin
步驟 2:安裝 plugin
1/plugin install taiwan-legal@taiwan-legal-plugin
安裝完重啟 Claude Code(讓新 MCP 宣告生效)。
步驟 3:安裝底層 MCP server
1pip install mcp-taiwan-legal-db
若 PyPI 尚未上架,可改用 git 安裝:
1pip install git+https://github.com/lawchat-oss/mcp-taiwan-legal-db.git@v1.0.0
建議:用 uv 隔離(避免 pip 污染系統 Python):
1uv tool install mcp-taiwan-legal-db
2# 確認 mcp-taiwan-legal-db 在 PATH 中
3which mcp-taiwan-legal-db
步驟 4:(強烈建議)執行 cold-start interview 設定預設值
1/taiwan-legal:cold-start-interview
會問你 6 題(法院層級、審判庭、日期範圍、引用格式、是否排除廢止法規、固定研究範圍),最後寫入:
1~/.claude/plugins/config/taiwan-legal-plugin/taiwan-legal/CLAUDE.md
之後每次跑 judgment-search / statute-lookup 都會自動讀此檔。
2.3 安裝後驗證
在 Claude Code 內試打:
1/taiwan-legal:statute-lookup 民法 184
預期收到:
- 民法第 184 條侵權行為條文全文(兩項)
- 出處 URL:
https://law.moj.gov.tw/LawClass/LawSingle.aspx?pcode=B0000001&flno=184 - 末尾:「Confidence: high (canonical lookup). This is not legal advice…」
如果報錯 mcp-taiwan-legal-db: command not found,回到步驟 3 確認 MCP server 在 PATH。
3. 核心架構解析
3.1 整體分層
1使用者 (Claude Code 內)
2 │
3 ▼
4Slash command: /taiwan-legal:judgment-search 等 3 個
5 │
6 ▼ (skill 內 instructions 引導 LLM 呼叫 MCP)
7MCP server: taiwan-legal-db (stdio transport)
8 │
9 ▼ (httpx + Playwright 混合策略繞 F5 WAF)
10資料來源 (公開):
11- judgment.judicial.gov.tw (裁判書)
12- law.moj.gov.tw (全國法規)
13- cons.judicial.gov.tw (憲法法庭,v0.2)
關鍵設計:plugin 本身不存資料。所有查詢即時打官方 portal,避免「資料過期」與「資料權問題」。
3.2 檔案結構
1taiwan-legal-plugin/
2├── .claude-plugin/
3│ └── marketplace.json # marketplace 宣告 (1 個 plugin)
4├── README.md / README.en.md # 雙語說明
5├── qa-report.md # 作者自我評估報告
6├── LICENSE # MIT
7└── taiwan-legal/ # 唯一一個 plugin
8 ├── .claude-plugin/
9 │ └── plugin.json # plugin metadata (name, version, description)
10 ├── .mcp.json # MCP server 宣告 (stdio → mcp-taiwan-legal-db)
11 ├── README.md # plugin 內說明
12 └── skills/ # 3 個 skill (v0.1)
13 ├── cold-start-interview/SKILL.md
14 ├── judgment-search/SKILL.md
15 └── statute-lookup/SKILL.md
3.3 三個 skill 的職責切分
| Skill | 觸發時機 | 讀什麼 | 寫什麼 |
|---|---|---|---|
cold-start-interview | 首次安裝 / 想更新預設 | 使用者互動回答 | 寫 ~/.claude/plugins/config/taiwan-legal-plugin/taiwan-legal/CLAUDE.md |
judgment-search | 想查裁判書 / 字號 / 全文 | 讀 profile + 呼叫 search_judgments / get_judgment MCP | 不寫檔案 |
statute-lookup | 想查法規 / 條號 / 關鍵字 | 讀 profile + 呼叫 get_pcode / query_regulation / search_regulations MCP | 不寫檔案 |
3.4 為什麼分三個 skill 而不是一個?
從 SKILL.md 與 qa-report.md 可看出設計理念:
- Audience 一致但 Work Shape 不同:cold-start 是 interactive configuration,另外兩個是 retrieval-and-quote。混在一起 frontmatter description 會超過 Claude 的觸發判斷準確度
- Work Shape 對應不同 confidence band 規則:cold-start 不需要 confidence;search/lookup 各自有獨立 high/medium/low 定義
- Failure mode 對齊:search/lookup 都要面對「privilege content 偵測」、「不取代律師」這些 legal-specific failure modes;cold-start 不需要
3.5 Practice profile 機制
這是 plugin 內 multi-skill coordination 的核心模式:
1cold-start-interview --[寫]→ ~/.claude/plugins/config/.../CLAUDE.md
2 │
3 ▼ [讀]
4 judgment-search / statute-lookup
5 (skill 開頭第 1 步固定動作)
Profile 內容範例(給開發者參考):
1# taiwan-legal practice profile
2
3## Judgment search defaults
4- court_levels: [最高法院, 智慧財產及商業法院]
5- divisions: [民事, 行政]
6- default_date_window: "last 10 years"
7
8## Statute lookup defaults
9- exclude_abolished: true
10
11## Citation style
12- style: "完整版 (字號 + 法院 + 日期 + URL)"
13
14## Standing scope
15- subjects: "智慧財產"
為什麼這個 pattern 重要? 它讓「個人化偏好」獨立於 plugin code 之外,每個使用者本機保留自己的 profile,重灌 plugin 不會清空、跨 device 可用 dotfiles 同步管理。
4. Helper Scripts / 配置檔詳細用法
注意:本 plugin 沒有自有的 .py / .sh helper script,所有「執行邏輯」都在底層
mcp-taiwan-legal-dbMCP server 內。本節改為說明 plugin 內三個關鍵配置檔。
4.1 taiwan-legal/.mcp.json
1{
2 "mcpServers": {
3 "taiwan-legal-db": {
4 "type": "stdio",
5 "command": "mcp-taiwan-legal-db",
6 "title": "Taiwan Legal Database",
7 "description": "Stdio MCP server exposing eight tools..."
8 }
9 }
10}
| 欄位 | 用途 |
|---|---|
type: "stdio" | 用標準輸入/輸出傳遞 JSON-RPC,不開 socket,最低權限 |
command: "mcp-taiwan-legal-db" | 從 PATH 找執行檔;安裝失敗時 plugin 一律拋錯停機,不靜默降級 |
title / description | 給 Claude 用的人類可讀說明,影響 LLM 是否選擇此 server |
自訂方式:若你 fork 並改用本地路徑,可改成 "command": "/abs/path/to/mcp-taiwan-legal-db"。
4.2 taiwan-legal/.claude-plugin/plugin.json
1{
2 "name": "taiwan-legal",
3 "version": "0.1.0",
4 "description": "Access layer for Taiwan legal open data...",
5 "author": { "name": "LawChat OSS" }
6}
升級規則:API breaking change → bump major;新增 skill → bump minor;bug fix → bump patch。v0.x 期間視為實驗版。
4.3 .claude-plugin/marketplace.json (root)
1{
2 "name": "taiwan-legal-plugin",
3 "owner": { "name": "LawChat OSS" },
4 "plugins": [
5 { "name": "taiwan-legal", "source": "./taiwan-legal", ... }
6 ]
7}
之所以 marketplace 與 plugin 是 1:1,是為未來開新 plugin(例如 taiwan-interpretation 大法官解釋)時,不用再建一個 marketplace;同 maintainer 可在同個 marketplace 增加 entry。
5. 應用場景
5.1 Workflow A — 訴訟前判決趨勢蒐集
律師接到「不當得利返還消滅時效」案,想看最高法院近 5 年類似判決趨勢
1/taiwan-legal:judgment-search 找最高法院近五年關於「不當得利返還請求權消滅時效」的民事判決
預期輸出:表格 (字號 + 法院 + 日期 + 案由 + URL) → 接著問「讀 109 年度台上字第 1234 號 全文」即可拉全文。
5.2 Workflow B — 訴狀引用條文最新版確認
寫上訴狀要引民法第 184 條,怕條文已改
1/taiwan-legal:statute-lookup 民法 184 條 全文 + 引用
回傳第 1 項 + 第 2 項全文 + 出處 URL + 「retrieval time」時間戳,可貼進訴狀後加註「最後確認日:YYYY-MM-DD」。
5.3 Workflow C — 學期報告:判決字號清單匯出
學生要做「智財商業法院 設計專利 判決趨勢」期末報告
1/taiwan-legal:cold-start-interview
2# 設定:court_levels=[智慧財產及商業法院], 範圍=last 10 years, 標的=智慧財產
3
4/taiwan-legal:judgment-search 設計專利 侵害排除請求
得到表格後請 Claude 「以 markdown 表格輸出,欄位:字號 / 日期 / 案由 / 主文摘要」,可直接貼進 Word / Notion。
5.4 Workflow D — Legal Tech 產品整合
自家 Legal Tech 產品想接台灣法律資料
兩個方向:
- 直接用 plugin:產品介面是 Claude Code base / Anthropic SDK 整合,安裝 plugin 即可
- 直接呼叫 MCP server:跳過 Claude,自家 LLM 直接用
mcp-taiwan-legal-db;plugin 只是 Claude 專用包裝
6. 資安掃描報告
本節由 AI Knowledge Template 自動掃描,並交叉比對作者
qa-report.md自我宣稱。
6.1 整體風險等級
🟢 低風險(可放心安裝)
6.2 詳細掃描結果
| 風險面向 | 掃描方法 | 結果 |
|---|---|---|
命令執行 (eval / exec / shell=True / os.system) | grep 全 repo | 無,全 repo 沒有任何 .py / .sh 程式碼 |
網路請求 (curl / wget / urlopen / requests) | grep | 無;外部請求僅透過已宣告 MCP server |
Hooks 與自動觸發 (hooks/hooks.json / PreToolUse / PostToolUse) | 全檔搜尋 | 無;3 個 skill 皆無 hook |
權限工具 grants (Bash / WebFetch / WebSearch 在 frontmatter) | grep SKILL.md | 無;3 個 skill frontmatter 都沒有 allowed-tools |
| 隱藏字元 / Unicode 攻擊 (zero-width / RLO override) | grep -P [\\x{200B}-\\x{200F}] | 無 |
機密 / 憑證 (API_KEY / password / token) | grep | 無;plugin 不需任何 API key |
| 任意檔案寫入 | 程式碼路徑稽核 | 唯一寫入 ~/.claude/plugins/config/taiwan-legal-plugin/taiwan-legal/CLAUDE.md (cold-start-interview 寫,其他 skill 只讀) |
| 外部 URL 白名單 | 列舉所有 URL | 僅 3 個官方 portal:judgment.judicial.gov.tw / law.moj.gov.tw / cons.judicial.gov.tw |
| Prompt injection 模式 | 10 類 heuristic | 作者已自掃且我交叉驗證:override-instructions / authority-claims / config-override / out-of-scope-reads / out-of-scope-writes / external-URLs / hidden-content / shell-execution / credential-asks / legal-overclaiming 皆無 |
6.3 信任邊界
1[絕對信任] plugin 內 3 個 SKILL.md (純文字 instructions,無執行能力)
2[條件信任] ↓
3 mcp-taiwan-legal-db (Python 套件,需另外安裝;獨立 repo + 獨立 audit)
4[不信任] ↓
5 judgment.judicial.gov.tw / law.moj.gov.tw 回應內容 (verbatim quote 但不執行)
唯一需要額外信任的環節:底層 mcp-taiwan-legal-db Python 套件。建議:
- 看
mcp-taiwan-legal-db的pyproject.toml確認依賴 - 若高度敏感環境,可用
uv tool install --no-binary強制從原始碼裝 - 配合
pip-audit定期檢查 CVE
6.4 作者自我審查的可信度評估
qa-report.md 對 13 個 Legal Skill Design Framework 設計參數做了完整評估,所有項目自評 ✅ READY。本次掃描交叉驗證後,未發現任何作者過度宣稱或隱藏項目,可信度高。
提醒:作者自我評估不取代 runtime QA。Anthropic 的
legal-builder-hub提供獨立/legal-builder-hub:skills-qa,使用者安裝時可再跑一次。
7. FAQ
Q1:為什麼安裝後 /taiwan-legal:judgment-search 報錯找不到 MCP?
A:忘了重啟 Claude Code。.mcp.json 是啟動時讀取,安裝後一定要重啟。
Q2:pip install mcp-taiwan-legal-db 失敗怎麼辦?
A:先試 git 安裝:pip install git+https://github.com/lawchat-oss/mcp-taiwan-legal-db.git@v1.0.0。建議用 uv tool install 隔離 Python 環境。
Q3:可以查憲法法庭釋字 / 憲判字嗎?
A:v0.1 尚未開放,底層 MCP server 已就緒,預計 v0.2 暴露為 taiwan-interpretation-lookup skill。
Q4:為什麼 skill 不直接幫我寫法律意見書? A:設計上明確拒絕。每份 SKILL.md 都有「This skill does NOT provide legal advice」聲明;給的是研究素材(搜尋結果 + verbatim 條文 / 判決),意見書由律師寫。
Q5:搜尋結果為何有時是 0 筆? A:兩個常見原因:
- 司法院 portal 的 F5 WAF 擋住請求(MCP server 會 retry 一次)
- 關鍵字過於精確(試 broaden);或日期 / 法院 / 審判庭限制太緊
按 SKILL.md 設計,0 筆時 plugin 不會虛構結果,會明確告知並建議放寬範圍。
Q6:可以離線查嗎? A:不行。所有查詢即時打官方 portal。底層 MCP server 對少量公開資料(如釋字理由書)有快取,但設計上以即時取得為主。
Q7:可以匯出查詢結果嗎? A:可以請 Claude 把表格存成 .csv / .md / .json;plugin 本身不負責匯出,由 Claude Code 一般檔案操作能力處理。
Q8:跟 anthropics/claude-for-legal 有什麼關係?
A:本 plugin 是 claude-for-legal 生態內的台灣管道。claude-for-legal 主要聚焦美國法律(聯邦 + 各州 case law),本 plugin 補上台灣資料來源。設計準則同樣遵循 Legal Skill Design Framework v0.1。
8. 進階技巧
8.1 自訂 practice profile(不跑 cold-start)
直接編輯 ~/.claude/plugins/config/taiwan-legal-plugin/taiwan-legal/CLAUDE.md,依 cold-start 寫入的格式即可。適合用 dotfiles 管理多台機器設定。
8.2 建立自家 plugin marketplace 並 fork
1gh repo fork lawchat-oss/taiwan-legal-plugin --clone
2cd taiwan-legal-plugin
3# 改 .claude-plugin/marketplace.json 的 name + owner
4# 改 taiwan-legal/.claude-plugin/plugin.json 的 name + version
5git push
之後在 Claude Code:/plugin marketplace add github:<your-org>/<your-fork>。適合事務所內部 fork 加入自家 skill(例如「事務所訴狀模板抓取」)。
8.3 與其他 Claude plugin 組合
- 配
paper-search:學術文獻 + 判決交叉檢索 - 配
kami/quarkdown:研究結果直接輸出 PDF / HTML 報告 - 配
notebooklm:把研究的判決批次餵進 NotebookLM 問答
8.4 Debug MCP server 連線問題
1# 直接手動跑 MCP server,看是否能啟動
2mcp-taiwan-legal-db
3# 預期:等 stdio 輸入;按 Ctrl+C 可離開
4
5# 看 Claude Code 啟動 log
6tail -f ~/.claude/logs/mcp-*.log
9. 整合進其他工作流
9.1 與 gh-tutorial-qd 合作
如果你想把研究的判決或條文,整理成可分享的 PDF / HTML 報告,可以:
- 用
judgment-search/statute-lookup蒐集素材 - 請 Claude 整理成 markdown,存到
inbox/ - 走
qd from: <md路徑> as report編譯成 HTML - (選用)
kami build:進一步轉 PDF
9.2 與 paper-search 合作
跨檢索「學術文獻 + 判決字號」做實證法學研究:
paper:找學術論文(A 類 + C 類資料庫)/taiwan-legal:judgment-search找判決- 用
graphify把兩邊建知識圖
9.3 與 NotebookLM 合作
把判決全文批次匯入 NotebookLM 做主題式問答:
1/taiwan-legal:judgment-search ... # 蒐集 10 個判決字號
2# 請 Claude 一個個 get_judgment 取全文,存成 md 到 projects/<topic>/judgments/
3nlm: projects/<topic>/judgments/
10. 重點摘要 Checklist
- 這是 Claude Code plugin,不是 standalone 程式 — 安裝必經
/plugin marketplace add+/plugin install - 底層 MCP server 要另外裝:
pip install mcp-taiwan-legal-db - 首次使用先跑 cold-start-interview 設定 practice profile
- 資料即時取自官方 portal,沒有本地大批次資料庫
- 設計上明確拒絕提供法律意見,僅提供 verbatim quote + 引用元資料
- 資安等級 🟢 低風險:無 hooks / 無 Bash / 無 WebFetch / 唯一檔案寫入限定 plugin config 路徑
- v0.2 規劃:
taiwan-interpretation-lookup(大法官解釋 / 憲判字 + 引用關係圖譜) - 遵循 Legal Skill Design Framework v0.1:13 個設計參數 + 3 個 legal-specific failure modes 全部 READY
11. 進一步閱讀
- 主 repo:
lawchat-oss/taiwan-legal-plugin - 底層 MCP server:
lawchat-oss/mcp-taiwan-legal-db - 設計框架:
anthropics/claude-for-legal— Legal Skill Design Framework v0.1 - 作者自評:本 repo 內
qa-report.md - Claude Code plugin 文件:https://docs.claude.com/claude-code/plugins
- 資料來源:
- 司法院裁判書系統 https://judgment.judicial.gov.tw
- 全國法規資料庫 https://law.moj.gov.tw
- 憲法法庭裁判 https://cons.judicial.gov.tw
免責聲明:本教學由 AI Knowledge Template 自動產生,內容僅供技術安裝與 plugin 使用說明之用,不構成法律意見。實際法律問題請諮詢律師。
Comments