Create, inspect, edit, restyle, review, compare, sanitize, render, audit, and finalize professional Microsoft Word .docx documents. Use this skill whenever PilotDeck must produce or modify a Word document, preserve an existing document while making targeted changes, add comments or tracked replacements, analyze document structure or metadata, verify accessibility and layout quality, compare revisions, remove review data, or deliver a visually checked DOCX. Use only for .docx files, not legacy .doc, macro-enabled .docm, or Google Docs operations.
80
100%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
View guide
Low
Low-risk findings worth noting
Treat a Word document as both structured content and a paginated visual artifact. Use the bundled CLI for deterministic package operations, follow the task-specific guidance below, and do not deliver a mutated DOCX until the latest structural and visual checks pass.
Resolve the directory containing this SKILL.md as DOCX_SKILL_ROOT. Common locations are:
DOCX_SKILL_ROOT="${PILOT_HOME:-$HOME/.pilotdeck}/skills/docx"
# In a source checkout: <repo>/skills/docxInvoke all deterministic operations through:
bash "$DOCX_SKILL_ROOT/scripts/docx.sh" <command> [options]Use the turn-scoped PilotDeck work directory for every intermediate. The host sets PILOTDECK_WORK_DIR; the fallback keeps manual runs internal to the project:
WORKSPACE="${PILOTDECK_WORK_DIR:-$PWD/.pilotdeck/work/manual/<task-slug>}/docx"
mkdir -p "$WORKSPACE/tmp" "$WORKSPACE/qa"Keep JSON specifications, inspections, comparisons, rendered pages, optional QA PDFs, and temporary candidates in WORKSPACE. Keep source documents in place and put only requested final DOCX deliverables in the project or user-selected output directory. Never create inspection JSON, render directories, or other intermediates beside the user's files. Do not write task artifacts into the skill directory.
| User intent | Primary command | Read first |
|---|---|---|
| Read, summarize, or inspect a DOCX | inspect | workflows.md |
| Create a new document or substantially redesign one | create | design-and-layout.md, then specifications.md |
| Make targeted edits while preserving the source | edit | workflows.md, then specifications.md |
| Add reviewer comments or tracked replacements | review | ooxml-and-safety.md, then specifications.md |
| Accept/reject changes or strip comments | finalize | workflows.md |
| Compare two document versions | compare | workflows.md |
| Remove personal metadata and revision identifiers | sanitize | ooxml-and-safety.md |
| Check package integrity | validate | This file |
| Audit styles, hierarchy, tables, accessibility, or finalization | audit | design-and-layout.md |
| Convert every page to PNG for visual QA | render | workflows.md |
check before the first DOCX task in a session. Run fix only if dependencies are missing and installing them is allowed..docx path unless overwrite is explicitly requested.validate after every mutation. Run audit --profile draft during iteration and audit --profile final before delivery. Use accessible when accessibility matters.page-<N>.png at full-page scale and zoom into dense areas such as tables, forms, headers, and footers.bash "$DOCX_SKILL_ROOT/scripts/docx.sh" check
bash "$DOCX_SKILL_ROOT/scripts/docx.sh" fixfix creates an isolated Python environment in the user's cache directory and never installs packages globally. LibreOffice is detected but not installed automatically.
If LibreOffice is unavailable, complete structural validation and auditing, disclose that page-image QA could not be performed, and avoid claiming that layout was visually verified. If rendering fails for another reason, diagnose and correct the render environment before delivery.
bash "$DOCX_SKILL_ROOT/scripts/docx.sh" inspect \
--input "$INPUT_DOCX" --out "$WORKSPACE/tmp/inspection.json"Review at least:
For read-only questions, do not edit or re-export the source. Preserve qualifiers from headings, table labels, notes, and nearby context when answering.
Before writing the JSON specification:
bash "$DOCX_SKILL_ROOT/scripts/docx.sh" create \
--spec "$WORKSPACE/tmp/document.json" --out "$FINAL_DOCX"Do not rely on Word defaults for page geometry, heading hierarchy, list semantics, table widths, or cell padding. Prefer reusable Word styles and real list definitions over manually formatted lookalikes.
Use edit for supported local changes:
bash "$DOCX_SKILL_ROOT/scripts/docx.sh" edit \
--input "$INPUT_DOCX" --patch "$WORKSPACE/tmp/edits.json" --out "$FINAL_DOCX"Preserve structure and formatting unless the user requests redesign. Prefer inline replacement over paragraph replacement, and paragraph replacement over full-document reconstruction. Confirm that every requested operation reports a nonzero affected count; treat an unexpected zero as a failed edit.
Use comments or tracked replacements when the user requests reviewable changes. Do not silently turn a review task into a clean rewrite.
Add comments and tracked replacements:
bash "$DOCX_SKILL_ROOT/scripts/docx.sh" review \
--input "$INPUT_DOCX" --spec "$WORKSPACE/tmp/review.json" --out "$FINAL_DOCX"Finalize a reviewed document:
bash "$DOCX_SKILL_ROOT/scripts/docx.sh" finalize \
--input "$INPUT_DOCX" --accept-changes --remove-comments --out "$FINAL_DOCX"Use --reject-changes instead of --accept-changes when requested. Never pass both. Inspect after review and after finalization because page rendering does not reliably expose comment anchors.
Validate the ZIP package, required OOXML parts, XML well-formedness, archive safety, and macro absence:
bash "$DOCX_SKILL_ROOT/scripts/docx.sh" validate --input "$FINAL_DOCX"Audit semantic and layout risks:
bash "$DOCX_SKILL_ROOT/scripts/docx.sh" audit \
--input "$FINAL_DOCX" --profile draft --out "$WORKSPACE/qa/draft-audit.json"
bash "$DOCX_SKILL_ROOT/scripts/docx.sh" audit \
--input "$FINAL_DOCX" --profile final --out "$WORKSPACE/qa/final-audit.json"
bash "$DOCX_SKILL_ROOT/scripts/docx.sh" audit \
--input "$FINAL_DOCX" --profile accessible --out "$WORKSPACE/qa/a11y-audit.json"Interpret profiles as follows:
draft: flag hierarchy, fake lists, small text, unstable table geometry, narrow margins, and formatting drift.final: include draft checks and fail the audit when comments or tracked changes remain; warn about personal metadata.accessible: include final checks and flag missing image alternative text or unmarked repeating table headers.An audit can contain warnings even when passed is true. Evaluate each warning in context and resolve every material issue before delivery.
bash "$DOCX_SKILL_ROOT/scripts/docx.sh" render \
--input "$FINAL_DOCX" --out-dir "$WORKSPACE/qa/rendered" --emit-pdfInspect every PNG for:
Rendering verifies visible layout but not all document semantics. Verify comments, revisions, relationships, fields, and metadata structurally with inspect, audit, or OOXML-aware commands.
bash "$DOCX_SKILL_ROOT/scripts/docx.sh" compare \
--before "$INPUT_DOCX" --after "$FINAL_DOCX" --out "$WORKSPACE/qa/comparison.json"
bash "$DOCX_SKILL_ROOT/scripts/docx.sh" sanitize \
--input "$INPUT_DOCX" --out "$FINAL_DOCX" --remove-commentscompare reports paragraph-level textual differences and document counts; it is not a pixel diff and does not prove formatting equivalence. sanitize removes core personal metadata, custom properties, revision identifiers, and optionally comments; it does not redact sensitive words from visible document content.
.docx only. Reject .doc, .docm, .dotm, and unrelated ZIP archives.Before returning a DOCX, confirm all of the following:
.docx file;Run the bundled end-to-end regression when changing this skill itself:
bash "$DOCX_SKILL_ROOT/scripts/docx.sh" self-testc88d7d1
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.