Back to Documents

Word Document Management Skill

docxautomationnodeofficetypescript
4.8 (127)27📄 MIT🕒 2025-11-11Source ↗

Install this skill

npx skills add Fergana-Labs/claude_agent_desktop

Works across Claude Code, Cursor, Codex, Copilot & Antigravity

What this skill does

  • Extract raw text content from existing .docx files
  • Generate new Word documents with custom titles and paragraphs
  • Apply hierarchical heading levels to new document structures
  • Insert data-driven tables into document bodies
  • Modify existing files by appending new content

When to use it

  • Automating the generation of recurring weekly status reports
  • Converting structured JSON or log data into readable document formats
  • Extracting specific content from legacy Word files for documentation cleanup
  • Templating standardized project documentation for consistent formatting

When not to use it

  • Processing non-Word formats like ODT or rich text files
  • Handling complex documents with heavily embedded macros or tracked changes
  • Performing advanced visual styling beyond basic formatting tags

How to invoke it

Example prompts that trigger this skill:

  • Read the contents of the report at /documents/summary.docx.
  • Create a new document at project-doc.docx with these sections: Title, Paragraphs, and a table of task statuses.
  • Extract all text from the meeting minutes file.
  • Add a new section for Q4 findings to the existing Q3-report.docx.

Example workflow

  1. Identify the source .docx file or the desired output path.
  2. Pass the content structure as a JSON object to the create function.
  3. Run the ts-node command via the agent's bash executor.
  4. Verify the output file existence in the file system.
  5. Open the generated document to confirm the hierarchy and table alignment.

Prerequisites

  • Node.js installed in the environment
  • TypeScript/ts-node configured
  • Project dependencies: docx and mammoth

Pitfalls & limitations

  • !Does not support legacy .doc files, only .docx
  • !Cannot execute complex Word macros or VBA scripts
  • !Formatting is limited to the capabilities defined by the underlying npm libraries

FAQ

Does this tool require Microsoft Word installed on the machine?
No, it uses Node.js libraries to manipulate the OpenXML format directly.
Can I edit existing paragraphs in the middle of a document?
The current implementation is optimized for appending content and creating new documents from scratch.
What happens if I try to open a corrupted .docx file?
The library may fail to parse the file structure, resulting in a read error during the process.

How it compares

This tool automates file interactions that would otherwise require manual software usage or heavy external API dependencies, allowing for scripting within the local development flow.

Source & trust

27 stars📄 MIT🕒 Updated 2025-11-11🛡 runs-shell

From the source: “# Word Document Tool This skill allows you to work with Microsoft Word documents using Node.js tools. ## Capabilities - **Read** existing Word documents and extract text content - **Create** new Word documents with formatted text, headings, paragraphs, and tables - **Modify** existing documents by a…”

View the full SKILL.md source

# Word Document Tool

This skill allows you to work with Microsoft Word documents using Node.js tools.

## Capabilities

- **Read** existing Word documents and extract text content
- **Create** new Word documents with formatted text, headings, paragraphs, and tables
- **Modify** existing documents by appending content
- **Extract** document structure and formatting

## When to Use

Invoke this skill when the user:
- Mentions Word documents, .docx files, or document creation
- Asks to read, create, modify, or format text documents
- Needs to generate reports, letters, or formatted documents
- Wants to extract text from existing Word files

## How to Use

The Word tool is implemented as a TypeScript script at `src/tools/word-tool.ts`. You can invoke it using the Bash tool:

### Reading a Document
```bash
ts-node src/tools/word-tool.ts read "/path/to/document.docx"
```

### Creating a Document
```bash
ts-node src/tools/word-tool.ts create "/path/to/new-document.docx" '{"title":"My Document","paragraphs":["First paragraph","Second paragraph"]}'
```

## JSON Structure for Creating Documents

When creating documents, use this JSON format:
```json
{
  "title": "Document Title",
  "paragraphs": ["Paragraph 1", "Paragraph 2"],
  "headings": [{"text": "Section 1", "level": 1}],
  "tables": [{"headers": ["Col1", "Col2"], "rows": [["A", "B"]]}]
}
```

## Implementation

Uses the `docx` and `mammoth` npm libraries for reading and writing Word documents.

Quoted from Fergana-Labs/claude_agent_desktop for reference — see the original for the authoritative, latest version.

📄 Full skill instructions — original source: Fergana-Labs/claude_agent_desktop
This skill provides your agent with direct programmatic control over Microsoft Word (.docx) files. It enables automated document generation, data extraction, and structural modification, bridging the gap between raw text content and structured Office documents. Instead of relying on manual copy-pasting or complex third-party document processors, developers can instruct an agent to parse existing reports or create new ones with predefined headers, tables, and lists. This utility is particularly useful for teams automating the production of business documentation, project status updates, or formatted technical summaries within a Node.js environment. By wrapping standard libraries like docx and mammoth into a bash-accessible interface, the tool ensures consistency in document layout and data extraction tasks without requiring the presence of Microsoft Word software on the host machine.

How to Use This Skill Unit

Option A: Project-Specific (Recommended)

  1. Click "Download" above
  2. In your project, create the directory: .agent/skills/word/
  3. Save the file as SKILL.md
  4. The agent will automatically discover the skill based on its description.

Option B: Global Installation (All Agents)

Save the file to these locations to make it available across all projects:

  • Claude Code: ~/.claude/skills/Fergana-Labs/claude_agent_desktop/word/SKILL.md
  • Cursor: ~/.cursor/skills/Fergana-Labs/claude_agent_desktop/word/SKILL.md
  • Antigravity: ~/.gemini/antigravity/skills/Fergana-Labs/claude_agent_desktop/word/SKILL.md

🚀 Install with CLI:
npx skills add Fergana-Labs/claude_agent_desktop

Read the Master Guide: Mastering Agent Skills

Recommended Rules

View more rules

Recommended Workflows

View more workflows

Recommended MCP Servers

View more MCP servers

Take It Further

Maximize your productivity with these powerful resources

📋

Define Your Standards

Set up coding standards to ensure this workflow produces consistent, high-quality results.

Browse Rules Library
📖

Master Workflows

Learn how to create custom workflows, use Turbo Mode, and build your automation library.

Complete Guide

How to use this Skill in Claude Code & Cursor

For Claude Code (CLI)

To use this skill in Claude Code, copy the rule content into your project's custom instructions or follow our Add-Skill CLI guide. This ensures Claude follows your standards during every code generation.

For Cursor & Windsurf

For Cursor or Windsurf, individual skills are best used in the "Rules for AI" section. This specific unit helps the agent avoid documents issues, leading to cleaner, more efficient code.

Why the skill format matters: the standardized Agent Skills format lets your AI agent load detailed instructions only when they are relevant, keeping your prompt clean while improving results.

Source & attribution

This skill is categorized under Documents and is published by Fergana-Labs, maintained in Fergana-Labs/claude_agent_desktop.

← Browse All Agent Skills
Sponsored AI assistant. Recommendations may be paid.