Skip to content
Back to skills

Collection

ASecurity

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.

  • 24 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added September 8, 2026
developmentgoreactci/cd

Security analysis

A100/100

Pro scans all 21 files and shows the line behind each finding

Scanned September 8, 2026

npx -y skills add mattnigh/skills_collection --skill collection --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Collection?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Collection
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/mattnigh-collection-dce66114/badge)](https://www.skillsdirectory.com/skills/mattnigh-collection-dce66114)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: semantic-theming
description: 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.
---

# Semantic Theming Skill

Use semantic design tokens instead of raw colors. This skill teaches Claude to write theme-compliant code from the start.

## Detection Criteria

**This skill applies when the project has ANY of:**

- `docs/THEMING.md` exists
- `eslint-rules/no-raw-colors.js` exists
- ESLint config includes `wescobar/no-raw-colors` or similar theming rule
- `src/index.css` defines CSS custom properties (e.g., `--color-primary`)

**Quick check:** Look for these indicators before applying this skill.

## When to Use

- Writing or editing React components with `className`
- Using Tailwind utility classes for colors/backgrounds/borders
- Working with `cn()`, `clsx()`, or `cva()` class composition
- Styling any UI element with colors

## Forbidden Patterns

### Raw Color Literals

```tsx
// FORBIDDEN - Will fail ESLint
style={{ color: '#ff0000' }}
style={{ backgroundColor: 'rgb(255, 0, 0)' }}
style={{ borderColor: 'hsl(0, 100%, 50%)' }}
```

### Non-Semantic Tailwind Classes

```tsx
// FORBIDDEN - Will fail ESLint
className="bg-red-500"
className="text-white"
className="border-blue-300"
className="bg-slate-900 text-gray-100"
className="from-purple-500 via-pink-500 to-red-500"
```

## Correct Patterns

### Semantic Token Classes

```tsx
// CORRECT - Use semantic tokens
className="bg-surface text-primary"
className="bg-surface-secondary border-primary"
className="bg-error text-error"
className="bg-success text-success"
className="text-secondary bg-primary"
```

### Common Semantic Tokens

| Category | Tokens |
|----------|--------|
| **Background** | `bg-surface`, `bg-surface-secondary`, `bg-primary`, `bg-error`, `bg-success` |
| **Text** | `text-primary`, `text-secondary`, `text-accent`, `text-error`, `text-success` |
| **Border** | `border-primary`, `border-error`, `border-surface` |

### With Class Composition

```tsx
// CORRECT - Semantic tokens in cn/clsx/cva
import { cn } from '@/lib/utils';

className={cn(
  "bg-surface text-primary",
  isActive && "bg-primary text-surface",
  hasError && "border-error text-error"
)}
```

### CVA Variants

```tsx
// CORRECT - Semantic tokens in cva
const buttonVariants = cva(
  "bg-surface text-primary border-primary", // Base
  {
    variants: {
      variant: {
        primary: "bg-primary text-surface",
        error: "bg-error text-surface",
        success: "bg-success text-surface",
      }
    }
  }
);
```

## Escape Hatches

When absolutely necessary (rare):

```tsx
// Line-level disable
// eslint-disable-next-line wescobar/no-raw-colors
className="bg-red-500" // Legacy code migration

// File-level disable (very rare)
/* eslint-disable wescobar/no-raw-colors */
```

**Use sparingly** - prefer fixing to disabling.

## Migration Examples

| Old (Forbidden) | New (Semantic) |
|-----------------|----------------|
| `bg-white` | `bg-surface` |
| `bg-gray-900` | `bg-surface-secondary` |
| `text-white` | `text-surface` (on dark bg) |
| `text-gray-900` | `text-primary` |
| `text-gray-500` | `text-secondary` |
| `border-gray-300` | `border-primary` |
| `bg-red-500` | `bg-error` |
| `bg-green-500` | `bg-success` |
| `text-blue-500` | `text-accent` |

## Project-Specific Tokens

**Check `docs/THEMING.md` or `src/index.css`** for the full list of available semantic tokens in this project. Token names may vary between projects.

## Integration with ESLint

The `no-raw-colors` ESLint rule enforces this at:
- Pre-commit hooks (blocks commit)
- IDE integration (inline errors)
- CI/CD pipeline

**Generate correct code from the start** to avoid fix cycles.

## Related Skills

- `validate-lint` - Run linting validation
- `quality-gate` - Complete quality checks including lint

## Validation

After writing styled code:
1. Check for any raw colors or non-semantic Tailwind classes
2. Replace with semantic tokens from the project's theme
3. If unsure, check `docs/THEMING.md` for available tokens

Files in this skill

  • 0Chan-smc__claude-code-workflow-lab__claude__skills__frontend-dev-guidelines__SKILL.md15.1 KB
  • 17hz__nextjs-template__claude__skills__example-skill__SKILL.md316 B
  • 1ambda__dataops-platform__claude__skills__context-synthesis__SKILL.md3.5 KB
  • 1natsu172__dotfiles__claude__skills__git-analysis__SKILL.md5.4 KB
  • 1natsu172__dotfiles__claude__skills__github-pr-best-practices__SKILL.md7.7 KB
  • 23Maestro__prospect-pipeline__claude__skills__npid-fastapi-skill.md26.1 KB
  • 360AYA25__ClaudeN8N__claude__skills__n8n-code-javascript__SKILL.md15.7 KB
  • 360AYA25__ClaudeN8N__claude__skills__n8n-code-python__SKILL.md17.5 KB
  • 360AYA25__ClaudeN8N__claude__skills__n8n-expression-syntax__SKILL.md9.4 KB
  • 360AYA25__ClaudeN8N__claude__skills__n8n-mcp-tools-expert__SKILL.md12.5 KB
  • 360AYA25__ClaudeN8N__claude__skills__n8n-node-configuration__SKILL.md16.6 KB
  • 360AYA25__ClaudeN8N__claude__skills__n8n-workflow-patterns__SKILL.md11.2 KB
  • 3x-Projetos__claude-memory-framework__claude__skills__scientist__SKILL.md14.8 KB
  • 5MinFutures__futures-arena__claude__skills__migration-tracker__SKILL.md16.2 KB
  • 5MinFutures__futures-arena__claude__skills__planning-guidelines__SKILL.md11.8 KB
  • 92Bilal26__TaskPilotAI__claude__skills__assessment-builder__SKILL.md17.5 KB
  • 92Bilal26__TaskPilotAI__claude__skills__book-scaffolding__SKILL.md19.1 KB
  • 92Bilal26__TaskPilotAI__claude__skills__code-validation-sandbox__SKILL.md6.2 KB
  • 92Bilal26__TaskPilotAI__claude__skills__exercise-designer__SKILL.md18.1 KB
  • 92Bilal26__TaskPilotAI__claude__skills__learning-objectives__SKILL.md24.5 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…