mcpField
D
document-polisher

document-polisher

github.com/promptadvisers文档处理1966 次安装47 周前更新
代码仓库

关于 document-polisher

面向需要整理 DOCX 文档的用户,提供按 10 种品牌风格应用排版的技能。它使用 python-docx 创建新文件,并保留标题、列表、文字格式和表格。

主要功能

  1. 01提供 10 种品牌风格
  2. 02应用字体、颜色与页面边距
  3. 03保留标题、列表和文字格式
  4. 04复制并设置表格样式
  5. 05将结果保存为新文件

适用场景

  1. 01按品牌风格整理商业报告
  2. 02为技术文档应用统一排版
  3. 03将指南转换为指定品牌样式

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/promptadvisers/claude-code-polished-documents-skills --skill document-polisher

安装后在 Claude Code 中输入/document-polisher确认已加载。

包含的文件

除 SKILL.md 外,安装时一起下载的参考资料和脚本。

brands/
apple.md
deloitte.md
economist.md
figma.md
ibm.md
kpmg.md
linear.md
mckinsey.md
notion.md
stripe.md
scripts/
apply_brand.py
templates/
brand-mapping.json

详细介绍

文档润色器

运用世界一流的品牌美学,将任何文档打造成精致、专业的杰作。

概览

这项技能将精心挑选的 10 个品牌的高端风格应用于 DOCX 文档。我们对每个品牌的字体、配色方案和设计原则进行了分析,以打造出真实的品牌风格文档。

品牌选择菜单

当用户想要润色文档时,务必显示此选择菜单:

╔══════════════════════════════════════════════════════════════════════════╗
║                        DOCUMENT POLISHER                                 ║
║                    Select Your Brand Style                               ║
╠══════════════════════════════════════════════════════════════════════════╣
║                                                                          ║
║  EDITORIAL                                                               ║
║  ─────────                                                               ║
║  1. The Economist    │ Deep navy + serif typography                      ║
║                      │ Best for: Reports, analysis, thought leadership   ║
║                                                                          ║
║  CONSULTING                                                              ║
║  ──────────                                                              ║
║  2. McKinsey         │ Sharp corners + bold blue accents                 ║
║                      │ Best for: Strategy decks, executive summaries     ║
║                                                                          ║
║  3. Deloitte         │ Teal-blue + pill-shaped elements                  ║
║                      │ Best for: Audits, assessments, formal reports     ║
║                                                                          ║
║  4. KPMG             │ Two-tone blue + condensed headings                ║
║                      │ Best for: Financial reports, compliance docs      ║
║                                                                          ║
║  TECH                                                                    ║
║  ────                                                                    ║
║  5. Stripe           │ Dark blue + purple gradients                      ║
║                      │ Best for: API docs, developer guides, specs       ║
║                                                                          ║
║  6. Apple            │ Minimalist + generous whitespace                  ║
║                      │ Best for: Product docs, user guides               ║
║                                                                          ║
║  7. IBM              │ Plex typography + Carbon design                   ║
║                      │ Best for: Technical docs, enterprise reports      ║
║                                                                          ║
║  8. Linear           │ Modern purple + precise typography                ║
║                      │ Best for: Product specs, changelogs, dev docs     ║
║                                                                          ║
║  PRODUCTIVITY                                                            ║
║  ────────────                                                            ║
║  9. Notion           │ Clean blue + subtle accents                       ║
║                      │ Best for: Wikis, project plans, documentation     ║
║                                                                          ║
║  DESIGN                                                                  ║
║  ──────────                                                              ║
║  10. Figma           │ Vibrant multi-color palette                       ║
║                      │ Best for: Creative briefs, design docs, brands    ║
║                                                                          ║
╚══════════════════════════════════════════════════════════════════════════╝

工作流

第 1 步:询问用户

当用户想要润色文档时:

  1. 显示上方的品牌选择菜单
  2. 询问:“您想应用哪种品牌风格?也可以告诉我文档的用途,我会为您推荐一种风格。”
第 2 步:应用样式

重要:务必使用基于 Python 的脚本和 python-docx。切勿直接操作 XML/OOXML,否则可能损坏文档。

主要方法:Python 脚本(必需)

该脚本使用 python-docx 安全地重新创建文档并应用品牌样式。它会:

  • 读取源文档
  • 创建应用了品牌样式的新文档
  • 以适当的格式复制所有内容
  • 保留粗体、斜体、列表和结构
# Ensure python-docx is installed in the environment
pip install python-docx

# Apply brand styling
python scripts/apply_brand.py <input.docx> <brand_name> <output.docx>

# Examples:
python scripts/apply_brand.py report.docx economist polished_report.docx
python scripts/apply_brand.py proposal.docx mckinsey styled_proposal.docx
python scripts/apply_brand.py guide.docx stripe tech_guide.docx
可用品牌名称:
  • economist - The Economist(编辑风格、衬线字体)
  • mckinsey - McKinsey & Company(咨询风格、简洁利落)
  • deloitte - Deloitte(咨询风格、青绿色)
  • kpmg - KPMG(咨询风格、醒目的蓝色)
  • stripe - Stripe(科技风格、深蓝色/紫色)
  • apple - Apple(科技风格、极简)
  • ibm - IBM(科技风格、企业风格)
  • notion - Notion(效率工具风格、简洁)
  • linear - Linear(科技风格、现代紫色)
  • figma - Figma(设计风格、色彩丰富)
