← 返回 Skills 市场
loki612

Tech Docx Writer

作者 Loki612 · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ 安全检测通过
108
总下载
1
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install tech-docx-writer
功能描述
Generate deeply technical Word documents based on corporate templates. Use when the user asks to generate a specification, architecture document, or API manu...
使用说明 (SKILL.md)

Tech Doc Generator Workflow

Follow this strict pipeline to generate production-grade technical Word documents from corporate templates. Do not deviate, as python-docx has many pitfalls that this workflow avoids.

1. Explore & Read

Gather factual context from project wikis, codebases, or reference docs. Do not hallucinate content. Read the codebase files or use git log / grep / Read to ensure facts are accurate.

2. Drafting (Markdown)

Draft the content in a Markdown file (.md).

  • Use Markdown tables (|---|) for data dictionaries and API specs.
  • Write standard headings (#, ##, ###).
  • Get user approval on the Markdown content before proceeding.

3. Template Injection (Python Script)

You MUST write and execute a python script (using python-docx and lxml) to inject the Markdown into the target .docx template.

You MUST include these EXACT bulletproof functions in your script to avoid OXML bugs:

A. Bold Markdown Support

import re
def parse_inline_markdown(p, text):
    parts = re.split(r'(\*\*.*?\*\*)', text)
    for part in parts:
        if part.startswith('**') and part.endswith('**') and len(part) > 4:
            run = p.add_run(part[2:-2])
            run.bold = True
        else:
            if part:
                p.add_run(part)

B. Double Numbering Prevention

from docx.oxml.ns import qn
def remove_auto_numbering(paragraph):
    pPr = paragraph._element.find(qn('w:pPr'))
    if pPr is not None:
        numPr = pPr.find(qn('w:numPr'))
        if numPr is not None:
            pPr.remove(numPr)

def strip_heading_numbering(text):
    """Strips leading numeric parts like '3.4.1 ' from text before Word adds its own list numbering."""
    return re.sub(r'^(\d+\.)*\d*\s+', '', text)

When injecting headings, call strip_heading_numbering on the text, then call parse_inline_markdown(p, text), and finally call remove_auto_numbering(p).

C. Bulletproof Header Replacement

def update_all_headers_footers(doc, old_keyword, new_keyword):
    """Search for old_keyword within paragraph.text (handling split runs), 
    replace it, and merge into a single run to avoid breaking XML tags."""
    for section in doc.sections:
        parts = [section.header, section.first_page_header, section.even_page_header,
                 section.footer, section.first_page_footer, section.even_page_footer]
        for part in parts:
            if part is None: continue
            for p in part.paragraphs:
                if old_keyword in p.text:
                    new_text = p.text.replace(old_keyword, new_keyword)
                    for run in p.runs: run.text = ""
                    if p.runs: p.runs[0].text = new_text
                    else: p.add_run(new_text)

D. Table of Contents Update

from docx.oxml import OxmlElement
element = OxmlElement('w:updateFields')
element.set(qn('w:val'), 'true')
doc.settings.element.append(element)

4. Execution

Run the script, save the output .docx, and instruct the user to open it and update the TOC.

安全使用建议
This skill appears safe for its stated purpose. Before using it, limit it to the intended repository, wiki pages, template, and output path; review the approved Markdown draft and final .docx; and ensure any required Python packages come from trusted sources.
功能分析
Type: OpenClaw Skill Name: tech-docx-writer Version: 1.0.0 The skill bundle provides a legitimate workflow and Python code snippets for generating technical Word documents from templates. The instructions in SKILL.md guide the agent to use python-docx and lxml for document manipulation, including specific functions for handling Markdown bolding, XML numbering, and header/footer replacements. No indicators of data exfiltration, malicious execution, or harmful prompt injection were found.
能力评估
Purpose & Capability
The stated purpose matches the workflow: gather technical context, draft Markdown, inject it into a .docx template, and save a Word document. The noteworthy capabilities are local/source-document reading and generated Python execution.
Instruction Scope
The workflow is strict and requires user approval of the Markdown before producing the document, but it also instructs the agent to write and execute a Python script as part of the normal flow.
Install Mechanism
There is no install spec, while the skill expects python-docx and lxml to be available. This is an under-declared dependency note, not evidence of hidden installation.
Credentials
Reading project wikis, codebases, reference docs, and git history is proportionate for technical documentation, but users should scope which repositories and files are used.
Persistence & Privilege
No credentials, background workers, persistence mechanisms, privileged paths, or account mutation are shown. The persistent outputs appear limited to the Markdown draft and generated .docx.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install tech-docx-writer
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /tech-docx-writer 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
- Initial release of the tech-doc-generator skill. - Provides a step-by-step workflow for generating highly accurate technical Word documents from corporate templates. - Ensures user-approved drafting in Markdown before document generation. - Includes robust Python code snippets for Markdown parsing, bulletproof header/footer editing, and numbering fixes in Word files. - Guides users to update the Table of Contents for finalized documents.
元数据
Slug tech-docx-writer
版本 1.0.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 1
常见问题

Tech Docx Writer 是什么?

Generate deeply technical Word documents based on corporate templates. Use when the user asks to generate a specification, architecture document, or API manu... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 108 次。

如何安装 Tech Docx Writer?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install tech-docx-writer」即可一键安装,无需额外配置。

Tech Docx Writer 是免费的吗?

是的,Tech Docx Writer 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Tech Docx Writer 支持哪些平台?

Tech Docx Writer 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Tech Docx Writer?

由 Loki612(@loki612)开发并维护,当前版本 v1.0.0。

💬 留言讨论