用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/tomevault-io/skills-registry --skill rtl-web-development命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
正在显示 SKILL.md
基于 SOC 职业分类
| name | rtl-web-development |
| description | | Use when this capability is needed. |
You are generating frontend code. Unless explicitly told otherwise, assume the project may need RTL support. Following these conventions prevents layout bugs that are expensive to fix later.
Always use CSS logical properties and RTL-safe Tailwind classes. Never use physical direction properties (left, right, margin-left, margin-right) unless the positioning is intentionally physical and should NOT mirror.
| Never use | Always use | Why |
|---|---|---|
ml-* | ms-* | margin-left → margin-inline-start |
mr-* | me-* | margin-right → margin-inline-end |
pl-* | ps-* | padding-left → padding-inline-start |
pr-* | pe-* | padding-right → padding-inline-end |
left-* | start-* | left positioning |
right-* | end-* | right positioning |
text-left | text-start | text alignment |
text-right | text-end | text alignment |
border-l-* | border-s-* | border start |
border-r-* | border-e-* | border end |
rounded-l-* | rounded-s-* | border-radius start |
rounded-r-* | rounded-e-* | border-radius end |
rounded-tl-* | rounded-ts-* | top-start radius |
rounded-tr-* | rounded-te-* | top-end radius |
rounded-bl-* | rounded-bs-* | bottom-start radius |
rounded-br-* | rounded-be-* | bottom-end radius |
<!-- Bad -->
<div class="ml-4 mr-2 pl-3 pr-1 text-left rounded-l-lg border-l-2">
<!-- Good -->
<div class="ms-4 me-2 ps-3 pe-1 text-start rounded-s-lg border-s-2"></div>
</div>
| Physical | Logical |
|---|---|
margin-left / marginLeft | margin-inline-start / marginInlineStart |
margin-right / marginRight | margin-inline-end / marginInlineEnd |
padding-left / paddingLeft | padding-inline-start / paddingInlineStart |
padding-right / paddingRight | padding-inline-end / paddingInlineEnd |
border-left / borderLeft | border-inline-start / borderInlineStart |
border-right / borderRight | border-inline-end / borderInlineEnd |
left | inset-inline-start |
right | inset-inline-end |
width | inline-size |
height | block-size |
text-align: left | text-align: start |
text-align: right | text-align: end |
float: left | float: inline-start |
float: right | float: inline-end |
For the complete property table (border-color, border-width, border-style, min/max sizes), see references/mappings.md.
dir Attribute<html dir="rtl" lang="ar"></html>
<!-- OR -->
<html dir="ltr" lang="en"></html>
dir and lang on <html>, not via CSS direction alonedir="auto" on user-generated content containers where language is unknowndir on the element for correct word ordering<p dir="auto">مرحباً Welcome to the article about RTL design</p>
Flexbox and CSS Grid automatically respect the writing mode. Items reorder when dir="rtl" is set.
.header {
display: flex;
justify-content: space-between;
} /* auto-flips */
.layout {
display: grid;
grid-template-columns: 220px 1fr;
} /* auto-flips */
Gotcha: flex-direction: row-reverse also reverses in RTL, causing a double-flip back to LTR order. Never use row-reverse to "fix" RTL layout -- flexbox handles direction automatically.
Gotcha: explicit order values in flexbox do NOT auto-flip. Handle manually for RTL.
:dir() Pseudo-ClassUse :dir(rtl) for direction-based styling. Unlike [dir="rtl"], it matches elements that inherit direction from ancestors.
.element:dir(rtl) {
/* RTL styles */
}
.element:dir(ltr) {
/* LTR styles */
}
Browser support: Firefox, Chrome, Safari 16.4+, Edge.
<bdi> and <bdo><bdi> isolates user-generated content whose direction is unknown (prevents corrupting surrounding text)<bdo dir="ltr"> forces LTR for phone numbers, credit cards, code that must stay LTR<p>Welcome back, <bdi>Ahmed</bdi>! Your score: <bdi>۳۵۰</bdi></p>
<bdo dir="ltr">+1 (555) 123-4567</bdo>
<bdo dir="ltr">4111-1111-1111-1111</bdo>
rtl: VariantUse rtl: for directional icons and components that need explicit flipping:
<button class="rtl:rotate-180"><ArrowLeftIcon /></button>
<div class="text-start rtl:text-right">
<div class="ms-4 rtl:me-4 rtl:ms-0"></div>
</div>
Always prefer logical property utilities (ms-*, me-*, ps-*, pe-*, start-*, end-*) over rtl: variant hacks.
Never flip:
Force LTR when needed:
<span dir="ltr">+1 (555) 123-4567</span>
<code dir="ltr">console.log("hello");</code>
Flip (they indicate direction): arrows, breadcrumb separators, send icon, undo/redo, sort indicators.
Don't flip (universal/symmetrical): play/pause/stop, search, menu, close, plus, checkmark, home, settings, download/upload.
[dir="rtl"] .icon-arrow-right {
transform: scaleX(-1);
}
See references/arabic-typography.md for the full guide. Critical rules:
rgba() and opacity cause rendering artifacts between connected letterstext-decoration-skip-ink: auto or box-shadow underlinesbreak-all on Arabic -- connected letters can't break mid-wordSee references/component-patterns.md for detailed examples covering:
.c-input--search {
background-image: url("data:image/svg+xml,...");
background-position: right 6px center;
padding-inline-end: 32px;
}
Floats do NOT auto-flip. If you must use them:
.media__photo {
float: left;
margin-right: 16px;
}
[dir="rtl"] .media__photo {
float: right;
margin-right: 0;
margin-left: 16px;
}
Better: use flexbox instead.
translateX() does NOT auto-flip. Use scaleX(-1) for arrow icons:
.c-link:hover svg {
transform: translateX(6px);
}
[dir="rtl"] .c-link svg {
transform: scaleX(-1);
}
[dir="rtl"] .c-link:hover svg {
transform: scaleX(-1) translateX(6px);
}
Use start/end in class names, not left/right:
/* Bad */
.c-header__left {
}
.c-header__right {
}
/* Good */
.c-header__start {
}
.c-header__end {
}
<html dir={locale === "ar" ? "rtl" : "ltr"} lang={locale}>
CSS-in-JS (styled-components, Emotion) requires a Stylis plugin for RTL. MUI provides @mui/stylis-plugin-rtl:
import rtlPlugin from "stylis-plugin-rtl";
import { CacheProvider } from "@emotion/react";
import createCache from "@emotion/cache";
const cacheRtl = createCache({ key: "muirtl", stylisPlugins: [rtlPlugin] });
dir="rtl" on <html> in browser DevToolsFor automated linting of physical direction properties, use eslint-plugin-tailwind-rtl. It catches RTL bugs in CI and code review that slip past generation:
npm install --save-dev eslint-plugin-tailwind-rtl
:dir() pseudo-class (MDN)<bdi> element (MDN)Source: AmmarCodes/dotfiles — distributed by TomeVault.