skills/odl-pdf/SKILL.md
This skill is not a catalogue of ODL's current options. It is a procedure for reading the interface the currently-installed ODL exposes, solving the user's problem with it, verifying the result, and avoiding the silent failures that interface does not reveal. Option names, values, and defaults change between releases, so this skill never spells them — it teaches you to discover them at runtime and interpret them. It is written for any AI agent.
Help a user extract data from PDFs with ODL correctly: translate their goal into a capability, discover the option that expresses it from the installed tool, run the minimal command, verify the extraction against their intent, and diagnose failures. The single fact that motivates every step: a zero exit code does not mean the extraction succeeded. Command success and extraction success are different things, and several ODL behaviors return a clean exit while silently dropping what the user asked for. Guarding against that is this skill's core job.
The installed tool describes itself. Before you build any command, read the
installed help — invoke the tool with --help (or -h), and read the
companion help of any separate server or backend component the task needs. That
output is the authority for this environment: the options it lists, the values
it accepts, and the defaults it names are what will actually run.
Authority order, when sources disagree:
--help / -h — the truth for the user's version. Always wins.Probe when help is insufficient. --help is a syntax reference; it may not
say whether an option operates (a backend flag can be listed while no backend
is running) or how two options interact. When help does not settle it, run a
small safe probe — a tiny input, a throwaway output directory, a reachability
check — observe the real result, and confirm from that. Never assert behavior you
have not either read in help or observed in a probe.
Reading this skill's own files. Every references/… and scripts/… path in
this skill resolves against the directory containing this SKILL.md, not your
current working directory. Your harness exposes that base directory; resolve
siblings from there. If a path does not resolve, locate this SKILL.md's directory
and read the sibling from there — do not skip a reference or invent its contents.
This is the procedure, shown once end-to-end. It uses a placeholder
convention for anything version-specific: <the … option help lists> means
"the option you find in the installed help that provides this capability" — you
resolve the real name at runtime, you do not type the placeholder.
Goal → capability. Restate the user's ask as a capability the tool might provide, not as a flag. Common capabilities: choose an output format; select a processing mode (in-tool vs. an AI/OCR backend); enable OCR for scanned pages; control table handling; select pages; choose an output destination; stream to stdout. Example: "I need citations back to page and region" → capability = an output format that carries position metadata.
Search the installed help for the item that expresses that capability. Read the help text; find the option whose description matches the capability. Note its exact name and the values it documents — from the help, not memory.
Confirm values and defaults from help. If the option takes a value, read which values the help lists and what the default is. If the default already does what the user wants, you may not need the option at all.
Build the minimal command. Start with the simplest thing that can satisfy the goal — the fewest options, the least-complex mode. Prefer the in-tool local path before invoking any AI/OCR backend; add complexity only when a verified result shows it is needed. Shape:
opendataloader-pdf <input> <the output-format option help lists> <the output-destination option> <the quiet/no-log option>
Fill each placeholder with the real name you read in step 2.
VERIFY (next section) — never stop at the exit code.
Expand one step if insufficient. If verification shows the goal is not met, add exactly one capability (e.g. escalate table handling, or move to the AI/OCR backend), re-run, and verify again. One change at a time keeps cause and effect legible. Loop back to step 2 for each new capability.
Work down this ladder; stop at the first rung that lets you proceed honestly.
Each is a way ODL can return a clean exit while dropping what the user asked
for. The installed --help may name the mechanism — some of these are even
described in an option's own help text — but it never names the silent-failure
consequence, and a casual probe looks fine because the trap succeeds silently.
So the durable discipline is: when your intent touches one of these, VERIFY the
specific consequence regardless of what help says. Carry them as principles;
confirm the current option names from help when you act on one.
Enrichment can be silently skipped unless the document is fully routed to the AI backend. Requesting an enrichment (formula, figure description, etc.) is not enough: in a mixed/auto routing mode, pages the tool judges "simple" stay on the local path and never reach the backend, so the enrichment quietly does not happen — no error. To get enrichment on the whole document, route the whole document to the backend, and then VERIFY the enriched content is present.
A fallback can preserve completion while dropping requested quality. If the backend errors, ODL may fall back to the local path and still produce an output file — so the run "succeeds," but the OCR or enrichment you required did not occur. When those are mandatory, verify them explicitly; do not trust the file's existence or the zero exit.
Some structured outputs never stream to stdout. Certain output kinds are only ever written to files; asking to stream them yields an empty stdout on a zero exit. A zero exit with an empty pipe is not success. Route such outputs through a file and read the file (or pipe the parsed result of the file).
A structure-tagged input path can pre-empt the AI backend. When the source already carries a usable structure tree and you also request the backend, the tool may honor the existing structure and not call the backend (often with only a warning). If you specifically want backend processing, do not also force the structure-tree path; if you want author-intended structure, keep it — but know only one of them runs.
A parser/preprocessing crash happens before page handling. A malformed font or parse failure aborts before any page-level mode or OCR decision, so switching mode, selecting pages, or enabling OCR cannot bypass it — they operate at a later stage the run never reaches. Treat it as a file-specific upstream defect: report the file and the stack to the maintainers; as a workaround, repair/flatten or rasterize the file with another tool and re-run. For a single (non-batch) file this yields zero output — report it honestly rather than cycling other modes.
Verification has two parts, and both are required:
The exit code is necessary, not sufficient. A zero exit can accompany empty or wrong output; a non-zero exit in a batch can still have produced valid outputs for some inputs. So always also inspect the actual artifacts.
Verify the goal-specific thing a silent trap would fake. Check the one thing that would be missing if the matching hazard above had fired — not a generic "a file exists":
A result like "JSON has image nodes but no text" is a failure only when text was
expected — for an image-extraction goal it can be correct. Verify against what
the user actually asked for. The bundled scripts/verify-json.py summarizes an
output file's element types safely, which is more robust than hand-written
parsing. If a backend/OCR path was used, also confirm the backend was reachable
before the run (see scripts/hybrid-health.sh) so a "success" is not really a
silent fallback. Any failed check → DIAGNOSE.
Start from the observed symptom; for each, the loop is the same: observe → look up the relevant option in the installed help → make one small re-run → verify. Escalate least-invasive first, one change at a time.
No output, or far too little. Is the source scanned/image-only (text
expected but only image nodes present)? → find and enable the OCR capability in
help, set the document language if the help exposes a language option, route the
whole document to the backend, re-run, verify text is present. Was a backend
mode selected but output unchanged? → the backend is likely unreachable
(scripts/hybrid-health.sh) or the address is wrong. Did a stream come back
empty? → recall structured outputs may not stream; write to a file instead. Do
not conclude "malformed PDF" without evidence.
Output present but weak quality (tables mangled, reading order off, garbled text). → escalate one capability at a time: a stronger table-handling value from help, then the AI backend, then full backend routing; for reading order, a structure-tree option if the source is tagged; for garbled text on a scanned source, an OCR path. Inspect with an annotated/diagnostic output kind if help offers one. Re-run and verify after each single change.
Command failed or aborted — determine which stage first. Re-run without the quiet/no-log option so the real cause is visible (quiet mode hides it), then read stderr and the output directory, and locate the stage: (a) before processing — an invalid option, a missing input, or a runtime/prerequisite problem; (b) opening the file — wrong/missing password, corruption, or a parser/preprocessing crash (the crash-before-page-handling hazard: mode/OCR cannot bypass it); (c) during a backend request — backend unreachable, timeout, or wrong address (this is post-preprocessing and is backend-related; fix the server, do not conclude "OCR won't help"). Match the fix to the stage.
Batch partially succeeded. A non-zero exit on a multi-file run is the aggregate; valid outputs for other files may already exist. Inspect the output directory for what was produced before re-running anything, and re-process only the files that actually failed.
External service unreachable. When a backend/OCR path is in play, pre-flight
reachability before blaming extraction (scripts/hybrid-health.sh reports a
reachable/stopped/error state; branch on it). Reachability confirms only that the
endpoint answers — not that the OCR engine or enrichment model is operational,
which the post-run VERIFY checks.
Deeper quality analysis: references/eval-metrics.md and
python scripts/quick-eval.py <output> <reference> (a rough text-similarity
check, not a structure metric; scripts/ resolves against this skill's
directory, not your CWD — see "Reading this skill's own files" above).
Division of labor: the AI gathers, analyzes, and drafts; the human holds decision and action authority for anything consequential, irreversible, or outward-facing. Concretely:
127.0.0.1,
not to all interfaces (0.0.0.0), unless the user explicitly needs network
access and has access controls — the server is unauthenticated.'<PDF_PASSWORD>'), never a real value, in any command, code
block, log, or persisted/shared text. A secret on a command line is visible in
shell history and process listings, so hand the user the placeholder command to
run themselves rather than auto-running it.Progressive disclosure — do not read these upfront.
| File / script | Read or run when |
|---|---|
references/installation-matrix.md | installing / prerequisites for an environment |
references/option-interactions.md | how capabilities interact and silently change behavior |
references/hybrid-guide.md | when to use an AI/OCR backend + how to set one up |
references/format-guide.md | which output capability fits which downstream use |
references/integration-examples.md | code for CLI/Python/Node/LangChain/Java + RAG handoff |
references/eval-metrics.md | judging the quality of a bad extraction |
scripts/detect-env.sh | detect the environment before installing/running |
scripts/hybrid-health.sh | confirm a backend server is reachable |
scripts/verify-json.py | summarize a JSON output's element types safely |
scripts/quick-eval.py | rough text-similarity check against a reference file |