暂无简介
- License 许可
- Apache-2.0
- 最近更新
- 2026-11-14
- Stars
- ★ 0
- Forks
- 1
02 资源文件 11
- 参考文档references/forms.md9.2 KB
- 许可证references/LICENSE.txt1.4 KB
- 参考文档references/reference.md16.3 KB
- 脚本scripts/check_bounding_boxes_test.py8.6 KB
- 脚本scripts/check_bounding_boxes.py3.1 KB
- 脚本scripts/check_fillable_fields.py362 B
- 脚本scripts/convert_pdf_to_images.py1.1 KB
- 脚本scripts/create_validation_image.py1.6 KB
- 脚本scripts/extract_form_field_info.py6.0 KB
- 脚本scripts/fill_fillable_fields.py4.7 KB
- 脚本scripts/fill_pdf_form_with_annotations.py3.5 KB
03 SKILL.md 正文
PDF-to-Data Extraction and Verified Output
Purpose
Extract text and simple tables from PDFs in a tool-constrained execution environment, optionally combine with spreadsheet data, and produce verifier-aligned output artifacts with explicit existence/readability checks.
When to Use
Use this skill when the task requires reading a PDF (rules, spec, report, or embedded tables) and turning it into structured text/data for downstream computation, especially when the environment enforces strict command execution (one command per tool call unless explicitly chained) and a verifier expects an output file at an exact path.
Procedure
-
- Discover inputs and constraints (no assumptions)
- List available files in the working directory and identify candidate PDFs/spreadsheets.
- If the task/verifier specifies an output path (for example /root/answer.txt), record it exactly; otherwise choose an output path only after confirming a writable directory.
- Check tool availability by attempting minimal imports (pypdf, pdfplumber, pandas) using a single Python invocation.
-
- Choose an extraction route (decision point)
- If you need plain text and layout is not critical: prefer pypdf text extraction.
- If layout or tables matter: prefer pdfplumber.
- If imports fail, fall back to command-line utilities only if they are present (for example pdftotext); discover by running the tool with a help/version flag.
-
- Extract minimally, then validate evidence (checkpoint)
- Run the smallest extraction that proves progress (for example: page count, first 200 characters of page 1, or table row counts).
- Evidence to collect before heavier processing:
- Number of pages extracted successfully.
- Non-empty text sample or non-empty table output for at least one page.
- If evidence is empty, reassess: the PDF may be scanned (image-only). Only then consider OCR as an explicit alternative, and validate that OCR tools are installed before proceeding.
-
- If spreadsheets are involved, load with discovery-first parsing (optional)
- Use pandas to enumerate sheet names and inspect headers (read a small sample) before assuming column names or data types.
- Validate row/column counts and print a small preview as evidence before computing final results.
-
- Produce required outputs and verify at the exact path (final checkpoint)
- Write outputs only after confirming the destination directory is writable.
- Immediately verify the artifact at the exact required path using a separate existence + read check (for example: list the file and print the first lines).
- Do not stop until the verifier-visible check succeeds.
-
- Bounded recovery after tool failure (single fallback branch)
- If any tool call fails (for example: "cannot execute multiple commands at once" or an import error):
- Re-run the smallest failing action as a single command only (or explicitly chain with && in one shell command).
- Re-run only the minimal validation check (page count/text sample/file existence) to confirm recovery.
- If the same failure repeats, switch to the closest supported alternative (library <-> CLI) and retry the minimal check once; then stop and request clarification if requirements are ambiguous.
Constraints / Pitfalls
- One-command rule: never submit multiple independent commands in one tool call unless explicitly chained with && or ; in a single shell command. Prefer separate tool calls for "run then verify" steps.
- Verifier alignment: never assume an output was created; always perform an explicit existence/readability check at the exact task-specified path before finishing. Avoid writing to alternate locations unless the task allows it and you can prove the verifier will read it there.
04 同仓库更多 Skills
video-frame-extraction
Extract frames from video files and save them as images using OpenCV
openai-vision
Analyze images and multi-frame sequences using OpenAI GPT vision models
image-ocr
Extract text content from images using Tesseract OCR via Python, including structured field extraction from receipts and forms
video-frame-extraction
Extract frames from video files and save them as images using OpenCV
openai-vision
Analyze images and multi-frame sequences using OpenAI GPT vision models
image-ocr
Extract text content from images using Tesseract OCR via Python, including structured field extraction from receipts and forms