xberg-batch-extraction
Qué hace
Esta habilidad muestra cómo ejecutar la extracción de documentos sobre una carpeta o una lista de archivos en una sola pasada. Está pensada para personas con muchos documentos que quieren un único resultado, con los errores de cada archivo listados por separado.
Cuándo usarla
- ✓Cuando tienes una carpeta de PDF o de archivos de Word para procesar juntos.
- ✓Cuando quieres aplicar un mismo conjunto de opciones de extracción a todos los archivos.
- ✓Cuando algunos archivos pueden fallar y aun así quieres los resultados de los demás.
Link de la skill
https://github.com/xberg-io/xberg/blob/main/plugin/.ai-rulez/skills/xberg-batch-extraction/SKILL.mdCópialo y pégalo en tu IA (Claude, ChatGPT o Cursor) pidiéndole que siga las instrucciones.
Cómo usar
La forma más fácil: copia el mensaje y pégalo en tu IA. Ella lee la skill y sigue las instrucciones.
Mensaje listo para pegar
Para Claude Code, Codex o Cursor: ejecútalo en la carpeta del proyecto y la skill queda instalada.
Descarga el SKILL.md y ponlo en la carpeta de skills de tu agente.
Ejemplo de qué pedirle a la IA
“Extrae el texto de todos los PDF de mi carpeta de informes en una sola ejecución y dime qué archivos han fallado.”
5 skills nuevas por semana. 1 minuto de lectura.
Cómo funciona
El agente ejecuta el comando por lotes sobre tu lista de archivos, aplica los ajustes compartidos, procesa un número limitado de archivos a la vez y devuelve los resultados correctos junto con los errores.
Contenido técnico (SKILL.md original)
Texto original del autor, en inglés, directo de 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
Preguntas frecuentes
¿Un archivo defectuoso detiene toda la ejecución?
No. Los fallos en archivos individuales no detienen el resto del lote.
¿Cómo controlo la carga?
Un ajuste limita cuántos archivos se procesan a la vez, lo que ayuda en equipos con menos memoria.
¿Pueden usar archivos distintos ajustes distintos?
Sí. La habilidad menciona una opción de configuraciones por archivo para sobrescribir ajustes en casos concretos.
Detalles
Descripción original del 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
Popularidad
- Estrellas en GitHub
- 9,5 mil
- Posición en el ranking
- #12268
- Licencia
- MIT
- Actualizada
- 2/11/2026
Comentarios
- …
Más skills de este repositorio
xberg-chunking
9,5 milAyuda a tu agente a dividir textos largos de documentos en fragmentos más pequeños para prompts de IA o índices de búsqueda, con tamaños fijados y solapamiento opcional.
xberg-extracting-keywords
9,5 milAyuda a tu agente a extraer las palabras clave o frases clave principales de un documento y a detectar su idioma, usando los ajustes de palabras clave de Xberg.
xberg-extracting-tables
9,5 milAyuda a tu agente a extraer tablas de PDF, hojas de cálculo e imágenes, manteniendo intactas las filas y columnas como Markdown o datos estructurados.
xberg-extracting-with-ocr
9,5 milAyuda a tu agente a leer texto de PDF escaneados, fotos e imágenes que no tienen capa de texto, usando OCR con paquetes de idiomas opcionales.
Skills parecidas
feishu-doc
394 milAyuda a tu agente a leer, crear y editar documentos en la nube de Feishu, incluidos texto, imágenes y tablas, usando la herramienta de documentos.
feishu-drive
394 milPermite que tu agente explore, organice y comente archivos de una carpeta de la nube de Feishu que se haya compartido con el bot.
feishu-perm
394 milAyuda a tu agente a revisar y cambiar quién puede acceder a un archivo de Feishu, eligiendo el permiso más pequeño que cumpla tu petición.