Logo: Z Smart Xparse

Z Smart Xparse

Communautéit
tjxj
z-smart-xparse

Parse documents into clean markdown or structured JSON via xparse-cli, with smart PDF auto-split and merge. Use this skill when the user provides a PDF, image, Office file, HTML, OFD, or other supported document and wants it read, converted, summarized, or prepared for downstream agent use. For PDF files, automatically detects files larger than 5 MB or documents longer than 100 pages and splits them into manageable chunks, parses each chunk, then merges results into a single coherent output. Handles encrypted PDFs, page ranges, markdown/text output, and detailed structured extraction.

Iwwersiicht

Editeurtjxj
Repositoryz-skills
Skill-Nummz-smart-xparse
Stären
548
Forks
102
Matgeliwwert Dateien
4
Linken
  • Instruktiounen am Markdown-Format

    Eng SKILL.md-Datei, déi de Modell bei Bedarf luet, soudatt nëmmen Token ufalen, wann eng Ufro tatsächlech dozou passt.

  • Funktionéiert mat all LLM

    KI-Skills si reng Markdown, keen ubidderspezifesche Code. Dofir funktionéiert dëse Skill mat GPT, Claude, Gemini, Grok oder engem lokale Modell.

  • 4 matgeliwwert Dateien

    Skripten, Virlagen a Referenzen, déi de Modell beim Schaffe liese kann. D'Dateie kënnen nëmme gelies ginn a ginn ni ausgeféiert.

  • Open Source

    tjxj huet de Skill op GitHub verëffentlecht. Liest de Quelltext, ier Dir de Skill installéiert.

Installatioun

Installéiert de KI-Skill Z Smart Xparse an TypingMind, fir e mat all LLM ze benotzen, oder setzt en an en anere KI-Agent an, deen SKILL.md liest.

1

An TypingMind installéieren

TypingMind installéiert e Skill direkt aus sengem GitHub-Dossier — dobäi gëtt SKILL.md gelies, d'Ressourcedateie gi gebëndelt an d'Resultat gëtt lokal gespäichert.

  1. Maacht d'App op a gitt op Plugins → Skills.
  2. Wielt „Vu GitHub installéieren“.
  3. Pecht d'URL vum Skill-Dossier, déi hei drënner steet, an a bestätegt d'Installatioun.
    https://github.com/tjxj/z-skills/tree/main/z-smart-xparse
  4. Aktivéiert de Skill an all Chat, an deem Dir e benotze wëllt.
Plugins → Skills → Skill derbäisetzen → Iwwer eng GitHub-URL. Pecht dann d'URL vum Dossier an a klickt op Weider.
2

An engem anere KI-Agent installéieren

All KI-Agent, deen d'Format Agent Skills liest, kann dëse Skill benotzen — kopéiert den Dossier an d'Skill-Verzeechnes vun deem KI-Agent.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/tjxj/z-skills.git /tmp/z-skills
mkdir -p .claude/skills
cp -r /tmp/z-skills/z-smart-xparse .claude/skills/z-smart-xparse
Start Claude Code nom Kopéieren nei, fir datt den neie Skill erkannt gëtt.

An TypingMind benotzen

Aktivéiert Z Smart Xparse an engem Chat vun TypingMind, an de Modell iwwerhëlt de Rescht. Den Numm an d'Beschreiwung stinn am System-Prompt. Soubal eng Ufro dozou passt, luet de Modell déi komplett Instruktioune selwer — Dir musst de Skill ni manuell opruffen, an et fale keng Token un, bis en tatsächlech benotzt gëtt.

De Modell luet Z Smart Xparse automatesch, soubal eng Ufro dozou passt.

Funktionéiert mat all KI-Modell

KI-Skills si reng Markdown-Instruktiounen amplaz vun ubidderspezifeschem Code. Dofir ass Z Smart Xparse net un de Modell gebonnen, fir deen de Skill geschriwwe gouf. Installéiert en eemol an TypingMind a benotzt e mat GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama oder engem lokale Modell, deen Dir selwer bedreift — alles mat Ären eegenen API-Schlësselen.

  • Gëtt nëmme gelueden, wann et néideg ass

    De System-Prompt enthält nëmmen den Numm an d'Beschreiwung. D'Instruktioune gi bei der éischter passender Ufro gelueden, soudatt en onbenotzte Skill näischt kascht.

  • De Modell am lafende Chat wiesselen

    Well de Skill aus Instruktiounen amplaz vu Code besteet, funktionéiert en och no engem Modellwiessel — den nächste Modell liest déi selwecht SKILL.md-Datei.

Skill-Instruktiounen

Dëst ass den Inhalt vu SKILL.md, deen de Modell luet. Liest e virun der Installatioun — e Skill besteet aus Instruktiounen, déi Äre Modell befollegt.

