document-rendering-and-locators

document-rendering-and-locators is a skill for Claude Code, Codex from d-o-hub/github-template-ai-agents. It costs 78 tokens per session (606 once invoked), scanned A, original, MIT.

A set of coding guidelines for displaying documents and keeping highlights or comments attached to the right text. A locator is saved information describing where selected text appears, such as its position, chapter, and text excerpt.

In plain words
What is it for?
Use it when building or repairing document readers, tables of contents, locators, or annotation anchoring for formats such as EPUB and PDF. It covers fallback matching, lazy loading, cleanup, and tests.
Why use it?
It helps prevent highlights and comments from moving or disappearing when a document is rendered again or its layout changes.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: installed under .agents/ (shared by several agents).

Good fit Use it when building or repairing document readers, tables of contents, locators, or annotation anchoring for formats such as EPUB and PDF. It covers fallback matching, lazy loading, cleanup, and tests.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/d-o-hub/github-template-ai-agents/document-rendering-and-locators
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 d-o-hub/github-template-ai-agents --skill document-rendering-and-locators
Clone the repo
git clone --depth 1 https://github.com/d-o-hub/github-template-ai-agents

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 document-rendering-and-locators

README.md
[![agentmods](https://agentmods.dev/badge/skills/d-o-hub/github-template-ai-agents/document-rendering-and-locators.svg)](https://agentmods.dev/skills/d-o-hub/github-template-ai-agents/document-rendering-and-locators)
Your own site
<a href="https://agentmods.dev/skills/d-o-hub/github-template-ai-agents/document-rendering-and-locators"><img src="https://agentmods.dev/badge/skills/d-o-hub/github-template-ai-agents/document-rendering-and-locators.svg" alt="Measured on agentmods" height="20"></a>
Per session 78 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 606 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. 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.00078 $0.00606
Opus 5 $0.00039 $0.00303
Sonnet 5 $0.00016 $0.00121
Haiku 4.5 $0.00008 $0.00061

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

Security

Grade A, and why

document-rendering-and-locators scanned grade A with 0 findings 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 7d 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.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.agents/skills/document-rendering-and-locators/SKILL.md · 65 lines

How it starts

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

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

Read the full file on GitHub · 65 lines

Files

What ships with it

3 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 7d ago First seen · 65 lines · 78 tokens per session scan A f8f0df54620e

Subscribe to this mod's changes

document-rendering-and-locators is a skill published in the GitHub repository d-o-hub/github-template-ai-agents (2 stars, last pushed today), licensed MIT. It adds 78 tokens to every session and 606 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.