Communitygithub.com

David-Li0406/meta-skill-evloving

全面的文档创建、编辑与分析能力,支持修订跟踪、批注、格式保留和文本提取。适用于需要处理专业 .docx 文件的场景:新建文档、内容修改、修订跟踪、添加批注等。

meta-skill-evloving 是什么?

该技能专为 AI 代理(如 Claude)设计,用于高效处理 .docx 格式的专业文档。它提供了完整的文档生命周期支持,包括从零创建新文档(基于 docx-js 库)、编辑现有文档(基于 Document Python 库),以及内容分析和修订跟踪(支持批注、格式保留等)。技能特别强调“修订工作流”(Redlining workflow),要求代理在处理他人文档或法律、学术、政府类文档时,必须采用最小化、精确的修改策略,仅标记实际变更的文本,并保持原始文本格式。此外,还集成了文本提取(pandoc)、原始 XML 访问(用于复杂格式分析)以及文档转图片(用于视觉验证)等实用工具。

兼容平台✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/David-Li0406/meta-skill-evloving/tree/HEAD/AgentSkillOS/data/skill_seeds/docx

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

DOCX 创建、编辑和分析

概述

用户可能会要求您创建、编辑或分析 .docx 文件的内容。.docx 文件本质上是一个包含 XML 文件和其他资源的 ZIP 存档,您可以读取或编辑它。您可以根据不同的任务使用不同的工具和工作流程。

工作流决策树

阅读/分析内容

请使用下面的“文本提取”或“原始 XML 访问”部分。

创建新文档

请使用“创建新的 Word 文档”工作流。

编辑现有文档

  • 自己的文档 + 简单修改 请使用“基本 OOXML 编辑”工作流。

  • 他人的文档 请使用**“修订工作流”**(推荐默认选项)。

  • 法律、学术、商业或政府文档 请使用**“修订工作流”**(必需)。

阅读和分析内容

文本提取

如果您只需要读取文档的文本内容,应使用 pandoc 将文档转换为 markdown。Pandoc 对保留文档结构提供了出色的支持,并且可以显示修订跟踪:

# 将文档转换为 markdown,并保留修订跟踪
pandoc --track-changes=all path-to-file.docx -o output.md
# 选项:--track-changes=accept/reject/all

原始 XML 访问

您需要原始 XML 访问来处理:批注、复杂格式、文档结构、嵌入媒体和元数据。对于这些功能中的任何一个,您都需要解包文档并读取其原始 XML 内容。

解包文件

python ooxml/scripts/unpack.py <office_file> <output_directory>

关键文件结构

  • word/document.xml - 文档主要内容
  • word/comments.xml - 在 document.xml 中引用的批注
  • word/media/ - 嵌入的图像和媒体文件
  • 修订跟踪使用 <w:ins>(插入)和 <w:del>(删除)标签

创建新的 Word 文档

从头创建新的 Word 文档时,请使用 docx-js,它允许您使用 JavaScript/TypeScript 创建 Word 文档。

工作流

  1. 必须 - 读取整个文件:从头到尾完整阅读 docx-js.md(约 500 行)。阅读此文件时切勿设置任何范围限制。 在进行文档创建之前,请阅读完整的文件内容以了解详细的语法、关键格式规则和最佳实践。
  2. 创建一个 JavaScript/TypeScript 文件,使用 Document、Paragraph、TextRun 等组件(您可以假设所有依赖项都已安装,如果没有,请参考下面的依赖项部分)。
  3. 使用 Packer.toBuffer() 导出为 .docx。

编辑现有的 Word 文档

编辑现有的 Word 文档时,请使用 Document 库(一个用于 OOXML 操作的 Python 库)。该库会自动处理基础设施设置,并提供用于文档操作的方法。对于复杂场景,您可以通过该库直接访问底层 DOM。

工作流

  1. 必需 - 读取整个文件:从头到尾完整阅读 ooxml.md(约 600 行)。阅读此文件时切勿设置任何范围限制。 阅读完整的文件内容以了解 Document 库 API 和用于直接编辑文档文件的 XML 模式。
  2. 解包文档:python ooxml/scripts/unpack.py <office_file> <output_directory>
  3. 创建并运行一个使用 Document 库的 Python 脚本(参见 ooxml.md 中的“Document 库”部分)。
  4. 打包最终文档:python ooxml/scripts/pack.py <input_directory> <office_file>

