← Skills

ui-casing

One casing rule per role, kept for good

npx skills@latest add batuhankarasakal/Skills --skill ui-casing

Every product starts with a casing rule and slowly loses it. One PR adds “Delete Account”, another “CONTINUE”, a third “add member”. No single change looks wrong, but the screen does. This skill gives your agent the rule: it finds the convention for each role (buttons, titles, tabs, labels…), writes it into the repo so every future change follows it, audits the code for strings that break it, and fixes them.

What it does

  1. Finds the rule: reads ui-casing.json or CLAUDE.md, or infers the dominant style per role from the code and asks you to confirm it.
  2. Writes it down: ui-casing.json for the scanner, a short CLAUDE.md section so every teammate’s agent follows it while writing code.
  3. Audits: a zero-dependency scanner lists every string that breaks the rule, with file:line and a proposed fix.
  4. Fixes the source text, never with text-transform: capitalize; UPPERCASE stays a CSS style.
  5. Knows the edge cases: brand names and acronyms, sentences vs labels, Turkish İ/ı, German nouns, locale files.
Repository
batuhankarasakal/Skills
Files
SKILL.md, scan-casing.mjs
Package
ui-casing.skill for the Claude app’s Skills settings
SKILL.mdView on GitHub

UI casing

Casing is a design decision that erodes one pull request at a time. The designer picks Sentence case for buttons; six months later the product has "Save changes", "Delete Account", "CONTINUE" and "add member" on the same screen, because nobody who touched those strings knew there was a rule. No single change looked wrong. The whole thing does.

This skill keeps the rule alive: find it, write it down where every future change will see it, check the code against it, and follow it in every string you write.

The five styles

StyleExampleRule
Sentence caseSave changes to your profileFirst word capitalised, the rest lowercase (proper nouns keep theirs)
Title CaseSave Changes to Your ProfileEvery word capitalised except short minor words (a, an, the, and, or, of, to, in, on, for, with…) unless first or last
Start CaseSave Changes To Your ProfileEvery word capitalised, minor words too
UPPERCASESAVE CHANGESAll caps — usually best done with CSS, see below
lowercasesave changesNothing capitalised (proper nouns may still keep theirs)

Rules are set per role, because a product can legitimately use Title Case for page titles and Sentence case for buttons. What it cannot do is use both for buttons.

Roles: button (CTAs, submit, confirm), title (page h1), heading (sections, cards, modals, dialogs), tab, menu-item, nav, link, label, placeholder, table-header, option, badge (tags, chips, eyebrows), tooltip, toast, aria-label, document-title.

Workflow

1. Find the convention

Look for a written rule before inferring one:

  • ui-casing.json at the repo root (the format this skill writes, see below)
  • a "UI text casing" section in CLAUDE.md / AGENTS.md
  • the design system's docs, a content style guide, Figma text styles

If a rule exists, it wins over whatever the code currently does. Go to step 3.

2. No rule yet: infer it, then agree on it

Run the scanner on the source folders (not on build output):

node <this-skill>/scripts/scan-casing.mjs src

It prints, per role, how many strings use each style, the dominant one, and the strings that don't match. Turn that into a short table for the user: role, current split, proposed rule, two examples. Then ask them to confirm. A convention is a design decision, not a vote; if a role shows ⚠ no clear convention (no style above ~75%), the team never decided and the user should, not the majority.

If they have no preference, recommend this default and say why:

  • Sentence case for everything — buttons, titles, headings, tabs, menus, labels, placeholders. It reads like speech, survives translation and proper nouns without special cases, and is what most current design systems use (Material, Polaris, Primer, Fluent, Atlassian).
  • UPPERCASE only for tiny meta text (badges, eyebrows/overlines), and only via CSS.
  • Exception: a native macOS/iOS app should follow Apple's HIG, which uses Title Case for buttons and menu items.

Then write it down in two places:

ui-casing.json at the repo root — the machine-checkable rule the scanner reads automatically:

{
  "lang": "en",
  "default": "sentence",
  "roles": { "title": "sentence", "badge": "upper" },
  "names": ["Acme", "Smart Inbox", "Pro"],
  "ignore": ["src/legal/**", "**/*.test.tsx"]
}

names are proper nouns and product feature names that keep their own case ("Connect to Smart Inbox" stays like that under Sentence case). Common brands, acronyms (API, PDF), camel-cased names (GitHub, iPhone), handles and domains are already recognised.

A section in CLAUDE.md (create it if missing) — so every future session, and every teammate's Claude, follows the rule while writing code, without anyone having to remember this skill exists:

