Back to Skills

semantic-theming

Enforce semantic CSS variable theming in Tailwind projects. Prevents raw colors (hex, rgb) and non-theme Tailwind classes. Use when project has semantic tokens, CSS vars, or custom ESLint theming rules.

6stars3forksUpdated 3/1/2026

Security Assessment

Safe(100/100)
Security Score100/100

About semantic-theming

The semantic-theming skill is designed to enforce the use of semantic CSS variable theming in Tailwind projects. It helps maintain consistency in design by preventing raw colors, such as hex, RGB, or HSL values, and ensures that only theme-compliant classes are used. This skill is crucial in projects that rely on semantic design tokens, CSS custom properties, or custom ESLint theming rules, facilitating a standardized approach to styling across the entire codebase. By leveraging predefined semantic tokens instead of arbitrary colors, teams can enforce a unified and scalable design system that is easy to maintain and adapt over time.

Key features of this skill include the automatic detection of raw colors and non-semantic Tailwind classes using ESLint rules and other project-specific indicators, such as `docs/THEMING.md` or custom CSS variables in `src/index.css`. Developers can quickly transition to using semantic tokens like `bg-surface`, `text-primary`, and `border-primary` without worrying about manually adjusting styles. It also integrates with ESLint to provide real-time feedback on improper styling during development, pre-commit hooks, and in CI/CD pipelines. The skill supports various utilities like `cn()`, `clsx()`, and `cva()` to facilitate the use of semantic tokens in React components and class composition.

This skill is particularly useful for frontend developers working in Tailwind CSS projects, especially those focused on React components. It ensures that styles are aligned with a project's design system, providing cleaner, more maintainable code. It is also essential for teams that want to enforce consistency in their user interfaces and reduce the risk of introducing design inconsistencies due to raw color usage or incorrect class names.

FAQ

How does the semantic-theming skill enforce theming?

The skill enforces theming by preventing the use of raw colors (hex, RGB, HSL) and non-semantic Tailwind classes. It relies on ESLint rules and checks for the presence of specific files like `eslint-rules/no-raw-colors.js` or `docs/THEMING.md`.

Can I use custom tokens with this skill?

Yes, custom tokens can be used if they are defined in your project's CSS files or theming documentation. Ensure that the tokens are listed in `docs/THEMING.md` or `src/index.css` for the skill to recognize and enforce them.

Is the skill compatible with React and Tailwind?

Yes, this skill is specifically designed to work with Tailwind CSS in React projects, particularly when using utilities like `className`, `cn()`, `clsx()`, and `cva()` for class composition.

What happens if I use forbidden patterns?

If forbidden patterns such as raw color literals or non-semantic Tailwind classes are used, the skill will fail the ESLint check and provide an error message, preventing the code from being committed or deployed until fixed.

How can I disable the skill temporarily?

You can disable the skill on a line or file level using ESLint's `eslint-disable` directive. However, this should be used sparingly, as the skill is designed to ensure consistent theming across your project.

All Files

2 files
SKILL.md4.0 KB
View
REFERENCE.md4.7 KB
View

Install semantic-theming

Download and extract the skill files to your .claude/skills/ directory.

Quick Setup:

  1. Copy the skill folder to .claude/skills/
  2. Claude will automatically detect and use the skill