Claude Skill

anydoc

Convert Word (.doc/.docx/.docm), PowerPoint (.ppt/.pps/.pot/.pptx/.pptm/.ppsx/.ppsm), Excel (.xls/.xlsx/.xlsm/.xlsb), OpenDocument (.odt/.ods/.odp), RTF, EPUB, CSV, and PDF documents to clean GitHub-Flavored Markdown locally with the Any Doc CLI (npx -y @firecrawl/anydoc@0.2.4):

LLM Mart · 0 points · 13 views 0 listing impressions 0 install-command copies
Download magnus919-agent-skills-anydoc-addad86.zip · 224 KB

Install

skills CLI npx skills add https://github.com/magnus919/agent-skills/tree/main/anydoc
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

anydoc — office documents to GitHub-Flavored Markdown

Convert Word, PowerPoint, Excel, OpenDocument, RTF, EPUB, CSV, and PDF files into clean, LLM-friendly GitHub-Flavored Markdown. Local conversion stays on your machine; an explicitly authorized hosted OCR mode handles scanned PDFs through Firecrawl Parse when whole-document upload is acceptable.

Why Install This Skill

Office documents are opaque to agents. A .docx or .pptx is a binary zip; a .xls is an OLE container; a PDF can be anything. Reading them directly means parsing formats, handling encodings, and reconstructing structure by hand — exactly the work anydoc automates. This skill gives your agent a single, verified command that converts all 8 format families (21 extensions) into GitHub-Flavored Markdown with headings, GFM tables, slide structure, and footnotes preserved, plus the knowledge of exactly where fidelity is lost (Excel number formats, legacy PowerPoint tables, PDF tables).

The skill wraps the pinned @firecrawl/anydoc v0.2.4 CLI with a small helper script that adds input checks, friendly error hints for the known failure classes (scanned PDFs, encrypted files, malformed archives), batch conversion, dry-run planning, JSON output, and an explicit --allow-hosted-upload acknowledgement for hosted OCR.

What You Get

Directory / file What it provides
SKILL.md + README.md The skill index (trigger, command map, verification steps) and this human-facing guide
scripts/ anydoc — an executable Python 3 wrapper with convert (single file or stdin, -o output), batch (many files, per-file status, summary), and info (tool + pinned CLI version), plus global --json and --dry-run
references/ Five focused guides: formats.md (what GFM each format produces, with fidelity caveats), cli-reference.md (verbatim --help, every flag, stdout/stderr conventions), errors.md (exit codes and the exact error messages), workflows.md (recipes: single conversion, batch, vault ingestion, piping, output verification), sources.md (upstream URLs, fixture provenance, verification procedure)
tests/ Unit tests for the wrapper (argparse, pre-validation, hints, dry-run, JSON, batch) — runnable offline
evals/ An eval manifest with fixture-backed cases covering docx→headings, xlsx→tables, pptx→slide structure, csv→table, legacy .doc, ODS preserved values, ODT, and the image-only-PDF OCR failure
fixtures/ 24 tiny sample documents (all < 5 MB): valid samples for every family plus error cases (image-only PDF, encrypted ODT, empty DOCX, unsupported extension) — used by the tests, evals, and recipes

Quick Start

You need Node.js 20+ and npx (no other install — the CLI and its native binary are fetched on first use):

cd anydoc
npx -y @firecrawl/anydoc@0.2.4 fixtures/fixture-handmade-outline.docx