Document 库提供了用于常见操作的高级方法和用于复杂场景的直接 DOM 访问。

文档审阅的修订工作流

此工作流允许您在将更改实现到 OOXML 之前,使用 markdown 规划全面的修订跟踪。关键:对于完整的修订跟踪,您必须系统地执行所有更改。

批处理策略:将相关更改分组为批次,每批 3-10 个更改。这使得调试更容易管理,同时保持效率。在进入下一批之前测试每个批次。

原则:最小化、精确的编辑 在实现修订跟踪时,仅标记实际发生更改的文本。重复未更改的文本会使编辑难以审阅,并且显得不专业。将替换分解为:[未更改的文本] + [删除] + [插入] + [未更改的文本]。对于未更改的文本,通过从原始内容中提取 <w:r> 元素并重用它来保留原始运行的 RSID。

示例 - 将句子中的“30 days”更改为“60 days”:

# 错误 - 替换整个句子
'<w:del><w:r><w:delText>The term is 30 days.</w:delText></w:r></w:del><w:ins><w:r><w:t>The term is 60 days.</w:t></w:r></w:ins>'

# 正确 - 仅标记更改的内容,保留未更改文本的原始 <w:r>
'<w:r w:rsidR="00AB12CD"><w:t>The term is </w:t></w:r><w:del><w:r><w:delText>30</w:delText></w:r></w:del><w:ins><w:r><w:t>60</w:t></w:r></w:ins><w:r w:rsidR="00AB12CD"><w:t> days.</w:t></w:r>'

修订跟踪工作流

  1. 获取 markdown 表示:将文档转换为 markdown,同时保留修订跟踪:

    pandoc --track-changes=all path-to-file.docx -o current.md
    
  2. 识别并分组更改:审阅文档并识别所有需要的更改,将它们组织成逻辑批次:

    定位方法(用于在 XML 中查找更改):

    • 章节/标题编号(例如,“Section 3.2”、“Article IV”)
    • 如果已编号,则使用段落标识符
    • 使用带有唯一周围文本的 Grep 模式
    • 文档结构(例如,“first paragraph”、“signature block”)
    • 不要使用 markdown 行号 - 它们不映射到 XML 结构

    批次组织(每批分组 3-10 个相关更改):

    • 按章节:“Batch 1: Section 2 amendments”,“Batch 2: Section 5 updates”
    • 按类型:“Batch 1: Date corrections”,“Batch 2: Party name changes”
    • 按复杂度:从简单的文本替换开始,然后处理复杂的结构更改
    • 按顺序:“Batch 1: Pages 1-3”,“Batch 2: Pages 4-6”
  3. 读取文档并解包:

    • 必需 - 读取整个文件:从头到尾完整阅读 ooxml.md(约 600 行)。阅读此文件时切勿设置任何范围限制。 特别注意“Document 库”和“修订跟踪模式”部分。
    • 解包文档:python ooxml/scripts/unpack.py <file.docx> <dir>
    • 注意建议的 RSID:解包脚本会建议一个用于修订跟踪的 RSID。复制此 RSID 以在步骤 4b 中使用。
  4. 分批实施更改:逻辑地分组更改(按章节、按类型或按邻近性)并在单个脚本中一起实施。这种方法:

    • 使调试更容易(更小的批次 = 更容易隔离错误)
    • 允许增量进展
    • 保持效率(批次大小为 3-10 个更改效果良好)

    建议的批次分组:

    • 按文档章节(例如,“Section 3 changes”、“Definitions”、“Termination clause”)
    • 按更改类型(例如,“Date changes”、“Party name updates”、“Legal term replacements”)
    • 按邻近性(例如,“Changes on pages 1-3”、“Changes in first half of document”)

    对于每批相关更改:

    a. 将文本映射到 XML:在 word/document.xml 中 Grep 文本以验证文本如何跨 <w:r> 元素分隔。

    b. 创建并运行脚本:使用 get_node 查找节点,实施更改,然后使用 doc.save()。有关模式,请参见 ooxml.md 中的 “Document 库” 部分。

    注意:在编写脚本之前,总是立即 Grep word/document.xml 以获取当前行号并验证文本内容。每次脚本运行后行号都会更改。

  5. 打包文档:在所有批次完成后,将解包的目录转换回 .docx:

    python ooxml/scripts/pack.py unpacked reviewed-document.docx
    
  6. 最终验证:对整个文档进行全面检查:

    • 将最终文档转换为 markdown:
      pandoc --track-changes=all reviewed-document.docx -o verification.md
      
    • 验证所有更改均已正确应用:
      grep "original phrase" verification.md  # 不应找到
      grep "replacement phrase" verification.md  # 应找到
      
    • 检查是否引入了意外更改

