Skip to main content

readability — an AI agent is asked whether a page is easy to read, calls readability, reports contrast, typography, line length and clarity findings with evidence, fixes the CSS and re-checks.

readability

Audit how readable — and how comfortable to read — a website really is.
Contrast, typography, line length, clarity, structure, accessibility. Measured in a real browser.

license python ≥ 3.10 CI WCAG 2.2 + APCA

Install · Recipes · Commands · For AI agents · Methodology

Give your AI agent a reader's eye. One tool call opens the page in a real browser, measures what a reader actually meets, and returns each problem with its evidence and a fix.

Your agent can check What is measured Selector
◐ Contrast WCAG 2.2 ratio and APCA Lc (WCAG 3 draft), resolved through the real background, per size and weight --only contrast
Aa Typography body size, text below 16px, line height, paragraph spacing, capitals, justification, type scale --only typography
↔ Line length characters per line from real line boxes, desktop and phone --only measure
▯ Mobile body size and line length at 390px, sideways scrolling --only mobile
▣ Layout sticky headers, cookie walls and chat bubbles covering the first screen, layout shift --only layout
Clarity LIX, Flesch per language, Fog, SMOG, sentence length, passive voice, filler, rare words --only clarity
☰ Structure heading density, walls of text, paragraph length, links, title and meta description --only structure
♿ Accessibility declared vs detected language, alt text, heading order, link text, acronyms, text scaling --only access

Each check runs alone in seconds, or all together across a whole site.

readability page https://site.com --only contrast --format json   # what your agent runs
{"key": "apca_fail", "severity": "medium", "title": "3 text blocks are perceptually thin",
 "fix": "Raise the contrast or the font size for these blocks.",
 "evidence": [{"text": "Une installation, zéro config…", "color": "rgb(107, 100, 87)",
               "background": "rgb(238, 232, 220)", "ratio": 4.8, "apca_abs": 66.0,
               "apca_required": 92.5, "font_px": 15.5}]}

Give it to your agent

pip install readability-audit playwright && playwright install chromium
git clone https://github.com/pi-infected/readability
cp -r readability/skills/readability ~/.claude/skills/   # Claude Code; other agents: AGENTS.md

Then ask: "Is my pricing page easy to read? Fix what you find." The agent picks the checks it needs, fixes the CSS or the text the evidence points to, and re-measures.

Why readability

  • Measured, not guessed. Most readability tools stop at a Flesch score, which cannot see 12px body text, a 2.6:1 contrast, a 140-character line or a page declaring lang="en" over French prose. readability reads computed styles and line boxes in headless Chromium.
  • Narrow and fast. Measure only what you ask for. A selection that needs no browser skips it: a text-only audit of 8 pages runs in about 4 seconds.
  • Honest. A page with no readable text scores n/a, not a made-up number. Terminal demos and JSON blobs are not scored as prose. Targets are calibrated against a reference set of well-typeset sites and validated on 107 labelled difficulty pairs (methodology).
  • Agent-ready. --format json everywhere, stable exit codes, evidence and a fix on every finding, and a ready-made skill.

Install (command line)

pip install readability-audit    # or: uv tool install readability-audit
pip install playwright && playwright install chromium   # once, for the rendered pass
readability metrics              # check it works: lists everything you can measure

From source: git clone https://github.com/pi-infected/readability && cd readability && pip install -e .

Without Playwright, readability still runs every text, structure and accessibility metric — only the rendered comfort metrics (contrast, typography, layout) need the browser.

Measure only what you need

A full audit renders every page twice (desktop + mobile) and runs ~40 metrics. Most of the time you want one thing. Select it, and readability does only the work that thing needs.

You want Command Browser
Contrast of one page (WCAG + APCA) readability page URL --only contrast desktop only
Typography without the phone pass readability page URL --only typography --skip mobile desktop only
Is my mobile layout readable? readability page URL --only mobile both
How hard is my writing? readability page URL --only clarity none
Just the classic formulas readability text draft.md --only readability none
Whole blog, text only, fast readability audit https://site.com --include '/blog/' --pages 100 --only clarity,structure none
Everything except SEO nits readability audit https://site.com --skip seo both
One page of each kind (blog index, post, docs, legal…) readability audit https://site.com --per-section 1 both
Check a few exact pages readability page URL1 URL2 URL3 both
Accessibility, minus the browser readability page URL --only access --skip rem_scaling none

Selectors are pillars, groups or single metrics, comma-separated and repeatable. readability metrics prints them all.

  • Pillars: clarity · structure · comfort · access
  • Groups: readability · style · contrast · typography · layout · mobile · headings · links · seo · images
  • Metrics: lix, flesch, asl, passive, font_size, line_height, measure, contrast, apca, occlusion, cls, alt_coverage, rem_scaling… (40 in all)

Choose which pages

readability urls https://site.com --pages 200              # dry run: what would be audited
readability audit https://site.com --per-section 1 --pages 30   # one page of each template, fast
readability audit https://site.com --pages 50 \
  --include '/en/' --exclude '/tag/' --exclude '/page/[0-9]+'   # repeatable regexes
readability audit https://site.com --url-list https://site.com/a https://site.com/b
readability audit https://site.com --no-sitemap --depth 1  # links from the home page only

Discovery reads sitemap.xml first, then crawls same-origin links. robots.txt is respected, responses are cached on disk, duplicates (redirects, canonicals, identical bodies) are analysed once.

Commands