This converts the sample Word document and prints GitHub-Flavored Markdown to stdout (note the #/##/### heading lines). To write to a file instead:

npx -y @firecrawl/anydoc@0.2.4 fixtures/fixture-handmade-outline.docx -o outline.md

Or use the wrapper for the same job:

python3 scripts/anydoc convert fixtures/fixture-handmade-outline.docx -o outline.md

Triggers

Load this skill when the task involves any of these:

  • "Convert this Word/Excel/PowerPoint/PDF/EPUB/CSV file to markdown"
  • "Extract the headings, tables, or slide content from this document"
  • "Summarize this report / spreadsheet / deck"
  • "Turn this CSV into a markdown table"
  • "Read this document into markdown for a knowledge base or vault"
  • "Convert this PDF to markdown" — but only for text-based PDFs; scanned or image-only PDFs fail (anydoc does not OCR)
  • "OCR this scanned PDF" — use local OCR by default, or explicitly authorize --ocr hosted --allow-hosted-upload when sending the whole document to Firecrawl Parse is acceptable

Do not load this skill for document generation or editing ("create a docx report", "build a PDF proposal", "validate this document") — that is the documents skill's job — or for EPUB authoring (epub skill).

Requirements

  • Node.js >= 20 and npx (the CLI is distributed via npm; the native binary ships as a platform-specific npm optionalDependency, so there is no manual install or compilation).
  • Network once — the first npx run downloads the package and binary; later runs use the npm cache. For permanent or fully offline use, run npm install -g @firecrawl/anydoc once.
  • Python 3 (standard library only) if you use the scripts/anydoc wrapper.
  • Local mode needs no API key or service. Hosted OCR uses Firecrawl Parse and may use FIRECRAWL_API_KEY; it sends the whole OCR-required PDF and has no page selection.

Skill manifest

Any Doc — office documents to GitHub-Flavored Markdown

The anydoc skill converts office documents, spreadsheets, presentations, ebooks, CSV, and text-based PDFs into GitHub-Flavored Markdown using the pinned Any Doc CLI (@firecrawl/anydoc v0.2.4). One shared document model and one GFM serializer produce the same logical output across formats. Local conversion runs without a service, API key, or file upload; hosted OCR is a separate explicit route.

Overview

Load this skill when a task needs the contents of a document the agent cannot read directly: a Word report to summarize, a spreadsheet to turn into a table, a slide deck to extract, a CSV to analyze, or an ebook or PDF to quote from.

The skill ships a small Python helper (scripts/anydoc) that wraps the pinned CLI and adds input pre-validation, friendly error hints, batch conversion, and --dry-run/--json output. Every recipe in references/workflows.md also shows the raw npx invocation, so the skill works with or without the helper.

First-use decision gate

Before invoking anydoc, classify the request:

If the user needs... Do this
The contents of an existing supported document Continue to Command Map.
Generation, editing, validation, EPUB packaging, HTML scraping, or password decryption Stop and use the route in When not to use.
A format-fidelity or failure decision Load the matching row in Reference Routing before choosing a command.
A conversion result Choose stdout, -o, or batch; run it; then follow Verification.

Hard boundary: local anydoc conversion reads existing supported documents to Markdown without uploading them. Hosted OCR is opt-in only: it sends the whole OCR-required PDF to the configured Parse service. AnyDoc does not create, edit, validate, package, decrypt, or scrape documents.

When to use

  • Convert a document to markdown — Word, PowerPoint, Excel, OpenDocument, RTF, EPUB, CSV, or text-based PDF.
  • Extract structure — headings, GFM tables, slide titles, speaker notes (as blockquotes), and footnotes.
  • Feed documents to an LLM — one-pass conversion to clean markdown for summarization, extraction, or retrieval ingestion.
  • Batch a folder — convert a directory of mixed office files for a vault or knowledge base.
  • Read a document from stdin — pipe bytes into anydoc -.

Format coverage (summary)

anydoc covers 8 format families / 21 extensions through 12 canonical parsers. The canonical formats are doc, docx, odt, pdf, ppt, pptx, rtf, epub, xlsx, ods, odp, csv; extension aliases map through them (.docm→docx, .xls→xlsx, .pptm→pptx, and so on).

Family Extensions Expected GFM output Decision cue
Word .doc .docx .docm #–###### headings, GFM tables, [^n] footnotes Use when content extraction is enough; use documents when rendered layout matters.
PowerPoint .ppt .pps .pot .pptx .pptm .ppsx .ppsm slide titles as plain paragraphs, bullet lists, speaker notes as > blockquotes, GFM tables (PPTX/ODP; legacy .ppt flattens tables to text lines) Need table fidelity? Prefer PPTX or ODP; legacy .ppt preserves cell text but not table structure.
Excel .xls .xlsx .xlsm .xlsb ## <sheet name> heading + one GFM table per worksheet; number formats dropped (raw cell values) Need displayed percentages, currency, or number formats? Prefer ODS; XLS/XLSX output is raw values.
OpenDocument .odt .ods .odp same document/slide shapes as DOCX/PPTX; ODS keeps formatted display values Prefer ODS when spreadsheet display formatting is part of the meaning.
Rich Text Format .rtf same document shape as DOCX/ODT Use for text extraction, not layout preservation.
EPUB .epub # chapter headings, GFM tables, internal anchor links Use to read an existing EPUB; use epub to author or package one.
CSV .csv one GFM table; label-like first row promoted to header; delimiter sniffing; UTF-16 with BOM Use for delimited tabular content; inspect delimiter and encoding when output looks wrong.
PDF .pdf headings + inline emphasis, but a lower-fidelity pipeline: tables flatten to text, footnotes and links degrade. Text-based PDFs stay local; scanned/image-only PDFs require explicit hosted OCR or another OCR tool Use local mode by default; hosted mode uploads the whole PDF and has no page selection.

See references/formats.md for the full per-format expectations and fidelity caveats, and references/errors.md for the exact failure messages (including the no-OCR error).

Command Map

Commands are shown relative to the repository root. <file> is any document path (for example anydoc/fixtures/fixture-handmade-outline.docx); - reads the document from stdin.

Need Command Choose it when
Convert one file to small markdown on stdout anydoc/scripts/anydoc convert <file> The caller needs immediate content and does not need a saved artifact.
Convert one file to a markdown file anydoc/scripts/anydoc convert <file> -o out.md The output is large, must be reviewed later, or should be preserved as an artifact.
Convert many files to a directory anydoc/scripts/anydoc batch <file1> <file2> ... --out-dir out/ The request is a bounded batch and per-file output/status is useful.
Show the tool and pinned CLI version anydoc/scripts/anydoc info You need to confirm the executable and version before troubleshooting or reporting an environment issue.
Raw pinned CLI, one document npx -y @firecrawl/anydoc@0.2.4 <file> [-o out.md] The wrapper is unavailable; preserve the pinned CLI and its documented semantics.
Raw pinned CLI, read stdin cat data.csv \| npx -y @firecrawl/anydoc@0.2.4 - --format csv Bytes already arrive on stdin and the format is known; keep the producer pipeline separate from the converter.

For an OCR-required PDF, first use the local default so the failure is visible:

anydoc/scripts/anydoc convert scan.pdf --ocr reject

If the user explicitly authorizes sending the complete PDF to Firecrawl Parse, use the wrapper acknowledgement and a trusted FIRECRAWL_API_KEY environment variable when needed:

anydoc/scripts/anydoc convert scan.pdf --ocr hosted --allow-hosted-upload

The wrapper never places the key on the command line. Hosted OCR has no page selection, and a hosted failure is not permission to silently switch endpoints.

Notes:

  • scripts/anydoc is an executable Python 3 script (shebang #!/usr/bin/env python3); python3 anydoc/scripts/anydoc ... is equivalent when the executable bit is unavailable.
  • The raw npx -y @firecrawl/anydoc@0.2.4 rows are the ground truth for conversion behavior; the wrapper delegates to exactly that command.
  • Always pin @0.2.4 for reproducible conversions. -y answers npx's "Ok to proceed?" prompt non-interactively — the CLI itself never prompts.
  • Both forms share the same contract: one document per invocation, exit code 0 success / 1 conversion or IO failure / 2 usage error, diagnostics as exactly one anydoc: <message> line on stderr, and no prompts.

Hosted OCR is supported by the 0.2.4 library and CLI, but the wrapper requires both --ocr hosted and --allow-hosted-upload so an upload cannot be selected implicitly. The hosted route sends the complete PDF to Firecrawl Parse because page selection is unavailable. Do not place API keys on the command line.

Reference Routing

Load only the row that answers the immediate question; the command examples and verification contract remain in this file.

When you need to... Load It answers
Choose a format or predict fidelity references/formats.md Supported families, output shapes, and caveats such as raw XLSX values, ODS display values, legacy .ppt table flattening, and PDF degradation.
Select flags, stdin syntax, output behavior, or version details references/cli-reference.md Verbatim help, accepted options, stdin rules, stdout/stderr behavior, pinning, and runtime requirements.
Classify a failure or decide whether to retry references/errors.md Exit codes, exact error vocabulary, no-OCR/encryption boundaries, and the next route.
Choose a single-file, stdin, batch, vault, or large-output recipe references/workflows.md End-to-end recipes, safe output handling, per-file failure routing, and resource-limit behavior.
Verify a documented upstream or fixture claim references/sources.md Source URLs, access dates, fixture provenance, and the verification basis for documented claims.
Shape the final evidence report references/report-examples.md Complete success, expected-failure, and fidelity-boundary reports to imitate after following Verification.

When not to use

Use this routing table before reaching for a conversion command:

User's request Reach for Why
Generate, edit, inspect rendered layout, or validate a PDF/Word/Excel/PowerPoint artifact documents skill anydoc extracts existing document contents to Markdown; it does not author, preserve rendered layout, or validate artifacts.
Package or author an EPUB epub skill anydoc reads an existing EPUB to Markdown but never writes or validates an EPUB container.
OCR a scanned or image-only PDF Local OCR tooling, or AnyDoc hosted OCR after explicit authorization Local mode reports the OCR-required error without uploading; hosted mode sends the whole PDF to Firecrawl Parse.
Scrape HTML or other web content A web-scraping skill HTML is not a supported anydoc input.
Transcribe binary media such as images, video, or audio A media or transcription tool Embedded images become alt text; anydoc cannot transcribe media.
Preserve pagination, fonts, templates, or rendered layout A document/layout tool The only output contract is GitHub-Flavored Markdown.
Convert a password-protected file An unencrypted copy from the document owner anydoc has no password or decryption option.

Verification

Report evidence, not just success. For every attempted conversion, return the input, exact command or wrapper path, observed exit code, output destination (stdout or file), structural markers checked, and any documented caveat or next route.

Compact report shape:

Input: <path or stdin source>
Command: <exact wrapper or pinned CLI path>
Exit: <observed code>
Output: <stdout or destination file>
Checks: <markers or fidelity facts observed>
Caveat/route: <documented limitation or next action>

Common stop conditions

Condition Do not Next
Scanned or image-only PDF / OCR-required error Retry unchanged or upload implicitly Use local OCR, or explicitly authorize and run --ocr hosted --allow-hosted-upload; page selection is unavailable.
Encrypted or password-protected document Guess a password or retry unchanged Request an unencrypted copy or owner-authorized re-export.
Unsupported, malformed, or resource-limit error Guess a parser or claim partial success Match the exact error in references/errors.md and follow its bounded route.
Exit 0 but expected structural markers are absent Report success from the exit code alone Inspect the output shape and source fidelity before reporting completion.

Confirm a conversion before reporting it as done:

  1. Check the exit code. 0 means the CLI produced markdown. 1 means the document could not be read or converted — read the single anydoc: <message> stderr line and match it against references/errors.md. 2 means the command itself was a usage error (bad flag, missing input, invalid --format).
  2. Check the output shape. The markdown must contain the structural markers your format actually produces:
    • Word / ODT / RTF / text-based PDF: #/## headings. For PDF, do not expect GFM tables or [^1]: footnote definitions — that pipeline flattens them.
    • Spreadsheets (xlsx/xls/ods) and CSV: |-delimited GFM tables. xlsx/xls show raw cell values (0.155, 1234.5); ODS shows formatted display values (15.5%, $1,234.50).
    • Presentations (pptx/odp): slide titles as plain paragraphs, > blockquote speaker notes, GFM tables. Legacy .ppt flattens tables to bare text lines.
    • EPUB: # chapter headings and internal anchor links.
  3. Write large outputs to a file with -o. -o out.md keeps stdout silent and gives a reviewable file instead of streaming the whole document into context.
  4. Verify tables survived. If the source had tables and the output has no | rows, consult the format caveats — PDF and legacy .ppt flatten tables by design, not by error.

Stop when the conversion exits 0 and the structural markers match the source format. Do not re-run or retry on a documented failure mode (encrypted, malformed, scanned/image-only, unsupported) without changing the input; report the documented message and route as references/errors.md instructs.

Files (agent-skills)
  • evals
    • evals.json 10.7 KB
      Loading…
  • fixtures
    • book.epub 6 KB · in bundle
    • empty--errors.docx 0 B · in bundle
    • encrypted--errors.odt 658 B · in bundle
    • fixture-handmade-numbering.docx 2.8 KB · in bundle
    • fixture-handmade-outline.docx 1.4 KB · in bundle
    • fixture-handmade-quoted.csv 66 B · in bundle
    • fixture-handmade-rich.docx 3.2 KB · in bundle
    • fixture-handmade-semicolon.csv 30 B · in bundle
    • fixture-handmade-tables.docx 1.3 KB · in bundle
    • fixture-handmade-utf16.csv 62 B · in bundle
    • fixture-sheet.csv 210 B · in bundle
    • fixture-text.pdf 87.9 KB · in bundle
    • handmade-merged.xlsx 1.6 KB · in bundle
    • pres.odp 18.6 KB · in bundle
    • pres.ppt 453.5 KB · in bundle
    • pres.pptx 15.4 KB · in bundle
    • scanned-image-only.pdf 2.1 KB · in bundle
    • sheet.ods 15.8 KB · in bundle
    • sheet.xls 7 KB · in bundle
    • sheet.xlsx 6.9 KB · in bundle
    • text.doc 20 KB · in bundle
    • text.odt 24.9 KB · in bundle
    • text.rtf 19.7 KB · in bundle
    • unsupported.xyz 12 B · in bundle
  • references
    • cli-reference.md 10.5 KB
      Loading…
    • errors.md 10.3 KB
      Loading…
    • formats.md 13 KB
      Loading…
    • report-examples.md 1.7 KB
      Loading…
    • sources.md 5.2 KB
      Loading…
    • workflows.md 8.8 KB
      Loading…
  • scripts
    • anydoc 26.4 KB · in bundle
    • test_anydoc_hosted_ocr.py 6.3 KB
      Loading…
  • tests
    • test_anydoc.py 31.7 KB
      Loading…
  • README.md 4.7 KB
    # anydoc — office documents to GitHub-Flavored Markdown
    
    Convert Word, PowerPoint, Excel, OpenDocument, RTF, EPUB, CSV, and PDF files into clean, LLM-friendly GitHub-Flavored Markdown. Local conversion stays on your machine; an explicitly authorized hosted OCR mode handles scanned PDFs through Firecrawl Parse when whole-document upload is acceptable.
    
    ## Why Install This Skill
    
    Office documents are opaque to agents. A `.docx` or `.pptx` is a binary zip; a `.xls` is an OLE container; a PDF can be anything. Reading them directly means parsing formats, handling encodings, and reconstructing structure by hand — exactly the work anydoc automates. This skill gives your agent a single, verified command that converts all 8 format families (21 extensions) into GitHub-Flavored Markdown with headings, GFM tables, slide structure, and footnotes preserved, plus the knowledge of exactly where fidelity is lost (Excel number formats, legacy PowerPoint tables, PDF tables).
    
    The skill wraps the pinned `@firecrawl/anydoc` v0.2.4 CLI with a small helper script that adds input checks, friendly error hints for the known failure classes (scanned PDFs, encrypted files, malformed archives), batch conversion, dry-run planning, JSON output, and an explicit `--allow-hosted-upload` acknowledgement for hosted OCR.
    
    ## What You Get
    
    | Directory / file | What it provides |
    | --- | --- |
    | `SKILL.md` + `README.md` | The skill index (trigger, command map, verification steps) and this human-facing guide |
    | `scripts/` | `anydoc` — an executable Python 3 wrapper with `convert` (single file or stdin, `-o` output), `batch` (many files, per-file status, summary), and `info` (tool + pinned CLI version), plus global `--json` and `--dry-run` |
    | `references/` | Five focused guides: `formats.md` (what GFM each format produces, with fidelity caveats), `cli-reference.md` (verbatim `--help`, every flag, stdout/stderr conventions), `errors.md` (exit codes and the exact error messages), `workflows.md` (recipes: single conversion, batch, vault ingestion, piping, output verification), `sources.md` (upstream URLs, fixture provenance, verification procedure) |
    | `tests/` | Unit tests for the wrapper (argparse, pre-validation, hints, dry-run, JSON, batch) — runnable offline |
    | `evals/` | An eval manifest with fixture-backed cases covering docx→headings, xlsx→tables, pptx→slide structure, csv→table, legacy `.doc`, ODS preserved values, ODT, and the image-only-PDF OCR failure |
    | `fixtures/` | 24 tiny sample documents (all < 5 MB): valid samples for every family plus error cases (image-only PDF, encrypted ODT, empty DOCX, unsupported extension) — used by the tests, evals, and recipes |
    
    ## Quick Start
    
    You need Node.js 20+ and `npx` (no other install — the CLI and its native binary are fetched on first use):
    
    ```bash
    cd anydoc
    npx -y @firecrawl/anydoc@0.2.4 fixtures/fixture-handmade-outline.docx
    ```
    
    This converts the sample Word document and prints GitHub-Flavored Markdown to stdout (note the `#`/`##`/`###` heading lines). To write to a file instead:
    
    ```bash
    npx -y @firecrawl/anydoc@0.2.4 fixtures/fixture-handmade-outline.docx -o outline.md
    ```
    
    Or use the wrapper for the same job:
    
    ```bash
    python3 scripts/anydoc convert fixtures/fixture-handmade-outline.docx -o outline.md
    ```
    
    ## Triggers
    
    Load this skill when the task involves any of these:
    
    - "Convert this Word/Excel/PowerPoint/PDF/EPUB/CSV file to markdown"
    - "Extract the headings, tables, or slide content from this document"
    - "Summarize this report / spreadsheet / deck"
    - "Turn this CSV into a markdown table"
    - "Read this document into markdown for a knowledge base or vault"
    - "Convert this PDF to markdown" — but only for text-based PDFs; scanned or image-only PDFs fail (anydoc does not OCR)
    - "OCR this scanned PDF" — use local OCR by default, or explicitly authorize `--ocr hosted --allow-hosted-upload` when sending the whole document to Firecrawl Parse is acceptable
    
    Do **not** load this skill for document generation or editing ("create a docx report", "build a PDF proposal", "validate this document") — that is the `documents` skill's job — or for EPUB authoring (`epub` skill).
    
    ## Requirements
    
    - **Node.js >= 20** and `npx` (the CLI is distributed via npm; the native binary ships as a platform-specific npm `optionalDependency`, so there is no manual install or compilation).
    - **Network once** — the first `npx` run downloads the package and binary; later runs use the npm cache. For permanent or fully offline use, run `npm install -g @firecrawl/anydoc` once.
    - **Python 3** (standard library only) if you use the `scripts/anydoc` wrapper.
    - **Local mode needs no API key or service**. Hosted OCR uses Firecrawl Parse and may use `FIRECRAWL_API_KEY`; it sends the whole OCR-required PDF and has no page selection.
    
  • SKILL.md 14.8 KB
    ---
    name: anydoc
    description: >-
      Convert Word (.doc/.docx/.docm), PowerPoint (.ppt/.pps/.pot/.pptx/.pptm/.ppsx/.ppsm),
      Excel (.xls/.xlsx/.xlsm/.xlsb), OpenDocument (.odt/.ods/.odp), RTF, EPUB, CSV, and
      PDF documents to clean GitHub-Flavored Markdown locally with the Any Doc CLI
      (npx -y @firecrawl/anydoc@0.2.4): headings, GFM tables, slide structure, and
      footnotes in one pass. Use when a task needs the contents of an office document,
      spreadsheet, presentation, ebook, or PDF you cannot read directly. Do not use for
      generating, editing, or validating documents (use documents), for ebook packaging
      (use epub). For scanned or image-only PDFs, use hosted OCR only when the user
      explicitly authorizes whole-document upload; otherwise route to local OCR tooling.
    license: MIT
    compatibility: >-
      Node.js >= 20 and npx. The pinned CLI is @firecrawl/anydoc@0.2.4; the native
      binary ships via npm optionalDependencies (no install step, no postinstall, no
      compilation). Local conversion needs no service or API key. Hosted OCR sends the
      whole PDF to Firecrawl Parse and may use FIRECRAWL_API_KEY. The first npx run
      downloads the package once (network required); later runs use the npm cache.
    metadata:
      skills: anydoc, markdown, conversion, docx, xlsx, pptx, pdf, odt, ods, odp, rtf, epub, csv, office, documents, firecrawl
      tags: conversion, markdown, office, documents
      source: https://github.com/firecrawl/anydoc
    allowed-tools: Bash Read
    ---
    
    # Any Doc — office documents to GitHub-Flavored Markdown
    
    The `anydoc` skill converts office documents, spreadsheets, presentations,
    ebooks, CSV, and text-based PDFs into GitHub-Flavored Markdown using the pinned
    Any Doc CLI (`@firecrawl/anydoc` v0.2.4). One shared document model and one GFM
    serializer produce the same logical output across formats. Local conversion runs
    without a service, API key, or file upload; hosted OCR is a separate explicit route.
    
    ## Overview
    
    Load this skill when a task needs the *contents* of a document the agent cannot
    read directly: a Word report to summarize, a spreadsheet to turn into a table,
    a slide deck to extract, a CSV to analyze, or an ebook or PDF to quote from.
    
    The skill ships a small Python helper (`scripts/anydoc`) that wraps the pinned
    CLI and adds input pre-validation, friendly error hints, batch conversion, and
    `--dry-run`/`--json` output. Every recipe in [references/workflows.md](references/workflows.md)
    also shows the raw `npx` invocation, so the skill works with or without the
    helper.
    
    ## First-use decision gate
    
    Before invoking anydoc, classify the request:
    
    | If the user needs... | Do this |
    | --- | --- |
    | The contents of an existing supported document | Continue to [Command Map](#command-map). |
    | Generation, editing, validation, EPUB packaging, HTML scraping, or password decryption | Stop and use the route in [When not to use](#when-not-to-use). |
    | A format-fidelity or failure decision | Load the matching row in [Reference Routing](#reference-routing) before choosing a command. |
    | A conversion result | Choose stdout, `-o`, or batch; run it; then follow [Verification](#verification). |
    
    > **Hard boundary:** local anydoc conversion reads existing supported documents to Markdown without uploading them. Hosted OCR is opt-in only: it sends the whole OCR-required PDF to the configured Parse service. AnyDoc does not create, edit, validate, package, decrypt, or scrape documents.
    
    ## When to use
    
    - **Convert a document to markdown** — Word, PowerPoint, Excel, OpenDocument,
      RTF, EPUB, CSV, or text-based PDF.
    - **Extract structure** — headings, GFM tables, slide titles, speaker notes
      (as blockquotes), and footnotes.
    - **Feed documents to an LLM** — one-pass conversion to clean markdown for
      summarization, extraction, or retrieval ingestion.
    - **Batch a folder** — convert a directory of mixed office files for a vault
      or knowledge base.
    - **Read a document from stdin** — pipe bytes into `anydoc -`.
    
    ## Format coverage (summary)
    
    anydoc covers **8 format families / 21 extensions** through **12 canonical
    parsers**. The canonical formats are `doc, docx, odt, pdf, ppt, pptx, rtf,
    epub, xlsx, ods, odp, csv`; extension aliases map through them (`.docm`→docx,
    `.xls`→xlsx, `.pptm`→pptx, and so on).
    
    | Family | Extensions | Expected GFM output | Decision cue |
    | --- | --- | --- | --- |
    | Word | `.doc` `.docx` `.docm` | `#`–`######` headings, GFM tables, `[^n]` footnotes | Use when content extraction is enough; use `documents` when rendered layout matters. |
    | PowerPoint | `.ppt` `.pps` `.pot` `.pptx` `.pptm` `.ppsx` `.ppsm` | slide titles as plain paragraphs, bullet lists, speaker notes as `>` blockquotes, GFM tables (PPTX/ODP; legacy `.ppt` flattens tables to text lines) | Need table fidelity? Prefer PPTX or ODP; legacy `.ppt` preserves cell text but not table structure. |
    | Excel | `.xls` `.xlsx` `.xlsm` `.xlsb` | `## <sheet name>` heading + one GFM table per worksheet; number formats dropped (raw cell values) | Need displayed percentages, currency, or number formats? Prefer ODS; XLS/XLSX output is raw values. |
    | OpenDocument | `.odt` `.ods` `.odp` | same document/slide shapes as DOCX/PPTX; ODS keeps formatted display values | Prefer ODS when spreadsheet display formatting is part of the meaning. |
    | Rich Text Format | `.rtf` | same document shape as DOCX/ODT | Use for text extraction, not layout preservation. |
    | EPUB | `.epub` | `#` chapter headings, GFM tables, internal anchor links | Use to read an existing EPUB; use `epub` to author or package one. |
    | CSV | `.csv` | one GFM table; label-like first row promoted to header; delimiter sniffing; UTF-16 with BOM | Use for delimited tabular content; inspect delimiter and encoding when output looks wrong. |
    | PDF | `.pdf` | headings + inline emphasis, but a lower-fidelity pipeline: tables flatten to text, footnotes and links degrade. Text-based PDFs stay local; scanned/image-only PDFs require explicit hosted OCR or another OCR tool | Use local mode by default; hosted mode uploads the whole PDF and has no page selection. |
    
    See [references/formats.md](references/formats.md) for the full per-format
    expectations and fidelity caveats, and [references/errors.md](references/errors.md)
    for the exact failure messages (including the no-OCR error).
    
    ## Command Map
    
    Commands are shown relative to the repository root. `<file>` is any document
    path (for example `anydoc/fixtures/fixture-handmade-outline.docx`); `-` reads
    the document from stdin.
    
    | Need | Command | Choose it when |
    | --- | --- | --- |
    | Convert one file to small markdown on stdout | `anydoc/scripts/anydoc convert <file>` | The caller needs immediate content and does not need a saved artifact. |
    | Convert one file to a markdown file | `anydoc/scripts/anydoc convert <file> -o out.md` | The output is large, must be reviewed later, or should be preserved as an artifact. |
    | Convert many files to a directory | `anydoc/scripts/anydoc batch <file1> <file2> ... --out-dir out/` | The request is a bounded batch and per-file output/status is useful. |
    | Show the tool and pinned CLI version | `anydoc/scripts/anydoc info` | You need to confirm the executable and version before troubleshooting or reporting an environment issue. |
    | Raw pinned CLI, one document | `npx -y @firecrawl/anydoc@0.2.4 <file> [-o out.md]` | The wrapper is unavailable; preserve the pinned CLI and its documented semantics. |
    | Raw pinned CLI, read stdin | `cat data.csv \| npx -y @firecrawl/anydoc@0.2.4 - --format csv` | Bytes already arrive on stdin and the format is known; keep the producer pipeline separate from the converter. |
    
    For an OCR-required PDF, first use the local default so the failure is visible:
    
    ```bash
    anydoc/scripts/anydoc convert scan.pdf --ocr reject
    ```
    
    If the user explicitly authorizes sending the complete PDF to Firecrawl Parse,
    use the wrapper acknowledgement and a trusted `FIRECRAWL_API_KEY` environment
    variable when needed:
    
    ```bash
    anydoc/scripts/anydoc convert scan.pdf --ocr hosted --allow-hosted-upload
    ```
    
    The wrapper never places the key on the command line. Hosted OCR has no page
    selection, and a hosted failure is not permission to silently switch endpoints.
    
    Notes:
    
    - `scripts/anydoc` is an executable Python 3 script (shebang `#!/usr/bin/env
      python3`); `python3 anydoc/scripts/anydoc ...` is equivalent when the
      executable bit is unavailable.
    - The raw `npx -y @firecrawl/anydoc@0.2.4` rows are the ground truth for
      conversion behavior; the wrapper delegates to exactly that command.
    - Always pin `@0.2.4` for reproducible conversions. `-y` answers npx's
      "Ok to proceed?" prompt non-interactively — the CLI itself never prompts.
    - Both forms share the same contract: one document per invocation, exit code
      `0` success / `1` conversion or IO failure / `2` usage error, diagnostics as
      exactly one `anydoc: <message>` line on stderr, and no prompts.
    
    Hosted OCR is supported by the 0.2.4 library and CLI, but the wrapper requires
    both `--ocr hosted` and `--allow-hosted-upload` so an upload cannot be selected
    implicitly. The hosted route sends the complete PDF to Firecrawl Parse because
    page selection is unavailable. Do not place API keys on the command line.
    
    ## Reference Routing
    
    Load only the row that answers the immediate question; the command examples and verification contract remain in this file.
    
    | When you need to... | Load | It answers |
    | --- | --- | --- |
    | Choose a format or predict fidelity | [references/formats.md](references/formats.md) | Supported families, output shapes, and caveats such as raw XLSX values, ODS display values, legacy `.ppt` table flattening, and PDF degradation. |
    | Select flags, stdin syntax, output behavior, or version details | [references/cli-reference.md](references/cli-reference.md) | Verbatim help, accepted options, stdin rules, stdout/stderr behavior, pinning, and runtime requirements. |
    | Classify a failure or decide whether to retry | [references/errors.md](references/errors.md) | Exit codes, exact error vocabulary, no-OCR/encryption boundaries, and the next route. |
    | Choose a single-file, stdin, batch, vault, or large-output recipe | [references/workflows.md](references/workflows.md) | End-to-end recipes, safe output handling, per-file failure routing, and resource-limit behavior. |
    | Verify a documented upstream or fixture claim | [references/sources.md](references/sources.md) | Source URLs, access dates, fixture provenance, and the verification basis for documented claims. |
    | Shape the final evidence report | [references/report-examples.md](references/report-examples.md) | Complete success, expected-failure, and fidelity-boundary reports to imitate after following Verification. |
    
    ## When not to use
    
    Use this routing table before reaching for a conversion command:
    
    | User's request | Reach for | Why |
    | --- | --- | --- |
    | Generate, edit, inspect rendered layout, or validate a PDF/Word/Excel/PowerPoint artifact | `documents` skill | anydoc extracts existing document contents to Markdown; it does not author, preserve rendered layout, or validate artifacts. |
    | Package or author an EPUB | `epub` skill | anydoc reads an existing EPUB to Markdown but never writes or validates an EPUB container. |
    | OCR a scanned or image-only PDF | Local OCR tooling, or AnyDoc hosted OCR after explicit authorization | Local mode reports the OCR-required error without uploading; hosted mode sends the whole PDF to Firecrawl Parse. |
    | Scrape HTML or other web content | A web-scraping skill | HTML is not a supported anydoc input. |
    | Transcribe binary media such as images, video, or audio | A media or transcription tool | Embedded images become alt text; anydoc cannot transcribe media. |
    | Preserve pagination, fonts, templates, or rendered layout | A document/layout tool | The only output contract is GitHub-Flavored Markdown. |
    | Convert a password-protected file | An unencrypted copy from the document owner | anydoc has no password or decryption option. |
    
    ## Verification
    
    **Report evidence, not just success.** For every attempted conversion, return the input, exact command or wrapper path, observed exit code, output destination (stdout or file), structural markers checked, and any documented caveat or next route.
    
    **Compact report shape:**
    ```text
    Input: <path or stdin source>
    Command: <exact wrapper or pinned CLI path>
    Exit: <observed code>
    Output: <stdout or destination file>
    Checks: <markers or fidelity facts observed>
    Caveat/route: <documented limitation or next action>
    ```
    
    ### Common stop conditions
    
    | Condition | Do not | Next |
    | --- | --- | --- |
    | Scanned or image-only PDF / OCR-required error | Retry unchanged or upload implicitly | Use local OCR, or explicitly authorize and run `--ocr hosted --allow-hosted-upload`; page selection is unavailable. |
    | Encrypted or password-protected document | Guess a password or retry unchanged | Request an unencrypted copy or owner-authorized re-export. |
    | Unsupported, malformed, or resource-limit error | Guess a parser or claim partial success | Match the exact error in [references/errors.md](references/errors.md) and follow its bounded route. |
    | Exit 0 but expected structural markers are absent | Report success from the exit code alone | Inspect the output shape and source fidelity before reporting completion. |
    
    Confirm a conversion before reporting it as done:
    
    1. **Check the exit code.** `0` means the CLI produced markdown. `1` means the
       document could not be read or converted — read the single `anydoc: <message>`
       stderr line and match it against [references/errors.md](references/errors.md).
       `2` means the command itself was a usage error (bad flag, missing input,
       invalid `--format`).
    2. **Check the output shape.** The markdown must contain the structural markers
       your format actually produces:
       - Word / ODT / RTF / text-based PDF: `#`/`##` headings. For PDF, do not
         expect GFM tables or `[^1]:` footnote definitions — that pipeline
         flattens them.
       - Spreadsheets (xlsx/xls/ods) and CSV: `|`-delimited GFM tables. xlsx/xls
         show raw cell values (`0.155`, `1234.5`); ODS shows formatted display
         values (`15.5%`, `$1,234.50`).
       - Presentations (pptx/odp): slide titles as plain paragraphs, `>`
         blockquote speaker notes, GFM tables. Legacy `.ppt` flattens tables to
         bare text lines.
       - EPUB: `#` chapter headings and internal anchor links.
    3. **Write large outputs to a file with `-o`.** `-o out.md` keeps stdout silent
       and gives a reviewable file instead of streaming the whole document into
       context.
    4. **Verify tables survived.** If the source had tables and the output has no
       `|` rows, consult the format caveats — PDF and legacy `.ppt` flatten tables
       by design, not by error.
    
    **Stop when** the conversion exits 0 and the structural markers match the
    source format. Do not re-run or retry on a documented failure mode (encrypted,
    malformed, scanned/image-only, unsupported) without changing the input; report
    the documented message and route as [references/errors.md](references/errors.md)
    instructs.
    

Comments (0)

Sign in to join the conversation.

No comments yet.

Reviews (0)

No reviews yet.