xberg-picking-a-format
What it does
This skill explains which output format to pick when extracting text from documents. It is for people feeding results into AI tools, search databases or other software.
When to use it
- βWhen you are sending extracted text to an AI model and want clean output.
- βWhen you are loading documents into a vector store or search index.
- βWhen you need structured output that another program can read.
Skill link
https://github.com/xberg-io/xberg/blob/main/plugin/.ai-rulez/skills/xberg-picking-a-format/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agentβs skills folder.
Example of what to ask your AI
βI am extracting documents for my AI chatbot. Which output format should I use?β
5 new skills a week. 1 minute to read.
How it works
The agent matches the consumer of the output to the right format and content setting, such as markdown for an AI model or JSON for a program, and can also strip extra whitespace.
Technical content (original SKILL.md)
Original text by the author, straight from 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
markdownas 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
plainonly when downstream cannot tolerate any markup. - Reach for
djotonly if you're already in a djot/pandoc pipeline. - Reach for
htmlonly when re-rendering for the web. - Reach for
jsonfor a heading-driven content tree, ordoctagsfor 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.
FAQ
What is the difference between format and content format?
Format sets how the command prints the result, while content format sets how the text inside it is written.
Which format suits an AI model?
The skill suggests text or markdown output for AI model context.
What does token reduction do?
It removes extra whitespace and boilerplate, in levels from off to maximum, to save room in AI prompts.
Details
Original description by the author
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
Popularity
- GitHub stars
- 9.5k
- Ranking position
- #12273
- License
- MIT
- Updated
- 11/2/2026
Comments
- β¦
More skills from this repository
xberg-batch-extraction
9.5kHelps your agent process many documents at once with Xberg, sharing one set of options, limiting parallel work and keeping failed files from stopping the run.
xberg-chunking
9.5kHelps your agent split long document text into smaller pieces for AI prompts or search indexes, with set sizes and optional overlap.
xberg-extracting-keywords
9.5kHelps your agent pull the main keywords or key phrases from a document and detect its language, using Xberg's keyword settings.
xberg-extracting-tables
9.5kHelps your agent pull tables out of PDFs, spreadsheets and images, keeping rows and columns intact as markdown or structured data.
Similar skills
feishu-doc
394kHelps your agent read, create, and edit Feishu cloud documents, including text, images, and tables, using the document tool.
feishu-drive
394kLets your agent browse, organize, and comment on files in a Feishu cloud folder that has been shared with the bot.
feishu-perm
394kHelps your agent check and change who can access a Feishu file, choosing the smallest permission that meets your request.