by libnyx
AI-agent skill producing reusable Markdown from PDFs. It turns flowcharts, diagrams, and charts into text beside each caption instead of empty links. It checks an earlier conversion against the PDF and fixes misread or missing parts. Long PDFs run in small saved batches with an independent review pass, each paragraph tagged with its page.
# Add to your Claude Code skills
git clone https://github.com/libnyx/LT2MDLT2MD is an open-source ai agents skill for AI coding assistants such as Claude Code, Codex CLI, and ChatGPT, built by libnyx. AI-agent skill producing reusable Markdown from PDFs. It turns flowcharts, diagrams, and charts into text beside each caption instead of empty links. It checks an earlier conversion against the PDF and fixes misread or missing parts. Long PDFs run in small saved batches with an independent review pass, each paragraph tagged with its page. It has 50 GitHub stars.
LT2MD's catalog security scan is still queued. You can run an instant dependency and prompt-injection check now with the "Scan for vulnerabilities" button above.
Clone the repository with "git clone https://github.com/libnyx/LT2MD" and add it to your Claude Code skills directory (see the Installation section above). LT2MD ships a SKILL.md manifest, so compatible agents can discover and load it automatically.
LT2MD is primarily written in Python. It is open-source under libnyx on GitHub, so you can review or fork the full source.
Yes. SkillsLLM lists many other AI Agents skills you can browse and compare side by side. Open the AI Agents category from the badge at the top of this page, or use the Related Skills and comparison links further down to weigh LT2MD against similar tools.
No comments yet. Be the first to share your thoughts!
Unlocks once the catalog security scan passes (runs nightly).
⚠️ Third-Party Software Notice
This skill is third-party open-source software developed and hosted independently on GitHub. SkillsLLM is an informational directory and does not control or maintain the underlying repository.
Any security checks, ratings, or warnings displayed by SkillsLLM are automated and limited in scope. They do not constitute a security certification or guarantee that the software is safe, error-free, or free from malicious code, vulnerabilities, compromised dependencies, or prompt-injection risks.
Review the source code, permissions, dependencies, and configuration before installing or running any third-party skill. Use is at your own risk. To the maximum extent permitted by applicable law, SkillsLLM is not liable for losses arising from third-party software.
The deep catalog scan for this skill is still queued. Run an instant dependency check now instead.
LT2MD turns observable PDF content into Markdown that an agent or a person can audit later. It is designed for born-digital, scanned, and mixed PDFs. The goal is not merely to obtain text: preserve reading order, formulas, figure meaning, scope boundaries, and a path back to the source page.
The PDF remains the only authority for content. OCR, extracted text, model guesses, and formatting preferences are candidates or transformations, never evidence that can overrule the rendered page.
scripts/manage_job.py.scripts/validate_markdown.py, scripts/audit_markdown.py, and scripts/manage_job.py verify as separate final gates. Do not place OCR, model calls, or PDF interpretation inside the static tools.SOURCE HTML comment on its own line before every complete paragraph, display equation, figure block, table or example block. Do not insert an anchor inside a word, sentence, inline formula, display-math block, table row, caption or image description. A cross-page block uses one physical-page range before the merged block.转录注 with the exact page and ambiguity. Never silently normalize an uncertain value into a familiar one.manage_job.py set-book-page-offset <job> --offset <N>; otherwise retain unmapped rather than guessing. Once recorded, that mapping is source evidence: the batch scaffold's source_print_pages and every SOURCE BOOK_PAGE must follow it, and manager review/checkpoint/finalization rejects contradictions.manage_job.py batch-plan <job> --json after initialization, then visually lower any recommendation that contains formulas, tables, multi-column order, dense figures, poor legibility, or a cross-page semantic block. The raster-only plan is a conservative starting point, not visual proof. Prefer complete paragraphs, sections, or examples as cut points; keep a sentence crossing a page boundary with one transcriber.manage_job.py source-inventory-template, fill only source objects and evidence, then freeze it with manage_job.py seal-source-inventory. Only after that seal may the transcriber use manage_job.py batch-template --author-id <transcriber> to create a fresh, non-overwriting batch-scoped candidate. This order is a hard gate: candidate block IDs, review decisions and candidate text must not be retrofitted into the source inventory. Never copy an unreviewed full-document V1 draft into the batch candidate and mistake a whole-document audit failure for a batch transcription attempt. Separate body text, equations, figures, captions, examples, headers, footers, and scan noise. Preserve literal Markdown backslashes while writing formulas: an escape-interpreting string layer must not turn a formula command into TAB, FF, or another C0 control byte. Merge only print line breaks and cross-page continuation; do not insert a page boundary inside a word, sentence, or LaTeX expression. An existing Markdown draft is an untrusted candidate, not evidence: visually re-check every retained block. If an inventory item has no source-grounded candidate block, leave the batch blocked; do not omit it merely because the candidate lacks an anchor. If a block is left unchanged, preserve page-specific review evidence; if the page cannot be read, stop there rather than calling the unchanged draft complete.manage_job.py reviewer-handoff. The manager, not reviewer-supplied JSON, owns the reviewer actor ID, local security-principal record, candidate digest, and sealed-inventory binding. The default policy is an auditable process handoff: it does not prove subjective independence merely because labels differ. An optional init --review-identity-policy os-security-principal-v1 also requires the reviewer process to use a different local OS security principal from the candidate and source-inventory authoring processes; it still cannot prove distinct people or model contexts. The handoff reviewer re-reads the rendered source and completes mappings against the already sealed source-only inventory. The reviewer may add candidate mappings, dispositions and risk closures, but may not rewrite sealed source facts. The coordinator changes content only after confirming the source. An omitted footnote, caption, heading, or cross-page continuation remains blocking even when static Markdown checks pass.checkpoint-review JSON manifest through manage_job.py checkpoint before starting later pages. Use manage_job.py review-template only after the sealed-inventory-backed candidate passes the static contract and its exact-byte reviewer handoff is recorded; it produces a blocked identity/hash scaffold and does not replace source review. The manager rejects a missing handoff, a stale candidate digest, a forged reviewer label/principal, an indented-code pseudo-anchor, a review block spanning multiple SOURCE blocks, or a structural modification hidden by whitespace normalization. A failed static check, audit, source-inventory mapping, or independent review is a stop condition: repair the same batch or leave it explicitly incomplete; never treat a failure report as permission to continue. If a source object visibly continues to the next physical page before any independent review, do not accept the short batch or anchor a fragment. Use manage_job.py extend-unclosed-source-inventory only to preserve its sealed source facts and exact unclosed candidate while expanding the same-start range to at most six pages; then re-inventory every page, create a fresh candidate, and complete the normal independent review. This extension is blocked evidence, never acceptance, and cannot change a checkpointed range. When a reviewer supplies source-grounded omissions, misreads, ordering defects, or wrong-page anchors, return only that batch and the exact evidence to the transcriber, then obtain a new independent reread—never relabel the old review as accepted. If that review proves the source-only inventory facts themselves are incomplete or wrong, do not mutate the old seal: use manage_job.py source-inventory-revision-template with that independent blocked review, reread and seal the new source-only inventory, then create a fresh replacement candidate for the same range. The manager freezes a SHA-named copy of the blocked candidate and review; the new candidate receipt must bind the new active seal, and verification checks both the forward and backward revision chain. It rejects self-review, stale candidate replay, altered lineage, and unchanged source facts; a blocked review can never become acceptance. For jobs created before frozen-candidate evidence existed, use the strict manage_job.py backfill-revision-evidence <job> --pages <range> migration only when the preserved bytes, hashes, receipt, old seal and blocked review agree exactly. Every 16 accepted physical pages or 4 accepted batches, whichever comes first, actually reread task brief, render manifest, progress, frozen evidence and risk queue, then record the receipt with manage_job.py reread. This longer cadence supplements, rather than replaces, the per-batch evidence checkpoint; a cache-only or partial job must not pass manage_job.py verify.FORMAT_OK or strict FORMAT_CHANGE records. The reviewer must not read the source PDF or change content.--before <snapshot>. All content projections and source-anchor values must remain unchanged.final-review-template, obtain an independent source-page acceptance, then use manage_job.py finalize; verify with manage_job.py verify --require-finalization. If interruption leaves a prepared promotion, do not start another finalization: run manage_job.py recover-finalization <job> and re-verify. Report the final Markdown path, converted range, cache/job identity, validation result and any 转录注. Do not deliver internal candidate drafts unless the user asks for them.Follow the four roles in workflow.md:
转录注.LT2MD itself is a text workflow and does not require a GPU. Its local page renderer uses CPython 3.10+, pypdfium2 and Pillow; these are PDF/image dependencies, not OCR engines. It does not require Tesseract, PaddleOCR, Poppler or another dedicated OCR executable. The actual scan transcription and image-description quality still depends on a host agent with usable visual reading capability. CPU-only execution is allowed, but it may be slower and a host without a usable visual backend cannot promise accurate scan transcription or image descriptions. Do not describe LT2MD as an unconditional guarantee that every computer can complete every PDF.
The final file must be UTF-8 Markdown with the YAML fields, block-level page anchors, LaTeX delimiters, figure-caption/description adjacency, example structure, uncertainty notes, and strict range termination required by markdown-contract.md. It should be self-contained and not depend on external image files unless the user explicitly requests image assets. Cache PNGs remain in the local workspace by default.
The static validator, risk audit and job verifier are separate format/state gates. None proves that the text, equations, or image descriptions are factually correct; that requires the source-grounded visual reviews above.
Before sealing each source inventory, use cached predecessor/successor pages as independent semantic-boundary evidence. They are context only, never automatic output pages: a successor continuation requires bounded expansion while still unsealed; a predecessor continuation blocks the job rather than rewriting any accepted checkpoint. See references/workflow.md and references/job-state.md.
Turn PDFs — long ones, scanned ones, formula- and figure-heavy ones — into reliable Markdown, with every paragraph labeled with the PDF page it came from. It can also repair a Markdown file you converted before.
LT2MD is a skill for AI agents. It does two things. It converts a PDF into Markdown you can reuse and trace back to the source page. And it takes a Markdown file you already converted, but do not fully trust, and checks it against the PDF page by page, re-recognizing anything misread, missing, or out of order.
Long documents are not a problem. Instead of reading everything in one pass, it works in small batches, saves each batch, and has an independent pass check it, so even a few-hundred-page PDF comes out complete and consistent. Figures are not left behind either. The information in flowcharts, diagrams, and charts is read and written as text right next to the caption. No matter how many times that Markdown is read later, the images never have to be sent to a model again. Even a small text-only model is enough.
| Capability | What it means |
|---|---|
| Reliable long-document conversion | Processes in batches; each batch is saved and recoverable, so hundreds of pages stay consistent |
| Images turned into text | The information in flowcharts, diagrams, and charts is written as text next to the caption; reading the Markdown is enough |
| Formulas and complex layouts | Multi-column text, math formulas, and cross-page paragraphs are restored in reading order; no symbol is guessed at |
| A page number on every block | Every paragraph, formula, and figure is labeled with its PDF page, so checking the source is one step away |
| Repair of old Markdown | Import a Markdown file you converted before and check it against the PDF, re-recognizing errors and omissions |
| Lower token cost | Convert carefully once, then answer later questions from the Markdown instead of re-reading the PDF every time |
| Runs on a small model | Correctness comes from the workflow and scripts; the model only needs to understand images, so a small vision model is enough |
| One-line install | Send a link to your agent and it installs itself; works on Windows, Linux, and macOS |
Extracting text from a PDF is not the same as turning a PDF into knowledge you can use.
Ordinary extraction breaks in familiar ways. The left and right columns of a two-column article get merged, formulas are torn apart, figures are left as empty placeholders, and page numbers disappear, so you can no longer tell where a sentence came from. Scanned PDFs are worse, many have no text layer at all and yield nothing. Even when a large model reads the pages directly as images, reading dozens of pages in one go leads to slips. A misread label, arrow, or subscript in a figure may not be obvious until much later.
The bigger problem is repeated reading. If you ask many questions about one PDF, the agent reopens the PDF and re-reads the images every time, which is expensive in tokens. Images are especially costly.
LT2MD converts carefully once and hands back Markdown you can use freely afterward. Body text and formulas are in reading order, every figure has a text description beside it, and every block carries its PDF page number. Next time you read the text directly. A text-only model can do it, it is fast and cheap, and you can still jump back to the source page to confirm.
PDF-to-Markdown errors usually come from a loose process, reading it all at once and letting one pass decide. LT2MD fixes the steps and keeps a checkpoint at each one.
When the source page is not clear, it writes a transcription note with the page and the exact point of doubt instead of silently normalizing it into a familiar character.
Many people already have a folder of Markdown converted from PDFs, produced by other tools or by a quick earlier attempt. Typos, missing figures, broken formulas, and mismatched page numbers make them too risky to trust but too useful to throw away.
LT2MD treats that old Markdown as a candidate, not as fact. It goes back to the PDF and checks it block by block. Where a paragraph does not match the source, it re-recognizes and rewrites it from the page. Correct passages are kept, wrong ones are fixed, missing ones are added, and figures without descriptions get descriptions. Then it runs the same review and validation again. It is a full check-up and rework of the old document.
Every change is made against the source page, not by polishing the text in a vacuum. On delivery it reports which pages were touched and what was wrong, so each correction can be checked.
Option 1, let the agent install it (recommended)
Send this sentence to your agent.
Install this skill for me: https://github.com/libnyx/LT2MD
The agent detects the operating system, installs the dependencies, and places the skill in the correct directory. No manual environment setup.
Option 2, install manually
Clone the repository into the skills directory used by your agent. Pick the path that matches the agent you run.
Windows, using PowerShell.
# Claude Code
git clone https://github.com/libnyx/LT2MD.git $env:USERPROFILE\.claude\skills\LT2MD
# Codex
git clone https://github.com/libnyx/LT2MD.git $env:USERPROFILE\.codex\skills\LT2MD
macOS and Linux.
# Claude Code
git clone https://github.com/libnyx/LT2MD.git ~/.claude/skills/LT2MD
# Codex
git clone https://github.com/libnyx/LT2MD.git ~/.codex/skills/LT2MD
The only dependencies are Python and two page-rendering libraries (pypdfium2 and Pillow), which render PDF pages to images. They are not OCR engines. There is no need to install Tesseract or any other dedicated OCR software; it works once cloned.
To convert a PDF to Markdown, you can tell the agent something like this.
Use LT2MD to convert pages 12 through 18 of this scanned PDF to Markdown. Keep the formulas, write an image description next to every figure, label each block with its PDF page number, add a transcription note where anything is unclear, and run the validator when done.
To repair an existing Markdown file.
Use LT2MD to check this converted Markdown against the PDF. Re-recognize any paragraph that is wrong or missing, verify formulas and figures against the source, and tell me what you changed when you finish.
After a conversion or repair, check the handled range, the validation result, and the transcription notes before using the Markdown as a knowledge source.
Each block is preceded by a source comment with its PDF page number.
<!-- SOURCE: PDF_PAGE 29 | BOOK_PAGE 13 | FIGURE 2.1 -->
**Figure 2.1. Original caption from the page.**
> **Image description (transcriber supplement, not original text):** the objects, labels, arrow directions, subfigures, and the relationships directly shown in the figure, with no conclusions added beyond the source.
The figure's information sits right beside its caption. A text-only model can read it without ever opening the image file.