z-smart-xparse

Overview

An enhanced document parsing skill with smart PDF auto-split and merge. For non-PDF files, behaves identically to the standard xparse-parse skill. For PDF files, automatically checks file size and page count before parsing — large or long PDFs are split into chunks, parsed individually, then merged into a single result.

Compatibility

Requires the xparse-cli binary. Free API supports PDF and images with zero config; paid API unlocks additional formats (Doc(x)/Ppt(x)/Xls(x)/HTML/OFD/RTF, etc.) and requires paid credentials configured via xparse-cli auth (recommended), or XPARSE_APP_ID/XPARSE_SECRET_CODE env vars. For PDF splitting, requires qpdf or Python 3 with pypdf installed.

Use the parse CLI first. Read the result before requesting any more detail.

Routing Rules

  • For local document tasks, try z-smart-xparse before Python, PDF libraries, OCR tools, or custom scripts.
  • Do not start with Python, PyMuPDF, PyPDF, qpdf, OCR MCP, or image conversion unless z-smart-xparse has already failed or the task clearly exceeds its scope.
  • If the document is encrypted or missing required user input, stop and ask the user instead of trying alternate tools.
  • If the default parse result is sufficient, stop. Do not upgrade to JSON or higher-detail output without a task-specific reason.
  • Only fall back to OCR, image analysis, or custom scripting after you have clearly determined that z-smart-xparse cannot complete the requested task by itself.

Setup

xparse-cli

Check if installed: xparse-cli version

If command not found after install, try the absolute path: ~/.local/bin/xparse-cli version

Update to latest version: xparse-cli update

If available, skip to Quick start below. If not found, install:

