Token导航 LogoToken导航TokenDH.com
研究检索需要联网github未标认证来源可访问clear审计提醒

docx-generatorDOCX 生成器

Agent Skill

docx-generator 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

13,079

周安装

524

GitHub Stars

69

下载量

4,234
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

3

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:docx-generator(DOCX 生成器)
来源仓库:https://github.com/jwynia/agent-skills
仓库路径:skills/docx-generator
安装命令:
npx skills add https://github.com/jwynia/agent-skills --skill docx-generator
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/jwynia/agent-skills --skill docx-generator

简介

程序化创建 Word 文档,支持占位符替换与动态内容填充。

  • 适用于报告、信函与合同等自动化生成需求,保留品牌样式。
  • 不应用于查看文档或复杂邮件合并,仅限编程式操作场景。
  • 通过 GitHub 安装,建议确认输出路径与文件命名规则后再执行。
  • docx-generator 属于研究检索类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

DOCX Generator

When to Use This Skill

Use this skill when:

  • Creating Word documents programmatically from data or specifications
  • Populating branded templates with dynamic content while preserving corporate styling
  • Extracting text, tables, and structure from existing DOCX files for analysis
  • Finding and replacing placeholder text like {{TITLE}} or ${author}
  • Automating document generation workflows (reports, contracts, letters)

Do NOT use this skill when:

  • User wants to open/view documents (use native Word or viewer)
  • Complex mail merge with data sources (use native Word mail merge)
  • Working with older.doc format (DOCX only)
  • PDF output is needed (use pdf-generator skill instead)

