跳到正文
Skillpedia
PDF、Word 与幻灯片9.5k · #12273

xberg-picking-a-format

它能做什么

这项技能说明在从文档中提取文字时应选择哪种输出格式。适合把结果输入 AI 工具、搜索数据库或其他软件的人。

适用场景

  • ✓当你要把提取的文本发送给 AI 模型,并希望输出干净整洁时。
  • ✓当你要把文档加载到向量存储或搜索索引中时。
  • ✓当你需要另一个程序可以读取的结构化输出时。

技能链接

https://github.com/xberg-io/xberg/blob/main/plugin/.ai-rulez/skills/xberg-picking-a-format/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/xberg-io/xberg/blob/main/plugin/.ai-rulez/skills/xberg-picking-a-format/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“我正在为我的 AI 聊天机器人提取文档。我应该使用哪种输出格式?”

每周 5 个新技能,1 分钟读完。

工作原理

智能体会根据输出的使用对象,匹配合适的格式和内容设置,例如 AI 模型使用 Markdown,程序使用 JSON。它还可以去除多余的空白。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Picking a format

Xberg has two orthogonal format knobs. Get them right up front and the downstream code stays simple.

Knob What it controls Values Default
--format How the CLI prints the result text, json, toon text (extract), json (batch)
--content-format How extracted content is rendered inside result plain, markdown, djot, html, json, doctags plain
--token-reduction Strip whitespace / boilerplate for LLM contexts off, light, moderate, aggressive, maximum off

--format json returns an envelope wrapping the ExtractedDocument — the document lives under .result for extract and under .results[] for batch, with content, metadata, tables, and images as fields of that nested document. --format text prints just content. --content-format is what shows up inside that content field.

Decision tree

Who consumes the output?
├── LLM (Claude, GPT, Gemini, local) — embed/prompt context
│       --format text --content-format markdown
├── Vector store / RAG indexer
│       --format json --content-format markdown
│       (markdown preserves structure for chunking)
├── Downstream parser that expects machine-readable JSON
│       --format json --content-format plain
│       (cleanest text + structured metadata)
├── Human review / archival
│       --format text --content-format markdown
├── HTML re-rendering / web display
│       --format json --content-format html
├── Lossless intermediate for pandoc / academic tooling
│       --format json --content-format djot
└── Token-budget-constrained pipeline
        --format text --content-format plain
        (drops markup; add --token-reduction moderate for further savings)

Examples

Feed a PDF directly into an LLM:

xberg extract paper.pdf --content-format markdown

Index a corpus into a RAG store with tables and headings preserved:

xberg batch docs/*.pdf --format json --content-format markdown \
  | jq -c '.result | {content: .content, tables: .tables}'

Strip a file to bare text for a token-tight summarizer:

xberg extract long.pdf \
  --content-format plain \
  --token-reduction moderate

Pull metadata only, ignore content:

xberg extract file.pdf --format json | jq '.result.metadata'

When in doubt

  • Default to markdown as the content format. It is the best compromise across LLMs, RAG, and human review, and Xberg has the most faithful renderer for it.
  • Reach for plain only when downstream cannot tolerate any markup.
  • Reach for djot only if you're already in a djot/pandoc pipeline.
  • Reach for html only when re-rendering for the web.
  • Reach for json for a heading-driven content tree, or doctags for Docling-compatible output.

Token-reduction (orthogonal)

--token-reduction collapses whitespace, strips repeated headers/footers, and trims boilerplate. It composes with any --content-format:

  • off (default), light, moderate, aggressive, maximum.

Use moderate as a safe starting point for LLM context windows. maximum is lossy — verify before relying on it.

See ../../references/cli-reference.md for the full flag set and ../../references/configuration.md for the equivalent output_format and token_reduction keys in xberg.toml.

常见问题

格式和内容格式有什么区别?

格式设置命令输出结果的方式,内容格式则设置结果中文字的写法。

哪种格式适合 AI 模型?

这项技能建议使用文本或 Markdown 输出作为 AI 模型的上下文。

token 缩减功能有什么作用?

它会去除多余的空白和模板性内容,可从关闭到最大共多个级别,以节省 AI 提示中的空间。

详情

作者的原始描述

Use when choosing an output format for extracted documents — plain text, markdown, djot, HTML, JSON, or DocTags. Maps consumer (LLM, parser, archive) to the right `--format` / `--content-format` pair.

repo: xberg-io/xberg

热度

GitHub 星标
9.5k
排名
#12273
许可证
MIT
更新时间
2026/11/2

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能