doc-reader
- Repo stars 9,792
- Author updated Live
- Author repo Vibe-Trading
- Domain
- Documentation
- Compatible agents
-
- Claude Code
- Cursor
- Cline
- Codex
- Windsurf
- Gemini CLI
- +20
- Trust score
- 88 / 100 · community maintained
- Author / version / license
- @HKUDS · no license declared
- Token usage
- Lean
- Setup complexity
- Guided setup
- External API key
- Not required
- Operating systems
- Unspecified (assume cross-platform)
- Runtime requirements
- Python
- Permissions
-
- Read-only
- Shell exec
- Env read
- Write / modify
- Network behavior
- Local-only
- Install commands
- 26 variants
Profile is derived at build time from SKILL.md and install vectors. Subject to drift from author intent.
Heads up: 未限定 allowed-tools,默认拥有全部工具权限。
---
name: doc-reader
description: Read any common document/data file — PDF, Word (.docx), Excel (.xlsx/.xls), PowerPoint (.pptx)…
category: documentation
runtime: Python
---
# doc-reader output preview
## PART A: Task fit
- Use case: Read any common document/data file — PDF, Word (.docx), Excel (.xlsx/.xls), PowerPoint (.pptx), images (OCR), CSV/TSV, plain text, JSON/YAML/TOML, HTML/XML, and most source-code files. Use the `read_document` tool..
- Inputs: target material, constraints, expected output, and acceptance criteria.
- Evidence boundary: follow “Purpose / Supported formats / Usage” and do not present inference as author intent.
## PART B: Execution result
- **01** The card summarizes the use case; runtime output centers on “Read any common document/data file — PDF, Word (.docx), Excel (.xlsx/.xls), PowerPoint (.pptx), images (OCR), CSV/TSV, plain text, JSON/YAML/TOML, HTML/XML, and most source-code files. Use the `read_document` tool.”.
- **02** When the source has headings, the agent prioritizes “Purpose / Supported formats / Usage” so the result follows the author’s structure.
- **03** Typical output includes task judgment, concrete steps, required commands or file edits, validation, and follow-up options.
- **04** Risk context follows the fingerprint: read files, run shell commands, read environment variables, write/modify files; mostly runs locally; usually needs no extra API key.
## Running Rules
- read files, run shell commands, read environment variables, write/modify files; mostly runs locally; usually needs no extra API key.
- Validate with a small sample before expanding scope.
- Return the result, validation criteria, and next iteration options. The source mentions slash commands such as `/upload`; use them first when your agent supports command triggers.
Name target files or source material, expected output, forbidden changes, and whether network or shell access is allowed. Permission fingerprint: read files, run shell commands, read environment variables, write/modify files.
Start with a small task and check whether the result follows “Purpose / Supported formats / Usage”. Inspect diffs, logs, previews, or tests before expanding scope.
Confirm the final output includes a concrete result, evidence, and next action. If it stays generic, tighten inputs, boundaries, and acceptance criteria.
---
name: doc-reader
description: Read any common document/data file — PDF, Word (.docx), Excel (.xlsx/.xls), PowerPoint (.pptx)…
category: documentation
source: HKUDS/Vibe-Trading
---
# doc-reader
## When to use
- Read any common document/data file — PDF, Word (.docx), Excel (.xlsx/.xls), PowerPoint (.pptx), images (OCR), CSV/TSV…
- Use it when the task has clear inputs, repeatable steps, and validation criteria.
## What to provide
- Target material, scope, expected result, and forbidden changes.
- Whether network, commands, file writes, or external services are allowed.
## Execution rules
- Organize steps around “Purpose / Supported formats / Usage” and keep inference separate from source facts.
- read files, run shell commands, read environment variables, write/modify files; mostly runs locally; usually needs no extra API key.
- Validate with a small sample before expanding the task.
## Output requirements
- Return the deliverable, key evidence, validation method, and next action.
- Mark missing information as unknown; do not invent commands, platforms, or dependencies. The author source anchors workflow facts; repository files anchor sources and commands; Fluxly only adds fit, limitations, and quality judgment.
skill "doc-reader" {
input -> user goal + target files + boundaries + acceptance criteria
context -> Purpose / Supported formats / Usage
rules -> SKILL.md triggers / order / output contract
runtime -> Python | read files, run shell commands, read environment variables, write/modify files | mostly runs locally
guardrails -> usually needs no extra API key + small-sample validation + diff/log review
output -> copyable result + checklist + next iteration
} Universal Document Reader
Purpose
Return extracted text from any supported file in a single unified JSON envelope. The tool dispatches by file extension — you always call the same tool regardless of format.
Supported formats
| Category | Extensions | Notes |
|---|---|---|
.pdf |
Text pages extracted in ms; scanned/image pages fall back to OCR | |
| Word | .docx |
Paragraphs + table cells |
| Excel | .xlsx, .xls |
All sheets, first 100 rows per sheet as preview |
| PowerPoint | .pptx |
Slide text content |
| Images | .png/.jpg/.jpeg/.gif/.bmp/.webp/.tiff |
OCR only |
| CSV / TSV | .csv, .tsv |
Raw text with encoding fallback |
| Plain text | .txt/.md/.log/.rst |
Encoding fallback |
| Config | .json/.yaml/.yml/.toml/.ini/.cfg/.env |
Raw text |
| Markup | .html/.htm/.xml |
Raw text (no HTML stripping) |
| Source code | .py/.js/.ts/.tsx/.go/.rs/.java/.cpp/.c/.sql/.sh/... |
Raw text |
| Unknown extension | anything else | Best-effort read as UTF-8/GBK text |
Blocked (rejected at /upload): executables (.exe/.dll/.so/...) and
archives (.zip/.tar/...). Ask the user to unpack archives locally first.
Usage
Always call the tool directly — do not run Python from bash.
read_document(file_path="uploads/paper.pdf")
read_document(file_path="uploads/annual_report.pdf", pages="1-10")
read_document(file_path="uploads/contract.docx")
read_document(file_path="uploads/sales.xlsx")
read_document(file_path="uploads/deck.pptx")
read_document(file_path="uploads/chart.png") # image → OCR
read_document(file_path="uploads/config.yaml")
read_document(file_path="uploads/notes.md")
The pages parameter only applies to PDF; other formats ignore it.
Return envelope
All formats share this shape:
{
"status": "ok",
"file": "paper.pdf",
"format": "pdf",
"char_count": 52000,
"truncated": true,
"text": "..."
}
Format-specific extra fields:
| Format | Extra keys |
|---|---|
pdf |
total_pages, pages_read, ocr_pages |
docx |
paragraphs, tables |
excel |
sheets (array of {name, rows, cols}) |
pptx |
slides |
text |
encoding, size |
Content longer than 15000 chars is truncated; for PDFs use the pages
parameter to read slices.
Workflows
Paper / report summary
1. read_document(file_path="paper.pdf") → full text
2. Extract abstract, methodology, conclusion → summarize
Contract review
1. read_document(file_path="contract.docx") → paragraphs + tables
2. Flag key clauses (termination, liability, payment, IP)
Spreadsheet quick-look
1. read_document(file_path="sales.xlsx") → all sheet previews
2. If user wants trade journal analysis specifically, pivot to
`analyze_trade_journal` tool instead (see trade-journal skill).
Chart / screenshot / scanned PDF
1. read_document(file_path="scan.png") → OCR text
2. If OCR returns empty, tell the user; don't fabricate.
Notes
- Encoding fallback order for text: utf-8 → utf-8-sig → gbk → gb2312 → big5 → latin-1.
- OCR uses RapidOCR; if the package is missing, image/scanned files
return empty
textwith anotefield — tell the user to installrapidocr-onnxruntime. - Excel previews are limited to 100 rows per sheet to stay in budget.
If the user needs full data (e.g. trade journals), call
analyze_trade_journalinstead. - Source-code files are returned raw; do not re-format or re-indent.
Decide Fit First
Design Intent
How To Use It
Boundaries And Review