line-length-optimizer
Skill1 starsChanged 5 months agoMITView on GitHub
Use when checking or fixing the measure (line length) of a text block — verifying a paragraph or container sits in the 45–75 character range (35–45 on mobile) per Bringhurst/Latin readability guidance, and producing a max-width/ch fix.
In this repository20 other files it gives its agents.
- AGENTS.mdAGENTS.md
- skills/AGENTS.mdAGENTS.md
- .github/copilot-instructions.mdCopilot instructions
- kano-model-strategistSkill
- legible-agent-outputSkill
- socratic-dialogueSkill
- value-proposition-canvasSkill
- figjam-storymap-llmSkill
- kano-model-strategistSkill
- legible-agent-outputSkill
- socratic-dialogueSkill
- glyph-fidelitySkill
- microtypographySkill
- text-typesettingSkill
- type-scale-generatorSkill
- ui-text-overflowSkill
- vertical-spacingSkill
- ui-roi-auditSkill
- ux-content-designSkill
- value-proposition-canvasSkill
The file
We split this skill into the rules it gives an agent
8 rules. About 0 are common, 7 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈7
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 25
Check whether a block of body text sits within a comfortable reading measure, and produce a concrete CSS fix (max-width in ch or px) when …
- Distinctive: line 31
Not for headings, buttons, labels, or anything that's one line by design — measure only matters for wrapping prose.
- Distinctive: line 52
Ask only when a value can't be read and the answer would change the result.
- Distinctive: line 53
Don't ask for anything the request already states or the file shows — say what you took and where it came from.
- Distinctive: line 54
If the question can't be answered, state the assumption and carry on.
- Distinctive: line 55
Always ask before writing to a file or a Figma node.
- Distinctive: line 64
If given a text block: count average characters per line (including spaces) across the paragraph, or estimate from total character count ÷ …
- Distinctive: line 82
When running with Figma access (Figma MCP / plugin context), read the selected node instead of asking the user to paste text:
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Line Length Optimizer
Purpose
Check whether a block of body text sits within a comfortable reading measure, and produce a concrete CSS fix (max-width in ch or px) when it doesn't. Based on the standard typographic range: 45–75 characters per line on desktop, 35–45 on mobile (Bringhurst, Latin — see References).
When To Use
- Reviewing a container/component that holds body copy (article, blog post, card description) for readable width.
- The user pastes a paragraph and asks "is this column too wide?" or gives a
max-width/font-size and asks if it's in range. - Not for headings, buttons, labels, or anything that's one line by design — measure only matters for wrapping prose.
Inputs
One of:
- A CSS snippet or container width + font-size (compute expected characters-per-line), or
- A block of text + a stated or assumed container width, or
- Just a block of text with no width given — in that case, output the recommended
max-widthrather than judging an existing one.
Target device: desktop, mobile, or both (default: report both).
Outputs
- Verdict: in range / too wide / too narrow, with the measured or estimated characters-per-line.
- A concrete fix:
max-width: NNch;(preferred —chscales with font, unlike a fixedpx) or an equivalentpxvalue if the codebase doesn't usech. - Change log explaining the math, not just the answer.
Questions
This skill is an audit, not an interview. Work in this order: read what the file or the input already says, report, then ask.
- Ask only when a value can't be read and the answer would change the result. One question at a time.
- Don't ask for anything the request already states or the file shows — say what you took and where it came from.
- If the question can't be answered, state the assumption and carry on. Never stall the report on it.
- Always ask before writing to a file or a Figma node.
Questions this skill may need:
- The target device (desktop or mobile), when the container width doesn't make it clear. Without an answer, report both.
Workflow
- Get characters-per-line.
- If given a text block: count average characters per line (including spaces) across the paragraph, or estimate from total character count ÷ expected line count if it's reflowing.
- If given
max-width+font-size(+font-familyif known): estimate usingchunit semantics — 1ch ≈ the width of "0" in the given font, somax-width: 65chtargets ~65 characters regardless of font-size. If the input usespxinstead ofch, note that the actual character count will vary by font and flag it as a reason to preferch.
- Compare against target range.
- Desktop: 45–75 characters, 65 is the commonly cited sweet spot (Bringhurst).
- Mobile: 35–45 characters.
- Serif body text tolerates the higher end of the range better than sans-serif at small sizes — note this as a soft factor, not a separate hard range.
- Verdict + fix.
- In range: confirm, no change needed.
- Too wide: recommend
max-width: 65ch;(or narrower, e.g. 60ch, if the content is dense/technical) on the text container. - Too narrow: recommend removing an over-tight
max-widthorpadding, or increasing container width — narrow columns cause more line breaks and more ragged/hyphenation pressure, which interacts withmicrotypography's Rule 3. - If mobile and desktop diverge, recommend a responsive value: either two breakpoint-specific
max-widthvalues, or ach-based value that already scales reasonably since mobile font-sizes are usually smaller too — call out if a media query is actually needed (e.g. desktop uses a much larger font-size, breaking thechscaling assumption).
- Report, don't silently edit a stylesheet. Output the CSS as a suggestion in the response; only apply it to a file if the user explicitly asks you to edit that file.
Figma Node Integration
When running with Figma access (Figma MCP / plugin context), read the selected node instead of asking the user to paste text:
textNode.textAutoResize— determines what "width" even means for this node:NONEorHEIGHT→ the node has a fixed width; readtextNode.width(or the bounding box) directly and treat it as the measured container width.WIDTH_AND_HEIGHT(auto-width) → there is no fixed measure to check; the box grows with content. Flag this instead of computing a verdict — recommend switching toHEIGHT(auto-height, fixed width) if the intent is a readable paragraph column, since auto-width text has no line wrap at all.TRUNCATE→ fixed width and height with the overflow cut off; measure the width as forNONE, and flag that part of the text is hidden.
textNode.fontSizeandtextNode.fontName.family— needed to convert a pixel width into an estimated character count (characters-per-line ≈ width in px ÷ average glyph width, which scales withfontSizeand varies by typeface — monospace and condensed faces need a different divisor than a default sans).- Action back to Figma: if the fix is "too wide," the agent may resize the node's width directly (set
textNode.resize(newWidth, textNode.height)or the equivalent plugin API call) to the pixel width corresponding to ~65 characters at the node's currentfontSize/font — but only when the user has asked for a direct fix, not as a silent default. Otherwise, report the recommended width and let the user apply it.
Quality Checklist
- Character count is stated explicitly (measured or estimated), not just "looks too wide."
- Recommendation uses
chunless the codebase's existing convention ispx/rem— match existing convention if shown in the input. - Desktop and mobile both addressed, even if the answer is "same value works for both, here's why."
- Didn't touch headings, labels, or non-wrapping UI text — flag if the user's target isn't actually body prose.
- If a fix is suggested for a real file, it's proposed, not silently applied, unless the user explicitly asked for a direct edit.
- Noted the interaction with
microtypographyRule 3 when the fix affects ragged-edge risk (narrower column → more hyphenation/rag pressure).
References
- Bringhurst, R. (2012). The Elements of Typographic Style (4th ed.). Hartley & Marks — standard measure: 45–75 characters per line, 66 as the classic ideal.
- Hochuli, J. (2008). Detail in Typography. Hyphen Press — how the eye scans a line, and why an optimal word count per line reduces reading fatigue.
- Latin, M. (2017). Better Web Typography for a Better Web. — practical
ch-based implementation for web body text, and the mobile 35–45 character range. - Figma Plugin API Docs:
TextNode.textAutoResize. - Related skill:
microtypography— apply after fixing measure, since a corrected column width changes where ragged-edge and hyphenation risks actually occur.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

