Skip to main content
rule CX Codex

ui-styling — Claude Code rule: what it does, how to install

ui-styling enforces modern React Native styling practices: smooth continuous borders, gap spacing, CSS boxShadow syntax, and native gradients.

MIT ★ 1,216 updated 2026-10-24

Install into Claude Code · Plugin marketplace All methods and platforms ↓
/plugin marketplace add fcakyon/claude-codex-settings
/plugin install react-skills@claude-settings
Open on GitHub

What ui-styling does

The rule guides the coding assistant to apply modern React Native styling standards across your components. It replaces nested child margin values with container-level gap, keeping spacing predictable alongside internal padding. Legacy shadow definitions with elevation and shadowOffset objects are replaced with standard CSS boxShadow strings.

Components avoid unnecessary packages for simple visuals. Gradients rely directly on experimental_backgroundImage with standard linear-gradient syntax instead of third-party wrappers. Visual hierarchy avoids scattered fontSize definitions, relying instead on fontWeight adjustments and grayscale palette contrast. Every borderRadius pairs with borderCurve: 'continuous' for smooth iOS-like corners.

Because this setup relies on modern React Native styling capabilities, projects running older runtime versions will fail to render properties like gap or CSS boxShadow properly.

What it helps with

  • switch child element margins to parent gap layouts
  • replace legacy elevation and shadowOffset with CSS boxShadow
  • apply continuous borderCurve to all rounded corners
  • render linear gradients without extra dependencies

Example prompts for the agent

  • Style this React Native settings view following ui-styling rules
  • Refactor the feed card shadows and spacing to modern React Native syntax
  • Review the styling in this screen component for consistent font weights and gap usage

How to install ui-styling

1Plugin marketplace

/plugin marketplace add fcakyon/claude-codex-settings
/plugin install react-skills@claude-settings

2Manually: put the files in place

.claude/rules/ui-styling.md

The paths frontmatter field limits the files

Step by step, with commands for each platform: AGENTS.md vs CLAUDE.md: what they are and which one to use

Questions about ui-styling

How to install ui-styling in Claude Code?

Add the repository and install the plugin by running /plugin marketplace add fcakyon/claude-codex-settings followed by /plugin install react-skills@claude-settings. Alternatively, place the rule file directly at .claude/rules/ui-styling.md.

What does ui-styling do?

It instructs the agent to generate cleaner React Native styles using native gradients, CSS boxShadow strings, parent gap, and continuous corner curves.

Why does the rule limit font sizes?

It restricts font size proliferation to ensure visual harmony, creating typographic hierarchy through varying fontWeight and grayscale colors instead.

Source text

ui-styling.md · MIT
---
title: Modern React Native Styling Patterns
impact: MEDIUM
impactDescription: consistent design, smoother borders, cleaner layouts
tags: styling, css, layout, shadows, gradients
---

## Modern React Native Styling Patterns

Follow these styling patterns for cleaner, more consistent React Native code.

**Always use `borderCurve: 'continuous'` with `borderRadius`:**

```tsx
// Incorrect
{ borderRadius: 12 }

// Correct – smoother iOS-style corners
{ borderRadius: 12, borderCurve: 'continuous' }
```

**Use `gap` instead of margin for spacing between elements:**

```tsx
// Incorrect – margin on children
<View>
  <Text style={{ marginBottom: 8 }}>Title</Text>
  <Text style={{ marginBottom: 8 }}>Subtitle</Text>
</View>

// Correct – gap on parent
<View style={{ gap: 8 }}>
  <Text>Title</Text>
  <Text>Subtitle</Text>
</View>
```

**Use `padding` for space within, `gap` for space between:**

```tsx
<View style={{ padding: 16, gap: 12 }}>
  <Text>First</Text>
  <Text>Second</Text>
</View>
```

**Use `experimental_backgroundImage` for linear gradients:**

```tsx
// Incorrect – third-party gradient library
<LinearGradient colors={['#000', '#fff']} />

// Correct – native CSS gradient syntax
<View
  style={{
    experimental_backgroundImage: 'linear-gradient(to bottom, #000, #fff)',
  }}
/>
```

**Use CSS `boxShadow` string syntax for shadows:**

```tsx
// Incorrect – legacy shadow objects or elevation
{ shadowColor: '#000', shadowOffset: { width: 0, height: 2 }, shadowOpacity: 0.1 }
{ elevation: 4 }

// Correct – CSS box-shadow syntax
{ boxShadow: '0 2px 8px rgba(0, 0, 0, 0.1)' }
```

**Avoid multiple font sizes – use weight and color for emphasis:**

```tsx
// Incorrect – varying font sizes for hierarchy
<Text style={{ fontSize: 18 }}>Title</Text>
<Text style={{ fontSize: 14 }}>Subtitle</Text>
<Text style={{ fontSize: 12 }}>Caption</Text>

// Correct – consistent size, vary weight and color
<Text style={{ fontWeight: '600' }}>Title</Text>
<Text style={{ color: '#666' }}>Subtitle</Text>
<Text style={{ color: '#999' }}>Caption</Text>
```

Limiting font sizes creates visual consistency. Use `fontWeight` (bold/semibold)
and grayscale colors for hierarchy instead.

© fcakyon · MIT · fcakyon/claude-codex-settings

Similar IDE rules

All IDE rules for Mobile →

From the same set113

The whole set →
review-pr The review-pr skill checks pull requests for bugs, regressions, risky changes, and missing tests. Use it to get a focused list of issues before approving a PR. CX Codex +1 ★ 1,216repo stars animation-gpu-properties animation-gpu-properties — a rule that keeps animations off width, height, top, left, margin and padding and moves them onto transform and opacity, so no layout pass runs per frame. CX Codex +1 ★ 1,216repo stars rerender-no-inline-components The rerender-no-inline-components rule flags React components declared inside other components, a pattern that causes remounts on parent renders. Use it when state, focus, or scroll position keeps resetting. CX Codex +1 ★ 1,216repo stars state-ground-truth state-ground-truth — a rule that stops agents from storing derived visual values in state. Keeps React and Reanimated logic centered on facts. CX Codex +1 ★ 1,216repo stars ui-measure-views ui-measure-views guides agents to measure React Native view dimensions using useLayoutEffect alongside onLayout without triggering unneeded re-renders. CX Codex +1 ★ 1,216repo stars create-issue create-issue is a Claude Code skill for drafting or revising issues about bugs and missing features. It can also refine an issue title or body before publication. CX Codex +1 ★ 1,216repo stars list-performance-item-memo list-performance-item-memo — a rule for React list rows: split the item into primitive props so memo() can compare them shallowly and skip a render when nothing changed. CX Codex +1 ★ 1,216repo stars react-state-dispatcher react-state-dispatcher enforces functional dispatch updaters in React setState calls whenever state depends on current values. Prevents stale closures in callbacks. CX Codex +1 ★ 1,216repo stars

Project sponsors

Companies that keep this analytics open