xberg-batch-extraction
하는 일
이 스킬은 폴더나 파일 목록 전체에 문서 추출을 한 번에 실행하는 방법을 보여 줍니다. 문서가 많아서 하나의 결과와 파일별 오류 목록을 함께 받고 싶은 사람을 위한 것입니다.
사용하는 경우
- ✓PDF나 워드 파일이 든 폴더를 한꺼번에 처리해야 할 때.
- ✓모든 파일에 같은 추출 옵션을 적용하고 싶을 때.
- ✓일부 파일이 실패할 수 있지만 나머지 결과는 받고 싶을 때.
스킬 링크
https://github.com/xberg-io/xberg/blob/main/plugin/.ai-rulez/skills/xberg-batch-extraction/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“reports 폴더의 모든 PDF에서 한 번에 텍스트를 추출하고, 실패한 파일이 어떤 것인지 알려 주세요.”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
에이전트는 파일 목록에 배치 명령을 실행하고, 공통 설정을 적용하며, 한 번에 제한된 수만큼 처리합니다. 성공한 결과와 오류를 함께 돌려줍니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 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
자주 묻는 질문
잘못된 파일 하나 때문에 전체 작업이 멈추나요?
아니요. 개별 파일의 실패가 나머지 배치를 멈추지 않습니다.
작업 부하는 어떻게 조절하나요?
한 번에 처리할 파일 수를 제한하는 설정이 있어서, 메모리가 적은 컴퓨터에서 도움이 됩니다.
파일마다 다른 설정을 쓸 수 있나요?
네. 이 스킬은 파일별 재정의를 위한 file-configs 옵션이 있다고 설명합니다.
상세 정보
작성자의 원본 설명
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
인기도
- GitHub 스타
- 9.5k
- 순위
- #12268
- 라이선스
- MIT
- 업데이트
- 2026. 11. 2.
댓글
- …
이 저장소의 다른 스킬
xberg-chunking
9.5k에이전트가 긴 문서 텍스트를 AI 프롬프트나 검색 색인에 맞게 작은 조각으로 나누도록 돕습니다. 크기와 겹침을 정할 수 있습니다.
xberg-extracting-keywords
9.5k에이전트가 문서에서 핵심 키워드나 핵심 구문을 뽑고 문서의 언어를 감지하도록 돕습니다. Xberg의 키워드 설정을 사용합니다.
xberg-extracting-tables
9.5k에이전트가 PDF, 스프레드시트, 이미지에서 표를 뽑고, 행과 열을 유지한 채 마크다운이나 구조화된 데이터로 바꾸도록 돕습니다.
xberg-extracting-with-ocr
9.5k에이전트가 텍스트 층이 없는 스캔 PDF, 사진, 이미지에서 OCR로 글자를 읽도록 돕습니다. 언어 팩을 선택적으로 쓸 수 있습니다.
비슷한 스킬
feishu-doc
394k에이전트가 문서 도구를 사용해 텍스트, 이미지, 표를 포함한 Feishu 클라우드 문서를 읽고, 만들고, 편집하도록 돕습니다.
feishu-drive
394k에이전트가 봇과 공유된 Feishu 클라우드 폴더의 파일을 찾아보고, 정리하고, 댓글을 달도록 돕습니다.
feishu-perm
394k에이전트가 요청을 충족하는 가장 작은 권한을 골라, Feishu 파일에 누가 접근할 수 있는지 확인하고 바꾸도록 돕습니다.