将文档转换为图像

为了直观地分析 Word 文档,使用两步过程将其转换为图像:

  1. 将 DOCX 转换为 PDF:

    soffice --headless --convert-to pdf document.docx
    
  2. 将 PDF 页面转换为 JPEG 图像:

    pdftoppm -jpeg -r 150 document.pdf page
    

    这将创建类似于 page-1.jpg、page-2.jpg 等的文件。

选项:

  • -r 150:设置分辨率为 150 DPI(根据质量/大小平衡进行调整)
  • -jpeg:输出 JPEG 格式(如果需要 PNG,请使用 -png)
  • -f N:要转换的第一页(例如,-f 2 从第 2 页开始)
  • -l N:要转换的最后一页(例如,-l 5 在第 5 页停止)
  • page:输出文件的前缀

特定范围的示例:

pdftoppm -jpeg -r 150 -f 2 -l 5 document.pdf page  # 仅转换第 2-5 页

代码风格指南

重要:在生成 DOCX 操作的代码时:

  • 编写简洁的代码
  • 避免冗长的变量名和冗余操作
  • 避免不必要的 print 语句

依赖项

必需的依赖项(如果不可用,请安装):

  • pandoc:sudo apt-get install pandoc(用于文本提取)
  • docx:npm install -g docx(用于创建新文档)
  • LibreOffice:sudo apt-get install libreoffice(用于 PDF 转换)
  • Poppler:sudo apt-get install poppler-utils(用于 pdftoppm 将 PDF 转换为图像)
  • defusedxml:pip install defusedxml(用于安全的 XML 解析)

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

David-Li0406/meta-skill-evloving

Browser automation with persistent page state. Use when users ask to navigate websites, fill forms, take screenshots, extract web data, test web apps, or automate browser workflows. Trigger phrases include "go to [url]", "click on", "fill out the form", "take a screenshot", "scrape", "automate", "test the website", "log into", or any browser interaction request.

David-Li0406/meta-skill-evloving

Create technical diagrams using Mermaid syntax for architecture, sequences, ERDs, flowcharts, and state machines. Use for visualizing system design, data flows, and processes. Triggers: diagram, mermaid, architecture diagram, sequence diagram, flowchart, ERD, entity relationship, state diagram, C4 model, component diagram, visualize, draw.

David-Li0406/meta-skill-evloving

Complete color manipulation and green screen effects system. PROACTIVELY activate for: (1) Green screen/chromakey removal, (2) Color grading with LUTs, (3) Color correction (levels, curves, white balance), (4) Colorkey/color removal effects, (5) Hue/saturation manipulation, (6) Color space conversions (BT.709, BT.2020, HDR), (7) Color isolation effects, (8) Teal and orange look, (9) Vintage/film looks, (10) Color keying for transparency. Provides: chromakey and colorkey filters, LUT application (lut3d), curves and levels adjustment, color balance, selective color manipulation, color space handling, HDR tone mapping, professional color grading chains.

David-Li0406/meta-skill-evloving

Convert files and office documents to Markdown. Supports PDF, DOCX, PPTX, XLSX, images (with OCR), audio (with transcription), HTML, CSV, JSON, XML, ZIP, YouTube URLs, EPubs and more.

David-Li0406/meta-skill-evloving

Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).

David-Li0406/meta-skill-evloving