PlatformCommand
Linux / macOSsource <(curl -fsSL https://dllf.intsig.net/download/2026/Solution/xparse-cli/install.sh)
Windows (PowerShell)irm https://dllf.intsig.net/download/2026/Solution/xparse-cli/install.ps1 | iex

PDF Splitting Dependencies (only needed for large PDFs)

Check if qpdf is installed: qpdf --version

If not found, install:

PlatformCommand
macOSbrew install qpdf
Linuxsudo apt install qpdf or sudo yum install qpdf

Alternatively, Python 3 with pypdf works: pip install pypdf

Quick Start

Zero config — free API, no registration needed. Supports PDF and images only.

bash
# Non-PDF or small PDF: parse directly
xparse-cli parse report.pdf                         # Markdown → stdout

# Large PDF: skill auto-detects and handles splitting (see Smart PDF Parsing below)

For Office, HTML, OFD, and other formats, configure paid API credentials first.

Smart PDF Parsing (Auto-Split & Merge)

This is the core enhancement over the standard xparse-parse skill. Only applies to PDF files. All other file types skip directly to Step 5.

Step 1: Detect — Check File Size and Page Count

bash
# Get file size in bytes
FILE_SIZE=$(stat -f%z "input.pdf" 2>/dev/null || stat -c%s "input.pdf" 2>/dev/null)

# Get page count using qpdf
PAGE_COUNT=$(qpdf --show-npages "input.pdf" 2>/dev/null)

# Fallback: use Python if qpdf is unavailable
PAGE_COUNT=$(python3 -c "from pypdf import PdfReader; print(len(PdfReader('input.pdf').pages))" 2>/dev/null)

Step 2: Decide — Determine if Splitting is Needed

NEED_SPLIT = false
CHUNK_SIZE = 50   # pages per chunk (safe for free API limit of 50 pages/request)

IF file_size > 5242880 (5 MB):
    NEED_SPLIT = true

IF page_count > 100:
    NEED_SPLIT = true

IF page_count is unknown AND file_size > 5242880:
    NEED_SPLIT = true

Thresholds:

ConditionAction
≤ 5 MB AND ≤ 100 pagesParse directly with xparse-cli parse (no splitting)
> 5 MB OR > 100 pagesSplit into chunks, parse each, then merge

Chunk sizing:

  • Default: 50 pages per chunk (safe for both free and paid API)
  • If paid API is configured: can increase to 200 pages per chunk for efficiency
  • If file is > 5 MB but ≤ 100 pages: split by file size (~4MB per chunk) using page estimation

Step 3: Split — Extract PDF Chunks

Option A: Using qpdf (preferred)

bash
# Create temp directory for chunks
mkdir -p /tmp/xparse-chunks

# Split into chunks of CHUNK_SIZE pages
# Example: 150-page PDF with CHUNK_SIZE=50 → 3 chunks
qpdf input.pdf --pages . 1-50   -- /tmp/xparse-chunks/chunk_001.pdf
qpdf input.pdf --pages . 51-100 -- /tmp/xparse-chunks/chunk_002.pdf
qpdf input.pdf --pages . 101-150 -- /tmp/xparse-chunks/chunk_003.pdf

Option B: Using Python pypdf

python
from pypdf import PdfReader, PdfWriter
import math, os

reader = PdfReader("input.pdf")
chunk_size = 50
total = len(reader.pages)
out_dir = "/tmp/xparse-chunks"
os.makedirs(out_dir, exist_ok=True)

for i in range(0, total, chunk_size):
    writer = PdfWriter()
    for page in reader.pages[i:i+chunk_size]:
        writer.add_page(page)
    chunk_path = os.path.join(out_dir, f"chunk_{i//chunk_size+1:03d}.pdf")
    with open(chunk_path, "wb") as f:
        writer.write(f)

For size-based splitting (>5 MB but ≤100 pages):

Estimate pages per chunk: pages_per_chunk = floor(total_pages * 4MB / file_size_MB)

Then split using the same methods above.

Step 4: Parse & Merge

Parse each chunk sequentially:

bash
# Parse chunk 1 → save markdown
xparse-cli parse /tmp/xparse-chunks/chunk_001.pdf --output /tmp/xparse-chunks/chunk_001.md

# Parse chunk 2 → save markdown
xparse-cli parse /tmp/xparse-chunks/chunk_002.pdf --output /tmp/xparse-chunks/chunk_002.md

# Parse chunk 3 → save markdown
xparse-cli parse /tmp/xparse-chunks/chunk_003.pdf --output /tmp/xparse-chunks/chunk_003.md

Run parse requests serially. Do not start another until the previous result has been inspected. Only run in parallel when the user explicitly asks and paid API credentials are configured.

Merge results into a single file:

bash
# Merge all chunk markdown files into one
cat /tmp/xparse-chunks/chunk_*.md > /tmp/xparse-chunks/merged_output.md

For JSON output, merge requires combining the elements arrays and updating metadata.page_count:

python
import json, glob

chunks = sorted(glob.glob("/tmp/xparse-chunks/chunk_*.json"))
merged = {"code": 200, "message": "success", "data": {"elements": [], "markdown": ""}}

for chunk_file in chunks:
    with open(chunk_file) as f:
        chunk = json.load(f)
    merged["data"]["elements"].extend(chunk["data"]["elements"])
    merged["data"]["markdown"] += chunk["data"]["markdown"] + "\n"

with open("/tmp/xparse-chunks/merged_output.json", "w") as f:
    json.dump(merged, f, ensure_ascii=False, indent=2)

Cleanup:

bash
rm -rf /tmp/xparse-chunks

Step 5: Non-PDF Files — Parse Directly

For all non-PDF file types (images, Office, HTML, OFD, etc.), parse directly without any splitting:

bash
xparse-cli parse <FILE>

No size or page checking needed. Proceed with the standard workflow.

Quick Reference

GoalCommand
Parse small PDF / imagexparse-cli parse <FILE>
Parse large PDF (auto-split)Follow Steps 1-4 above
JSON outputxparse-cli parse <FILE> --view json
Save markdownxparse-cli parse <FILE> --view markdown --output <DIR|FILE>
Save JSONxparse-cli parse <FILE> --view json --output <DIR|FILE>
Page rangexparse-cli parse <FILE> --page-range 1-5
Encrypted docxparse-cli parse <FILE> --password <PWD>
Character detailsxparse-cli parse <FILE> --view json --output <DIR|FILE> --include-char-details

--output <DIR> auto-generates <basename>.md or <basename>.json; --output <FILE> writes directly.

Default Path

  1. Detect file type — is it a PDF?
  2. If PDF: check file size and page count (Step 1)
  3. If needs splitting: split → parse chunks → merge (Steps 2-4)
  4. If no splitting needed: parse directly with xparse-cli parse <FILE>
  5. If non-PDF: parse directly with xparse-cli parse <FILE>
  6. Read the markdown result
  7. If the task needs more structure, then and only then upgrade to JSON
  8. If required input is missing, stop and ask the user
  9. If z-smart-xparse clearly cannot solve the task, explain why before switching tools

When to Stop

Stop and ask the user if:

  • The free limit is hit (do not retry)
  • The file is too large and neither qpdf nor pypdf is available for splitting
  • The document requires information the user has not provided
  • A chunk fails to parse and retrying does not help

If the error looks temporary, retry once at most. Never silently skip a failed parse.

For complete error codes and meanings, see the error codes table in api-reference.md.

Splitting Failure Handling

SituationAction
qpdf not installed and pypdf not availableInstall one: brew install qpdf or pip install pypdf
qpdf fails to split (corrupted PDF)Try Python pypdf as fallback
A chunk parse failsRetry that chunk once; if still fails, stop and report which chunk failed
Merge produces garbled outputCheck individual chunk outputs, identify the problematic chunk

Learn More

Detailed references in skill directory:

Matgeliwwert Dateien

De Modell liest dës Dateie bei Bedarf, wärend de Skill gelueden ass. Si ginn als liesbar Dateie bereetgestallt a ginn ni ausgeféiert.

Heefeg gestallte Froen

Wat mécht de KI-Skill Z Smart Xparse?

Parse documents into clean markdown or structured JSON via xparse-cli, with smart PDF auto-split and merge. Use this skill when the user provides a PDF, image, Office file, HTML, OFD, or other supported document and wants it read, converted, summarized, or prepared for downstream agent use. For PDF files, automatically detects files larger than 5 MB or documents longer than 100 pages and splits them into manageable chunks, parses each chunk, then merges results into a single coherent output. Handles encrypted PDFs, page ranges, markdown/text output, and detailed structured extraction.

Firwat Z Smart Xparse op TypingMind benotzen?

Well Dir en eemol installéiert a mat all Modell benotze kënnt. Z Smart Xparse besteet aus einfachem Markdown amplaz vun ubidderspezifeschem Code. Dee selwechte Skill funktionéiert also mat GPT-5, Claude, Gemini, Grok oder engem lokale Modell – an Dir kënnt de Modell matzen am Chat wiesselen, ouni datt de Skill ophält ze funktionéieren. TypingMind benotzt Är eegen API-Schlësselen, sou datt Dir d'Ubidder direkt bezuelt, amplaz en Abonnement pro Benotzerplaz ze bezuelen. Är Skills a Chats bleiwen an Ärem eegene Späicher.

Wéi installéieren ech Z Smart Xparse an TypingMind?

Maacht an TypingMind Plugins → Skills → Vu GitHub installéieren op a setzt https://github.com/tjxj/z-skills/tree/main/z-smart-xparse an. TypingMind liest d'Datei SKILL.md, bëndelt déi zougehéiereg Dateien an installéiert dat Ganzt als Skill, deen Dir pro Chat aktivéiere kënnt.

Wéi eng KI-Modeller kënnen Z Smart Xparse benotzen?

All Modell, deen Dir an TypingMind verbënnt. KI-Skills sinn einfach Markdown-Instruktiounen an net ubidderspezifesche Code. Dofir kënne GPT, Claude, Gemini, Grok a lokal Modeller dëse Skill lueden, wann eng Ufro dozou passt.

Wéi vill KI-Modeller kann ech mat Z Smart Xparse benotzen?

Esou vill wéi Dir wëllt. Soulaang e Modell Skills ënnerstëtzt, kënnt Dir Z Smart Xparse domat benotzen – zum Beispill mat GPT, Claude, Gemini, Grok, DeepSeek, Mistral oder Llama – alles op TypingMind mat Ären eegenen API-Schlësselen.

Ass de KI-Skill Z Smart Xparse gratis?

tjxj huet de Skill op GitHub publizéiert. Kuckt am Repository no de Lizenzbedéngungen. Dir bezuelt nëmmen Ären eegene KI-Ubidder fir d'Token, déi Dir benotzt.

Wat si KI-Skills?

E KI-Skill ass e weiderverwendbare Pak vun Instruktiounen, deen engem KI-Modell bäibréngt, wéi en eng bestëmmt Aufgab erfëllt. E follegt dem oppenen Agent Skills-Format: eng Datei SKILL.md mat engem Numm an enger Beschreiwung, plus all Scripten, Virlagen oder Referenzdateien, déi de Modell eventuell brauch. De Modell liest d'Instruktiounen eréischt, wann Är Ufro zum Skill passt. En installéierte Skill kascht also näischt, bis e benotzt gëtt.

Wéi ënnerscheede sech KI-Skills vu Plugins oder MCP-Serveren?

E Plugin oder MCP-Server gëtt engem Modell nei Tools, déi en opruffe kann – Code, deen iergendwou leeft an e Resultat zeréckgëtt. E KI-Skill gëtt dem Modell dogéint Wëssen an eng Virgoensweis: wéi en eng Aufgab ugeet, wéi eng Schrëtt e maache soll a wéi eng gutt Ausgab ausgesäit. Skills bestinn aus einfachem Markdown, brauche kee Server, keen API-Schlëssel a kee Lafzäitëmfeld a funktionéiere mat all Modell.

Alleguer weisen

Elo Ären eegene KI-Aarbechtsberäich ariichten

Abonnéiert Iech op eisen Newsletter, fir iwwer nei Funktiounen an zukünfteg Gewënnspiller informéiert ze ginn 👇