# PDF to Markdown First

> Efficiently convert PDF and Office docs to Markdown to save tokens and improve data extraction.

PDF to Markdown First is a free AI agent skill on Agensi by Mudabbir | مُدبِّر, in LLM Ops. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: Free
- Creator: [Mudabbir | مُدبِّر](https://www.agensi.io/creators/mudabbirai)
- Category: [LLM Ops](https://www.agensi.io/skills/llm-ops)
- Version: 1.0
- Last updated: 2026-11-28
- Security: scan passed (2026-11-28); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/pdf-to-markdown-first
- Tags: llm-ops, python, pdf-parsing, token-optimization, markdown

## About this skill

Raw PDF and Office document parsing often eats through token budgets or fails to capture structured data accurately. This skill forces a Markdown-first workflow using Microsoft's MarkItDown to convert files before processing, significantly reducing context window bloat.

### What it does
- **Automated conversion** converts PDF, DOCX, XLSX, and PPTX files into clean Markdown format.
- **Token optimization** reduces context usage by reading specific line ranges instead of dumping entire files.
- **Smart inspection** checks file size and character counts to determine the most efficient reading strategy.
- **OCR detection** identifies scanned documents that lack text and automatically switches to image-based reading.
- **Search indexing** uses grep-based searching to locate relevant sections before extracting data.

### How it works
1. **Environment check** verifies or installs the `markitdown` library within the current session environment.
2. **Local staging** creates a dedicated directory and generates a Markdown replica without altering the original document.
3. **Volume analysis** measures line and character counts to choose between full-file reading or chunked extraction.
4. **Targeted retrieval** employs offset-limited reading or keyword searches to pull only high-relevance data into the prompt.

### Frameworks & tools
This skill utilizes the `markitdown` Python library and standard shell utilities like `grep`, `wc`, and `pip`. It is designed for environments with terminal access.

### Why this beats prompting it yourself
Standard agents often default to reading every page as an image or pasting massive text blocks, leading to high latency and cost. This skill implements a programmatic strategy to ensure you only pay for the tokens you actually need while maintaining document structure.

### Use cases
- Extracting specific clauses from long legal contracts without reading the whole file.
- Summarizing multi-page PowerPoint presentations into bulleted text.
- Searching for specific line items across large Excel spreadsheets.
- Converting legacy PDF manuals into searchable developer documentation.

### Known limitations
Complex financial tables or bank statements may require manual verification against the original file to ensure column alignment. Scanned images with no text layer require image-based reading.

---
Free and open source (Apache-2.0) by Mudabbir | مُدبِّر.

## How to use this skill

1. Connect your AI agent to Agensi once: add the MCP server https://mcp.agensi.io/mcp/auth and sign in with your Agensi account (OAuth, no API key). Steps for Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and other agents: https://www.agensi.io/docs/mcp-setup
2. Ask your agent: "Use the PDF to Markdown First skill from Agensi" and describe your task.
3. Your agent loads the skill from Agensi when it needs it. Nothing is downloaded.

## Frequently asked questions

### How exactly does this skill help me save on LLM token costs?

This skill converts PDF and Office files into Markdown using Microsoft's MarkItDown library, allowing you to extract specific line ranges or search for keywords rather than dumping the entire document into your context window.

### Which file formats are supported for Markdown conversion?

The skill supports a wide range of common productivity formats, including PDF, DOCX, XLSX, and PPTX, ensuring your agent can handle everything from slide decks to complex spreadsheets.

### What are the technical requirements for running this skill?

This skill is designed for AI agents with access to a Python environment and terminal, as it utilizes the `markitdown` library and shell utilities like `grep` to process files locally.

### Can this skill handle scanned PDFs that don't have selectable text?

Yes, the skill includes built-in OCR detection that identifies scanned documents without a text layer and automatically switches to an image-based reading strategy.

### What is included in the 'PDF to Markdown First' package?

Upon purchase, you receive the full skill logic and configuration, including the automated environment setup scripts and the multi-step conversion and retrieval workflow.

### Are there any specific document types that might require extra verification?

While it excels at converting standard documents, highly complex financial tables or bank statements may require manual verification, as Markdown conversion can sometimes struggle with intricate column alignments.

---

Source: [Agensi](https://www.agensi.io), the marketplace of skills for AI agents. Any MCP-compatible agent (Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and more) connects at https://mcp.agensi.io/mcp/auth and signs in with an Agensi account; setup for every agent: https://www.agensi.io/docs/mcp-setup. Append .md to any skill, guide or docs address on agensi.io for its markdown version.
