reading-files

reading-files is a skill for Claude Code, Codex from mindsdb/anton. It costs 60 tokens per session (2,291 once invoked), scanned A, original, MIT.

A set of instructions for reading web pages, PDFs, Word files, images, photos, and scanned documents with Python libraries.

In plain words
What is it for?
It helps download and extract text from web pages and documents, read PDFs and Word files, and work with scanned or photographed text.
Why use it?
It avoids unreliable command-line tools and limits large extracted text from overwhelming the conversation. It also provides a way to handle scanned pages and images that contain text.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit It helps download and extract text from web pages and documents, read PDFs and Word files, and work with scanned or photographed text.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/mindsdb/anton/reading-files
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add mindsdb/anton --skill reading-files
Clone the repo
git clone --depth 1 https://github.com/mindsdb/anton

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for reading-files

README.md
[![agentmods](https://agentmods.dev/badge/skills/mindsdb/anton/reading-files/github.svg)](https://agentmods.dev/skills/mindsdb/anton/reading-files)
Your own site
<a href="https://agentmods.dev/skills/mindsdb/anton/reading-files"><img src="https://agentmods.dev/badge/skills/mindsdb/anton/reading-files/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for reading-files

Your own site · 80×15
<a href="https://agentmods.dev/skills/mindsdb/anton/reading-files"><img src="https://agentmods.dev/badge/skills/mindsdb/anton/reading-files.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 60 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,291 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00060 $0.02291
Opus 5.5 $0.00024 $0.00916
Sonnet 5.5 $0.00012 $0.00458
Haiku 4.5 $0.00006 $0.00229

Measured 9d ago against content hash efa14c7a0b95, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

reading-files scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 9d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

r = requests.get(url, timeout=30, headers={"User-Agent": "Mozilla/5.0"})
anton/core/memory/builtin_skills/reading-files/SKILL.md · 154 lines

How it starts

The opening of the file, as written. The whole thing — 154 lines — stays where its author put it; the contents beside it link to each section on GitHub.

READING WEB PAGES, DOCUMENTS AND SCANS

Libraries: requests, beautifulsoup4 with lxml, pypdf, pdfplumber (with pypdfium2), python-docx and pillow. Cowork on the web has all of them; on a person's own computer some may be missing. Put every one of these libraries that a cell imports in that cell's packages array: one already installed is skipped, and a missing one is installed before the cell runs. An import alone never installs anything.

Use these Python libraries, not command-line tools such as pdftotext, pdftoppm, qpdf, tesseract or LibreOffice. The web sandbox has none of them and a person's computer usually doesn't either, so trying them costs a step.

Keep text out of the conversation. Write extracted text to a file under .anton/output and print only a short excerpt and its length; printed output stops at 10,000 characters. Search or read the file for what you need.

WEB PAGE

import requests
from bs4 import BeautifulSoup
r = requests.get(url, timeout=30, headers={"User-Agent": "Mozilla/5.0"})
r.raise_for_status()
soup = BeautifulSoup(r.text, "lxml")
for tag in soup(["script", "style", "nav", "footer"]):
    tag.decompose()
text = soup.get_text("\n", strip=True)

A page that comes back nearly empty is usually built by JavaScript. Say so and try another source rather than parsing it again.

PDF

import pdfplumber
with pdfplumber.open(path) as pdf:
    pages = [(p.extract_text() or "") for p in pdf.pages]
    # Pages to read with the model: almost no text, or an image covering most of the page (a scan).
    scanned = [i for i, p in enumerate(pdf.pages)
               if len(pages[i].strip()) < 20
               or any((im["x1"] - im["x0"]) * (im["bottom"] - im["top"]) >= 0.7 * p.width * p.height for im in p.images)]

Tables: page.extract_tables(). Pages in scanned are scans: their text, if any, may be only a stamp or a poor OCR layer. Read them as images (below).

WORD

import docx
d = docx.Document(path)
text = "\n".join(p.text for p in d.paragraphs)
tables = [[[c.text for c in row.cells] for row in t.rows] for t in d.tables]

Only .docx can be read. For an old .doc file, tell the person plainly and ask for a .docx or PDF copy.

IMAGES, PHOTOS AND SCANNED PAGES Read them with the model. Copy this cell as it is and run it; set path first, and LIMIT = 20 if the person chose to start with the first 20 pages. Don't write your own async loop: a cell has no running event loop, so a top-level await is a SyntaxError and asyncio.run(asyncio.gather(...)) fails. To change how pages are read, edit read_page and keep the asyncio.run(read_pages(...)) call.

import asyncio, base64, hashlib, io, pathlib
import pypdfium2 as pdfium
from PIL import Image

llm = get_llm()
LIMIT = None  # 20 if the person chose to start with the first 20 pages
SYSTEM = ("Transcribe all text in the image exactly, in reading order. Keep the original "
          "language. Write [illegible] for anything you cannot read; never guess. "
          "If the page has no text at all, reply exactly [blank page].")

def needs_model(page):
    # Almost no text, or an image covering most of the page: a scan, even one
    # whose text layer is only a stamp or a poor OCR layer.
    if len(page.get_textpage().get_text_range().strip()) < 20:
        return True
    area = page.get_width() * page.get_height()
    for obj in page.get_objects(filter=[pdfium.raw.FPDF_PAGEOBJ_IMAGE]):
        left, bottom, right, top = obj.get_bounds()
        if (right - left) * (top - bottom) >= 0.7 * area:
            return True
    return False

def render(pdf, i):
    # Long side about 1600 px whatever the page size, so a huge page can't exhaust memory.
    page = pdf[i]
    return page.render(scale=1600 / max(page.get_width(), page.get_height())).to_pil()

def to_block(img):
    img = img.convert("RGB")
    img.thumbnail((1600, 1600))
    buf = io.BytesIO()
    img.save(buf, "JPEG", quality=85)
    data = base64.b64encode(buf.getvalue()).decode()
    return {"type": "image", "source": {"type": "base64", "media_type": "image/jpeg", "data": data}}

async def read_page(pdf, i, out_dir):
    # Rendered here, inside the page's own task, so a page that cannot be
    # rendered fails alone instead of stopping the batch.
    img = render(pdf, i)
    if img.convert("L").getextrema()[0] > 245:  # nothing but white: no model call
        text = "[blank page]"
    else:
        r = await llm.complete_async(system=SYSTEM, messages=[{"role": "user", "content": [
            {"type": "text", "text": f"Page {i + 1}."}, to_block(img)]}], max_tokens=4000)
        stop = getattr(r, "stop_reason", None)
        if stop in ("max_tokens", "length"):
            raise ValueError("the reply was cut off")
        if stop in ("refusal", "content_filter"):
            raise ValueError("the model declined the page")
        text = (r.content or "").strip()
        if not text:
            raise ValueError("the model returned no text")
    (out_dir / f"page_{i + 1:04d}.txt").write_text(text)

async def read_pages(pdf_path, pages, out_dir, batch=8, limit=None):
    """Read the pages not saved yet, only the first `limit` of `pages` if set.
    Returns {page number: error} for pages that failed."""
    out_dir.mkdir(parents=True, exist_ok=True)
    pdf = pdfium.PdfDocument(pdf_path)
    pages = list(pages)[:limit]
    todo = [i for i in pages if not (out_dir / f"page_{i + 1:04d}.txt").exists()]
    failed = {}
    for start in range(0, len(todo), batch):
        chunk = todo[start:start + batch]
        results = await asyncio.gather(*(read_page(pdf, i, out_dir) for i in chunk), return_exceptions=True)
        for i, result in zip(chunk, results):
            if isinstance(result, Exception):
                failed[i + 1] = f"{type(result).__name__}: {result}"[:200]
        progress(f"Read {start + len(chunk)} of {len(todo)} pages")
    return failed

# Call it with asyncio.run: a cell has no running event loop, so a bare `await` is a SyntaxError.
# Read only this file's scanned pages: each page sent is a model call.
# Found here for `path` every time, never from an earlier cell or another file.
# Saved pages are kept per file content, so a revised file with the same name is read again.
# (For an image file, there are no pages: send the image itself, as below.)
doc = pdfium.PdfDocument(path)
scanned = [i for i in range(len(doc)) if needs_model(doc[i])]
with open(path, "rb") as fh:
    digest = hashlib.file_digest(fh, "sha256").hexdigest()[:12]
out_dir = pathlib.Path(".anton/output/extracted_text") / f"{pathlib.Path(path).stem}-{digest}"
failed = asyncio.run(read_pages(path, scanned, out_dir, limit=LIMIT))
print("pages not read:", failed or "none")
if LIMIT and len(scanned) > LIMIT:
    print(f"{len(scanned) - LIMIT} more scanned pages not read yet")

For a photo or image file, open it with Image.open(path) and send it the same way.

Read the full file on GitHub · 154 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 9d ago First seen · 154 lines · 60 tokens per session scan A efa14c7a0b95

Subscribe to this mod's changes

reading-files is a skill published in the GitHub repository mindsdb/anton (753 stars, last pushed today), licensed MIT. It adds 60 tokens to every session and 2,291 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-11-21.

Related

reading-files compared with skills from other repositories

reading-files next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
reading-filesmindsdb/antonSkill753todayMITA60Claude Code, Codex
pdfWrongStack/WrongStackSkill444todayMITA93Claude Code, Codex
office-documentsWrongStack/WrongStackSkill444todayMITA98Claude Code, Codex
claude-paper-summaryalaliqing/claude-paperSkill3603mo agoMITA51Claude Code
datasheet-interpreterwedsamuel1230/arduino-skillsSkill243mo agoMITA67Claude Code
mermaid-renderDesko77/cursor-1c-skillsSkill786d agoMITA166Claude Code, Codex
doa-apidocmedalsoftchina/workcopilotSkill46mo agoApache-2.0A206Claude Code, Codex