rtl-check
Skill1 starsChanged 2 days agoMITView on GitHub
Finds and fixes left/right styling that breaks Arabic, Hebrew, Persian or Urdu (right-to-left) pages in a Next.js App Router project with Tailwind CSS or plain CSS. Use after adding an RTL locale, after any UI change in an app that ships one, or when Arabic pages show spacing, borders, arrows or panels on the wrong side.
In this repository10 other files it gives its agents.
- add-admin-dashboardSkill
- app-screenshotsSkill
- design-rulesSkill
- docs-checkSkill
- i18n-keys-checkSkill
- nextjs-claude-mdSkill
- nextjs-hooksSkill
- production-checkSkill
- template-rebrandSkill
- vps-deploySkill
The file
We split this skill into the rules it gives an agent
11 rules. About 0 are common, 3 are distinctive, and 8 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
8
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 21
Check: it ends with a Summary: line.
- Very specific: line 23
Fix the layout first: if it says FAIL. Render <html lang={locale} dir={dir}> in the layout that owns <html> (usually …
- Very specific: line 28
Check: run step 1 again; the Layout line says ok.
- Very specific: line 33
Check: run step 1 again; To fix: 0.
- Distinctive: line 41
Check: run step 1 again; every remaining review line is something you chose to keep.
- Distinctive: line 46
Check: run step 1 again; those lines are gone from the report.
- Very specific: line 50
Check: grep -rn 'type="tel"\|type="email"' src and confirm each field has dir="ltr".
- Very specific: line 54
Check: the tag contains dir="rtl" and lang="ar" in the server HTML.
- Distinctive: line 57
Check: all exit with code 0.
- Very specific: line 61
Add to .claude/settings.json, with the path where this skill lives:
- Very specific: line 80
Check: /hooks lists it; ask for a test edit with ml-2 and the report appears.
≈ “Common” is an estimate: at least 1 in 5 of the 364,980 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
rtl-check
scripts/rtl-check.mjs (Node 20+, no dependencies) reports:
- Layout: whether the layout that renders
<html>setsdirfrom the locale on the server. - To fix: physical classes and properties, each with its logical replacement
(
ml-2 -> ms-2,text-left -> text-start,border-r -> border-e,margin-left -> margin-inline-start). - To review: things that may need an
rtl:version (arrows,translate-x, gradients, transform origins,rtl:flex-row-reverse).
Steps
- Run the check on the app folders (not the API):
node ${CLAUDE_SKILL_DIR}/scripts/rtl-check.mjs src(in a monorepo, list each app:... apps/web apps/admin). Check: it ends with aSummary:line. Exit code 0 means nothing to fix. - Fix the layout first if it says FAIL. Render
<html lang={locale} dir={dir}>in the layout that owns<html>(usuallyapp/[locale]/layout.tsx), withdircomputed on the server from the locale. Do not setdirinuseEffect, and do not put it on<body>or a wrapper<div>. If<html>must stay in a root layout above[locale], an inline<script>in that layout may setlanganddirfrom the first path segment. Check: run step 1 again; the Layout line saysok. - Apply every "To fix" line with the replacement it prints. Keep
mx-*,px-*,inset-x-*andleft-1/2 -translate-x-1/2(they are symmetric). Never addflex-row-reversefor Arabic: flex and grid already followdir. Check: run step 1 again;To fix: 0. - Decide each "To review" line. Arrows and chevrons that mean next/back get
rtl:rotate-180(orrtl:-scale-x-100). Motion that follows reading order gets anrtl:counterpart (group-hover:translate-x-1 rtl:group-hover:-translate-x-1). Removertl:flex-row-reverse. On Tailwind CSS 3,space-x-*anddivide-x-*use left and right sides and needrtl:space-x-reverse/rtl:divide-x-reverse; from Tailwind CSS 4 they followdirand need nothing. Check: run step 1 again; every remaining review line is something you chose to keep. - Mark what is physical on purpose. A before/after slider, a map popup, a progress bar
animated by a library, or tabs whose order is already reversed in code: put a comment
containing
rtl-check-ignoreand the reason on the line above. Check: run step 1 again; those lines are gone from the report. - Keep left-to-right content left to right. Prices, phone numbers, emails, order
references and code get
<bdi dir="ltr">(inline) ordir="ltr"(inputs and blocks). Check:grep -rn 'type="tel"\|type="email"' srcand confirm each field hasdir="ltr". - Check the real page. With the dev server running, request an Arabic page:
curl -s http://localhost:<port>/ar | grep -o '<html[^>]*>'Check: the tag containsdir="rtl"andlang="ar"in the server HTML. - Run the project's own checks (
lint,typecheck,build). Check: all exit with code 0.
Run it after every edit (optional)
Add to .claude/settings.json, with the path where this skill lives:
{
"hooks": {
"PostToolUse": [
{
"matcher": "Edit|Write",
"hooks": [
{ "type": "command", "command": "node \"$CLAUDE_PROJECT_DIR\"/.claude/skills/rtl-check/scripts/rtl-check.mjs --hook" }
]
}
]
}
}The hook checks only the edited file. When it finds something it exits with code 2, and
Claude Code shows its report to Claude, which fixes the line in its next step.
Check: /hooks lists it; ask for a test edit with ml-2 and the report appears.
Options: --json, --no-review, --ignore <text> (skip paths containing the text).
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.

