--- name: rtl description: RTL skill for Arabic UI. Use when building, auditing, or converting Arabic interfaces — including apps for Saudi Arabia, UAE, or Egypt. Covers layout mirroring, logical properties, Arabic typography, directional icons, animations, forms, and bidirectional text. Triggers on /rtl-init, /rtl-audit, /rtl-convert, /rtl-check, or any mention of Arabic UI or RTL layout. Don't use for translation or non-Arabic RTL scripts. --- # RTL Skill — Arabic UI This skill makes you RTL-first. Not RTL-aware. RTL-first. Before generating any component, run the **Start/End Axis Test**: > "Does this element have a start and an end? If yes — it needs a conscious RTL decision." ## The Three Categories Every element in every component falls into one of these: | Category | Rule | Examples | |----------|------|---------| | **Always mirror** | Flip in RTL, no exceptions | Layout, flex direction, padding, margin, positioning, chevrons, arrows, progress bars, sliders, breadcrumbs | | **Never mirror** | Stay LTR always | Numbers, currency, phone numbers, URLs, code blocks, email addresses, mathematical expressions | | **Context-dependent** | Requires judgment | Images with people, decorative illustrations, brand logos | When in doubt: mirror it. It's easier to un-mirror than to discover it was wrong in production. --- ## Forbidden Workarounds **Violating the letter of these rules is violating the spirit. If you're rationalizing an exception, you're wrong.** Under pressure, agents reach for shortcuts that ship the change without solving the RTL problem. Don't. For each forbidden pattern below, the correct substitute is named — use it. ### 1. Don't match existing physical-property style "for consistency" **Forbidden:** ```css .card { margin-left: 16px; } /* matches the rest of the file */ ``` **Do instead:** Convert as you go. The codebase migrates one file at a time. ```css .card { margin-inline-start: 16px; } ``` ### 2. Don't add `!important` to override RTL bugs **Forbidden:** ```css .sidebar { left: 0 !important; } /* force-pin to "fix" RTL */ ``` **Do instead:** Fix the underlying property. ```css .sidebar { inset-inline-start: 0; } ``` ### 3. Don't wrap sections in `direction: ltr` to dodge mirroring decisions **Forbidden:** ```jsx
{/* whole feature */}
``` **Do instead:** Mark only the specific LTR island — a number, code snippet, or URL. ```jsx

الرصيد: $1,250.00

``` ### 4. Don't use `transform: scaleX(-1)` on text **Forbidden:** ```css [dir="rtl"] .heading { transform: scaleX(-1); } /* mirrors the glyphs */ ``` **Do instead:** `scaleX(-1)` is for **directional icons only**. For layout, use logical properties; for text alignment, use `text-align: start`/`end`. ### 5. Don't manipulate Arabic strings by character index **Forbidden:** ```js const initial = name.charAt(0); // breaks combined letterforms and tashkeel ``` **Do instead:** Use grapheme-aware APIs. ```js const initial = [...new Intl.Segmenter('ar', { granularity: 'grapheme' }).segment(name)][0]?.segment; ``` ### 6. Don't set positive `letter-spacing` on Arabic — ever **Forbidden:** ```css .brand { letter-spacing: 0.05em; } /* "for design reasons" */ ``` **Do instead:** Always `0` on Arabic text. If the design needs visual emphasis, use weight, size, or color — not spacing. Arabic is cursive; spacing breaks letter connections. ```css .brand { letter-spacing: 0; font-weight: 700; } ``` ### 7. Don't skip root `dir="rtl"` and set direction per-component **Forbidden:** ```jsx