Skip to main content
rule CX Codex

icons — rule for Claude Code and Codex: icon imports and styling

This rule enforces icon imports from your project's configured library and removes manual sizing from components. Use it to keep all icons consistent across the codebase.

LicenseRef-Proprietary ★ 7,523 updated 2026-10-29

Install into Claude Code · Manually: put the files in place All methods and platforms ↓
.claude/rules/icons.md
Open on GitHub

What icons does

The rule sets three constraints. First: import icons from the library specified in your project's iconLibrary field. If it says lucide, use lucide-react; if tabler, use @tabler/icons-react. Never default to lucide-react without checking.

Second: add data-icon="inline-start" (before text) or data-icon="inline-end" (after text) to icons inside buttons and other components. Skip sizing classes like mr-2 size-4 — the component handles those via CSS.

Third: pass icons as React components, not string keys. Instead of a lookup table with icon="check", pass icon={CheckIcon}. This keeps types tight and prevents mapping mistakes.

What it helps with

  • pick the correct icon package from project config and import from it
  • place an icon in a button without extra sizing classes
  • pass an icon to a component as a type-safe React component
  • ensure all icons have consistent sizes and spacing

Example prompts for the agent

  • Check the project's iconLibrary and import CheckIcon from lucide-react if it's set to lucide
  • Add an icon to a button with data-icon="inline-start" without className="size-4"
  • Pass icon={AlertIcon} to StatusBadge instead of the string icon="alert"

How to install icons

Manually: put the files in place

.claude/rules/icons.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 icons

How do I install the icons rule in Claude Code?

Create .claude/rules/icons.md in your project root or copy it there if it already exists. Claude Code loads all rules from this folder on startup.

What does the icons rule do?

It enforces using your project's iconLibrary for all imports, removes manual sizing on component icons, and requires passing icons as React components instead of string keys.

Why can't I add size-4 or similar classes to icons inside Button?

The Button component already controls icon size through CSS. Extra classes override the styles and break the design.

Similar IDE rules

All IDE rules for Frontend and UI →

From the same set42

The whole set →
triage This subagent reviews GitHub issues with github-triage, applies labels, and routes issues to people under explicit assignment rules. CX Codex ★ 7,523repo stars ipollowork-design-graphics ipollowork-design-graphics edits posters and card series inside an iPolloWork Design session — copy, theme, single elements. Useful when the host already built the layout and you need changes, not a rebuild. CX Codex +1 ★ 7,523repo stars ipollowork-design-web ipollowork-design-web edits web pages and app interfaces within an active iPolloWork Design session. Useful when updating layouts and design tokens safely. CX Codex +1 ★ 7,523repo stars ipollowork-design-editorial ipollowork-design-editorial is a Claude Code and Codex skill that creates and edits articles and reports in an active iPolloWork Design session. CX Codex +1 ★ 7,523repo stars ipollowork-video-studio ipollowork-video-studio routes video production requests in iPolloWork to dedicated skills for scripting, visual assembly, narration, or soundtrack editing. CX Codex +1 ★ 7,523repo stars get-env-var get-env-var is a Claude Code skill that loads Infisical secrets into the shell environment or runs a command with project secrets. It lets scripts access a token or API key. CX Codex +1 ★ 7,523repo stars daytona-chrome-cdp daytona-chrome-cdp starts a separate Chromium inside a Daytona sandbox and exposes it over CDP, so you can finish web sign-in, OAuth or admin flows in a real browser. CX Codex +1 ★ 7,523repo stars ipollowork-presentations ipollowork-presentations guides agents in building and refining slide decks inside an iPolloWork Design session while keeping layout contracts and tokens intact. CX Codex +1 ★ 7,523repo stars

More in the catalog

Project sponsors

Companies that keep this analytics open