본문으로 건너뛰기
Skillpedia
PDF, Word, 슬라이드7.1k · #13588

docx

하는 일

이 스킬은 Microsoft Word 파일을 다룹니다. 구조를 읽는 것부터 편집하고 새로 만드는 것까지 포함합니다. 스타일을 유지하면서 Word 문서를 바꾸거나 새로 만들어야 하는 사람을 위한 스킬입니다.

사용하는 경우

  • ✓Word 파일의 텍스트나 구조를 뽑아내야 할 때.
  • ✓스타일과 레이아웃을 유지하면서 Word 문서를 편집해야 할 때.
  • ✓요청서를 바탕으로 새 Word 문서를 만들고 싶을 때.

스킬 링크

https://github.com/TokenRhythm/opensquilla/blob/main/src/opensquilla/skills/bundled/docx/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/TokenRhythm/opensquilla/blob/main/src/opensquilla/skills/bundled/docx/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“이 Word 계약서의 가격을 업데이트해 주세요. 서식은 그대로 유지해 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

에이전트는 먼저 파일의 구조를 살펴 내부에 무엇이 있는지 확인한 다음, 스타일과 레이아웃이 그대로 남도록 내용을 제자리에서 편집합니다. 새 문서라면 요청 내용을 바탕으로 파일을 만듭니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

docx

Work with Microsoft Word .docx files. The format is OOXML — a zip container holding XML parts (word/document.xml, styles.xml, numbering.xml, headers, footers, relationships). Treat structure as primary; rendered text is a view.

Decide the path first

Pick one path up front. The right path depends only on what is on disk before you start.

You have Goal Path
Existing .docx Read text/structure A. Inspect
Existing .docx Modify content while keeping styles B. Edit-in-place
Nothing or a brief Build a new doc C. Create from scratch

If the user hands you a doc and asks for changes, default to path B and treat the input as the visual style baseline. Only choose path C when the user says "start fresh" or there is no input.


Path A: Inspect

Dump structure as JSON for inspection without mutating anything.

python {baseDir}/scripts/inspect_docx.py /path/to/doc.docx

Output schema:

{
  "paragraphs": [{"index": 0, "text": "...", "style": "Heading 1"}, ...],
  "tables": [[["row0,col0", "row0,col1"], ...], ...],
  "sections": 1,
  "has_tracked_changes": false
}

Use this whenever you need to see what is in the doc before deciding how to edit. The output is stable and machine-readable — diff two inspect outputs to verify a round-trip preserved everything you intended.


Path B: Edit in place

Two sub-strategies; pick by how invasive the edit is.

B1. Run-level text replacement (preferred)

When the change is "swap this string" or "fill these placeholders": mutate runs in place. This preserves all theme/style/font settings.

python {baseDir}/scripts/edit_docx.py input.docx ops.json --out output.docx

ops.json is a list of operations:

[
  {"op": "replace_run", "para": 0, "run": 0, "text": "Q3 Review"},
  {"op": "replace_text", "find": "{{CLIENT}}", "with": "Acme Corp"}
]

Edit at the run level, not the paragraph level — replacing whole paragraph text drops formatting. If a placeholder spans multiple runs (often happens when the original template applied bold/italic mid-word), the helper script collapses runs into the first one and clears the rest.

B2. Structural edits (sections / page layout / numbering)

python-docx exposes paragraphs, tables, and runs but has limited support for page layout, numbering definitions, and tracked changes. For those, unzip the .docx, patch word/document.xml and adjacent parts, and repack:

mkdir _unpacked && (cd _unpacked && unzip -q ../input.docx)
# edit _unpacked/word/document.xml
(cd _unpacked && zip -q -r ../output.docx . -x "*.DS_Store")

Rules when patching XML:

  • Use defusedxml.ElementTree or lxml, not stdlib xml.etree.ElementTree. ET drops or rewrites namespace prefixes (w:, r:) in ways Word refuses to load.
  • Preserve xml:space="preserve" on <w:t> elements that hold leading or trailing whitespace.
  • [Content_Types].xml must list every part type. Removing a header without also removing its override entry yields a "repair" prompt in Word.
  • Numbering definitions live in numbering.xml; bullet/number changes must patch the numbering ID, not just the visible text.

When done, validate by opening in LibreOffice headless before declaring success — silent failures are common.


Path C: Create from scratch

For a simple Markdown source, run the export script with the Markdown on stdin:

python {baseDir}/scripts/export_markdown_docx.py --out out.docx < draft.md

For structured content, use a JSON specification:

python {baseDir}/scripts/create_docx.py spec.json --out out.docx

spec.json describes content declaratively:

{
  "metadata": {"title": "Q3 Review", "author": "Wei E."},
  "body": [
    {"kind": "heading", "level": 1, "text": "Q3 Review"},
    {"kind": "paragraph", "text": "Revenue +18% YoY."},
    {"kind": "table", "rows": [["Metric", "Value"], ["Revenue", "$2.1M"]]}
  ]
}

For programmatic use call python-docx directly:

from docx import Document
doc = Document()
doc.add_heading("Q3 Review", level=1)
doc.add_paragraph("Revenue +18% YoY.")
table = doc.add_table(rows=2, cols=2)
table.rows[0].cells[0].text = "Metric"
doc.save("out.docx")

See references/python_docx.md for paragraphs, styles, numbering, tables, headers/footers, and section breaks.


Tracked changes

Tracked changes are stored in `word/document

자주 묻는 질문

서식이 유지되나요?

네. 편집할 때 이 스킬은 기존 파일을 스타일 기준으로 삼고 그대로 유지합니다.

변경 내용 추적도 처리하나요?

네. 이 스킬은 Word 파일의 변경 내용 추적을 검토하는 것도 다룹니다.

새 파일을 원하면 어떻게 하나요?

처음부터 다시 시작하라고 하거나 입력 파일이 없으면, 이 스킬은 새 문서를 만듭니다.

상세 정보

작성자의 원본 설명

Read, inspect, edit, or create Microsoft Word `.docx` documents, including structured text extraction, style-preserving edits, tracked-change review, and generation from a brief.

repo: TokenRhythm/opensquilla

인기도

GitHub 스타
7.1k
순위
#13588
라이선스
Apache-2.0
업데이트
2026. 11. 2.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