Communitygithub.com

LiChangZheng10086/doyin_ai_video

用於建立、讀取、編輯和操作 Word 文件(.docx)與範本(.dotx)的技能。當使用者提及 Word 文件、.docx、.dotx 或需要含有目錄、標題、頁碼、信頭等格式的專業文件時觸發。

doyin_ai_video 是什麼?

這項技能專為開發者與 AI 代理設計,提供以程式化方式處理 Word 文件(.docx/.dotx)的完整解決方案。它支援三種主要操作:透過 docx-js 函式庫建立新文件(需注意頁面尺寸、表格、清單等常見陷阱);使用 unzip + 編輯 XML + rezip 流程修改現有文件(含合併分散文字執行序與驗證功能);以及使用 pandoc 讀取文件內容。進階功能包括處理追蹤修訂(redlining)時自動驗證註記完整性、透過輔助腳本管理註解,以及將文件轉換為 PDF 以進行視覺檢查。此技能可與 Claude Code、Cursor 等代理命令列環境搭配使用,並預先安裝了必要的 npm 套件和 Python 工具鏈。

相容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/LiChangZheng10086/doyin_ai_video/tree/HEAD/.agents/skills/docx

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

DOCX 建立、編輯與分析

.docx 是一個 ZIP 壓縮的 XML 檔案集合。請根據任務選擇適當方法:

任務方法
建立新文件撰寫 docx(npm)腳本 — 請參閱下方注意事項
編輯現有文件unzip → 編輯 word/document.xml → zip(docx-js 無法直接開啟現有檔案)
讀取內容pandoc -t markdown file.docx

以下腳本路徑均相對於此技能目錄。

使用 docx-js 建立文件 — 注意事項

docx 已預先安裝 — 請勿先執行 npm install;直接撰寫腳本並使用 require('docx')。僅在該 require 失敗時才執行 npm install docx。模型已知曉 API;以下為常見陷阱:

  • 頁面尺寸預設為 A4。 若要使用 US Letter,需設定 page: { size: { width: 12240, height: 15840 } }(DXA 單位;1440 = 1 英寸)。
  • 橫向: 傳入直向尺寸並加上 orientation: PageOrientation.LANDSCAPE — docx-js 會內部交換寬高。
  • 表格需要雙重寬度: 在表格上設定 columnWidths,同時在每個儲存格上設定 width,兩者皆使用 WidthType.DXA(PERCENTAGE 在 Google Docs 中會出錯)。各欄寬度總和必須等於表格寬度。
  • 表格背景: 使用 ShadingType.CLEAR,絕不要用 SOLID(會渲染為黑色)。
  • 清單: 絕不要直接插入 • 符號;應使用 numbering 設定搭配 LevelFormat.BULLET。
  • ImageRun 需要指定 type:"png"、"jpg"…)。
  • PageBreak 必須放在 Paragraph 內部。
  • 絕不要使用 \n — 應使用獨立的 Paragraph 元素。
  • 目錄: 標題必須使用內建的 HeadingLevel.*;自訂標題樣式需設定 outlineLevel,否則不會出現在目錄中。
  • 不要用表格充當水平線 — 應改用段落底框線。
  • 點引線 / 同一行靠右對齊: 使用 PositionalTab(alignment: PositionalTabAlignment.RIGHT、leader: PositionalTabLeader.DOT)放在 TextRun 內,不要用文字點或空白填補。

驗證輸出

寫好 .docx 後,將其渲染並查看:

python scripts/office/soffice.py --headless --convert-to pdf output.docx
pdftoppm -jpeg -r 100 output.pdf page
ls page-*.jpg   # 然後讀取這些圖片

pdftoppm 會將頁碼補零至頁數寬度(page-01.jpg…page-12.jpg)。

編輯現有文件

舊版 .doc 檔案必須先轉換:python scripts/office/soffice.py --headless --convert-to docx file.doc。

unzip -q doc.docx -d unpacked/
find unpacked -type l -delete   # 移除符號連結項目 — 來自外部的 docx 不可信任
python scripts/merge_runs.py unpacked/   # 合併分散的執行序,使文字可被搜尋
# 就地編輯 unpacked/word/document.xml — 不要重新格式化或美化
(cd unpacked && rm -f ../out.docx && zip -Xr ../out.docx .)
python scripts/office/validate.py out.docx --original doc.docx   # XSD 檢查;--auto-repair 可修復常見問題
# 需要顯示修訂標記?加上 --author "<您的修訂名稱>" 以檢查每項編輯是否都有追蹤

Word 會將文字分散到許多 <w:r> 執行序中(因修訂 ID、拼字檢查標記等),因此您在文件中看到的詞組在 XML 中通常不存在為連續字串。merge_runs.py 會合併 word/document.xml 中相鄰且格式相同的執行序,而不改變內容或呈現方式;它也接受 .docx 檔案直接處理(python scripts/merge_runs.py doc.docx -o merged.docx)。

追蹤修訂: 當進行修訂標記時,使用 --author "<您的修訂名稱>" 驗證(需要 --original)— 它會報告任何您修改但未以 <w:ins>/<w:del> 包裹的文字,這很容易發生且在接受檢視中不可見。以具有 w:id、w:author、w:date 屬性的 <w:ins>/<w:del> 包裹執行序。在 <w:del> 內部,文字元素應為 <w:delText>,而非 <w:t>。一個被刪除的段落標記(<w:pPr><w:rPr><w:del w:id=".." w:author=".." w:date=".."/></w:rPr></w:pPr>)表示「將此段落合併至下一段」— 因此直接刪除一個段落等於在每個執行序外部加上 <w:del>。<w:del/> 必須在 rPr 的其他子元素之前;它們的順序受結構定義約束。

