Index of every page on this site: llms.txt
All skills
wangzan101 avatar

/documents

@0c258ac
by WangZanwangzan101/mika9.2k stars
2,081
Run it yourself

读 PDF 的文字、按页取、看文档信息,拆分合并后把文件交给用户

  • 3 files
  • 6.1 KB
  • Updated 3 weeks ago
  • GitHub
Use this Skill: https://skilld.dev/gh/wangzan101/mika/documents

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

SKILL.md

≈24 tokens for metadata: the name and description. ≈477 when used: this file. ≈22 more on demand in 1 file.

How this Skill uses context

Before choosing a Skill, your Agent reads its name and description. All available Skills share that space.

In our Claude Code example, all Skill names and descriptions share 8,000 characters. This Skill uses ≈44 characters, or 0.5%.

Your model, settings, and other Skills decide how much text your Agent can read.

Example settings and source

The example uses a 200k-token context and default Claude Code settings. The count includes the name, description, separators, and when_to_use when present. Codex also counts local file paths.

Skit's source and limits: Codex 0.160.1, Claude Code 2.1.292.

入口

先看文档在哪:

  • 网上的公开链接:用 web_navigate 打开,内置浏览器能直接显示的,读页面就够了。
  • 用户发来的附件:在 /workspace/inbox/。
  • 网页上下载的文件:在 /workspace/downloads/,可以用 web_downloads 查下载记录。

步骤

  1. 文字型 PDF 用 run_bundled_script 跑 scripts/extract_pdf.py,source 填 skills/documents,文件路径相对 /workspace 写:
    • 全文:args: ["inbox/a.pdf"]
    • 指定页(从 1 数,可写 3、1-5、1,4,7-9):args: ["inbox/a.pdf", "--pages", "1-5"]
    • 标题、作者、页数等信息(JSON):args: ["inbox/a.pdf", "--metadata"]
    • 长文档先存成文本:args: ["inbox/a.pdf", "--out", "a.txt"],再用 read_file 分段读,或用 search_files 找关键词。
    • 有密码的:加 --password 和密码。
  2. 输出里每页以 --- page N --- 开头,引用时按它写页码。
  3. 拆分、合并、抽页用 run_command 写一小段 Python,调用 pypdf;新文件放在 /workspace 下。
  4. 做好的文件用 share_file 交给用户。

容易出错的地方

  • 脚本退出码为 3、提示没有可取的文字,说明是扫描出来的图片型 PDF;本机没有文字识别,只能看页面图片或告诉用户这一点。部分页没有文字时,脚本会单独报出这些页。
  • 表格、多栏排版取出来的顺序常常是乱的,引用表格里的数字前要对照原页。
  • 页码范围超出文档页数时脚本直接报错,先用 --metadata 看页数。

怎样算办成(核实证据)

给出的文字能在脚本输出里对应到原页,并写了页码;交出去的文件 share_file 成功,页数和内容与预期一致(可以对新文件再跑一次 --metadata 核对页数)。

什么时候停下交给用户

文档有密码而用户没给,或者需要用户决定保留哪些页、按什么顺序合并时,先问用户。

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No third-party reports yet.

Signed by skilld at 0c258ac. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub yesterday.

Activeupdated 3 weeks ago
display
处理 PDF 文档
aliases
[
  "读 PDF",
  "PDF 转文字",
  "合并 PDF"
]
terms
[
  "PDF",
  "文档",
  "提取文字",
  "按页",
  "合并",
  "拆分",
  "扫描件"
]

README badge

README badge for wangzan101/mika/documents