Prerequisites

  • Deno installed (https://deno.land/)
  • Input DOCX files for template-based operations
  • JSON specification for scratch generation

Quick Start

Two Modes of Operation

  1. Template Mode: Modify existing branded templates

- Analyze template to find placeholders - Replace {{PLACEHOLDERS}} with actual content

  1. Scratch Mode: Create documents from nothing using JSON specifications

Instructions

Mode 1: Template-Based Generation

Step 1a: Analyze the Template

Extract text inventory to understand what can be replaced:

deno run --allow-read scripts/analyze-template.ts corporate-template.docx > inventory.json

Output (inventory.json):

{
  "filename": "corporate-template.docx",
  "paragraphCount": 25,
  "tableCount": 2,
  "imageCount": 1,
  "paragraphs": [
    {
      "index": 0,
      "style": "Title",
      "fullText": "{{DOCUMENT_TITLE}}",
      "runs": [
        { "text": "{{DOCUMENT_TITLE}}", "bold": true, "fontSize": 28 }
      ]
    }
  ],
  "placeholders": [
    { "tag": "{{DOCUMENT_TITLE}}", "location": "paragraph", "paragraphIndex": 0 },
    { "tag": "{{AUTHOR}}", "location": "footer-default", "paragraphIndex": 0 },
    { "tag": "${date}", "location": "table", "tableIndex": 0, "cellLocation": "R1C2" }
  ]
}

Step 1b: Create Replacement Specification

Create replacements.json:

{
  "textReplacements": [
    { "tag": "{{DOCUMENT_TITLE}}", "value": "Q4 2024 Financial Report" },
    { "tag": "{{AUTHOR}}", "value": "Finance Department" },
    { "tag": "${date}", "value": "December 15, 2024" },
    { "tag": "{{COMPANY}}", "value": "Acme Corporation" }
  ],
  "includeHeaders": true,
  "includeFooters": true
}

Step 1c: Generate Output

deno run --allow-read --allow-write scripts/generate-from-template.ts \
  corporate-template.docx replacements.json output.docx

Mode 2: From-Scratch Generation

Step 2a: Create Specification

Create spec.json:

{
  "title": "Quarterly Report",
  "creator": "Finance Team",
  "styles": {
    "defaultFont": "Calibri",
    "defaultFontSize": 11
  },
  "sections": [
    {
      "header": {
        "paragraphs": [
          { "text": "Acme Corporation", "alignment": "right" }
        ]
      },
      "footer": {
        "paragraphs": [
          { "text": "Confidential", "alignment": "center" }
        ]
      },
      "content": [
        {
          "text": "Q4 2024 Financial Report",
          "heading": 1,
          "alignment": "center"
        },
        {
          "runs": [
            { "text": "Executive Summary: ", "bold": true },
            { "text": "This report provides an overview of our financial performance for Q4 2024." }
          ]
        },
        { "pageBreak": true },
        {
          "text": "Revenue Breakdown",
          "heading": 2
        },
        {
          "rows": [
            {
              "cells": [
                { "content": [{ "text": "Category" }], "shading": "DDDDDD" },
                { "content": [{ "text": "Amount" }], "shading": "DDDDDD" },
                { "content": [{ "text": "Change" }], "shading": "DDDDDD" }
              ],
              "isHeader": true
            },
            {
              "cells": [
                { "content": [{ "text": "Product Sales" }] },
                { "content": [{ "text": "$1,250,000" }] },
                { "content": [{ "text": "+15%" }] }
              ]
            },
            {
              "cells": [
                { "content": [{ "text": "Services" }] },
                { "content": [{ "text": "$750,000" }] },
                { "content": [{ "text": "+8%" }] }
              ]
            }
          ],
          "width": 100,
          "borders": true
        }
      ]
    }
  ]
}

Step 2b: Generate Document

deno run --allow-read --allow-write scripts/generate-scratch.ts spec.json output.docx

Examples

Example 1: Contract Generation

Scenario: Generate contracts from a branded template.

Steps:

# 1. Analyze template for replaceable content
deno run --allow-read scripts/analyze-template.ts contract-template.docx --pretty

# 2. Create replacements.json with client data
# 3. Generate contract
deno run --allow-read --allow-write scripts/generate-from-template.ts \
  contract-template.docx replacements.json acme-contract.docx

Example 2: Report with Tables

Scenario: Generate a data report with tables and formatting.

spec.json:

{
  "title": "Sales Report",
  "sections": [{
    "content": [
      { "text": "Monthly Sales Report", "heading": 1 },
      { "text": "January 2025", "heading": 2 },
      {
        "runs": [
          { "text": "Total Sales: ", "bold": true },
          { "text": "$125,000", "color": "2E7D32" }
        ]
      }
    ]
  }]
}

Example 3: Letter with Headers/Footers

Scenario: Create a formal letter with letterhead.

spec.json:

{
  "sections": [{
    "header": {
      "paragraphs": [
        { "text": "ACME CORPORATION", "alignment": "center", "runs": [{"text": "ACME CORPORATION", "bold": true, "fontSize": 16}] },
        { "text": "123 Business Ave, City, ST 12345", "alignment": "center" }
      ]
    },
    "content": [
      { "text": "December 15, 2024", "alignment": "right" },
      { "text": "" },
      { "text": "Dear Valued Customer," },
      { "text": "" },
      { "text": "Thank you for your continued business..." },
      { "text": "" },
      { "text": "Sincerely," },
      { "text": "John Smith" },
      { "runs": [{ "text": "CEO", "italic": true }] }
    ],
    "footer": {
      "paragraphs": [
        { "text": "www.acme.com | contact@acme.com", "alignment": "center" }
      ]
    }
  }]
}

Script Reference

ScriptPurposePermissions
analyze-template.tsExtract text, tables, placeholders from DOCX--allow-read
generate-from-template.tsReplace placeholders in templates--allow-read --allow-write
generate-scratch.tsCreate DOCX from JSON specification--allow-read --allow-write

Specification Reference

Paragraph Options

PropertyTypeDescription
textstringSimple text content
runsarrayFormatted text runs (for mixed formatting)
heading1-6Heading level
alignmentstringleft, center, right, justify
bulletbooleanBulleted list item
numberingbooleanNumbered list item
spacingobjectbefore, after, line spacing
indentobjectleft, right, firstLine indentation
pageBreakBeforebooleanInsert page break before paragraph

Text Run Options

PropertyTypeDescription
textstringText content
boldbooleanBold formatting
italicbooleanItalic formatting
underlinebooleanUnderline formatting
strikebooleanStrikethrough
fontSizenumberFont size in points
fontstringFont family name
colorstringText color (hex, no #)
highlightstringHighlight color
superScriptbooleanSuperscript
subScriptbooleanSubscript

Table Options

PropertyTypeDescription
rowsarrayArray of row specifications
widthnumberTable width as percentage
bordersbooleanShow table borders

Hyperlink Options

PropertyTypeDescription
textstringLink text
urlstringTarget URL
boldbooleanBold formatting
italicbooleanItalic formatting

Common Issues and Solutions

Issue: Placeholders not being replaced

Symptoms: Output DOCX still contains {{PLACEHOLDER}} tags.

Solution:

  1. Run analyze-template.ts to verify exact tag text
  2. Tags may be split across XML runs - the script consolidates these automatically
  3. Ensure includeHeaders and includeFooters are true if placeholders are there

Issue: Formatting lost after replacement

Symptoms: Replaced text doesn't match original formatting.

Solution:

  • Text replacement preserves the formatting of the original placeholder
  • Ensure placeholder is formatted the way you want the final text to appear

Issue: Images not appearing

Symptoms: Image elements are blank in output.

Solution:

  1. Use paths relative to the spec.json file location
  2. Verify image file exists and is readable
  3. Check supported formats: PNG, JPEG, GIF

Issue: Table cell content incorrect

Symptoms: Table cells have wrong content or formatting.

Solution:

  • Each cell's content must be an array of paragraph specifications
  • Use shading for background color, verticalAlign for alignment

Limitations

  • DOCX only: Does not support legacy.doc format
  • No track changes: Cannot add or process track changes
  • No comments: Cannot add document comments
  • No macros: Cannot include VBA macros
  • Basic numbering: Limited support for complex numbering schemes
  • Text run splitting: Word may split text across XML elements; script handles common cases

Related Skills

  • pptx-generator: For creating PowerPoint presentations
  • xlsx-generator: For creating Excel spreadsheets
  • pdf-generator: For creating PDF documents

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

04

需要参考平台分布和安装热度时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

能力 5

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Claude Code

27.97%
按下载量换算1,184

OpenCode

25.65%
按下载量换算1,086

Codex

19.14%
按下载量换算810

Gemini CLI

13.61%
按下载量换算576

Cursor

8.34%
按下载量换算353

Antigravity

3.34%
按下载量换算141

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

可疑

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。

来源信息

继续浏览同类 Skills