Claude Skill

documents

Generate, inspect, validate, and fix PDF, Word (.docx), Excel (.xlsx), and PowerPoint (.pptx) documents: turn structured content into render-ready artifacts, verify structural and output quality before delivery, and repair broken files. Use when a task involves creating, editing,

LLM Mart · 0 points · 17 views 0 listing impressions 0 install-command copies
Download magnus919-agent-skills-documents-ade3385.zip · 34 KB

Install

skills CLI npx skills add https://github.com/magnus919/agent-skills/tree/main/documents
Claude Code claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install magnus919-agent-skills@llmmart
Git git clone https://github.com/magnus919/agent-skills.git

The skills CLI installs just this skill, for any of its supported agents. Claude Code installs the whole magnus919/agent-skills collection as a plugin from our marketplace. Git is the plain clone.

README

Documents — PDF, Word, Excel & PowerPoint Skill

One skill that lets your agent generate, inspect, validate, and fix PDF, Word (.docx), Excel (.xlsx), and PowerPoint (.pptx) files — with a shared workflow, per-format references, and a validation script that verifies output quality before anything ships.

Why Install This Skill

Document output is one of the most common things people ask agents to produce, yet it is easy to get subtly wrong: files that open in one viewer but corrupt in another, spreadsheets with broken cell references, decks with missing slide relationships. This skill packages the full generation-to-delivery loop so your agent produces files that are structurally sound and actually render.

After installing, your agent can turn a markdown brief into a formatted PDF, build a Word report with proper headings and tables, generate a spreadsheet from CSV data, assemble a slide deck from an outline — and then run the included validation script on every artifact to prove it is well-formed before you ever open it. Because the four formats share one workflow, one skill covers them all; you do not need four overlapping skills with four sets of instructions to maintain.

What You Get

Directory Purpose
SKILL.md Shared six-step workflow (scope → content model → template → render → validate → deliver) with per-format load-on-demand
references/pdf.md PDF generation, tooling, and validation specifics
references/word.md Word (.docx) package layout, generation, and validation specifics
references/excel.md Excel (.xlsx) workbook structure, generation, and validation specifics
references/powerpoint.md PowerPoint (.pptx) deck structure, generation, and validation specifics
references/output-quality.md Cross-format output-quality checklist for all four formats
scripts/validate-documents.py Stdlib-only validation script: structural sanity + optional render check, with --json output and graceful degradation when no renderer is installed
templates/pdf-template.md Fillable generation template for PDF (print-ready HTML/CSS or LaTeX)
templates/word-template.md Fillable generation template for Word documents
templates/excel-template.md Fillable generation template for Excel workbooks
templates/powerpoint-template.md Fillable generation template for PowerPoint decks
fixtures/ One small valid sample per format, used to smoke-test the validation script

Quick Start

# Validate a finished artifact (human report)
python3 scripts/validate-documents.py report.pdf

# Validate with a render check and machine-readable output
python3 scripts/validate-documents.py --render-check --json report.pdf data.xlsx deck.pptx

# Smoke-test the script against the bundled per-format fixtures
python3 scripts/validate-documents.py --json fixtures/sample.pdf fixtures/sample.docx fixtures/sample.xlsx fixtures/sample.pptx

The render check uses pdftoppm (poppler-utils) for PDF and LibreOffice for Office formats when they are installed. When neither is present, validation still performs full structural checks and reports the render check as unavailable instead of failing — no renderer required to use the skill.

Triggers

Load this skill when the user mentions any of:

  • Generating documents: "create a PDF report", "make a Word document", "turn this CSV into a spreadsheet", "build a slide deck"
  • Editing documents: "update the docx", "change the Excel file", "fix this presentation"
  • Extracting from documents: "read the text from this PDF", "pull the table out of this xlsx"
  • Converting: "docx to PDF", "export this data as an Excel file"
  • Validating: "check that this document is valid", "why won't this file open", "verify the output before sending"

Do not load for ebooks (use the epub skill), image/video/media production, or data pipeline work (use data-engineering).

