agentsclimarketplace

Pretext

Skill radustefandumitru/overdrive/skills/pretext

Use for advanced web text measurement and layout with @chenglou/pretext: virtualized lists with variable-height text, shrinkwrapped chat bubbles, responsive multiline text, auto-growing textareas, dev-time label overflow checks, Canvas/SVG/WebGL text, and avoiding DOM reflow from getBoundingClientRect/offsetHeight. This is text-layout engineering/performance, not visual design polish.From its SKILL.md

Install
npx -y skills add radustefandumitru/overdrive --skill pretext

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

2 things to look at

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
  • 18 stars18 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

SKILL.md

3.9 KB, 760 tokens by cl100k_base, as published. Nobody here has run it

Pretext Text Layout

Use this skill when the hard part is measuring or laying out text accurately without forcing browser layout reflow. Do not use it for ordinary typography taste, brand direction, or visual polish; route those to the frontend/design skills.

What This Skill Does

@chenglou/pretext is a pure TypeScript text measurement and layout library. It helps agents replace repeated DOM measurement loops with deterministic text layout calls when building:

  • Virtualized feeds, logs, comments, or chat lists with variable-height rows.
  • Chat/message bubbles that shrinkwrap text without layout thrash.
  • Auto-growing textareas or editor previews.
  • Responsive/magazine/multi-column text layout experiments.
  • Dev-time checks such as "does this label overflow at this width?"
  • Canvas, SVG, WebGL, or custom-rendered text where the browser DOM is not doing layout.

Before Implementing

  1. Confirm the project is a JavaScript/TypeScript web project and inspect its package manager.

  2. If the package is not installed, ask or state the dependency change before adding it:

    npm install @chenglou/pretext
    

    Use the project's existing package manager when it is not npm.

  3. Match measurement inputs to rendered CSS: font family, font size, line height, letter spacing, available width, white-space behavior, and locale.

  4. Ensure relevant web fonts are loaded before relying on measured output in the browser.

Implementation Pattern

Use prepare for repeated layout of the same text/font inputs, then call layout whenever width or wrapping constraints change.

import { layout, prepare } from '@chenglou/pretext';

const prepared = prepare({
  text: message.body,
  font: '16px Inter',
  lineHeight: 22,
  whiteSpace: 'pre-wrap',
});

const box = layout(prepared, {
  width: availableWidth,
});

For virtualization, keep prepared handles or cached layout metadata near the row model. Recompute only when the text, font metrics, or available width changes. Use the resulting height/line information to feed the virtualizer instead of mounting hidden DOM nodes.

For lower-level control, use APIs such as prepareWithSegments, layoutWithLines, measureLineStats, walkLineRanges, layoutNextLineRange, and materializeLineRange when the component needs custom segmentation, incremental line layout, or manual rendering.

For rich inline text, inspect @chenglou/pretext/rich-inline and keep spans/segments explicit rather than trying to infer style from rendered DOM.

Verification

  • Compare a few representative strings against the rendered browser result, including long words, emoji, mixed scripts, newlines, and narrow widths.
  • Test resize behavior and font-loading timing.
  • Check that the implementation reduces layout reads such as getBoundingClientRect, offsetHeight, and hidden measurement nodes.
  • For virtualized lists, verify scroll position stability when data loads or widths change.

Caveats

  • Pretext is not a full CSS layout engine. It is for text measurement/layout, not arbitrary flex/grid/block layout.
  • Browser font rendering, fallback fonts, and international text can still create differences; verify visually when precision matters.
  • Do not add global tooling or Overdrive installer setup for this. It is a normal per-project app dependency.

Attribution

This skill is original Overdrive guidance for using Cheng Lou's MIT-licensed @chenglou/pretext library.

What ships with it: 1 file

695 B alongside SKILL.md

agents/

Gives 0 of the 12 instructions most design frontend skills give in 760 tokens

Counted across 1,179 of the 2,086 authors here whose files we hold, read 2026-09-06

  • Commit to a bold aesthetic directionin 31 of 1179, across 24 files
  • Prefer component composition over inheritancein 28 of 1179, across 14 files
  • Animate only transform and opacity propertiesin 27 of 1179, across 22 files
  • Memoize expensive computations with useMemoin 26 of 1179, across 13 files
  • Use semantic HTML elementsin 24 of 1179, across 23 files
  • Virtualize long lists for performancein 21 of 1179, across 10 files
  • Use CSS variables for design tokensin 20 of 1179, across 14 files
  • Implement loading, empty, and error statesin 20 of 1179
  • Lazy load heavy components with Suspensein 19 of 1179, across 8 files
  • Respect prefers-reduced-motion media queriesin 18 of 1179, across 10 files
  • Prioritize CSS-only animations for HTMLin 18 of 1179, across 16 files
  • Use compound components for related UI elementsin 18 of 1179, across 7 files

Said here and by no other author read

  • use for text measurement without browser reflow
  • confirm project is a web project
  • match measurement inputs to rendered CSS
  • ensure web fonts are loaded before measurement
  • use prepare for repeated layout inputs
  • call layout when width or constraints change

Grouped from the skills themselves: near-identical wordings counted once, and counted by distinct author, so one author publishing three of these counts once. Length counted with cl100k_base; the agent that loads this file may tokenize it differently.

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.