Communitygithub.com

bg-szy/TOP-SKILLS

在用戶需要建立、讀取、編輯或操作 Word 文件(.docx)或 Word 範本(.dotx)時使用。觸發詞包括:提到「Word 文件」、「word 文件」、「.docx」、「.dotx」,或要求產出包含目錄、標題、頁碼或信頭等格式的專業文件。也用於從 .docx/.dotx 檔案提取或重新組織內容、插入或取代圖片、執行尋找與取代、處理追蹤修訂或註解,以及將內容轉換為精美 Word 文件。若用戶要求以 Word 或 .docx 格式提供「報告」、「備忘錄」、「信件」、「範本」等產出,請使用此技能。勿用於 PDF、試算表、Google 文件或與文件生成無關的一般程式設計任務。

TOP-SKILLS 是什麼?

這是一套專用於操作 Word 文件的專業技能,適用於 Claude Code、Cursor、Codex 等 AI 代理工具。它涵蓋建立新文件、編輯現有文件、讀取內容及分析 .docx/.dotx 檔案等常見工作流程。對於建立新文件,技能仰賴已預先安裝的 docx (npm) 套件,並提供關鍵注意事項清單,例如 US Letter 紙張尺寸的 DXA 設定、表格的雙重寬度指定、避免使用原始項目符號字元(應改用 numbering 設定),以及 `ImageRun` 必須指定 `type` 等。針對編輯現有文件,技能採用解壓縮 ZIP 檔案、直接編輯 XML、再重新壓縮的方法,並附帶腳本(如 merge_runs.py、validate.py)來處理常見的相容性問題。此外,它還深入支援追蹤修訂(使用 w:ins/w:del XML 元素)和註解(透過 comment.py 腳本管理六個相互關聯的檔案),並提供驗證與轉換工具(如 soffice、pdftoppm)。這套技能透過明確的 CLI 命令與腳本,將複雜的 XML 操作自動化,讓 AI 代理能可靠地產出符合專業規範的 Word 文件。

相容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/bg-szy/TOP-SKILLS/tree/HEAD/skills/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 文件中出錯)。各欄寬度總和必須等於表格寬度。
  • 表格網底: 使用 ShadingType.CLEAR,絕不使用 SOLID(會顯示為黑色)。
  • 清單: 絕對不要直接插入 • 字元;應使用包含 LevelFormat.BULLET 的 numbering 設定。
  • ImageRun 需要指定 type:(如 "png"、"jpg" 等)。
  • PageBreak 必須放在 Paragraph 內部。
  • 絕不使用 \n — 請使用獨立的 Paragraph 元素。
  • 目錄 (TOC): 標題必須使用內建的 HeadingLevel.*;自訂標題樣式需設定 outlineLevel,否則不會出現在目錄中。
  • 不要用表格充當水平線 — 改為在段落上使用底部邊框。
  • 點狀引導 / 同行靠右對齊: 在 TextRun 內部使用 PositionalTab(alignment: PositionalTabAlignment.RIGHT、leader: PositionalTabLeader.DOT),不要使用文字句號或空白填充。

驗證輸出結果

產生 .docx 後,將其轉為 PDF 並檢查:

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/   # 合併分散的 run,讓文字可被搜尋
# 就地編輯 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> run 中(因修訂 ID、拼字檢查標記等),因此在 XML 中,您在文件裡看到的片語往往並非連續字串。merge_runs.py 會合併 word/document.xml 中相鄰且格式相同的 run,且不改變內容或顯示效果;它也可以直接接受 .docx 檔案(python scripts/merge_runs.py doc.docx -o merged.docx)。

追蹤修訂: 進行修訂時,請以 --author "<您的修訂姓名>" 進行驗證(需要 --original)— 它會回報您修改過但沒有被 <w:ins>/<w:del> 包圍的文字,這很容易意外發生且在「接受」檢視中不可見。需在 run 外層加上含有 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>)表示「將此段落合併至下一段」— 因此完全刪除一個段落就是這個標記加上每個 run 外層的 <w:del>。<w:del/> 必須位於 rPr 的其他子元素之前;它們的順序受到 XML Schema 約束。

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

