Agent skill · nousresearch

pretext

Build creative browser demos with DOM-free text layout.

What it needs

About 8k tokens when loaded.

What this skill does

Pretext Creative Demos Overview @chenglou/pretext is a 15KB zero-dependency TypeScript library by Cheng Lou (React core, ReasonML, Midjourney) for DOM-free multiline text measurement and layout. It does one thing: given (text, font, width), return the line breaks, per-line widths, per-grapheme positions, and total height — all via canvas measurement, no reflow. That sounds like plumbing. It is not. Because it is fast and geometric, it is a creative primitive: you can reflow paragraphs around a moving sprite at 60fps, build games whose level geometry is made of real words, drive ASCII logos through prose, shatter text into particles with exact per-grapheme starting positions, or pack shrink-wrapped multiline UI without any getBoundingClientRect thrash. This skill exists so Hermes can make cool demos with it — the kind people post to X. See pretext.cool and chenglou.me/pretext for the community demo corpus. When to Use Use when the user asks for: A "pretext demo" / "cool pretext thing" / "text-as-X" Text flowing around a moving shape (hero sections, editorial layouts, animated long-form pages) ASCII-art effects using real words or prose, not monospace rasters Games where the playfield / obstacles / bricks are made of text (Tetris-from-letters, Breakout-of-prose) Kinetic typography with per-glyph physics (shatter, scatter, flock, flow) Typographic generative art, especially with non-Latin scripts or mixed scripts Multiline "shrink-wrap" UI (smallest container width that still fits the text) Anything that would require knowing line breaks before rendering Don't use for: Static SVG/HTML pages where CSS already solves layout — just use CSS Rich text editors, general inline formatting engines (pretext is intentionally narrow) Image → text (use ascii-art / ascii-video skills) Pure canvas generative art with no text role — use p5js Creative Standard This is visual art rendered in a browser. Pretext returns numbers; you draw the thing. Don't ship a "hello world" demo. …

How to use it

Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:

@skills nousresearch/pretext--bba4f8

View the source on GitHub

Browse the @skills marketplace