Command What it does
readability page URL… Analyse one or more pages, no crawl. Prints metrics, findings and evidence.
readability audit URL Crawl a site, score every page, write JSON / CSV / HTML / PDF reports.
readability text FILE Analyse a local Markdown, text or HTML file (- for stdin). JSON out.
readability urls URL List the pages an audit would visit, without analysing them.
readability metrics List every pillar, group and metric you can pass to --only / --skip.
readability diff A.json B.json What changed between two audits: score delta, resolved and new findings.
readability benchmark URL URL… Audit several sites the same way and rank them.

Options

selection   --only SEL          measure only these pillars / groups / metrics
            --skip SEL          leave these out
            --no-render         never start the browser
pages       --pages N           page budget (audit 10, urls 50)
            --include RE        URL must match one of these   (repeatable)
            --exclude RE        URL must not match any        (repeatable)
            --url-list A B C    exactly these URLs, no crawl
            --per-section N     N pages per site section, index and detail apart
            --depth N           link-crawl depth (default 2)
            --no-sitemap        crawl links only
            --delay S           politeness delay (default 0.4s)
            --ignore-robots     only for sites you own
targets     --audience A        general · technical · academic · children
            --lang fr           force the language of the linguistic metrics
            --config FILE       TOML/JSON: bands, weights, only/skip (see below)
output      --format json       machine-readable result on stdout
            --out DIR           readability.{json,csv,html,pdf} in DIR
            --json/--csv/--html/--pdf PATH
            --report-lang en fr reports in one or more languages, one crawl
            --pdf-detail N      pages detailed in the PDF, worst first (default 40, 0 = all)
            --screenshots       desktop screenshot per page in the report
            --evidence N        evidence lines per finding (page, default 2)
            --fail-under N      exit 2 below this score (CI gate)
speed       --concurrency N     pages rendered at once, clamped to free RAM
            --no-cache          always refetch

Reports

readability audit https://site.com --pages 30 --out report/ --report-lang en fr --screenshots

writes readability.json (the single source of truth: every value, its target, its evidence, the methodology and coverage), readability.csv (one row per page), and an HTML + PDF report per language — all from the same crawl. readability diff before.json after.json closes the loop when you ship a fix.

Tune the targets

The bands are data, not code (examples/readability.toml):

only = ["comfort", "access"]   # same selectors as --only / --skip
skip = ["seo"]
disable = ["meta_description"]

[bands.measure]                # our column is deliberately narrow
ideal = [45, 72]
tolerable = [35, 88]

[weights]
contrast = 2.5

[pillar_weights]
comfort = 0.35

For AI agents

readability is built to be driven by coding agents (Claude Code, Codex, Cursor, Copilot…):

  • --format json on every command: result on stdout, progress on stderr.
  • Narrow first. --only keeps the payload small and the run fast; readability metrics --format json lists every valid selector.
  • Exit codes: 0 ok · 1 (page) a URL could not be fetched or parsed · 2 below --fail-under · 64 bad selector.
  • Every finding carries key, severity, pillar, detail, fix and evidence (the text, its colours, size, ratio, APCA level), so the agent can go straight to the CSS or the sentence.
readability page https://site.com/pricing --only contrast,typography --format json \
  | jq '.findings[] | {key, severity, fix, evidence: .evidence[:2]}'

Install the skill so your agent knows when and how to use it:

mkdir -p ~/.claude/skills && cp -r skills/readability ~/.claude/skills/   # Claude Code

Other agents: point them at AGENTS.md.

How each number is produced, calibrated and validated: docs/METHODOLOGY.md.

Built on

Playwright (rendering) · trafilatura and readability-lxml (content extraction) · textstat (cross-check) · wordfreq (vocabulary rarity) · pyphen and syllapy (syllables) · WeasyPrint (PDF) · WCAG 2.2 contrast and APCA implemented from the specifications.

Development

pip install -e . pytest && python -m pytest -q          # browser tests need Chromium
python -m pytest -q -m "not render"                     # offline subset

Issues and pull requests welcome.

License

Licensed under either of Apache License, Version 2.0 or MIT license, at your option (MIT OR Apache-2.0).

Metadata

Release files for readability-audit 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for readability-audit 0.1.1
File Size Uploaded Provenance Actions
readability_audit-0.1.1.tar.gz 137.3 kB With provenance Details for readability_audit-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for readability-audit 0.1.1
File Interpreter ABI Platform Actions
readability_audit-0.1.1-py3-none-any.whl Python 3 none any Details for readability_audit-0.1.1-py3-none-any.whl

Total release size: 262.2 kB

Release files / readability_audit-0.1.1.tar.gz

Download URL readability_audit-0.1.1.tar.gz
Size 137.3 kB
Tags Source
SHA-256 checksum
How to use checksums
d592ddc225f12f49802cb75fcfb47dafc4bf1290982f77dd0d9822a9034baa9e
BLAKE2b-256 checksum
How to use checksums
fac686ca1061e7ec61338db16b6bca02a27f4fd90dbcfd77027c5fff9428c72f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 20, 2026.

Transparency log

Release files / readability_audit-0.1.1-py3-none-any.whl

Download URL readability_audit-0.1.1-py3-none-any.whl
Size 124.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1fe39ee37153141b400f87c48c22d49ef520f4f44810c7b342402255918e4878
BLAKE2b-256 checksum
How to use checksums
2359e01f6d089c19ed09d16919061234b7fd9d2b7c12e99ea5567fa5f0c95b3d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 20, 2026.

Transparency log

Security for readability-audit 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for readability_audit-0.1.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 20, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page