anthropics / anthropics/skills

docx skill: scripts need Python 3.10+ and defusedxml, but SKILL.md declares neither

Offen
#1,461 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Python
Sterne
176k
Forks
20.9k
Ø Merge
7 Std. 21 Min.
Gemergte PRs (30 T.)
5

Beschreibung

## Summary

The docx skill's Python scripts fail on macOS system Python (3.9) in two ways, and neither requirement is declared:

1. `skills/docx/scripts/merge_runs.py` imports third-party `defusedxml` (`import defusedxml.minidom`, line 33). Not preinstalled on a stock Mac, so the first failure is `ModuleNotFoundError: No module named 'defusedxml'`.
2. After installing defusedxml, the import chain still breaks on Python 3.9: `merge_runs.py` does `from office.helpers import ...`, and `skills/docx/scripts/office/helpers/__init__.py` line 24 uses PEP 604 union syntax in a signature (`-> str | None`), which raises `TypeError: unsupported operand type(s) for |` at import time on anything below 3.10. Same syntax appears in `office/helpers/pptx_chart.py` (lines 89, 101).

SKILL.md's Dependencies section lists `docx` (npm), pandoc, LibreOffice, and pdftoppm, but no Python version or Python packages, and its usage examples invoke bare `python scripts/merge_runs.py ...`. A model following the skill on a machine where `python3` is 3.9 hits two consecutive dead ends and falls back to hand-editing `word/document.xml`, which is exactly what merge_runs.py exists to make safe.

## Environment

- macOS (Darwin 25.3.0), system python3 = 3.9
- Claude Code desktop app, bundled docx skill (matches current main of this repo)

## Suggested fix (any of these)

- Declare `Python >= 3.10` and `defusedxml` in SKILL.md's Dependencies line so the model installs/selects correctly up front
- Add an early version gate in the scripts (`sys.version_info` check with a clear message) so the failure is one obvious error instead of two confusing ones
- Or drop the 3.10-only syntax (use `Optional[str]`) and fall back to stdlib `xml.dom.minidom` when defusedxml is missing, since the input is the user's own file

🤖 Filed with [Claude Code](https://claude.com/claude-code)

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Rechercherichtung

Start with skills/docx/SKILL.md and its Dependencies section, then inspect skills/docx/scripts/merge_runs.py and office/helpers/__init__.py for the reported requirements. Decide which suggested fix is in scope, and verify that the documented prerequisites or resulting error handling address Python 3.9 and the missing defusedxml failure.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
python
Bereich
documentation
Issue-Typ
Bug
Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Aktivitätsstatus
Ruhig
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
58/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.