接受已刪除的段落標記應將該段落與其下一段合併,因此所有 run 都被刪除的段落會消失。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 會自動指派。腳本接著會輸出需加入 word/document.xml 的 <w:commentRangeStart>/<w:commentRangeEnd>/<w:commentReference> 程式碼片段,以便將註解錨定到特定文字 — 在您放置這些標記之前,註解雖然存在但不會顯示。

相依性

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

Individual skills in this repo

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

bg-szy/TOP-SKILLS

Brand-first landing page designer — runs a brand-identity interview (colors, typography, shape language), then generates and iterates on a polished landing page via Stitch with deployment-ready HTML. Use when the user asks to create, design, or build a landing page, homepage, or marketing page and has no established visual direction. Skip when they have a design mockup, need a dashboard or app UI, are working at component level, building a multi-page app, or restyling with known design tokens — use frontend-design instead.

bg-szy/TOP-SKILLS

Fill out Microsoft Azure Landing Zone (ALZ) Accelerator checklists by interviewing the user, mapping their Azure subscriptions, integrating IP addressing documentation, and applying Microsoft Cloud Adoption Framework best practices. Produces a completed Excel checklist (.xlsx) ready for ALZ deployment. Use this skill whenever the user mentions Azure Landing Zone, ALZ checklist, landing zone accelerator, platform landing zone configuration, ALZ bootstrap, hub-and-spoke setup, Azure network topology planning, or wants to fill out any ALZ-related checklist or configuration file. Also trigger when the user uploads an Excel file that contains tabs like "Accelerator - Bootstrap", "Accelerator - Bicep", or "Accelerator - Terraform".

bg-szy/TOP-SKILLS

Compose a premium, animated landing page section by section in Next.js + Tailwind + Motion (Framer Motion) — built on a real design system, with editorial copy and motion that feels human-crafted, not template-generated. Use when building or rebuilding a landing page, marketing site, or hero/feature/pricing/CTA sections that need to look production-ready and bespoke from day one.

bg-szy/TOP-SKILLS

Write high-converting landing page copy using proven frameworks like PAS (Problem-Agitate-Solution), AIDA, and StoryBrand. Creates headlines, value propositions, CTAs, and full page sections optimized for conversion. Use when users need landing page copy, sales page content, or marketing website text.

bg-szy/TOP-SKILLS

Optimize landing pages for conversions, performance, and SEO. Use when improving landing pages, increasing conversions, or optimizing page performance.

bg-szy/TOP-SKILLS

Review investment portfolios for risk, diversification, fees. Asset allocation recommendations, tax-loss harvesting, rebalancing.

bg-szy/TOP-SKILLS

Beads Viewer - Graph-aware triage engine for Beads projects. Computes PageRank, betweenness, critical path, and cycles. Use --robot-* flags for AI agents.

bg-szy/TOP-SKILLS

CI red? Call us. Pipeline fire brigade deploys. Use when user mentions CI failures, build errors, test failures, or pipeline issues. Do NOT load for: local builds, standard implementation work, reviews, or setup.

bg-szy/TOP-SKILLS

CASS Memory System - procedural memory for AI coding agents. Three-layer cognitive architecture with confidence decay, anti-pattern learning, cross-agent knowledge transfer, trauma guard safety system. Bun/TypeScript CLI.

bg-szy/TOP-SKILLS

Mandatory entry point: read this first for any request to make, create, edit, animate, or render a video, animation, or motion graphic, including a promo, explainer, captioned clip, title card, overlay, slideshow or interactive deck, Remotion port, or any HyperFrames HTML composition. Also use it to inspect, diagnose, validate, preview, publish, or batch-render an existing HyperFrames project. Inputs may be a website URL, GitHub PR, Figma design or URL, text or brief, existing footage, or music. It resumes project state, captures intent when applicable, selects and installs the owning workflow, and routes domain capabilities. HyperFrames is the default output framework unless the user explicitly chooses another framework for the deliverable or asks only to record a browser session.

bg-szy/TOP-SKILLS

