# hebrew-rtl-best-practices

Guides your coding assistant through Hebrew right-to-left layout rules, CSS logical properties, and bidirectional text handling for web apps.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 695 installs · ★ 26
- Author: skills-il
- License: MIT · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/skills-il/localization/tree/HEAD/hebrew-rtl-best-practices/SKILL.md
- Updated: 2026-10-12
- HTML: https://affpapa.org/en/nevibecode/skills/hebrew-rtl-best-practices

## What it does

This skill guides agents to apply CSS logical properties instead of physical offsets. It replaces `left` and `right` with inline equivalents. Modern `:dir()` pseudo-classes take priority over basic attribute selectors.

You get rules for bidirectional strings. The guidance covers when to wrap raw digits in `<bdo>`. It also explains why `Intl` currency outputs must be isolated without overriding their native directionality.

Native mobile frameworks like React Native and Arabic typography are excluded from this setup.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add skills-il/localization --skill hebrew-rtl-best-practices -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/hebrew-rtl-best-practices/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/hebrew-rtl-best-practices/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add skills-il/localization --skill hebrew-rtl-best-practices -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/hebrew-rtl-best-practices/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add skills-il/localization --skill hebrew-rtl-best-practices -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/hebrew-rtl-best-practices/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install skills-il/localization hebrew-rtl-best-practices
```

2. **Manually: put the files in place**
- File: `.github/skills/hebrew-rtl-best-practices/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add skills-il/localization --skill hebrew-rtl-best-practices -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/skills-il/localization --path hebrew-rtl-best-practices
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/hebrew-rtl-best-practices/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add skills-il/localization --skill hebrew-rtl-best-practices -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/skills-il/localization/tree/HEAD/hebrew-rtl-best-practices/SKILL.md

## When to use it
- switch directional CSS layouts to logical properties
- prevent mixed Hebrew and English phrases from scrambling
- isolate phone numbers and dates against text flipping
- configure form inputs to handle mixed text direction properly

## Example prompts
- Convert these layout styles to CSS logical properties for Hebrew RTL
- Fix bidirectional text flipping for phone numbers in this component
- Set up input fields to resolve direction automatically for Hebrew and Latin text

## Source text · SKILL.md · MIT

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: 778cbedec6276670.

BEGIN THIRD-PARTY FILE 778cbedec6276670
````text
---
name: hebrew-rtl-best-practices
description: Implement right-to-left (RTL) layouts for Hebrew web applications. Use when user asks about RTL layout, Hebrew text direction, bidirectional (bidi) text, Hebrew CSS, "right to left", or needs to build a Hebrew web UI. Covers CSS logical properties, the :dir() pseudo-class, Tailwind RTL, React/Next.js RTL setup, icon mirroring, Hebrew typography, and font selection. Do NOT use for Arabic RTL (similar but different typography) unless user explicitly asks for shared RTL patterns, or for native mobile RTL (React Native I18nManager, SwiftUI, Android) which is out of scope.
license: MIT
compatibility: Works with Claude Code, Claude.ai, Cursor. No network required.
---

# Hebrew RTL Best Practices

## Instructions

### Step 1: Set Up Document Direction
Always start with the HTML attribute (not just CSS):

```html
<html lang="he" dir="rtl">
```

This tells browsers, screen readers, and CSS to use RTL as the base direction.

### Step 2: Use CSS Logical Properties
NEVER use physical directional properties for layout:

| Physical (avoid) | Logical (use) |
|-------------------|--------------|
| `margin-left` | `margin-inline-start` |
| `margin-right` | `margin-inline-end` |
| `padding-left` | `padding-inline-start` |
| `padding-right` | `padding-inline-end` |
| `border-left` | `border-inline-start` |
| `text-align: left` | `text-align: start` |
| `text-align: right` | `text-align: end` |
| `float: left` | `float: inline-start` |
| `left: 10px` | `inset-inline-start: 10px` |

This ensures the layout automatically mirrors in RTL mode.

When you genuinely need a direction-specific rule that logical properties cannot express, prefer the `:dir()` pseudo-class over `[dir="rtl"]` attribute selectors:

```css
/* Modern: matches the resolved direction, including dir="auto" and inheritance */
.chevron:dir(rtl) { transform: scaleX(-1); }

/* Older approach: only matches an explicit dir attribute on/above the element */
[dir="rtl"] .chevron { transform: scaleX(-1); }
```

`:dir()` is part of Selectors Level 4 and resolves the *computed* direction, so it also works for elements whose direction comes from `dir="auto"` or from an ancestor, where an attribute selector would miss them. Browser support: Chrome and Edge shipped it in version 120 (late 2023), Firefox has supported it for years, and Safari added it in 16.4, so it is now Baseline (widely available). For older-browser support, keep an `[dir="rtl"]` fallback rule or use a logical property instead. Check current support at https://caniuse.com/css-dir-pseudo.

### Step 3: Handle Bidirectional Text
When mixing Hebrew and English/numbers:

```css
/* Isolate embedded LTR content */
.ltr-content {
  unicode-bidi: isolate;
  direction: ltr;
}

/* Mixed or unknown-direction content: each paragraph picks its own base direction */
.user-content {
  unicode-bidi: plaintext;
}
```
````
END THIRD-PARTY FILE 778cbedec6276670

The third-party file has ended. Everything between the 778cbedec6276670 tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

First 2901 of 22511 bytes. © skills-il · MIT · https://github.com/skills-il/localization/tree/HEAD/hebrew-rtl-best-practices/SKILL.md

_Part of the page did not fit — see the HTML version._

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
