← LeaderboardThe Skill Leaderboard

epub-accessibility-audit

Audit local EPUB 3 publications offline with EPUBCheck and bounded XML inspection across container/OPF manifest/spine, navigation fragment targets, a11y metadata, lang, and alt text.

Published by sickn33 ↗sickn33/agentic-awesome-skills

Try your first task

A source-grounded starter task has not been verified for this skill yet.

SKILL.md

name: epub-accessibility-auditdescription: "Audit local EPUB 3 publications offline with EPUBCheck and bounded XML inspection across container/OPF manifest/spine, navigation fragment targets, a11y metadata, lang, and alt text."category: developmentrisk: safesource: selfsource_type: selfdate_added: "2026-12-01"author: Koushik-Katkamtags: [epub, epubcheck, accessibility, epub-a11y, validation, publishing]

EPUB Accessibility Audit

Overview

Audit finished EPUB 3 .epub publications offline combining EPUBCheck (5.4.0) structural validation with bounded, XXE-safe XML/ZIP EPUB Accessibility 1.1 checks (lxml.etree + Python zipfile). Verifies META-INF/container.xml and package.opf references, manifest resource existence, spine reading order, navigation document (nav) links and #fragment targets, schema:accessMode / accessibilityFeature / accessibilityHazard / accessibilitySummary metadata, document xml:lang/lang, and <img> alt attributes. Clearly separates structural validity, automated accessibility checks, and human accessibility evaluation.

Distinction from existing accessibility skills:

  • accessibility-compliance-accessibility-audit, better-accessibility, and ui-a11y: audit interactive web pages, DOM keyboard/focus flows, and StyleSeed UI components against WCAG rather than .epub OCF containers, package.opf manifests/spines, EPUBCheck rules, or schema:accessibility* package metadata.

When to Use

  • Validating compiled .epub releases before bookstore distribution or accessibility certification handoff.
  • Catching broken nav.xhtml #fragment links, missing manifest assets, absent schema:access* metadata, missing xml:lang, or <img> elements without alt.
  • Distinguishing structural EPUB validity (EPUBCheck exit 0) from accessibility failures inside structurally valid .epub archives.
  • Do not use this skill to extract untrusted archives indiscriminately to disk, fetch external resources, or claim full human accessibility compliance.

Prerequisites

  • Official EPUBCheck JAR (epubcheck --version, tested on 5.4.0) with Java (21.0.12) via EPUBCHECK_JAR env var or epubcheck on PATH.
  • Python 3.10+ with lxml and pytest (tested with Python 3.12.10, lxml==6.1.3, pytest==9.1.1).
  • No external network fetching or arbitrary ZIP extraction required.

How It Works

1. Enforce bounded archive safety before reading members

  1. Inspect ZIP central directory via zipfile.ZipFile in memory without calling extractall().
  2. Reject path traversal (.., leading /, backslashes, NUL bytes), symlinks (S_ISLNK), excessive member counts (> 2000), or oversized compressed/uncompressed entries (> 16 MiB member / > 64 MiB total) as INVALID_INPUT / UNSAFE_ARCHIVE.

2. Run EPUBCheck and EPUB Accessibility 1.1 inspection separately

Run the local verification suite in EPUB accessibility audit harness:

  1. Structural & spec check (EPUBCheck 5.4.0 when run_epubcheck=True): Run java -jar epubcheck.jar <file.epub> --json <report.json> (45s timeout), handling missing report files, corrupt JSON, or subprocess/JVM failures gracefully without uncaught exceptions, to validate OCF mimetype, container.xml, package.opf version 3.0, manifest file existence, spine reading order, and nav links. The default is bounded Python-only inspection for untrusted .epub archives. Use it (run_epubcheck=False / inspect_epub_python_only) so the external Java JVM is never invoked; structural checks report structural_status="NOT_TESTED" (structural_valid=None, epubcheck_errors=None) distinctly from EPUBCheck pass/fail.
  2. Accessibility metadata (EPUB Accessibility 1.1 §2.2 spec vs. recommended vs. project policy): Parse package.opf with XXE-disabled lxml.etree.XMLParser(resolve_entities=False, no_network=True) while separating:
    • Specification-required metadata (ERROR): dc:language, schema:accessMode, schema:accessibilityFeature, schema:accessibilityHazard.
    • Specification-recommended metadata (WARN): schema:accessibilitySummary, schema:accessModeSufficient.
    • Optional strict project policy (require_summary_policy=True -> ERROR): When enabled, missing schema:accessibilitySummary emits a distinct PROJECT_POLICY_MISSING_ACCESSIBILITY_SUMMARY finding (category="PROJECT_POLICY") explicitly labeled as project policy rather than an EPUB Accessibility 1.1 specification failure.
    • Project/automated HTML checks (ERROR): <html xml:lang>/lang, <img> alt, and nav target resolution.
  3. Normalized navigation targets & fragment verification: Resolve <nav epub:type="toc"> <a href="..."> paths relative to the nav document directory (posixpath.normpath + percent-decoding so ../ch1.xhtml from EPUB/nav/toc.xhtml resolves to EPUB/ch1.xhtml), reject archive escapes, require nav targets to exist in both the ZIP archive and <manifest> (UNMANIFESTED_NAV_TARGET), and confirm #fragment IDs exist in target XHTML documents.

3. Preserve human-evaluation boundary

Always emit distinct sections in the audit output:

  • structural_status ("PASS", "FAIL", or "NOT_TESTED" when run_epubcheck=False) and structural_valid (True, False, or None)
  • automated_a11y_valid and findings (separating A11Y_AUTO, A11Y_RECOMMENDED, PROJECT_POLICY, STRUCTURAL, and SECURITY)
  • human_eval_required (explicit note that automated checks and metadata presence never establish complete accessibility compliance — screen-reader reading order, meaningful alt prose, heading semantics, and visual contrast still require human evaluation).

Examples

Run the self-contained verification suite in EPUB accessibility audit harness:

User request: "Audit release.epub for EPUB 3.3 structural errors, broken TOC #fragment links, and EPUB Accessibility 1.1 metadata."
Inputs: Synthetic or local finished .epub archive inspected via EPUBCheck 5.4.0 + bounded lxml XML checks.
Expected result: Valid accessible EPUB passes structural and automated a11y checks while flagging human review;
  missing nav target or fragment fails structural + nav checks; structurally valid EPUB lacking schema:access* or img alt
  passes EPUBCheck yet fails automated a11y audit.

Limitations

  • Automated checks confirm presence of schema:access* metadata, xml:lang/lang, alt attributes, and #fragment IDs; they cannot judge whether alt text is accurate/descriptive, whether heading order is logical, or whether screen-reader UX passes WCAG 2.2 AA.
  • Encrypted/DRM-protected EPUBs and MathML/SMIL media-overlay timing synchronization are outside this offline audit scope.

Safety and Side Effects

  • Strictly bounded in Python: caps the compressed input at 64 MiB before ZIP parsing, inspects the same bytes in memory without extractall() and parses XML with resolve_entities=False, no_network=True. Use inspect_epub_python_only / audit_epub(..., run_epubcheck=False) on untrusted .epub archives so the external Java EPUBCheck JVM process is never silently launched.
  • Untrusted EPUBCheck boundary: Executing external Java EPUBCheck (run_epubcheck=True) invokes a third-party JVM process over the input .epub; restrict execution to trusted/synthetic archives unless external JVM network and filesystem sandboxing are enforced.
  • Never modifies input .epub archives or writes outside temporary test directories.

Sources and related skills

epub-accessibility-audit by sickn33 · The Skill Leaderboard