d-o-hub/github-template-ai-agents · Archived

document-rendering-and-locators

Implement resilient document rendering and annotation anchoring. Use this skill when working with reader-core rendering, TOC generation, locator systems, or highlight anchoring changes — even if they just say "fix the document rendering" or "the highlights aren't sticking". Generic pattern applicable to EPUB, PDF, or any document format. Not for reader-ui-ux.

First seen Jun 16, 2026

Installation

$ npx skills add d-o-hub/github-template-ai-agents --skill document-rendering-and-locators

Stronger alternatives

This repository is archived — consider an actively maintained alternative.

Similar popular skills

Related neighbors and high-traction skills in the same topics — useful to compare before installing.

Also in this package

Other skills from d-o-hub/github-template-ai-agents · top by installs.

npx skills add d-o-hub/github-template-ai-agents

Browse all from d-o-hub/github-template-ai-agents

More details

Agent compatibility

Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.

Claude Code Not declared
Cursor Not declared
Codex Not declared
GitHub Copilot Not declared
Windsurf Not declared
Gemini CLI Not declared
Cline Not declared
OpenCode Not declared

Repository health

Stars 2
License LICENSE
Default branch main
Open issues 0
Status Archived

Skill metadata

Parsed from SKILL.md frontmatter.

Version0.2.10
LicenseMIT

Package contents

Files included with this skill beyond the listing page.

  • skill md SKILL.md 2,845 B
  • docs SUMMARY.md 402 B

History

  1. First seen on skills.sh
  2. First recorded snapshot · 1 installs

SKILL.md

Document Rendering and Locators

Purpose: implement resilient document rendering, locator extraction, and annotation anchoring.

When to Use

  • Integrating document rendering library or reader-core changes.
  • Working on TOC, locator, or highlight/comment anchoring logic.
  • Debugging annotation drift or document loading regressions.

Workflow

  1. Define data model -- confirm multi-signal locator requirements (position + text + chapter + DOM fallback).
  2. Design anchors -- map DOM selections --> { position, selectedText, chapterRef, elementIndex, charOffset }.
  3. Implement -- use rendering library APIs for annotations and navigation, ensure async cleanup.
  4. Resilience -- add re-anchoring strategy (exact match --> fuzzy text --> chapter fallback --> user notice).
  5. Performance -- lazy-load document assets, reuse single rendition, clean up listeners to avoid leaks.
  6. Testing -- add test cases for locator serialization + re-anchor helpers; capture regressions.

Checklist

  • Position + text excerpt + chapterRef persisted together.
  • Anchor serialization uses stable casing + schema.
  • Re-anchoring warns user when falling back.
  • Event handlers removed on unmount.
  • Telemetry events logged for load failures with trace IDs.

See Also

  • reader-ui-ux — Reader/admin UI with responsive layouts
  • turso-db — Database for document storage

Rationalizations

Rationalization Reality
"Exact match anchoring is always sufficient" Documents change formatting across versions; multi-signal fallback prevents total anchor loss.
"Lazy loading complicates the code" Eager loading wastes memory and blocks rendering; lazy loading is essential for large documents.
"Telemetry for load failures is overkill" Without telemetry, silent anchor failures are invisible until users report them.

Red Flags

  • Relying on a single anchoring signal without fallback strategy
  • Not cleaning up event handlers on unmount
  • Skipping locator serialization tests

References

  • references/locator-patterns.md - Document locator strategies
  • references/anchoring.md - Annotation anchoring techniques

Voice & Context

  • Default: professional + blog
  • Reference: voice-profiles skill for definitions and auto-detection.