Zum Inhalt springen
Skillpedia
PDF, Word & Folien7.8k · #12866

docx-read-fallback

Was er macht

Dieser Skill zeigt der KI, wie sie Text, Tabellen und Überschriften aus einer .docx-Datei mit der Bibliothek python-docx herausholt, wenn einfachere Methoden scheitern. Er richtet sich an Menschen, deren Word-Dokumente sonst nicht geöffnet werden können.

Wann du ihn nutzt

  • ✓Wenn der Dateileser bei einer .docx-Datei fehlschlägt oder eine Zeitüberschreitung meldet.
  • ✓Wenn ich den Text, die Tabellen oder die Überschriften eines Word-Dokuments brauche.
  • ✓Wenn die Code-Sandbox die Word-Datei nicht lesen kann.

Link zum Skill

https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/docx-read-fallback/SKILL.md

Kopiere ihn und füge ihn in deine KI ein (Claude, ChatGPT oder Cursor) mit der Bitte, den Anweisungen zu folgen.

So nutzt du ihn

Am einfachsten: Kopiere die Nachricht und füge sie in deine KI ein. Sie liest den Skill und folgt den Anweisungen.

Fertige Nachricht zum Einfügen

Nutze diesen Skill, um mir zu helfen: https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/docx-read-fallback/SKILL.md Lies die SKILL.md unter diesem Link und folge ihren Anweisungen für meine Aufgabe.
Soll deine KI Skills wie diesen selbst finden?Installiere den kostenlosen Skillpedia-MCP: eine Zeile, und sie durchsucht vor jeder Aufgabe 15.000+ Skills.In 1 Minute installieren →

Beispielanfrage an deine KI

“Die KI kann meine Word-Datei nicht öffnen. Bitte zieh den Text und alle Tabellen heraus.”

5 neue Skills pro Woche. 1 Minute Lesezeit.

So funktioniert es

Die KI führt einen kurzen Python-Befehl in der Shell aus, der mit python-docx die Absätze, Tabellen oder Überschriften der Datei ausgibt.

Technischer Inhalt (originale SKILL.md)

Originaltext des Autors, auf Englisch, direkt von GitHub.

DOCX Read Fallback

When read_file or execute_code_sandbox fails to read .docx files, use run_shell with python-docx as a reliable workaround.

When to Use

  • read_file fails, times out, or returns errors on .docx files
  • execute_code_sandbox attempts to read the docx fail
  • You need to extract text content from a Word document
  • Multiple standard approaches have been exhausted

How to Use

Basic Text Extraction

python -c "import docx; doc = docx.Document('path/to/file.docx'); print('\n'.join([p.text for p in doc.paragraphs]))"

Using run_shell Tool

run_shell command="python -c \"import docx; doc = docx.Document('path/to/file.docx'); print('\n'.join([p.text for p in doc.paragraphs]))\"" timeout=60

Extract Paragraphs with Indices

python -c "import docx; doc = docx.Document('file.docx'); [print(f'P{i}: {p.text}') for i, p in enumerate(doc.paragraphs) if p.text.strip()]"

Extract Tables

python -c "import docx; doc = docx.Document('file.docx'); [[print([[cell.text for cell in row.cells] for row in table.rows]) for table in doc.tables]]"

Extract Headings (by style)

python -c "import docx; doc = docx.Document('file.docx'); [print(p.text) for p in doc.paragraphs if p.style.name.startswith('Heading')]"

Prerequisites

Ensure python-docx is available:

python -c "import docx; print('docx available')"

If not installed:

pip install python-docx

Tips

  • Use absolute paths to avoid working directory issues
  • Set appropriate timeout (30-60 seconds for large documents)
  • Escape quotes properly when embedding in shell commands
  • For large documents, extract content in chunks or filter by paragraph index
  • This approach bypasses file type detection issues in read_file

Example Workflow

  1. Try read_file on the .docx file
  2. If it fails, verify python-docx availability
  3. Use run_shell with the python-docx extraction command
  4. Parse the stdout to get document content
  5. Proceed with your analysis using the extracted text
Häufige Fragen

Was ist python-docx?

Eine Python-Bibliothek, die Word-Dateien liest und schreibt.

Kann sie auch Tabellen lesen?

Ja. Die Anleitung enthält einen Befehl, der den Inhalt von Tabellen ausgibt.

Was muss installiert sein?

Die Anleitung sagt, dass python-docx verfügbar sein muss, bevor der Befehl läuft.

Details

Originalbeschreibung des Autors

Use run_shell with python-docx as reliable fallback when read_file fails on .docx files

repo: HKUDS/AgentPilot

Beliebtheit

GitHub-Sterne
7.8k
Platz im Ranking
#12866
Lizenz
MIT
Aktualisiert
1.11.2026

Ist dieser Skill nützlich?

0

Anmelden um abzustimmen.

Kommentare

  • …

Weitere Skills aus diesem Repository

Ähnliche Skills