## UI text casing
Rules live in `ui-casing.json`. Short version: Sentence case for all UI text
(buttons, titles, headings, tabs, menus, labels, placeholders); badges and
eyebrows are written in Sentence case and uppercased with CSS. Product names
in `names` keep their own case. Before adding or editing a user-facing string,
match its role's rule; check with `node <path>/scan-casing.mjs src`.

This step is what makes the consistency last. The audit fixes today; the CLAUDE.md section is what stops the next PR from undoing it.

3. Audit

node <this-skill>/scripts/scan-casing.mjs src            # picks up ./ui-casing.json
  • ✗ — breaks the rule. A fix is proposed.
  • ? — probably breaks it, but check by eye: a single word, or a capitalised word that might be a proper noun ("Venice Inc", "Ravenna").

The scanner is a regex heuristic, not a parser. It misses strings built at runtime and sometimes catches non-UI text. Read every flagged line in context before changing it. When a flag turns out to be a proper noun, add it to names instead of skipping it silently, so the next run is quiet.

It also lists every CSS text-transform it finds: on those elements, what users see is not what the source says, so judge them by the rendered result.

4. Fix

  • Change the source string, not the display. Show the user the list of changes (file:line, before → after) before applying a large batch.
  • Locale files: fix the source language only (usually en.json). Other languages follow their own grammar; never copy English casing into them.
  • UPPERCASE as a visual style: write the string in Sentence case and apply text-transform: uppercase in CSS. Screen readers may spell out hard-coded caps letter by letter, copy-paste carries the shouting, translations get the wrong base text, and the style can change in one place later.
  • Don't fix with text-transform: capitalize. It capitalises every word, minor words included ("Terms Of Service"). That's Start Case, not Title Case, and it can't tell proper nouns apart.
  • Keep punctuation consistent with the case: buttons, tabs, titles and labels take no trailing period; full-sentence toasts and errors do.

5. Keep it

Offer, don't impose: a CI or pre-commit step that fails on new violations.

node <path>/scan-casing.mjs src --check     # exit 1 if any ✗

To use it in CI, copy scan-casing.mjs into the repo (e.g. scripts/) so the check doesn't depend on this skill being installed.

Writing new UI text (the everyday case)

Most of the time this skill isn't an audit. You're adding one button. Before writing the string:

  1. Check the rule for its role (ui-casing.json, or the CLAUDE.md section).
  2. No rule? Look at three or four existing strings of the same role nearby: the same component, the same screen, the same locale file. Match them.
  3. Write the string in that style, keeping proper nouns as they are.

If the existing strings disagree with each other, say so to the user briefly instead of silently picking one, because they are seeing the start of exactly the drift this skill exists to stop.

Edge cases

  • Proper nouns, brands, acronyms keep their own case in every style: "Sign in with Google", "Export as PDF", "Open in iPhone". Product feature names count only if the product treats them as names. Decide once, add them to names.
  • Full sentences (toast messages, error text, descriptions, empty-state body) are always sentence case with normal punctuation, even in a Title Case product. Only short UI labels follow the role rule.
  • After a colon a new segment may start with a capital: "Section: Welcome" is fine in Sentence case.
  • Turkish: Title Case is unusual in Turkish UI; Sentence case is natural. Use locale-aware conversion: "istanbul".toUpperCase() gives "ISTANBUL" without the dot, toLocaleUpperCase('tr-TR') gives "İSTANBUL". For CSS uppercase, set lang="tr" on the element or page so the browser uses İ/ı. Run the scanner with --lang tr (or "lang": "tr" in the rules).
  • German capitalises all nouns, so its Sentence case still has capitals mid-string. Don't flag those, and don't apply English rules to German locale files.
  • Leave alone: user-generated content, legal text, code identifiers, log and developer-only messages, test fixtures, quoted names of things.

Scanner reference

node scripts/scan-casing.mjs [dirs…] [options]
  --rules <file>   convention file (default: ./ui-casing.json if present)
  --names A,B      extra proper nouns, comma separated
  --lang <code>    locale for case conversion (tr, az, de…)
  --json           machine-readable output
  --check          exit 1 when there are ✗ outliers
  --all            list every string found, not only outliers

It reads HTML, JSX/TSX, Vue, Svelte, Astro and common template files, plus JSON files under locales/, i18n/, lang/, messages/ or translations/. In locale files it infers the role from the key name (submitButton, page.title, email.placeholder). It skips node_modules, build folders and dot-folders, and ignores long prose (over 14 words), since prose is sentence case by nature.