export-docx

Export research project reports to Word (.docx) format with embedded figures and formatted references. Use when user says "导出 Word", "/export word", "转 docx", "生成 Word 报告", "export to Word", or wants a Word document from project results.

42 stars

Best use case

export-docx is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Export research project reports to Word (.docx) format with embedded figures and formatted references. Use when user says "导出 Word", "/export word", "转 docx", "生成 Word 报告", "export to Word", or wants a Word document from project results.

Teams using export-docx should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/export-docx/SKILL.md --create-dirs "https://raw.githubusercontent.com/Zaoqu-Liu/ScienceClaw/main/skills/export-docx/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/export-docx/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How export-docx Compares

Feature / Agentexport-docxStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Export research project reports to Word (.docx) format with embedded figures and formatted references. Use when user says "导出 Word", "/export word", "转 docx", "生成 Word 报告", "export to Word", or wants a Word document from project results.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# Export to Word (.docx)

Convert a ScienceClaw project's report and figures into a formatted Word document using python-docx.

## When to Use

- User says "/export word", "导出 Word", "转 docx", "生成 Word 报告"
- User wants to share findings with collaborators who use Word
- User needs a formatted document for submission or review

## Workflow

1. **Identify the project directory** from ACTIVE_PROJECT.md or the most recent project
2. **Read the main report** from `reports/` directory (markdown)
3. **Collect figures** from `figures/` directory
4. **Read METHODS.md** if present
5. **Generate .docx** using python-docx with proper formatting
6. **Save** to `reports/<project_name>_report.docx`

## Code Template

```python
pip install -q python-docx Pillow 2>/dev/null && python3 << 'DOCXEOF'
import os, re, glob
from docx import Document
from docx.shared import Inches, Pt, Cm, RGBColor
from docx.enum.text import WD_ALIGN_PARAGRAPH
from docx.enum.style import WD_STYLE_TYPE

PROJECT_DIR = os.path.expanduser("PROJECT_DIR_PLACEHOLDER")
REPORT_FILE = "REPORT_FILE_PLACEHOLDER"
OUTPUT_FILE = os.path.join(PROJECT_DIR, "reports", "OUTPUT_NAME_PLACEHOLDER.docx")

doc = Document()

# --- Page setup ---
section = doc.sections[0]
section.top_margin = Cm(2.54)
section.bottom_margin = Cm(2.54)
section.left_margin = Cm(3.18)
section.right_margin = Cm(3.18)

# --- Styles ---
style = doc.styles['Normal']
font = style.font
font.name = 'Times New Roman'
font.size = Pt(11)
font.color.rgb = RGBColor(0x33, 0x33, 0x33)
style.paragraph_format.line_spacing = 1.5
style.paragraph_format.space_after = Pt(6)

for level in range(1, 4):
    hs = doc.styles[f'Heading {level}']
    hs.font.name = 'Arial'
    hs.font.color.rgb = RGBColor(0x3C, 0x54, 0x88)
    hs.font.size = Pt(16 - level * 2)
    hs.font.bold = True

# --- Read report markdown ---
report_path = os.path.join(PROJECT_DIR, "reports", REPORT_FILE)
with open(report_path, 'r', encoding='utf-8') as f:
    lines = f.readlines()

fig_dir = os.path.join(PROJECT_DIR, "figures")

# --- Parse and convert ---
for line in lines:
    line = line.rstrip('\n')

    # Headings
    if line.startswith('### '):
        doc.add_heading(line[4:], level=3)
    elif line.startswith('## '):
        doc.add_heading(line[3:], level=2)
    elif line.startswith('# '):
        doc.add_heading(line[2:], level=1)
    # Figure references
    elif '![' in line:
        m = re.search(r'!\[.*?\]\((.*?)\)', line)
        if m:
            img_path = m.group(1)
            if not os.path.isabs(img_path):
                img_path = os.path.join(PROJECT_DIR, img_path)
            if os.path.exists(img_path):
                doc.add_picture(img_path, width=Inches(5.5))
                last_p = doc.paragraphs[-1]
                last_p.alignment = WD_ALIGN_PARAGRAPH.CENTER
    # Table rows (simple pipe tables)
    elif line.startswith('|') and '---' not in line:
        cells = [c.strip() for c in line.split('|')[1:-1]]
        if cells:
            # Check if this is first row of a table
            if not hasattr(doc, '_current_table') or doc._current_table is None:
                doc._current_table = doc.add_table(rows=0, cols=len(cells))
                doc._current_table.style = 'Table Grid'
            row = doc._current_table.add_row()
            for i, cell_text in enumerate(cells):
                if i < len(row.cells):
                    row.cells[i].text = cell_text
    elif line.startswith('|') and '---' in line:
        pass  # skip separator rows
    else:
        # End current table if any
        if hasattr(doc, '_current_table'):
            doc._current_table = None
        # Regular paragraph
        if line.strip():
            p = doc.add_paragraph()
            parts = re.split(r'(\*\*.*?\*\*)', line)
            for part in parts:
                if part.startswith('**') and part.endswith('**'):
                    run = p.add_run(part[2:-2])
                    run.bold = True
                else:
                    p.add_run(part)

# --- Embed remaining figures at the end ---
if os.path.isdir(fig_dir):
    pngs = sorted(glob.glob(os.path.join(fig_dir, '*.png')))
    if pngs:
        doc.add_heading('Figures', level=1)
        for png in pngs:
            fname = os.path.basename(png)
            doc.add_heading(fname.replace('.png', '').replace('_', ' ').title(), level=3)
            doc.add_picture(png, width=Inches(5.5))
            last_p = doc.paragraphs[-1]
            last_p.alignment = WD_ALIGN_PARAGRAPH.CENTER
            doc.add_paragraph('')

# --- Append METHODS if present ---
methods_path = os.path.join(PROJECT_DIR, "METHODS.md")
if os.path.exists(methods_path):
    doc.add_page_break()
    doc.add_heading('Methods', level=1)
    with open(methods_path, 'r', encoding='utf-8') as f:
        for line in f:
            line = line.strip()
            if line and not line.startswith('#'):
                doc.add_paragraph(line)

os.makedirs(os.path.dirname(OUTPUT_FILE), exist_ok=True)
doc.save(OUTPUT_FILE)
print(f"Saved: {OUTPUT_FILE}")
DOCXEOF
```

