office-docs
БесплатноБез исполняемых скриптовНе проверенOffice document ingestion for RAG: DOCX (python-docx, mammoth to markdown), PPTX (python-pptx with image extraction), XLSX (openpyxl, pandas, table-aware…
от claude-dev-suite★ 51 звезда на GitHubОб этом скилле
Office Documents for RAG
Format Matrix
| Format | Library | Markdown Path | Tables | Images | Comments |
|---|---|---|---|---|---|
| DOCX | python-docx | mammoth | Yes | python-docx InlineShape |
python-docx |
| PPTX | python-pptx | custom | Limited | shape.image.blob |
slide.notes_slide |
| XLSX | openpyxl / pandas | custom | Native | Embedded images | openpyxl |
| Notion | Notion API + notion-to-md | Native | Yes | Block downloads | Discussion blocks |
| Confluence | atlassian-python-api | html2md | Yes | Attachments endpoint | Inline comments API |
| Quip | Quip API | html2md | Yes | Blob endpoint | Section comments |
DOCX — python-docx + mammoth
# Structured extraction with python-docx
from docx import Document
from docx.oxml.ns import qn
def extract_docx(path: str) -> list[dict]:
doc = Document(path)
out = []
heading_stack: list[str] = []
for para in doc.paragraphs:
style = (para.style.name or "").lower()
text = para.text.strip()
if not text:
continue
if style.startswith("heading"):
try:
level = int(style.split()[-1])
except ValueError:
level = 1
heading_stack = heading_stack[: level - 1] + [text]
out.append({"type": "heading", "level": level, "text": text,
"path": list(heading_stack)})
elif style == "list paragraph":
out.append({"type": "list_item", "text": text,
"path": list(heading_stack)})
else:
out.append({"type": "paragraph", "text": text,
"path": list(heading_stack)})
# Tables
for t_idx, table in enumerate(doc.tables):
rows = [[cell.text.strip() for cell in row.cells] for row in table.rows]
out.append({"type": "table", "index": t_idx, "rows": rows,
"path": list(heading_stack)})
return out
DOCX to Markdown with Mammoth
import mammoth
with open("brief.docx", "rb") as f:
result = mammoth.convert_to_markdown(
f,
style_map="""
p[style-name='Heading 1'] => h1:fresh
p[style-name='Heading 2'] => h2:fresh
p[style-name='Quote'] => blockquote:fresh
r[style-name='Code'] => code
""",
convert_image=mammoth.images.img_element(lambda img: {
"src": save_image(img),
}),
)
markdown = result.value
for message in result.messages:
print("mammoth:", message.type, message.message)
Comments and Revisions
from docx.oxml.ns import qn
def extract_comments(path: str) -> list[dict]:
doc = Document(path)
comments_part = doc.part.package.part_related_by_reltype(
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments"
)
xml = comments_part.blob
from lxml import etree
tree = etree.fromstring(xml)
out = []
for c in tree.findall(qn("w:comment")):
out.append({
"id": c.get(qn("w:id")),
"author": c.get(qn("w:author")),
"date": c.get(qn("w:date")),
"text": " ".join(t.text or "" for t in c.iter(qn("w:t"))),
})
return out
# Tracked changes: look for w:ins (insertion) and w:del (deletion) elements
Embedded Images from DOCX
from pathlib import Path
def extract_docx_images(path: str, out_dir: str):
doc = Document(path)
Path(out_dir).mkdir(parents=True, exist_ok=True)
for rel in doc.part.rels.values():
if "image" in rel.reltype:
blob = rel.target_part.blob
ext = rel.target_part.partname.split(".")[-1]
(Path(out_dir) / f"{rel.rId}.{ext}").write_bytes(blob)
PPTX — Slide to Markdown
from pptx import Presentation
from pptx.enum.shapes import MSO_SHAPE_TYPE
from pathlib import Path
def pptx_to_markdown(path: str, image_dir: str) -> list[dict]:
Path(image_dir).mkdir(parents=True, exist_ok=True)
prs = Presentation(path)
slides = []
for i, slide in enumerate(prs.slides, start=1):
parts: list[str] = []
title = ""
for shape in slide.shapes:
if shape.has_text_frame:
for para in shape.text_frame.paragraphs:
txt = " ".join(run.text for run in para.runs).strip()
if not txt:
continue
if shape == slide.shapes.title and not title:
title = txt
parts.append(f"# {txt}")
else:
bullet = "- " if para.level > 0 else ""
parts.append(f"{' ' * para.level}{bullet}{txt}")
if shape.shape_type == MSO_SHAPE_TYPE.PICTURE:
img = shape.image
name = f"slide{i}_{shape.shape_id}.{img.ext}"
(Path(image_dir) / name).write_bytes
Установить office-docs в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
ReadGrepGlobWriteEditFAQ
Что делает скилл office-docs?
Office document ingestion for RAG: DOCX (python-docx, mammoth to markdown), PPTX (python-pptx with image extraction), XLSX (openpyxl, pandas, table-aware chunking), plus Notion/Confluence/Quip export to markdown. Preserves headings, lists, comments, and embedded images. USE WHEN: user mentions "DOCX", "Word document", "python-docx", "mammoth", "PPTX", "PowerPoint", "python-pptx", "XLSX", "Excel", "openpyxl", "spreadsheet", "Notion export", "Confluence export", "Quip export", "office documents" DO NOT USE FOR: generic multi-format partitioning - use `unstructured-io`; PDF exports of office docs - use `pdf-extraction`; structured markdown vaults - use `markdown-structured`; emails with office attachments (handle extraction here, ingestion via `email-ingestion`)
Как установить скилл office-docs?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл office-docs запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
docx
Use this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files) or Word templates (.dotx files). Triggers include…
от AnthropicUse this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple…
от Anthropicxlsx
Use this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing…
от Anthropicpptx
Use this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or…
от Anthropic