Skip to content
docx-automation logo

/docx-automation - DOCX Document Generation

docx-automation

Generate DOCX documents from pipeline results or structured data. Uses python-docx library for Word document generation. Independent utility skill (can be called standalone or post-pipeline).

SKILL.md

Full skill instructions

/​docx-automation - DOCX Document Generation

Version: 3.1.0 | Type: Independent Utility Skill Role: Generate Word documents from pipeline results or data Pipeline: Standalone or post-pipeline utility

1. Purpose

Generate Microsoft Word documents from:

  • Pipeline export results (mathpix_pipeline)
  • Structured data (JSON/​YAML/​Dict)
  • Template-based reports

2. Prerequisites

pip install python-docx>=0.8.11

3. Invocation

# Generate from pipeline results
/​docx-automation generate <source_file> [--output <output.docx>]

# Convert JSON to DOCX
/​docx-automation from-json <data.json> --output report.docx

# Generate report from pipeline data
/​docx-automation report <image_id> --format detailed

# With workload context
/​docx-automation generate synthesis-report --workload <slug>

4. L1/​L2/​L3 Output Format

L1 Summary (returned to main context)

taskId: docx-{timestamp}
agentType: docx-automation
status: success
summary: "Generated report.docx (125KB)"

filePath: ".agent/​prompts/​{slug}/​docx/​report.docx"
fileSize: 128000
pageCount: 5

l2Path: .agent/​prompts/​{slug}/​docx-automation/​l2_index.md
requiresL2Read: false
nextActionHint: "Document at {filePath}"

L2 Report Structure

# DOCX Generation Summary

## Document Info
- **Output:** report.docx
- **Size:** 125 KB
- **Pages:** 5

## Content Structure
1. Title Section
2. Content (equations, graphs)
3. Metadata
4. Provenance

## Generation Details
- Font: Times New Roman, 11pt
- Margins: 1 inch
- Header/​Footer: Enabled

5. Actions

generate

Generate DOCX from pipeline results.

/​docx-automation generate <source_file> [--output <output.docx>] [--config <config.yaml>]

from-json

Convert structured JSON to formatted DOCX.

/​docx-automation from-json <data.json> --output <output.docx> [--template <template>]

report

Generate detailed report from pipeline results.

/​docx-automation report <image_id> --format <summary|detailed|full> [--include-images]

6. Configuration Options

OptionTypeDefaultDescription
output_dirPath./​exportsOutput directory
page_width_inchesfloat8.5Page width
page_height_inchesfloat11.0Page height
margin_inchesfloat1.0Page margins
font_namestrTimes New RomanBody font
font_size_ptint11Body font size
heading_font_namestrArialHeading font
include_tocboolfalseTable of contents
include_headerbooltrueDocument header
include_footerbooltruePage numbers

7. Programmatic Usage

from mathpix_pipeline.export.exporters.docx_exporter import (
    DOCXExporter,
    DOCXExporterConfig,
)
from mathpix_pipeline.schemas.export import ExportOptions

# Initialize with custom config
config = DOCXExporterConfig(
    output_dir=Path("./​exports"),
    font_name="Arial",
    font_size_pt=12,
)
exporter = DOCXExporter(config)

# Export
options = ExportOptions(include_metadata=True)
spec = exporter.export(data, options, image_id="img_001")
print(f"Exported to: {spec.file_path}")

8. Output Structure

Generated DOCX documents include:

  1. Title Section - Document title, center-aligned
  2. Content Section - Outputs, graphs, equations
  3. Metadata Section (optional) - Generation timestamp, attributes
  4. Provenance Section (optional) - Pipeline version, stages

9. Error Handling

try:
    spec = exporter.export(data, options, image_id)
except ImportError:
    print("Install python-docx: pip install python-docx")
except ExporterError as e:
    print(f"Export error: {e.message}")

10. Pipeline Integration

[Independent Utility]
    |
/​docx-automation ---- Can be called standalone
    |
    +-- Output: .agent/​prompts/​{slug}/​docx/​{filename}.docx

Workload Context Resolution

# Priority:
# 1. --workload argument
# 2. Active workload (_active_workload.yaml)
# 3. New workload (document type based)

11. Handoff Contract

handoff:
  skill: "docx-automation"
  workload_slug: "{slug}"
  status: "completed"
  next_action:
    skill: null
    arguments: null
    required: false
    reason: "Document generated successfully"
  output:
    path: ".agent/​prompts/​{slug}/​docx/​{filename}.docx"
    format: "docx"

12. Post-Compact Recovery

if (isPostCompactSession()) {
  const slug = await getActiveWorkload();
  if (slug) {
    const exportDir = `.agent/​prompts/​${slug}/​docx/`;
    const partialFiles = await Glob(`${exportDir}/​*.partial`);
    if (partialFiles.length > 0) {
      console.log("Resuming partial document generation...");
    }
  }
}

Version History

VersionChange
3.1.0Cleaned duplicate blocks, normalized frontmatter
3.0.0EFL Pattern integration, context: fork
2.2.0Standalone execution, handoff contract
2.1.0V2.1.19 spec compatibility
1.1.1Initial DOCX generation

More skills from majiayu000

xiaohongshu logo
majiayu000/claude-arsenal

xiaohongshu

xiaohongshu

286 148
View
agent-task-conductor logo
majiayu000/claude-skill-registry

agent-task-conductor

Conduct multi-agent task orchestration and workflow coordination.

663 1
View
conductor-setup logo
majiayu000/claude-skill-registry

conductor-setup

Initialize project with Conductor artifacts (product definition,

663 1
View
animation-designer logo
majiayu000/claude-skill-registry

animation-designer

Expert in web animations, transitions, and motion design using Framer Motion and CSS

663 1
View
diagramming logo
majiayu000/claude-skill-registry

diagramming

Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...

663 1
View
h3-pg logo
majiayu000/claude-skill-registry-data

h3-pg

PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.

23 1
View
conductor-development logo
majiayu000/claude-skill-registry

conductor-development

Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...

663 1
View
conductor-status logo
majiayu000/claude-skill-registry

conductor-status

Display project status, active tracks, and next actions

663 1
View
dockerization logo
majiayu000/claude-skill-registry

dockerization

Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.

663 1
View

Popular AI tools

Kaiber logo
Video

Kaiber

Generate, edit, and beat-sync AI video with leading models in one workspace.

Paid
View
Vimcal logo
Productivity

Vimcal

The world's fastest calendar for remote work

Free
View

Transform Your Design with AI Designer by ImgCreator.ai

Freemium
View
Akool AI logo
Content & writing

Akool AI

Revolutionizing Video Production with AI-Powered Creativity

Paid
View

Extend an image past the frame and let AI fill the new aspect ratio.

Freemium
View
StarByFace logo
Security

StarByFace

Discover your celebrity doppelgänger with StarByFace!

Free
View
C

ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.

Freemium
View
Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View