xberg-batch-extraction
O que ela faz
Esta skill mostra como extrair conteúdo de documentos de uma pasta ou lista de arquivos em uma só passada. É para quem tem muitos documentos e quer um único resultado, com os erros de cada arquivo listados à parte.
Quando usar
- ✓Quando você tem uma pasta de PDFs ou arquivos do Word para processar juntos.
- ✓Quando quer um único conjunto de opções de extração aplicado a todos os arquivos.
- ✓Quando alguns arquivos podem falhar e você ainda quer os resultados dos demais.
Link da skill
https://github.com/xberg-io/xberg/blob/main/plugin/.ai-rulez/skills/xberg-batch-extraction/SKILL.mdCopie e cole na sua IA (Claude, ChatGPT ou Cursor) pedindo para seguir as instruções.
Como usar
O jeito mais fácil: copie a mensagem e cole na sua IA. Ela lê a skill e segue as instruções.
Mensagem pronta para colar
Para Claude Code, Codex ou Cursor: rode na pasta do projeto e a skill fica instalada.
Baixe o SKILL.md e coloque na pasta de skills do seu agente.
Exemplo do que pedir para a IA
“Extraia o texto de todos os PDFs da minha pasta de relatórios em uma única execução e me diga quais arquivos falharam.”
5 skills novas por semana. 1 minuto de leitura.
Como funciona
O agente roda o comando de lote na sua lista de arquivos, aplica as configurações compartilhadas, processa um número limitado por vez e devolve os resultados bem-sucedidos junto com os erros.
Conteúdo técnico (SKILL.md original)
Texto original do autor, em inglês, direto do GitHub.
Batch extraction
Use this when processing a directory or glob of documents in one pass.
xberg batch shares one extraction config across every file, runs
extractions concurrently, and returns a JSON envelope — failures on
individual files do not abort the run.
Basic usage
# Glob expands to many paths; results come back in a JSON envelope (default)
xberg batch *.pdf
# Mixed formats, markdown content for LLM ingestion
xberg batch docs/*.docx --content-format markdown
# Recurse with the shell, then extract
xberg batch $(find ./corpus -name '*.pdf')
batch defaults to --format json (vs --format text for single
extract). The envelope contains results, total_ms, per_file_ms and, when failures
occur, errors. Each results entry is a full extracted document. One input may produce
multiple documents, so do not pair results with inputs by position. per_file_ms is
aligned with inputs; inspect errors for per-input failures.
xberg batch reports/*.pdf \
| jq '.results[] | {chars: (.content | length), mime: .mime_type}'
Parallelism
--max-concurrent caps how many files extract at once. When omitted, the scheduler derives document concurrency from the total thread budget. Lower it on memory-constrained hosts or when OCR/ML
models are active, since each in-flight extraction holds its own buffers.
Layout-heavy batches are further limited (1 concurrent extraction for
all-PDF-layout batches, 2 for mixed layout):
# Cap at 4 concurrent extractions
xberg batch scans/*.pdf --ocr true --max-concurrent 4
--max-threads additionally caps total internal threads (Rayon, ONNX
intra-op, the batch semaphore) for tightly constrained environments:
xberg batch *.pdf --max-concurrent 2 --max-threads 4
Per-file config overrides
A single shared config does not always fit. --file-configs points at a
JSON file mapping each path to its own override object, merged on top of
the shared config for that file only:
{
"scan.pdf": { "force_ocr": true },
"report.pdf": { "output_format": "markdown" },
"data.xlsx": { "output_format": "json" }
}
xberg batch scan.pdf report.pdf data.xlsx --file-configs overrides.json
Keys are file paths (matching the paths passed on the command line); values are per-file extraction config objects in snake_case, the same shape as a config file.
Output layout
For text/toon output with image extraction, --output-dir controls where
referenced image files (e.g. image_0.png) are written; the directory
must already exist. JSON output embeds image bytes inline and ignores
--output-dir.
mkdir -p out/images
xberg batch slides/*.pptx --extract-images true --output-dir out/images --format text
Error recovery
Batch extraction is fault-tolerant per file: one unreadable or corrupt
document does not stop the rest. Inspect results for partial content and
surfaced errors rather than relying on the process exit code alone. Pair
with --max-concurrent to avoid exhausting memory when a few large files
sit in a big batch.
Shared config
Every extract flag also applies to batch (OCR, chunking, layout,
content format, etc.) and is shared across all files unless a
--file-configs entry overrides it:
xberg batch invoices/*.pdf \
--layout --layout-table-model slanet_wireless \
--content-format markdown --max-concurrent 8
A config file works too and auto-discovers from the cwd upward:
output_format = "markdown"
[ocr]
backend = "tesseract"
language = "eng"
xberg batch corpus/*.pdf --config xberg.toml
Programmatic access
From Python, extract_batch takes a list of ExtractInputs and returns one
envelope whose results array holds a document per input:
from xberg import ExtractInput, extract_batch, ExtractionConfig
config = ExtractionConfig(output_format="markdown")
inputs = [ExtractInput(uri=p) for p in ["a.pdf", "b.docx", "c.xlsx"]]
output = await extract_batch(inputs, config)
for doc in output.results:
print(len(doc.content))
Per-input overrides go on ExtractInput.config (a FileExtractionConfig).
Node.js mirrors this with extractBatch; Rust uses extract_batch(inputs, &config).
See ../../references/python-api.md, ../../references/nodejs-api.md, and
../../references/rust-api.md.
MCP
When the xberg MCP server is registered, prefer the
extract_batch tool over shelling out — it takes an array of inpu
Perguntas frequentes
Um arquivo ruim para a execução inteira?
Não. Falhas em arquivos individuais não interrompem o restante do lote.
Como controlar a carga?
Uma configuração limita quantos arquivos são processados ao mesmo tempo, o que ajuda em computadores com menos memória.
Arquivos diferentes podem usar configurações diferentes?
Sim. A skill menciona uma opção de configurações por arquivo para sobrescrever valores individualmente.
Detalhes
Descrição original do autor
Use when extracting from many files at once with shared config, bounded parallelism, per-file overrides, and error recovery. Covers the `batch` command, `--file-configs`, `--max-concurrent`, and output layout.
repo: xberg-io/xberg
Popularidade
- Estrelas no GitHub
- 9,5 mil
- Posição no ranking
- #12268
- Licença
- MIT
- Atualizada em
- 02/11/2026
Comentários
- …
Mais skills deste repositório
xberg-chunking
9,5 milAjuda seu agente a dividir textos longos de documentos em pedaços menores para prompts de IA ou índices de busca, com tamanhos definidos e sobreposição opcional.
xberg-extracting-keywords
9,5 milAjuda seu agente a extrair as principais palavras-chave ou expressões de um documento e a detectar o idioma dele, usando as configurações de palavras-chave do Xberg.
xberg-extracting-tables
9,5 milAjuda seu agente a extrair tabelas de PDFs, planilhas e imagens, mantendo linhas e colunas íntegras em markdown ou em dados estruturados.
xberg-extracting-with-ocr
9,5 milAjuda seu agente a ler texto de PDFs digitalizados, fotos e imagens sem camada de texto, usando OCR com pacotes de idioma opcionais.
Skills parecidas
feishu-doc
394 milAjuda seu agente a ler, criar e editar documentos na nuvem do Feishu, incluindo textos, imagens e tabelas, usando a ferramenta de documentos.
feishu-drive
394 milPermite que seu agente navegue, organize e comente arquivos de uma pasta na nuvem do Feishu que foi compartilhada com o bot.
feishu-perm
394 milAjuda seu agente a verificar e alterar quem pode acessar um arquivo do Feishu, escolhendo a menor permissão que atende ao seu pedido.