## Customization

- Replace `PROJECT_DIR_PLACEHOLDER` with the actual project directory
- Replace `REPORT_FILE_PLACEHOLDER` with the main report filename
- Replace `OUTPUT_NAME_PLACEHOLDER` with the desired output name
- Adjust page margins, fonts, and heading styles as needed

Related Skills

export-pptx

42
from Zaoqu-Liu/ScienceClaw

Export research project findings to a presentation (.pptx) with key findings, figures, and conclusions. Use when user says "导出 PPT", "/export pptx", "做个汇报", "生成 PPT", "export to PowerPoint", "make a presentation from results", or wants slides from project results. Builds on pptx-generation skill.

export-latex

42
from Zaoqu-Liu/ScienceClaw

Export research project findings to a LaTeX manuscript draft with figures, references, and methods. Supports Nature, Cell, Lancet, and generic article formats. Use when user says "导出 LaTeX", "/export latex", "写论文初稿", "export to LaTeX", "generate manuscript", or wants a paper draft from project results. Builds on venue-templates skill.

zinc-database

42
from Zaoqu-Liu/ScienceClaw

Access ZINC (230M+ purchasable compounds). Search by ZINC ID/SMILES, similarity searches, 3D-ready structures for docking, analog discovery, for virtual screening and drug discovery.

zarr-python

42
from Zaoqu-Liu/ScienceClaw

Chunked N-D arrays for cloud storage. Compressed arrays, parallel I/O, S3/GCS integration, NumPy/Dask/Xarray compatible, for large-scale scientific computing pipelines.

Academic Writing

42
from Zaoqu-Liu/ScienceClaw

## Overview

scientific-visualization

42
from Zaoqu-Liu/ScienceClaw

## Overview

venue-templates

42
from Zaoqu-Liu/ScienceClaw

Access comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.

vaex

42
from Zaoqu-Liu/ScienceClaw

Use this skill for processing and analyzing large tabular datasets (billions of rows) that exceed available RAM. Vaex excels at out-of-core DataFrame operations, lazy evaluation, fast aggregations, efficient visualization of big data, and machine learning on large datasets. Apply when users need to work with large CSV/HDF5/Arrow/Parquet files, perform fast statistics on massive datasets, create visualizations of big data, or build ML pipelines that do not fit in memory.

uspto-database

42
from Zaoqu-Liu/ScienceClaw

Access USPTO APIs for patent/trademark searches, examination history (PEDS), assignments, citations, office actions, TSDR, for IP analysis and prior art searches.

uniprot-database

42
from Zaoqu-Liu/ScienceClaw

Direct REST API access to UniProt. Protein searches, FASTA retrieval, ID mapping, Swiss-Prot/TrEMBL. For Python workflows with multiple databases, prefer bioservices (unified interface to 40+ services). Use this for direct HTTP/REST work or UniProt-specific control.

umap-learn

42
from Zaoqu-Liu/ScienceClaw

UMAP dimensionality reduction. Fast nonlinear manifold learning for 2D/3D visualization, clustering preprocessing (HDBSCAN), supervised/parametric UMAP, for high-dimensional data.

treatment-plans

42
from Zaoqu-Liu/ScienceClaw

Generate concise (3-4 page), focused medical treatment plans in LaTeX/PDF format for all clinical specialties. Supports general medical treatment, rehabilitation therapy, mental health care, chronic disease management, perioperative care, and pain management. Includes SMART goal frameworks, evidence-based interventions with minimal text citations, regulatory compliance (HIPAA), and professional formatting. Prioritizes brevity and clinical actionability.