脚本的功能
  1. 加载品牌配置,来源为 templates/brand-mapping.json
  2. 创建全新文档(避免 XML 编辑导致的损坏)
  3. 应用文档级样式:
    • 正文样式(字体、字号、颜色)
    • 标题 1、2、3 样式(字体、字号、颜色、间距)
    • 标题样式
    • 页边距
  4. 按格式复制内容:
    • 保留正确级别的标题
    • 保留项目符号列表和编号列表
    • 保留粗体、斜体、下划线格式
    • 保留段落对齐方式
    • 复制并设置表格样式
  5. 另存为新文件(绝不覆盖原文件)

品牌参考文件

详细的品牌指南存放在 brands/ 目录中:

品牌参考文件关键元素
The Economistbrands/economist.mdGeorgia 衬线字体、#1F2E7A 藏青色、极简边框
McKinseybrands/mckinsey.mdHelvetica Neue、#051C2C 深色、利落直角
Deloittebrands/deloitte.mdOpen Sans、#007CB0 青绿色、圆角元素
KPMGbrands/kpmg.mdOpen Sans、#1E49E2 蓝色
Stripebrands/stripe.mdHelvetica Neue、#0A2540 + #9966FF 紫色
Applebrands/apple.mdHelvetica Neue、#0071E3 蓝色、极简
IBMbrands/ibm.mdArial、#0F62FE 蓝色、利落直角
Notionbrands/notion.mdArial、#0075DE 蓝色、块状布局
Linearbrands/linear.mdArial、#5E6AD2 紫色、现代风格
Figmabrands/figma.mdArial、多色调色板

样式映射

templates/brand-mapping.json 文件包含用于程序化设置样式的结构化数据:

{
  "brands": {
    "economist": {
      "name": "The Economist",
      "colors": {
        "primary": "#1F2E7A",
        "accent": "#E3120B",
        "textPrimary": "#0D0D0D"
      },
      "typography": {
        "headingFont": "Georgia",
        "bodyFont": "Georgia"
      },
      "styles": {
        "h1": { "size": 28, "color": "#1F2E7A", "bold": true },
        "h2": { "size": 22, "color": "#1F2E7A", "bold": true },
        "body": { "size": 11, "color": "#0D0D0D" }
      }
    }
  }
}

示例

示例 1:使用 McKinsey 风格润色报告

用户:“让我的季度报告看起来更专业。”

  1. 显示品牌菜单
  2. 用户选择“McKinsey”
  3. 应用样式:
cd /path/to/project
source venv/bin/activate  # if using virtual environment
python .claude/skills/document-polisher/scripts/apply_brand.py quarterly_report.docx mckinsey polished_quarterly_report.docx
示例 2:为指南应用 Economist 风格

用户:“把这份指南设计成 The Economist 的风格。”

python .claude/skills/document-polisher/scripts/apply_brand.py guide.docx economist guide_economist.docx
示例 3:使用 Stripe 风格设计技术文档

用户:“让这份 API 文档看起来像 Stripe 的文档。”

python .claude/skills/document-polisher/scripts/apply_brand.py api_doc.docx stripe api_doc_stripe.docx

依赖项

  • Python 3.x
  • python-docx:pip install python-docx

如果缺少 python-docx,脚本会进行检查并提供安装说明。

获得最佳效果的提示

  1. 让品牌与内容相匹配:商务文档使用咨询品牌,技术内容使用科技品牌
  2. 考虑受众:学术内容使用《经济学人》风格,开发者使用 Stripe 风格,消费者使用 Apple 风格
  3. 不要过度打造品牌感:目标是专业润色,而非精确复制品牌
  4. 使用 PDF 导出进行测试:某些样式在 PDF 和 Word 中的呈现不同
  5. 使用虚拟环境:隔离依赖项

故障排除

“Module not found: docx”
pip install python-docx
文档显示异常
  • 确保源文档使用标准 Word 样式(Heading 1、2、3、Normal)
  • 检查列表是否使用内置的 List Bullet/List Number 样式
脚本路径问题

始终从项目根目录运行,或使用绝对路径:

python /full/path/to/.claude/skills/document-polisher/scripts/apply_brand.py input.docx brand output.docx

添加新品牌

添加新品牌:

  1. 使用 FireCrawl 提取品牌信息:mcp__firecrawl__firecrawl_extract_branding
  2. 在 brands/<brand_name>.md 中创建新文件
  3. 在 templates/brand-mapping.json 中添加条目,包含:
    • name、description、category
    • colors:primary、accent、background、textPrimary、textSecondary
    • typography:headingFont、bodyFont
    • styles:h1、h2、h3、body,包含 size、color、bold
  4. 使用示例文档进行测试

评论

支持 Markdown