xberg-picking-a-format
Skill này làm gì
Skill này giải thích nên chọn định dạng đầu ra nào khi trích xuất văn bản từ tài liệu. Nó dành cho người đưa kết quả vào công cụ AI, cơ sở dữ liệu tìm kiếm hoặc phần mềm khác.
Khi nào nên dùng
- ✓Khi bạn gửi văn bản đã trích xuất cho một model AI và muốn đầu ra sạch.
- ✓Khi bạn nạp tài liệu vào một vector store hoặc chỉ mục tìm kiếm.
- ✓Khi bạn cần đầu ra có cấu trúc để một chương trình khác đọc được.
Liên kết skill
https://github.com/xberg-io/xberg/blob/main/plugin/.ai-rulez/skills/xberg-picking-a-format/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Tôi đang trích xuất tài liệu cho chatbot AI của mình. Tôi nên dùng định dạng đầu ra nào?”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Agent ghép người tiêu thụ đầu ra với định dạng phù hợp và cài đặt nội dung tương ứng, chẳng hạn markdown cho model AI hoặc JSON cho chương trình, và cũng có thể loại bỏ khoảng trắng thừa.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
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.
Câu hỏi thường gặp
Khác nhau giữa định dạng và định dạng nội dung là gì?
Định dạng quyết định cách lệnh in kết quả, còn định dạng nội dung quyết định cách văn bản bên trong được viết.
Định dạng nào phù hợp với model AI?
Skill gợi ý đầu ra văn bản hoặc markdown cho ngữ cảnh của model AI.
Giảm token làm gì?
Nó loại bỏ khoảng trắng thừa và phần mẫu lặp lại, theo các mức từ tắt đến tối đa, để tiết kiệm chỗ trong prompt AI.
Chi tiết
Mô tả gốc của tác giả
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
Độ phổ biến
- Sao GitHub
- 9.5k
- Vị trí xếp hạng
- #12273
- Giấy phép
- MIT
- Cập nhật
- 2/11/2026
Bình luận
- …
Thêm skill từ kho mã này
xberg-batch-extraction
9.5kGiúp agent của bạn xử lý nhiều tài liệu một lượt với Xberg, dùng chung tùy chọn, giới hạn việc song song và không để một file lỗi làm dừng cả lượt.
xberg-chunking
9.5kGiúp agent của bạn chia văn bản dài thành các đoạn nhỏ cho prompt AI hoặc chỉ mục tìm kiếm, với kích thước đặt sẵn và chồng lấp tùy chọn.
xberg-extracting-keywords
9.5kGiúp agent của bạn lấy các từ khóa chính hoặc cụm từ khóa từ tài liệu và nhận diện ngôn ngữ của tài liệu, bằng các cài đặt từ khóa của Xberg.
xberg-extracting-tables
9.5kGiúp agent của bạn lấy bảng từ PDF, bảng tính và hình ảnh, giữ nguyên hàng và cột dưới dạng markdown hoặc dữ liệu có cấu trúc.
Skill tương tự
feishu-doc
394kGiúp agent của bạn đọc, tạo và sửa tài liệu đám mây Feishu, gồm văn bản, hình ảnh và bảng, bằng công cụ tài liệu.
feishu-drive
394kCho phép agent của bạn duyệt, sắp xếp và bình luận các file trong một thư mục đám mây Feishu đã được chia sẻ với bot.
feishu-perm
394kGiúp agent của bạn kiểm tra và thay đổi ai có quyền truy cập một file Feishu, chọn quyền nhỏ nhất đáp ứng yêu cầu của bạn.