Requirements

  • Python 3.8+ — the validation script uses only the standard library.
  • Optional renderers (only for the render-check step): pdftoppm/mutool/ghostscript for PDF, libreoffice/soffice for Office formats. Generation libraries such as python-docx, openpyxl, or python-pptx are optional per format and documented in the references.

Skill manifest

Documents — PDF, Word, Excel & PowerPoint Skill

One skill for the four most common document formats. All four share a single agent workflow — structured content in, render-ready, validated artifact out — so they live in ONE family skill with per-format references, following the epub precedent. Load the shared workflow below, then pull the per-format reference for the format you are actually touching.

Format Extension Reference (load on demand)
PDF .pdf references/pdf.md
Word .docx references/word.md
Excel .xlsx references/excel.md
PowerPoint .pptx references/powerpoint.md
All formats — references/output-quality.md

Generation templates for each format live in templates/, and the validation script with per-format fixtures lives in scripts/.

When to use

Load this skill when the task involves any of the four formats:

  • Generate: build a report, memo, spreadsheet, or deck from structured content (markdown, JSON, data tables, outlines).
  • Edit: modify an existing document's content, layout, or metadata in place.
  • Extract: pull text, tables, or structure out of an existing file.
  • Convert: move content between formats or from a data source into a document.
  • Validate: check that a produced artifact is structurally sound and will render correctly before it is delivered.

When not to use

  • Ebooks and EPUB — use the epub skill; it owns the EPUB container, reading order, and package validation.
  • Images, video, and other media — this skill covers document formats only; route media production to the appropriate media skills.
  • Code and API documentation sites — use the technical-documentation and documentation-site conventions, not office documents.
  • Data pipelines — moving or transforming raw data belongs to data-engineering; Excel here is a deliverable format, not a data store.
  • Office documents to Markdown — converting an existing office document (docx, xlsx, pptx, pdf, odt, rtf, epub, csv) to GitHub-Flavored Markdown belongs to the anydoc skill; this skill owns generation, editing, and validation, not document-to-markdown extraction.

The Shared Workflow

Every document task follows the same six steps, regardless of format. Deep format-specific detail is deferred to the per-format reference — read it at the step where it matters.

1. Scope

Pin down what the document is for before touching a file:

  • Audience and purpose — who reads it and what decision it supports.
  • Format — PDF (fixed layout, print, archival), Word (editable prose, review), Excel (data, calculations), PowerPoint (presentation).
  • Boundaries — page/slide count, size limits, brand or style constraints.
  • Source of truth — the structured content the document is generated from (markdown, JSON, CSV, outline), so the artifact is reproducible.

2. Content model

Represent the document's content as structured data before rendering:

  • A title, sections/headings, body text, and metadata for prose documents.
  • A table model (headers, rows, column types) for spreadsheets.
  • A slide outline (title + bullets per slide, speaker notes) for decks.
  • Keep content and layout separate: content in the model, layout in the template. This is what makes regeneration cheap.

3. Template

Choose the generation template for the target format from templates/:

Fill the [fill: ...] markers in the template with content from the content model. Templates are the contract between content and layout — changing the template is how you change appearance without touching content.

4. Render

Produce the artifact file:

  • PDF — render the template to PDF (print CSS in a browser or engine, or a LaTeX toolchain). See references/pdf.md for tooling.
  • Word / Excel / PowerPoint — write the OOXML package directly (stdlib zipfile + XML for small artifacts) or with the conventional library for the format (python-docx, openpyxl, python-pptx). See the per-format reference for the exact package layout to produce.

5. Validate

Never deliver unvalidated output. Run the validation script:

python3 scripts/validate-documents.py --render-check --json report.pdf brief.docx data.xlsx deck.pptx

The script performs structural sanity (container signatures, required parts, XML well-formedness) and, when a renderer is installed, a render check (actually renders the file). When no renderer is present it reports unavailable instead of failing — validation never hard-requires a renderer. See references/output-quality.md for the full output-quality checklist, and the fixture files in fixtures/ (one per format) to smoke-test the script itself:

