← Back to Skills Marketplace
loki612

Tech Docx Writer

by Loki612 · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ Security Clean
108
Downloads
1
Stars
0
Active Installs
1
Versions
Install in OpenClaw
/install tech-docx-writer
Description
Generate deeply technical Word documents based on corporate templates. Use when the user asks to generate a specification, architecture document, or API manu...
README (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.

Usage Guidance
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.
Capability Analysis
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.
Capability Assessment
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.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install tech-docx-writer
  3. After installation, invoke the skill by name or use /tech-docx-writer
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
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.
Metadata
Slug tech-docx-writer
Version 1.0.0
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 1
Frequently Asked Questions

What is 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... It is an AI Agent Skill for Claude Code / OpenClaw, with 108 downloads so far.

How do I install Tech Docx Writer?

Run "/install tech-docx-writer" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is Tech Docx Writer free?

Yes, Tech Docx Writer is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does Tech Docx Writer support?

Tech Docx Writer is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created Tech Docx Writer?

It is built and maintained by Loki612 (@loki612); the current version is v1.0.0.

💬 Comments