Expert in building portfolios that actually land jobs and clients - not just showing work, but creating memorable experiences. Covers developer portfolios, designer portfolios, creative portfolios, and portfolios that convert visitors into opportunities.

bg-szy/TOP-SKILLS

Use when the user asks to "pre-launch check the landing page", "run a Quality-Score preflight", or "verify ad-to-page message match before launch"; produces an ad↔page continuity report — message-match gaps, above-the-fold check, page-speed read, form-friction count, mobile-render flags — as a pass/fix punch list. Not for redesigning or rewriting the page — use landing-optimizer; not for scoring the account or the RQS — use ad-account-auditor. 落地页体验预检/广告落地页一致性检查

bg-szy/TOP-SKILLS

Use when the user asks to "optimize our landing page for influencer traffic", "fix our promo-code landing page", or "improve conversion from a creator campaign"; produces a message-match audit, page-structure and social-proof recommendations, a promo-code/CTA conversion plan, and an A/B test roadmap. Not for measuring campaign results after launch — use performance-analyzer.

bg-szy/TOP-SKILLS

Audit a landing page, sales page or checkout page for conversion leaks and return a fix list ordered by expected revenue impact. Use when asked to review, critique or improve a landing page, sales page, opt-in page, product page or checkout flow, when conversion rate is low, when paid traffic is not converting, or when someone asks "why isn't this page converting" or wants a CRO / landing page review.

bg-szy/TOP-SKILLS

Landing page conversion optimization with layout rules, hero section design, and CTA psychology. Covers above-the-fold formula, social proof placement, mobile design, and F-pattern reading. Use for: startup landing pages, product pages, SaaS marketing, conversion optimization. Triggers: landing page, hero section, above the fold, conversion optimization, landing page design, cta button, hero image, landing page layout, saas landing page, product page design, conversion rate, landing page best practices

bg-szy/TOP-SKILLS

Create high-converting, visually distinctive landing pages. Use when building marketing pages, product launches, SaaS homepages, or any single-page conversion-focused website. Guides section-by-section composition with anti-AI-slop principles.

bg-szy/TOP-SKILLS

Landing page conversion optimization with layout rules, hero section design, and CTA psychology. Covers above-the-fold formula, social proof placement, mobile design, and F-pattern reading. Use for: startup landing pages, product pages, SaaS marketing, conversion optimization. Triggers: landing page, hero section, above the fold, conversion optimization, landing page design, cta button, hero image, landing page layout, saas landing page, product page design, conversion rate, landing page best practices

bg-szy/TOP-SKILLS

Account assets, equity and fund positions, P&L, cash flow records, account statements, margin ratios, buy-power estimates, order management, and DCA recurring investments via Longbridge (most require Trade permission). Frameworks: portfolio diagnosis, rebalancing, asset allocation, risk analysis (VaR/CVaR), performance attribution, and tax-loss harvesting. Triggers: "持仓", "账户", "盈亏", "资产", "对账单", "下单", "买入", "卖出", "撤单", "定投", "组合诊断", "再平衡", "资产配置", "风险分析", "绩效归因", "税损收割", "持倉", "賬戶", "盈虧", "對賬單", "下單", "買入", "賣出", "組合診斷", "再平衡", "稅損收割", "positions", "portfolio", "P&L", "order", "buy", "sell", "DCA", "statement", "risk analysis", "rebalancing", "tax harvesting", "我的风险", "持仓风险", "风险敞口", "資產", "資產配置", "風險分析", "績效歸因", "撤單

bg-szy/TOP-SKILLS

Auto-loaded context for Portfolio Buddy 2 development. Use for ANY task involving: React 19 development, TypeScript, portfolio analysis features, metrics calculations, trading strategy comparison, or working with the Portfolio Buddy 2 codebase. Contains tech stack, known issues, and architectural constraints.

bg-szy/TOP-SKILLS

Process video files with audio extraction, format conversion (mp4, webm), and Whisper transcription. Use when user mentions video conversion, audio extraction, transcription, mp4, webm, ffmpeg, or whisper transcription.

相關技能