python3 scripts/validate-documents.py --json fixtures/sample.pdf fixtures/sample.docx fixtures/sample.xlsx fixtures/sample.pptx

6. Deliver

Hand off the artifact with its provenance:

  • The source content model (so it can be regenerated).
  • The template version used.
  • The validation result (structure passed; render checked or unavailable).
  • Any known deviations (fonts substituted, images downscaled, layout drift).

Exit conditions

The task is complete when the artifact exists, passes structural validation (and the render check when a renderer is available), and the content matches the agreed scope. Stop after delivering the validated artifact with its provenance; do not keep iterating on layout without a new scope instruction.

Scripts

All scripts live in scripts/ relative to this skill's directory and follow cli-builder conventions: --json for machine output, non-interactive, errors to stderr. Run with --help for full flag details.

validate-documents.py — Structural Sanity + Render Check

python3 scripts/validate-documents.py report.pdf            # human report
python3 scripts/validate-documents.py --json report.pdf    # machine report
python3 scripts/validate-documents.py --render-check --json report.pdf data.xlsx deck.pptx

Behavior:

  • Structural sanity per format: PDF header/EOF/page objects; OOXML ZIP container, [Content_Types].xml, required parts, XML well-formedness. Legacy .doc/.xls/.ppt files are recognized via OLE2 magic bytes.
  • Render check (--render-check): renders PDF via pdftoppm/mutool/gs and Office formats via LibreOffice. Reports unavailable — exit 0 — when no renderer is installed (graceful degradation, never a crash).
  • Exit codes: 0 all pass (or render check unavailable); 1 a file fails structure or rendering; 2 usage/I/O error.
  • JSON output: top-level status (ok / fail / unavailable / error) with per-file checks and render results.

Related skills

  • epub — ebook container skill; the sibling family-skill precedent for this format family.
  • data-engineering — data pipelines and transformation; Excel is a deliverable format here, not a data store.
  • cli-builder — the CLI conventions the validation script follows (--json, non-interactive, exit codes).
