doc-extract

โดย anthropic

แยกข้อความธรรมดาจากไฟล์เอกสาร - PDF, DOCX, XLSX, PPTX, RTF หรือข้อความธรรมดา/markdown/HTML ใช้เมื่อต้องการแปลงเอกสารไบนารีให้เป็นข้อความ สำหรับ…

npx skills add https://github.com/anthropics/healthcare --skill doc-extract

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).

Skills เพิ่มเติมจาก anthropic

access
anthropic
จัดการการเข้าถึงช่อง Discord — อนุมัติการจับคู่ แก้ไขรายการที่อนุญาต ตั้งค่านโยบาย DM/กลุ่ม ใช้เมื่อผู้ใช้ขอจับคู่ อนุมัติใครบางคน ตรวจสอบว่าใครได้รับอนุญาต…
official
session-report
anthropic
สร้างรายงาน HTML ที่สามารถสำรวจได้เกี่ยวกับการใช้งานเซสชันของ Claude Code (โทเค็น, แคช, ตัวแทนย่อย, ทักษะ, พรอมพ์ที่มีค่าใช้จ่ายสูง) จากบันทึกการสนทนาใน ~/.claude/projects
official
build-mcp-server
anthropic
ทักษะนี้ควรใช้เมื่อผู้ใช้ขอให้ "สร้าง MCP server", "สร้าง MCP", "ทำการรวม MCP", "ห่อ API สำหรับ Claude", "เปิดเผยเครื่องมือให้กับ…
official
cookbook-audit
anthropic
ตรวจสอบสมุดบันทึก Cookbook ของ Anthropic ตามเกณฑ์ที่กำหนด ใช้เมื่อมีการขอให้ตรวจสอบหรือประเมินสมุดบันทึก
official
handle-complaint
anthropic
จัดการข้อร้องเรียนของลูกค้าที่เข้ามาตั้งแต่ต้นจนจบ — ดึงข้อมูลบริบท ร่างคำตอบ และแนะนำแนวทางแก้ไขการดำเนินงาน รองรับอีเมลหรือรหัสตั๋วที่เป็นทางเลือก…
official
use-case-triage
anthropic
ระบุอย่างรวดเร็วว่ากิจกรรมการประมวลผลจำเป็นต้องมี PIA, DPIA ตามข้อบังคับ GDPR หรือสามารถดำเนินการต่อได้ — แสดงข้อขัดแย้งของนโยบายความเป็นส่วนตัวและนำทางไปยัง...
official
board-minutes
anthropic
ร่างรายงานการประชุมคณะกรรมการหรือคณะอนุกรรมการในรูปแบบขององค์กรของคุณ ตรวจจับการประชุมคณะกรรมการและคณะอนุกรรมการที่กำลังจะมาถึงจากปฏิทินของคุณโดยอัตโนมัติ สอบถามวาระการประชุมและ…
official
renewal-tracker
anthropic
แสดงสัญญาที่มีกำหนดเส้นตายการยกเลิกที่กำลังจะมาถึง และเตือนก่อนที่กรอบเวลาการแจ้งเตือนจะปิดลง โดยทำงานจากทะเบียนการต่ออายุที่ได้รับการดูแล ใช้เมื่อผู้ใช้ถาม…
official