Build with OpenAI's stateless APIs - Chat Completions (GPT-5, GPT-4o), Embeddings, Images (DALL-E 3), Audio (Whisper + TTS), and Moderation. Includes Node.js SDK and fetch-based approaches for Cloudflare Workers. Use when: implementing chat completions with GPT-5/GPT-4o, streaming responses with SSE, using function calling/tools, creating structured outputs with JSON schemas, generating embeddings for RAG (text-embedding-3-small/large), generating images with DALL-E 3, editing images with GPT-Image-1, transcribing audio with Whisper, synthesizing speech with TTS (11 voices), moderating content (11 safety categories), or troubleshooting rate limits (429), invalid API keys (401), function calling failures, streaming parse errors, embeddings dimension mismatches, or token limit exceeded.

David-Li0406/meta-skill-evloving

Comprehensive PDF manipulation toolkit for extracting text and tables, creating new PDFs, merging/splitting documents, and handling forms. When Claude needs to fill in a PDF form or programmatically process, generate, or analyze PDF documents at scale.

David-Li0406/meta-skill-evloving

Presentation creation, editing, and analysis. When Claude needs to work with presentations (.pptx files) for: (1) Creating new presentations, (2) Modifying or editing content, (3) Working with layouts, (4) Adding comments or speaker notes, or any other presentation tasks

David-Li0406/meta-skill-evloving

Comprehensive spreadsheet creation, editing, and analysis with support for formulas, formatting, data analysis, and visualization. When Claude needs to work with spreadsheets (.xlsx, .xlsm, .csv, .tsv, etc) for: (1) Creating new spreadsheets with formulas and formatting, (2) Reading or analyzing data, (3) Modify existing spreadsheets while preserving formulas, (4) Data analysis and visualization in spreadsheets, or (5) Recalculating formulas

David-Li0406/meta-skill-evloving

Download YouTube videos with customizable quality and format options. Use this skill when the user asks to download, save, or grab YouTube videos. Supports various quality settings (best, 1080p, 720p, 480p, 360p), multiple formats (mp4, webm, mkv), and audio-only downloads as MP3.

David-Li0406/meta-skill-evloving

Best practices for Remotion - Video creation in React

David-Li0406/meta-skill-evloving

Provides bidirectional translation (Chinese/English), grammar checking, and sentence polishing. Supports specific tense constraints, context-aware tone adjustment, and natural expression optimization. Outputs direct text without formatting.

David-Li0406/meta-skill-evloving

指导如何通过自定义注解(如@Unicom)标识Dubbo接口,利用BeanDefinitionRegistryPostProcessor在启动时扫描并动态注册ReferenceBean,实现RPC调用的封装。

David-Li0406/meta-skill-evloving

生成Python脚本,利用FFmpeg将图片序列按3x3布局合并,或将合并图拆分。要求使用subprocess模块执行命令,并支持用户交互式输入路径。

David-Li0406/meta-skill-evloving

SOP for extracting and analyzing promotional activity details, handling time formatting, location mapping, payment logic, and step-by-step process validation.

David-Li0406/meta-skill-evloving

Specializes in creating TikTok short video scripts using an anthropomorphic 'Chef' perspective to explain wildlife food chains and survival environments, utilizing real field footage.

David-Li0406/meta-skill-evloving

针对TikTok平台,以拟人化视角(如动物作为厨师)创作系列短视频脚本。重点介绍野生动物、食物链及生态环境,要求使用野外实拍素材,风格幽默且具有教育意义。

David-Li0406/meta-skill-evloving

Generates KWL (Know, Want to know, Learned) charts for educational videos, specifically BrainPOP, using simple 7th-grade language and short, concise bullet points.

David-Li0406/meta-skill-evloving

Develops DAX measures to calculate promo and regular volumes and generates a calculated table of dates excluding continuous promo date ranges, handling multiple periods and nulls.

David-Li0406/meta-skill-evloving

Tracks complex, multi-session work using the Beads issue tracker and dependency graphs, and provides persistent memory that survives conversation compaction. Use when work spans multiple sessions, has complex dependencies, or needs persistent context across compaction cycles. Trigger with phrases like "create task for", "what's ready to work on", "show task", "track this work", "what's blocking", or "update status".

相关技能