Hagen Fritz
← Blog

Lorem Ipsum by the Character, Word, or Token

claude-codetooling

I use lipsum.com any time I need to check that a UI handles scrolling, overflow, or a character limit. I go there, grab a block of filler text, and paste it in.

Two things about using lipsum.com started to bug me:

  1. lipsum.com counts by paragraphs, words, or bytes. No option for character or token.
  2. Having to navigate away from Claude Code to get the text

Finally, when I needed 500 characters to test the limit of a text entry box, I decided to create my own skill. Thus, /lorem was born. It is a Claude Code skill in my Claude Code workflow repository cc-forge

What it does

You type /lorem, a count, and a unit:

/lorem 160 chars

The unit is [c]hars, [w]ords, [p]aragraphs, or [t]okens. The text prints in the session and copies to your clipboard.

Why a skill and script

The skill is primarily a shortcut for a prompt. /lorem 160 chars is what I would otherwise type out as “give me exactly 160 characters of lorem ipsum”, the same way /tldr replaced “please respond in one or two sentences”. The skill file holds the prompt and its rules so I only type the two arguments.

But the skill also helps create more reliable token-based outputs. Claude can count well enough. I tested it: asked for exactly 500 characters or 50 words with tools switched off and Opus 5.5 hit the number every time. Tokens are where Claude struggles. I asked for exactly 100 tokens and received 154, 229, and 250 across three tries, because a model has no tokenizer to consult while it writes. But every ask is a model call, and the text comes out different each run. So I use a script to generate the filler text. The script sizes the text from a characters-per-token ratio, sends that text to Anthropic’s count_tokens endpoint, and lets Haiku 5.5 count it. If the answer is off by more than 2%, it resizes once and counts again. Two or three round trips, and what comes back is a decent estimate rather than an exact hit. The bundled-script idea comes from intellectronica’s lorem-ipsum skill, which generates its filler with a Python script.

Three runs

Words

/lorem 25 words
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis

Characters

Characters are a hard cut, so the text stops mid-word when the count says so.

/lorem 160 chars
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostru

Tokens

/lorem 60 tokens
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

58 tokens by Haiku 5.5’s counter

Try it

The skill is a folder with two files, the skill file and the script: skills/lorem. Copy it into your own skills folder, or use it as a starting point for your own.