pdf-analyzer

从 PDF 文件中提取文本、表格、元数据和结构化数据。用于在用户要求读取或解析 PDF、提取或总结 PDF 内容、导出表格、或将 PDF 转换为 JSON/CSV 等结构化格式时提供支持,覆盖单页与多页文档、扫描版 PDF 及复杂表格布局的处理场景。

仓库最近推送
GitHub Stars
219
Forks
38
Issues / PRs
7

安装方式

先用 Prompt 核对来源与依赖。也可下载安装包。

用 AI 助手安装

复制提示词,让助手先核对固定版本和依赖。

查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "pdf-analyzer":https://skillpi.com/zh/skills/deepskill-de3975b3ed774da54fd921b21ed9aee6c1fb064ac5b9380edc8c9a837a9e7684。安装前核对上游来源和版本:https://github.com/TerminalSkills/skills。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。

来源与配置

github.com

配置方式待核实

请查看原始来源中的适用工具、依赖和权限要求。

安装实测待补充

从 PDF 文件中提取文本、表格、元数据和结构化数据。用于在用户要求读取或解析 PDF、提取或总结 PDF 内容、导出表格、或将 PDF 转换为 JSON/CSV 等结构化格式时提供支持,覆盖单页与多页文档、扫描版 PDF 及复杂表格布局的处理场景。

0 下载

介绍来源: third_party · TerminalSkills · 1.0.0 参考来源

SkillPi 解读

输入和输出
翻译待完成,请参阅来源文档。
实测状态
未测试

文件浏览

在原站浏览文件 ↗

原始 SKILL.md

打开原文 ↗
Frontmatter
name: pdf-analyzer
description: >-
  Extract text, tables, metadata, and structured data from PDF files. Use when
  a user asks to read a PDF, parse a PDF, extract data from a PDF, summarize a
  PDF document, pull tables from a PDF, or convert PDF content to structured
  formats like JSON or CSV. Handles single and multi-page documents, scanned
  PDFs, and PDFs with complex table layouts.
license: Apache-2.0
compatibility: "Requires Python 3.9+ with pdfplumber or PyMuPDF (fitz) installed"
metadata:
  author: terminal-skills
  version: "1.0.0"
  category: documents
  tags: ["pdf", "document", "extraction", "tables", "parsing"]

PDF Analyzer

Overview

Extract text, tables, and structured data from PDF files and convert them into usable formats. This skill handles text extraction, table detection, metadata reading, and output formatting for single or multi-page PDFs.

Instructions

When a user asks you to analyze, read, parse, or extract data from a PDF file, follow these steps:

Step 1: Identify the PDF and goal

Determine the file path and what the user wants extracted:

  • Full text: All readable text from every page
  • Tables: Structured tabular data
  • Metadata: Title, author, creation date, page count
  • Specific sections: Targeted content from certain pages
  • Summary: A condensed version of the document contents

Step 2: Choose the extraction method

Write a Python script using one of these libraries (prefer pdfplumber for tables, PyMuPDF for speed):

For text extraction:

import pdfplumber

def extract_text(pdf_path):
    text_by_page = []
    with pdfplumber.open(pdf_path) as pdf:
        for i, page in enumerate(pdf.pages):
            text = page.extract_text()
            if text:
                text_by_page.append({"page": i + 1, "text": text.strip()})
    return text_by_page

For table extraction:

import pdfplumber
import csv

def extract_tables(pdf_path, output_csv=None):
    all_tables = []
    with pdfplumber.open(pdf_path) as pdf:
        for i, page in enumerate(pdf.pages):
            tables = page.extract_tables()
            for table in tables:
                headers = table[0]
                rows = table[1:]
                all_tables.append({
                    "page": i + 1,
                    "headers": headers,
                    "rows": rows
                })
    if output_csv and all_tables:
        with open(output_csv, "w", newline="") as f:
            writer = csv.writer(f)
            writer.writerow(all_tables[0]["headers"])
            for table in all_tables:
                writer.writerows(table["rows"])
    return all_tables

For metadata:

import pdfplumber

def extract_metadata(pdf_path):
    with pdfplumber.open(pdf_path) as pdf:
        return {
            "pages": len(pdf.pages),
            "metadata": pdf.metadata
        }

