Agent Skillsanthropics/healthcare › doc-extract

doc-extract

GitHub

提供文档到文本的提取功能,支持PDF、DOCX等多种格式。通过CLI或代码调用,输出JSON格式的纯文本,确保无状态且符合PHI安全要求,适用于合同、医疗文档等二进制文件的文本化处理。

plugins/healthcare/skills/doc-extract/SKILL.md anthropics/healthcare

Trigger Scenarios

需要将PDF、DOCX等二进制文档转换为纯文本 处理EHR附件或合同文件以获取文本内容

Install

npx skills add anthropics/healthcare --skill doc-extract -g -y
More Options

Non-standard path

npx skills add https://github.com/anthropics/healthcare/tree/main/plugins/healthcare/skills/doc-extract -g -y

Use without installing

npx skills use anthropics/healthcare@doc-extract

指定 Agent (Claude Code)

npx skills add anthropics/healthcare --skill doc-extract -a claude-code -g -y

安装 repo 全部 skill

npx skills add anthropics/healthcare --all -g -y

预览 repo 内 skill

npx skills add anthropics/healthcare --list

SKILL.md

Frontmatter
{
    "name": "doc-extract",
    "description": "Extract plain text from a document file - PDF, DOCX, XLSX, PPTX, RTF, or plain text\/markdown\/HTML. Use when a binary document needs to be turned into text, for example a contract PDF or an EHR DocumentReference attachment. Other skills (fhir) invoke scripts\/extract.ts directly; the contracts MCP server bundles its own copy (servers\/documents\/src\/extract.mjs) so its bundle stays self-contained — port fixes to both."
}

doc-extract

Shared document-to-text extraction. One script, no state: reads an input file, prints JSON to stdout, writes nothing to disk (PHI-safe — no caches, no temp files; callers own any caching).

Setup (once)

cd <this skill dir> && bun install

This pulls liteparse (the lit bin, used for PDF/DOCX/XLSX/PPTX, OCR included) and rtf-to-text (RTF). Without it, PDFs still work via a pdftotext -layout fallback if poppler is installed; other binary formats require liteparse.

Use

bun <this skill dir>/scripts/extract.ts <input-file> [--content-type <mime>]

Output on stdout:

{ "text": "...", "method": "liteparse | pdftotext | rtf-to-text | passthrough", "pages": 12 }
  • text is page-anchored for paged formats: === [page N] === markers between pages.
  • pages is present when page markers exist.
  • method is the extractor that actually produced the text.
  • Format is taken from the file extension; pass --content-type (e.g. application/pdf) when the file has no useful extension, as with downloaded EHR attachments. Note liteparse refuses extension-less files, so those PDFs go through the pdftotext fallback.
  • Errors print {"error": "..."} to stderr and exit 1.

Table caveat

Tables with multiple value columns (option A vs option B, in-tier vs out-of-tier) can interleave columns line-by-line in the extracted text: fragments of adjacent cells alternate, and a cell's text can even land mid-sentence inside a neighboring column. Values usually survive, but which column a value belongs to can become ambiguous. When an answer comes from one column of a multi-column table and the document has no redundant restatement of the value elsewhere, verify it by reading the original page directly before treating it as ground truth. The extracted text's === [page N] === anchor tells you which page: pass it to the Read tool's pages parameter (e.g. pages: "37") to render just that page to vision instead of the whole document.

For other skills

Import the functions instead of shelling out when you're already in bun TS:

import { extract, resolveLit } from "../doc-extract/scripts/extract";
const lit = resolveLit([myRoot]); // also checks myRoot/node_modules/.bin/lit
const text = extract(lit, "/path/to/file.pdf"); // string | null

The contracts skill consumes it this way (its ingest caching stays on the contracts side).

Version History

  • 744278a Current 2026-07-25 08:05

Same Skill Collection

plugins/healthcare/skills/clinical-note-extract/SKILL.md
plugins/healthcare/skills/clinical-trial-protocol/SKILL.md
plugins/healthcare/skills/contracts/SKILL.md
plugins/healthcare/skills/fhir/SKILL.md
plugins/healthcare/skills/fraud-detection/SKILL.md
plugins/healthcare/skills/icd10-cm/SKILL.md
plugins/healthcare/skills/prior-auth/SKILL.md
plugins/healthcare/skills/procedure-coding/SKILL.md
plugins/healthcare/skills/fhir-developer/SKILL.md

Metadata

Files
0
Version
744278a
Hash
154ad089
Indexed
2026-07-25 08:05

Главная - Вики-сайт
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-21 06:30
浙ICP备14020137号-1 $Гость$