/ 目錄 / 演練場 / document-format-skills
● 社群 KaguraNanaga ⚡ 即開即用

document-format-skills

作者 KaguraNanaga · KaguraNanaga/document-format-skills

將中文 .docx 檔案格式化為中國政府/學術/法律標準——使用 python-docx 修正縮排、標點、字體、編號。

專為中文 Word 文件格式化設計的 Claude Code 技能。可偵測中英文標點混用、字體不一致及間距問題,並套用三種樣式預設之一:GB/T 9704-2012 公文、學術論文或法律文書。以 Python 實作,依賴 python-docx。

為什麼要用

核心特性

即時演示

實際使用效果

document-format-skill.replay ▶ 就緒
0/0

安裝

選擇你的客戶端

~/Library/Application Support/Claude/claude_desktop_config.json  · Windows: %APPDATA%\Claude\claude_desktop_config.json
{
  "mcpServers": {
    "document-format-skill": {
      "command": "git",
      "args": [
        "clone",
        "https://github.com/KaguraNanaga/document-format-skills",
        "~/.claude/skills/document-format-skills"
      ],
      "_inferred": true
    }
  }
}

開啟 Claude Desktop → Settings → Developer → Edit Config。儲存後重啟應用。

~/.cursor/mcp.json · .cursor/mcp.json
{
  "mcpServers": {
    "document-format-skill": {
      "command": "git",
      "args": [
        "clone",
        "https://github.com/KaguraNanaga/document-format-skills",
        "~/.claude/skills/document-format-skills"
      ],
      "_inferred": true
    }
  }
}

Cursor 使用與 Claude Desktop 相同的 mcpServers 格式。專案級設定優先於全域。

VS Code → Cline → MCP Servers → Edit
{
  "mcpServers": {
    "document-format-skill": {
      "command": "git",
      "args": [
        "clone",
        "https://github.com/KaguraNanaga/document-format-skills",
        "~/.claude/skills/document-format-skills"
      ],
      "_inferred": true
    }
  }
}

點擊 Cline 側欄中的 MCP Servers 圖示,然後選 "Edit Configuration"。

~/.codeium/windsurf/mcp_config.json
{
  "mcpServers": {
    "document-format-skill": {
      "command": "git",
      "args": [
        "clone",
        "https://github.com/KaguraNanaga/document-format-skills",
        "~/.claude/skills/document-format-skills"
      ],
      "_inferred": true
    }
  }
}

格式與 Claude Desktop 相同。重啟 Windsurf 生效。

~/.continue/config.json
{
  "mcpServers": [
    {
      "name": "document-format-skill",
      "command": "git",
      "args": [
        "clone",
        "https://github.com/KaguraNanaga/document-format-skills",
        "~/.claude/skills/document-format-skills"
      ]
    }
  ]
}

Continue 使用伺服器物件陣列,而非映射。

~/.config/zed/settings.json
{
  "context_servers": {
    "document-format-skill": {
      "command": {
        "path": "git",
        "args": [
          "clone",
          "https://github.com/KaguraNanaga/document-format-skills",
          "~/.claude/skills/document-format-skills"
        ]
      }
    }
  }
}

加入 context_servers。Zed 儲存後熱重載。

claude mcp add document-format-skill -- git clone https://github.com/KaguraNanaga/document-format-skills ~/.claude/skills/document-format-skills

一行命令搞定。用 claude mcp list 驗證,claude mcp remove 移除。

使用場景

實戰用法: document-format-skills

將政府報告格式化為 GB/T 9704-2012 標準

👤 中國政府/國有企業員工、文書人員 ⏱ ~15 min beginner

何時使用: 當您收到公文草稿,需要通過公文處理審查時。

前置條件
  • 已安裝 Python 3 + python-docx — pip install python-docx
  • 已複製技能 — git clone https://github.com/KaguraNanaga/document-format-skills ~/.claude/skills/document-format-skills
步驟
  1. 先進行分析
    分析 report.docx 的格式問題,按 GB/T 9704-2012 標準列出所有偏差。✓ 已複製
    → 依類別分組列出的偏差清單
  2. 套用預設
    按公文標準自動修復,保留原內容。輸出到 report-fixed.docx。✓ 已複製
    → 產生新檔案,並列印差異摘要

結果: 報告可通過內部格式審查,無需手動重新排版。

注意事項
  • 複雜表格可能渲染錯誤 — 請手動檢查表格——此技能對表格處理較為保守
搭配使用: filesystem

清理中文學術論文的標點與格式

👤 中文系研究生與研究人員 ⏱ ~20 min beginner

何時使用: 在投稿至有嚴格標點規範的中文期刊之前。

步驟
  1. 標點修正
    修正 paper.docx 中所有中英文標點混用問題,統一為中文全形標點。✓ 已複製
    → 所有 ( 和 , 均已正規化
  2. 套用學術預設
    按學術論文標準套用格式預設。✓ 已複製
    → 標題、縮排、行距一致

結果: 可直接投稿的論文。

注意事項
  • 程式碼區塊或英文引用可能被過度轉換 — 請指示技能保留純英文段落——指定要排除的區段範圍

組合

與其他 MCP 搭配,撬動十倍槓桿

document-format-skill + filesystem

批次格式化資料夾中的所有 .docx 檔案

遍歷 reports/ 下所有 .docx,全部按公文標準格式化,輸出到 reports-fixed/。✓ 已複製

工具

此 MCP 暴露的能力

工具輸入參數何時呼叫成本
analyze_format path to .docx 套用任何變更之前 0 — local
fix_punctuation path, target (cn|mixed) 統一中英文標點時使用 0
apply_preset path, preset (gov|academic|legal) 分析完成後,執行主要格式轉換 0

成本與限制

運行它的成本

API 配額
None
每次呼叫 Token 數
極少——此技能主要驅動 Python 腳本執行
費用
Free
提示
先執行一次 analyze_format,再執行 apply_preset——不要讓 Claude 逐 token 手動完成格式化

安全

權限、密鑰、影響範圍

憑證儲存:
資料出站: 無——完全透過 python-docx 在本機執行

故障排查

常見錯誤與修復

ModuleNotFoundError: python-docx

pip install python-docx

驗證: python -c 'import docx'
Tables misrender after formatting

還原後以排除表格的方式重新執行預設

Fonts missing on the final machine

預設使用宋體/仿宋/黑體——請在開啟檔案的系統上安裝中文字型

驗證: fc-list :lang=zh

替代方案

document-format-skills 對比其他方案

替代方案何時用它替代權衡
Manual Word styles單次文件處理,且您已熟悉 Word 操作無法批次處理,容易產生格式不一致

更多

資源

📖 閱讀 GitHub 上的官方 README

🐙 查看未解決的 issue

🔍 瀏覽全部 400+ MCP 伺服器和 Skills