Step 3: Run the script and format output

Execute the script, then present results in the format the user needs (plain text, JSON, CSV, markdown table, or summary).

Step 4: Handle errors gracefully

If extraction fails, try these fallback approaches:

  1. Switch from pdfplumber to PyMuPDF (fitz)
  2. For scanned PDFs, suggest OCR with pytesseract
  3. For encrypted PDFs, inform the user a password is needed

Examples

Example 1: Extract all tables from an invoice PDF

User request: "Pull the line items table from invoice.pdf and save as CSV"

Actions taken:

  1. Open invoice.pdf with pdfplumber
  2. Detect tables on each page
  3. Extract headers and rows
  4. Write to invoice_items.csv

Output:

Found 1 table on page 1 with 5 columns: Item, Quantity, Unit Price, Tax, Total
Extracted 12 rows. Saved to invoice_items.csv.

Preview:
| Item            | Quantity | Unit Price | Tax   | Total   |
|-----------------|----------|------------|-------|---------|
| Widget A        | 100      | $2.50      | $25.00| $275.00 |
| Widget B        | 50       | $4.00      | $20.00| $220.00 |

Example 2: Summarize a research paper

User request: "Summarize the key findings from paper.pdf"

Actions taken:

  1. Extract full text from all pages
  2. Identify abstract, introduction, results, and conclusion sections
  3. Produce a structured summary

Output:

Document: paper.pdf (14 pages)

Title: Effects of Sleep Duration on Cognitive Performance
Authors: Smith et al., 2024

Key Findings:
- Participants sleeping < 6 hours showed 23% slower reaction times
- Optimal cognitive performance observed at 7-8 hours of sleep
- No significant benefit observed beyond 9 hours

Methods: Randomized controlled trial, n=240, over 12 weeks
Conclusion: 7-8 hours of sleep optimizes cognitive performance in adults

Guidelines

  • Always check if the PDF is readable before attempting extraction. Some PDFs are image-only and require OCR.
  • For large PDFs (100+ pages), process in batches and show progress.
  • When extracting tables, validate that column counts are consistent across rows. Merged cells often cause misalignment.
  • Preserve the original page numbers in output so the user can cross-reference.
  • If a PDF has both text and scanned pages, extract text where available and flag scanned pages for OCR.
  • Never assume table headers. Always use the first row unless the user specifies otherwise.
  • For multi-column layouts (academic papers), extract text in reading order, not left-to-right across columns.

当前收录版本

1.0.0

核对来源版本 ↗

质量评测

满分100 · 来自 SkillPi LAB 实验室的评测报告。

场景价值85/100

亮点

  • 解决 PDF 文档处理的通用刚需场景
  • 支持文本、表格、元数据多维度提取
  • 覆盖发票、论文等高频使用案例
触发精准90/100

亮点

  • 触发词覆盖全面(read/parse/extract/summarize/convert)
  • 边界清晰,无歧义
结构规范90/100

待提升项

  • description写错位置 原报告严重程度:轻微

    顶层 frontmatter 中 description 为空,实质描述在 skill_body 内部

    改进建议:将 description 内容移至顶层 frontmatter

亮点

  • Phase/步骤清晰(Step 1-4)
  • 提供端到端示例(Example 1 & 2)
  • frontmatter 完整
执行可靠85/100

亮点

  • 工具来源明确(pdfplumber/PyMuPDF)
  • 覆盖主要异常(加密/扫描/OCR 建议)
  • 提供 fallback 方案(切换库/OCR 建议)
证据可验 (前四项均值)88/100

取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。

正文静态检测

100 / 100 · skillpi-20261123-no-r3-v1

正文未命中当前规则。

分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。

权限与使用前检查

根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。

  • 保存或修改文件

    先确认输出目录和同名文件是否会被覆盖;重要文件保留备份,优先写入新的输出目录。

    主文档提及 · 第 76 行

本站展示提示不会授予权限。涉及文件改动、密钥、外部发送或费用时,仍由你使用的工具按需确认。

安全评级与访问范围

safe · 静态证据核验,不代表运行安全保证。

使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。