Agent SkillsHKUDS/Vibe-Trading › doc-reader

doc-reader

GitHub

通用文档读取技能,支持PDF、Office、图片OCR及代码文件等多种格式的文本提取与结构化输出,提供统一JSON返回格式。

agent/src/skills/doc-reader/SKILL.md HKUDS/Vibe-Trading

Trigger Scenarios

需要读取或解析本地/上传的文档文件 对PDF、Word、Excel等文件进行内容提取或摘要

Install

npx skills add HKUDS/Vibe-Trading --skill doc-reader -g -y
More Options

Non-standard path

npx skills add https://github.com/HKUDS/Vibe-Trading/tree/main/agent/src/skills/doc-reader -g -y

Use without installing

npx skills use HKUDS/Vibe-Trading@doc-reader

指定 Agent (Claude Code)

npx skills add HKUDS/Vibe-Trading --skill doc-reader -a claude-code -g -y

安装 repo 全部 skill

npx skills add HKUDS/Vibe-Trading --all -g -y

预览 repo 内 skill

npx skills add HKUDS/Vibe-Trading --list

SKILL.md

Frontmatter
{
    "name": "doc-reader",
    "category": "tool",
    "description": "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."
}

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 .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, ocr_engine, ocr_quality, skipped_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.

OCR Configuration

The read_document tool automatically uses OCR for PDF pages with insufficient extractable text.

OCR Threshold

Use min_text_per_page to control when OCR is triggered (default: 50 characters):

read_document("scanned_report.pdf", min_text_per_page=10)  # More aggressive OCR
read_document("mixed_pdf.pdf", min_text_per_page=100)       # Less aggressive OCR

OCR Engine Configuration

Two OCR engines are built in — no extra packages needed beyond the engine SDK:

Engine Type Requires Install
rapid Local (offline) rapidocr_onnxruntime pip install rapidocr_onnxruntime
llm-vision Cloud A vision-capable LLM model + API key No extra install — uses your existing LLM provider config

The llm-vision engine works with any OpenAI-compatible vision model (GPT-4o, Qwen-VL, Gemini, Claude, GLM-4V, etc.). It reuses your existing LANGCHAIN_PROVIDER / LANGCHAIN_MODEL_NAME / API key configuration — no separate provider mapping needed. If you explicitly set VIBE_TRADING_OCR_ENGINE=llm-vision, your model choice is trusted; a real API error from the provider is clearer feedback than a heuristic guess.

To override the model used for OCR (without changing your agent's main model):

VIBE_TRADING_OCR_LLM_MODEL=qwen3.7-plus

Set VIBE_TRADING_OCR_ENGINE to select the engine:

  • auto (default): use local engines only, never cloud (privacy: document pages never leave the machine)
  • rapid: force RapidOCR (local, ONNX)
  • llm-vision: force LLM vision OCR (cloud — pages are sent to your configured LLM provider)
  • none: disable OCR entirely

Response Fields

PDF responses include OCR metadata:

  • ocr_engine: name of the OCR engine used (e.g. "rapid", "llm-vision") or null
  • ocr_pages: number of pages processed via OCR
  • skipped_pages: number of pages skipped (no OCR engine available)
  • ocr_quality: object with quality_flag (good/degraded/no_ocr_engine/no_ocr_needed), ocr_pages, and text_density (chars per page)

Notes

  • Encoding fallback order for text: utf-8 → utf-8-sig → gbk → gb2312 → big5 → latin-1.
  • OCR uses the configured engine (RapidOCR for local, or LLM vision for cloud). If no engine is available, image/scanned files return empty text with a note field — tell the user to install rapidocr-onnxruntime or set VIBE_TRADING_OCR_ENGINE=llm-vision with a vision-capable model.
  • 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_journal instead.
  • Source-code files are returned raw; do not re-format or re-indent.

Version History

  • 0aa45a9 Current 2026-07-24 17:45

Same Skill Collection

agent/src/skills/adr-hshare/SKILL.md
agent/src/skills/akshare/SKILL.md
agent/src/skills/alpha-zoo/SKILL.md
agent/src/skills/ashare-pre-st-filter/SKILL.md
agent/src/skills/asset-allocation/SKILL.md
agent/src/skills/backtest-diagnose/SKILL.md
agent/src/skills/behavioral-finance/SKILL.md
agent/src/skills/candlestick/SKILL.md
agent/src/skills/ccxt/SKILL.md
agent/src/skills/chanlun/SKILL.md
agent/src/skills/commodity-analysis/SKILL.md
agent/src/skills/corporate-events/SKILL.md
agent/src/skills/correlation-analysis/SKILL.md
agent/src/skills/correlation-regime/SKILL.md
agent/src/skills/cross-market-strategy/SKILL.md
agent/src/skills/crypto-derivatives/SKILL.md
agent/src/skills/data-routing/SKILL.md
agent/src/skills/defi-yield/SKILL.md
agent/src/skills/dividend-analysis/SKILL.md
agent/src/skills/earnings-forecast/SKILL.md
agent/src/skills/earnings-revision/SKILL.md
agent/src/skills/eastmoney/SKILL.md
agent/src/skills/edgar-sec-filings/SKILL.md
agent/src/skills/elliott-wave/SKILL.md
agent/src/skills/event-driven/SKILL.md
agent/src/skills/execution-model/SKILL.md
agent/src/skills/factor-research/SKILL.md
agent/src/skills/fund-analysis/SKILL.md
agent/src/skills/fundamental-filter/SKILL.md
agent/src/skills/geopolitical-risk/SKILL.md
agent/src/skills/global-macro/SKILL.md
agent/src/skills/harmonic/SKILL.md
agent/src/skills/hedging-strategy/SKILL.md
agent/src/skills/hk-connect-flow/SKILL.md
agent/src/skills/ichimoku/SKILL.md
agent/src/skills/investor-lenses/SKILL.md
agent/src/skills/liquidation-heatmap/SKILL.md
agent/src/skills/macro-analysis/SKILL.md
agent/src/skills/market-microstructure/SKILL.md
agent/src/skills/minute-analysis/SKILL.md
agent/src/skills/ml-strategy/SKILL.md
agent/src/skills/mootdx/SKILL.md
agent/src/skills/multi-factor/SKILL.md
agent/src/skills/okx-market/SKILL.md
agent/src/skills/onchain-analysis/SKILL.md
agent/src/skills/options-advanced/SKILL.md
agent/src/skills/options-payoff/SKILL.md
agent/src/skills/options-strategy/SKILL.md
agent/src/skills/pair-trading/SKILL.md

Metadata

Files
0
Version
9806936
Hash
01fd8306
Indexed
2026-07-24 17:45

inicio - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-16 17:15
浙ICP备14020137号-1 $mapa de visitantes$