若要產生一份接受所有追蹤修訂的乾淨副本:python scripts/accept_changes.py in.docx out.docx。

接受一個已刪除的段落標記應將該段落與其下方的段落合併,因此執行序全部被刪除的段落就會消失。Word 可以做到這一點;但 accept_changes.py 和 pandoc --track-changes=accept 並非總是能做到。兩者失敗方式相同 — 它們會移除被刪除的文字,但留下空的段落,在自動編號的情況下會變成一個多餘的空白項目符號:

  • pandoc --track-changes=accept 從不合併段落。
  • accept_changes.py(LibreOffice)能正確合併,除非被刪除的段落後面跟著一個空白間隔段落。

在任何檢視中出現空白項目符號都是該檢視的產物,而非文件本身的缺陷。請在 XML 中檢查段落刪除情況。

註解

註解需要六個相互關聯的檔案。使用輔助腳本 — 若您同時也要編輯 document.xml,請使用目錄模式(可節省一次解壓/壓縮循環);否則使用 .docx 直接模式:

# 針對已解壓的目錄(在同時放置標記時較佳)
python scripts/comment.py unpacked/ "費用與開支上限過低"
python scripts/comment.py unpacked/ "同意" --parent 0

# 直接針對 .docx 檔案
python scripts/comment.py contract.docx "此上限過低" -o annotated.docx

腳本會寫入 comments.xml、commentsExtended.xml、commentsIds.xml、commentsExtensible.xml、關係檔案以及內容類型覆寫。註解 ID 會自動指定。接著它會輸出 <w:commentRangeStart>/<w:commentRangeEnd>/<w:commentReference> 片段,供您加入到 word/document.xml 中以將註解錨定到特定文字 — 在您放置這些標記之前,註解雖然存在但不可見。

相依套件

docx(npm,已預先安裝 — 僅在 require('docx') 失敗時才安裝)· pandoc · LibreOffice(soffice)· pdftoppm(Poppler)

Individual skills in this repo

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

LiChangZheng10086/doyin_ai_video

Browser automation CLI for AI agents. Use when the user needs to interact with websites, including navigating pages, filling forms, clicking buttons, taking screenshots, extracting data, testing web apps, or automating any browser task. Triggers include requests to "open a website", "fill out a form", "click a button", "take a screenshot", "scrape data from a page", "test this web app", "login to a site", "automate browser actions", or any task requiring programmatic web interaction.

LiChangZheng10086/doyin_ai_video

Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER — read BEFORE opening the target file; don't skip because it "looks like a one-liner" — whenever: the prompt names Claude/Anthropic in any form (Claude, Anthropic, Fable, Opus, Sonnet, Haiku, `anthropic`, `@anthropic-ai`, `claude-*`, `us.anthropic.*`, `[1m]`); the user asks about an LLM (pricing/model choice/limits/caching) — never answer from memory; OR the task is LLM-shaped with provider unstated (agent/MCP/tool-definition/multi-agent/RAG/LLM-judge/computer-use; generate/summarize/extract/classify/rewrite/converse over NL; debugging refusals/cutoffs/streaming/tool-calls/tokens). SKIP only when another provider is being worked on (overrides all triggers): OpenAI/GPT/Gemini/Llama/Mistral/Cohere/Ollama named in the query; OR `grep -rE 'openai|langchain_openai|google.generativeai|genai|mistralai|cohere|ollama'` over the project hits (run this grep FIR...

LiChangZheng10086/doyin_ai_video

Guidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults.

LiChangZheng10086/doyin_ai_video

Grill me about specs for the workflows I want to build, within this workspace.

LiChangZheng10086/doyin_ai_video

Use this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple PDFs into one, splitting PDFs apart, rotating pages, adding watermarks, creating new PDFs, filling PDF forms, encrypting/decrypting PDFs, extracting images, and OCR on scanned PDFs to make them searchable. If the user mentions a .pdf file or asks to produce one, use this skill.

LiChangZheng10086/doyin_ai_video

智能 PPT 生成器。支持 7 种视觉风格(乐高/波普/黏土/黑白/商务/学术/科技),具备根据内容自动推荐风格、生成大纲、绘制配图并组装成片的全自动能力。

LiChangZheng10086/doyin_ai_video

Use this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or presentations; reading, parsing, or extracting text from any .pptx or .potx file (even if the extracted content will be used elsewhere, like in an email or summary); editing, modifying, or updating existing presentations; combining or splitting slide files; working with templates (.potx), layouts, speaker notes, or comments. Trigger whenever the user mentions \"deck,\" \"slides,\" \"presentation,\" or references a .pptx or .potx filename, regardless of what they plan to do with the content afterward. If a .pptx or .potx file needs to be opened, created, or touched, use this skill.

LiChangZheng10086/doyin_ai_video

Diagnose and fix React codebase health issues. Use when reviewing React code, fixing performance problems, auditing security, or improving code quality.

LiChangZheng10086/doyin_ai_video

Sentry error monitoring and performance tracing patterns for Next.js applications.

LiChangZheng10086/doyin_ai_video

Simplify and refine recently modified code for clarity and consistency. Use after writing code to improve readability without changing functionality.

LiChangZheng10086/doyin_ai_video

✅ "你知道今天所有大模型能读懂你的话,全靠一个叫Transformer的架构吗?"

LiChangZheng10086/doyin_ai_video

Use this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .xltx, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like \"the xlsx in my downloads\") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved.

相關技能