python-docx

python-docx is a skill for Claude Code, Codex from cxcscmu/SkillLearnBench. It costs 23 tokens per session (977 once invoked), scanned A, original, MIT.

A Python library and guide for reading, creating, and changing Word documents in the .docx format. It works with paragraphs, formatted text, tables, and document sections.

In plain words
What is it for?
It helps open and save documents, read or add paragraphs, apply formatting, find and replace text, and work with tables and sections.
Why use it?
It avoids manually editing documents when text or structure needs to be generated or changed programmatically.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit It helps open and save documents, read or add paragraphs, apply formatting, find and replace text, and work with tables and sections.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/cxcscmu/skilllearnbench/python-docx
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add cxcscmu/SkillLearnBench --skill python-docx
Clone the repo
git clone --depth 1 https://github.com/cxcscmu/SkillLearnBench

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for python-docx

README.md
[![agentmods](https://agentmods.dev/badge/skills/cxcscmu/skilllearnbench/python-docx/github.svg)](https://agentmods.dev/skills/cxcscmu/skilllearnbench/python-docx)
Your own site
<a href="https://agentmods.dev/skills/cxcscmu/skilllearnbench/python-docx"><img src="https://agentmods.dev/badge/skills/cxcscmu/skilllearnbench/python-docx/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for python-docx

Your own site · 80×15
<a href="https://agentmods.dev/skills/cxcscmu/skilllearnbench/python-docx"><img src="https://agentmods.dev/badge/skills/cxcscmu/skilllearnbench/python-docx.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 23 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 977 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00023 $0.00977
Opus 5.5 $0.00009 $0.00391
Sonnet 5.5 $0.00005 $0.00195
Haiku 4.5 $0.00002 $0.00098

Measured 3mo ago against content hash cc88272c4d6a, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

python-docx scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/b1-one-shot-claude-haiku-4-5/offer-letter-generator/python-docx/SKILL.md · 141 lines

How it starts

The opening of the file, as written. The whole thing — 141 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Python-docx: Working with Word Documents

Overview

The python-docx library allows you to create, read, and update Microsoft Word (.docx) files programmatically. It's essential for automating document generation, template filling, and Word document manipulation in Python.

Installation

pip install python-docx

Core Concepts

Document Structure

  • Document: Root object representing the entire .docx file
  • Paragraphs: Text blocks in the document
  • Runs: Individual text segments within a paragraph (can have different formatting)
  • Tables: Structured data with rows/cells
  • Sections: Document sections with different headers/footers

Common Operations

Loading and Saving Documents

from docx import Document

# Open existing document
doc = Document('template.docx')

# Create new document
doc = Document()

# Save document
doc.save('output.docx')

Working with Paragraphs and Text

# Access all paragraphs
for para in doc.paragraphs:
    print(para.text)

# Add new paragraph
new_para = doc.add_paragraph('Text here')

# Add text with formatting
run = new_para.add_run('Bold text')
run.bold = True

Finding and Replacing Text

# Search through all paragraphs and runs
for para in doc.paragraphs:
    for run in para.runs:
        if '{{PLACEHOLDER}}' in run.text:
            run.text = run.text.replace('{{PLACEHOLDER}}', 'replacement')

# Note: Text can be split across multiple runs!
# A safer approach:
full_text = ''.join(run.text for run in para.runs)
if '{{PLACEHOLDER}}' in full_text:
    # Clear all runs and recreate with replacement
    for run in para.runs:
        run.text = ''
    para.text = full_text.replace('{{PLACEHOLDER}}', 'replacement')

Working with Tables

# Access table rows and cells
for table in doc.tables:
    for row in table.rows:
        for cell in row.cells:
            print(cell.text)
            # Replace text in cell
            cell.text = cell.text.replace('{{PLACEHOLDER}}', 'value')

Read the full file on GitHub · 141 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3mo ago First seen · 141 lines · 23 tokens per session scan A cc88272c4d6a

Subscribe to this mod's changes

python-docx is a skill published in the GitHub repository cxcscmu/SkillLearnBench (93 stars, last pushed 1mo ago), licensed MIT. It adds 23 tokens to every session and 977 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

python-docx compared with skills from other repositories

python-docx next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
python-docxcxcscmu/SkillLearnBenchSkill931mo agoMITA23Claude Code, Codex
image-ocrbenchflow-ai/skillsbenchSkill1.9k6d agoApache-2.0A16Claude Code, Codex
pdfbenchflow-ai/skillsbenchSkill1.9k6d agoApache-2.0A29Claude Code, Codex
pdf-editingbenchflow-ai/skillsbenchSkill1.9k6d agoApache-2.0A17Claude Code, Codex
docxbenchflow-ai/skillsbenchSkill1.9k6d agoApache-2.0A22Claude Code, Codex
exoplanet-workflowsbenchflow-ai/skillsbenchSkill1.9k6d agoApache-2.0A45Claude Code, Codex
xlsx-parsingbenchflow-ai/skillsbenchSkill1.9k6d agoApache-2.0A83Claude Code, Codex