Files (agent-skills)
  • evals
    • evals.json 8.7 KB
      Loading…
  • fixtures
    • sample.docx 972 B · in bundle
    • sample.pdf 600 B · in bundle
    • sample.pptx 1.7 KB · in bundle
    • sample.xlsx 1.6 KB · in bundle
  • references
    • excel.md 3.9 KB
      Loading…
    • output-quality.md 4.5 KB
      Loading…
    • pdf.md 4.9 KB
      Loading…
    • powerpoint.md 3.6 KB
      Loading…
    • word.md 3.7 KB
      Loading…
  • scripts
    • validate-documents.py 19.1 KB
      Loading…
  • templates
    • excel-template.md 1.6 KB
      Loading…
    • pdf-template.md 1.7 KB
      Loading…
    • powerpoint-template.md 1.7 KB
      Loading…
    • word-template.md 1.8 KB
      Loading…
  • tests
    • test_validate_documents.py 9 KB
      Loading…
  • README.md 4.3 KB
    # Documents — PDF, Word, Excel & PowerPoint Skill
    
    One skill that lets your agent generate, inspect, validate, and fix PDF, Word (.docx), Excel (.xlsx), and PowerPoint (.pptx) files — with a shared workflow, per-format references, and a validation script that verifies output quality before anything ships.
    
    ## Why Install This Skill
    
    Document output is one of the most common things people ask agents to produce, yet it is easy to get subtly wrong: files that open in one viewer but corrupt in another, spreadsheets with broken cell references, decks with missing slide relationships. This skill packages the full generation-to-delivery loop so your agent produces files that are structurally sound and actually render.
    
    After installing, your agent can turn a markdown brief into a formatted PDF, build a Word report with proper headings and tables, generate a spreadsheet from CSV data, assemble a slide deck from an outline — and then run the included validation script on every artifact to prove it is well-formed before you ever open it. Because the four formats share one workflow, one skill covers them all; you do not need four overlapping skills with four sets of instructions to maintain.
    
    ## What You Get
    
    | Directory | Purpose |
    |-----------|---------|
    | `SKILL.md` | Shared six-step workflow (scope → content model → template → render → validate → deliver) with per-format load-on-demand |
    | `references/pdf.md` | PDF generation, tooling, and validation specifics |
    | `references/word.md` | Word (.docx) package layout, generation, and validation specifics |
    | `references/excel.md` | Excel (.xlsx) workbook structure, generation, and validation specifics |
    | `references/powerpoint.md` | PowerPoint (.pptx) deck structure, generation, and validation specifics |
    | `references/output-quality.md` | Cross-format output-quality checklist for all four formats |
    | `scripts/validate-documents.py` | Stdlib-only validation script: structural sanity + optional render check, with `--json` output and graceful degradation when no renderer is installed |
    | `templates/pdf-template.md` | Fillable generation template for PDF (print-ready HTML/CSS or LaTeX) |
    | `templates/word-template.md` | Fillable generation template for Word documents |
    | `templates/excel-template.md` | Fillable generation template for Excel workbooks |
    | `templates/powerpoint-template.md` | Fillable generation template for PowerPoint decks |
    | `fixtures/` | One small valid sample per format, used to smoke-test the validation script |
    
    ## Quick Start
    
    ```bash
    # Validate a finished artifact (human report)
    python3 scripts/validate-documents.py report.pdf
    
    # Validate with a render check and machine-readable output
    python3 scripts/validate-documents.py --render-check --json report.pdf data.xlsx deck.pptx
    
    # Smoke-test the script against the bundled per-format fixtures
    python3 scripts/validate-documents.py --json fixtures/sample.pdf fixtures/sample.docx fixtures/sample.xlsx fixtures/sample.pptx
    ```
    
    The render check uses `pdftoppm` (poppler-utils) for PDF and LibreOffice for Office formats when they are installed. When neither is present, validation still performs full structural checks and reports the render check as `unavailable` instead of failing — no renderer required to use the skill.
    
    ## Triggers
    
    Load this skill when the user mentions any of:
    
    - **Generating documents**: "create a PDF report", "make a Word document", "turn this CSV into a spreadsheet", "build a slide deck"
    - **Editing documents**: "update the docx", "change the Excel file", "fix this presentation"
    - **Extracting from documents**: "read the text from this PDF", "pull the table out of this xlsx"
    - **Converting**: "docx to PDF", "export this data as an Excel file"
    - **Validating**: "check that this document is valid", "why won't this file open", "verify the output before sending"
    
    Do not load for ebooks (use the `epub` skill), image/video/media production, or data pipeline work (use `data-engineering`).
    
    ## Requirements
    
    - Python 3.8+ — the validation script uses only the standard library.
    - Optional renderers (only for the render-check step): `pdftoppm`/`mutool`/`ghostscript` for PDF, `libreoffice`/`soffice` for Office formats. Generation libraries such as python-docx, openpyxl, or python-pptx are optional per format and documented in the references.
    
  • runtime-resources.json 17 B
    Loading…
  • SKILL.md 8.9 KB
    ---
    name: documents
    description: >-
      Generate, inspect, validate, and fix PDF, Word (.docx), Excel (.xlsx), and
      PowerPoint (.pptx) documents: turn structured content into render-ready
      artifacts, verify structural and output quality before delivery, and repair
      broken files. Use when a task involves creating, editing, converting, or
      validating office documents and PDFs. Do not use for ebook packaging (use
      epub), for images, video, or other media production, for API or code
      documentation, or for data pipelines (use data-engineering).
    license: MIT
    compatibility: >-
      Python 3.8+ for scripts; validation uses only the standard library. Optional
      renderers for the render check: poppler-utils (pdftoppm) for PDF and
      LibreOffice for Office formats; both degrade gracefully when absent.
      Portable across all AgentSkills-compatible harnesses.
    metadata:
      skills: documents, pdf, docx, xlsx, pptx, word, excel, powerpoint, office, report, generation
      tags: documents, pdf, docx, xlsx, pptx, word, excel, powerpoint, office, generation, validation
    ---
    
    # Documents — PDF, Word, Excel & PowerPoint Skill
    
    One skill for the four most common document formats. All four share a single
    agent workflow — structured content in, render-ready, validated artifact out —
    so they live in ONE family skill with per-format references, following the
    `epub` precedent. Load the shared workflow below, then pull the per-format
    reference for the format you are actually touching.
    
    | Format | Extension | Reference (load on demand) |
    |--------|-----------|----------------------------|
    | PDF | `.pdf` | [references/pdf.md](references/pdf.md) |
    | Word | `.docx` | [references/word.md](references/word.md) |
    | Excel | `.xlsx` | [references/excel.md](references/excel.md) |
    | PowerPoint | `.pptx` | [references/powerpoint.md](references/powerpoint.md) |
    | All formats | — | [references/output-quality.md](references/output-quality.md) |
    
    Generation templates for each format live in [templates/](templates/), and the
    validation script with per-format fixtures lives in [scripts/](scripts/).
    
    ## When to use
    
    Load this skill when the task involves any of the four formats:
    
    - **Generate**: build a report, memo, spreadsheet, or deck from structured
      content (markdown, JSON, data tables, outlines).
    - **Edit**: modify an existing document's content, layout, or metadata in place.
    - **Extract**: pull text, tables, or structure out of an existing file.
    - **Convert**: move content between formats or from a data source into a document.
    - **Validate**: check that a produced artifact is structurally sound and will
      render correctly before it is delivered.
    
    ## When not to use
    
    - **Ebooks and EPUB** — use the `epub` skill; it owns the EPUB container,
      reading order, and package validation.
    - **Images, video, and other media** — this skill covers document formats only;
      route media production to the appropriate media skills.
    - **Code and API documentation sites** — use the technical-documentation and
      documentation-site conventions, not office documents.
    - **Data pipelines** — moving or transforming raw data belongs to
      `data-engineering`; Excel here is a *deliverable format*, not a data store.
    - **Office documents to Markdown** — converting an existing office document
      (docx, xlsx, pptx, pdf, odt, rtf, epub, csv) to GitHub-Flavored Markdown
      belongs to the `anydoc` skill; this skill owns generation, editing, and
      validation, not document-to-markdown extraction.
    
    ## The Shared Workflow
    
    Every document task follows the same six steps, regardless of format. Deep
    format-specific detail is deferred to the per-format reference — read it at the
    step where it matters.
    
    ### 1. Scope
    
    Pin down what the document is for before touching a file:
    
    - **Audience and purpose** — who reads it and what decision it supports.
    - **Format** — PDF (fixed layout, print, archival), Word (editable prose,
      review), Excel (data, calculations), PowerPoint (presentation).
    - **Boundaries** — page/slide count, size limits, brand or style constraints.
    - **Source of truth** — the structured content the document is generated from
      (markdown, JSON, CSV, outline), so the artifact is reproducible.
    
    ### 2. Content model
    
    Represent the document's content as structured data before rendering:
    
    - A **title, sections/headings, body text, and metadata** for prose documents.
    - A **table model** (headers, rows, column types) for spreadsheets.
    - A **slide outline** (title + bullets per slide, speaker notes) for decks.
    - Keep content and layout separate: content in the model, layout in the
      template. This is what makes regeneration cheap.
    
    ### 3. Template
    
    Choose the generation template for the target format from [templates/](templates/):
    
    - [templates/pdf-template.md](templates/pdf-template.md) — fixed-layout
      document skeleton (print-ready HTML/CSS or LaTeX source).
    - [templates/word-template.md](templates/word-template.md) — Word processing
      document structure (styles, headings, tables).
    - [templates/excel-template.md](templates/excel-template.md) — workbook
      structure (sheets, cells, shared strings, formulas).
    - [templates/powerpoint-template.md](templates/powerpoint-template.md) — slide
      deck structure (slides, layouts, notes).
    
    Fill the `[fill: ...]` markers in the template with content from the content
    model. Templates are the contract between content and layout — changing the
    template is how you change appearance without touching content.
    
    ### 4. Render
    
    Produce the artifact file:
    
    - **PDF** — render the template to PDF (print CSS in a browser or engine, or a
      LaTeX toolchain). See [references/pdf.md](references/pdf.md) for tooling.
    - **Word / Excel / PowerPoint** — write the OOXML package directly (stdlib
      `zipfile` + XML for small artifacts) or with the conventional library for the
      format (python-docx, openpyxl, python-pptx). See the per-format reference for
      the exact package layout to produce.
    
    ### 5. Validate
    
    Never deliver unvalidated output. Run the validation script:
    
    ```bash
    python3 scripts/validate-documents.py --render-check --json report.pdf brief.docx data.xlsx deck.pptx
    ```
    
    The script performs **structural sanity** (container signatures, required
    parts, XML well-formedness) and, when a renderer is installed, a **render
    check** (actually renders the file). When no renderer is present it reports
    `unavailable` instead of failing — validation never hard-requires a renderer.
    See [references/output-quality.md](references/output-quality.md) for the full
    output-quality checklist, and the fixture files in
    [fixtures/](fixtures/) (one per format) to smoke-test the script itself:
    
    ```bash
    python3 scripts/validate-documents.py --json fixtures/sample.pdf fixtures/sample.docx fixtures/sample.xlsx fixtures/sample.pptx
    ```
    
    ### 6. Deliver
    
    Hand off the artifact with its provenance:
    
    - The **source content model** (so it can be regenerated).
    - The **template version** used.
    - The **validation result** (structure passed; render checked or unavailable).
    - Any **known deviations** (fonts substituted, images downscaled, layout drift).
    
    ## Exit conditions
    
    The task is complete when the artifact exists, passes structural validation
    (and the render check when a renderer is available), and the content matches
    the agreed scope. Stop after delivering the validated artifact with its
    provenance; do not keep iterating on layout without a new scope instruction.
    
    ## Scripts
    
    All scripts live in [scripts/](scripts/) relative to this skill's directory and
    follow cli-builder conventions: `--json` for machine output, non-interactive,
    errors to stderr. Run with `--help` for full flag details.
    
    ### validate-documents.py — Structural Sanity + Render Check
    
    ```bash
    python3 scripts/validate-documents.py report.pdf            # human report
    python3 scripts/validate-documents.py --json report.pdf    # machine report
    python3 scripts/validate-documents.py --render-check --json report.pdf data.xlsx deck.pptx
    ```
    
    Behavior:
    
    - **Structural sanity** per format: PDF header/EOF/page objects; OOXML ZIP
      container, `[Content_Types].xml`, required parts, XML well-formedness.
      Legacy `.doc/.xls/.ppt` files are recognized via OLE2 magic bytes.
    - **Render check** (`--render-check`): renders PDF via `pdftoppm`/`mutool`/`gs`
      and Office formats via LibreOffice. Reports `unavailable` — exit 0 — when no
      renderer is installed (graceful degradation, never a crash).
    - **Exit codes**: 0 all pass (or render check unavailable); 1 a file fails
      structure or rendering; 2 usage/I/O error.
    - **JSON output**: top-level `status` (`ok` / `fail` / `unavailable` / `error`)
      with per-file checks and render results.
    
    ## Related skills
    
    - [epub](../epub/SKILL.md) — ebook container skill; the sibling family-skill
      precedent for this format family.
    - [data-engineering](../data-engineering/SKILL.md) — data pipelines and
      transformation; Excel is a deliverable format here, not a data store.
    - [cli-builder](../cli-builder/SKILL.md) — the CLI conventions the validation
      script follows (`--json`, non-interactive, exit codes).
    

Comments (0)

Sign in to join the conversation.

No comments yet.

Reviews (0)

No reviews yet.