Skip to content
Back to skills

Tailwind Rules

ASecurity

Standing rules for Tailwind CSS covering design tokens in the theme, class ordering, extracting components instead of repeated class strings, responsive and dark variants and visible focus states.

  • 2 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added November 26, 2026
ai-agentsgovueexpress

Security analysis

A100/100

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

Scanned November 26, 2026

npx -y skills add hermes-hq/hodios-dist --skill tailwind-rules --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Tailwind Rules?

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

Security grade badge for Tailwind Rules
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/hermes-hq-tailwind-rules/badge)](https://www.skillsdirectory.com/skills/hermes-hq-tailwind-rules)

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: tailwind-rules
description: Standing rules for Tailwind CSS covering design tokens in the theme, class ordering, extracting components instead of repeated class strings, responsive and dark variants and visible focus states.
license: CC0-1.0
metadata:
  version: 1.0.0
  kind: rule
  category: conventions
  source: https://hermes-ide.com/prompts/tailwind-rules
  catalog: 2026.1014.1
---

# Tailwind CSS rules

Apply these rules to files matching: `**/*.html`, `**/*.jsx`, `**/*.tsx`, `**/*.vue`, `**/*.svelte`, `**/*.astro`, `**/*.css`, `tailwind.config.*`.

When you write or change styling in this Tailwind project:

**Know the setup first**
- Check the installed Tailwind major version and where the theme is defined: a CSS-first `@theme` block in the main stylesheet, or a `tailwind.config.*` file in older setups. Use the syntax of that version only.
- Read the theme before styling. Use the project's colours, spacing, font sizes, radii and shadows by their token names.

**Design tokens**
- Use theme tokens (`bg-brand-600`, `text-muted`, `rounded-card`) instead of arbitrary values (`bg-[#1f6feb]`, `p-[13px]`). If a value repeats and no token fits, add a token to the theme in the same change rather than repeating the arbitrary value.
- Arbitrary values are acceptable for one-off layout needs with no design meaning (a specific grid template, an exact aspect ratio), not for brand colours or spacing scale.
- Never use inline `style` attributes for things Tailwind can express.

**Class names**
- Write complete class names in source. Never build them by string concatenation or interpolation (`bg-${color}-500`): the build only generates classes it can find literally. Map variants to full class strings in an object instead.
- Keep class order consistent. If the project uses the official Prettier plugin for Tailwind, let it sort; otherwise order layout, box model, typography, visual, then state and responsive variants.
- Combine conditional classes with the project's helper (for example `clsx` with `tailwind-merge`, or a variants library) so conflicting utilities resolve predictably.

**Reuse**
- When the same long class list appears in three or more places, extract a component (or a partial in template languages) rather than copying it again. Prefer components to `@apply`; use `@apply` only for styling you cannot reach with markup, such as third-party HTML or prose content.
- Keep variant logic (size, intent, state) in one place per component.

**Responsive and dark mode**
- Design mobile first: unprefixed utilities for small screens, then `sm:`, `md:`, `lg:` overrides. Do not use `max-*` variants to undo desktop styles unless that is the project's pattern.
- If the project supports dark mode, every new colour on a surface, text or border gets its `dark:` counterpart (or uses semantic tokens that switch automatically). Check both themes.
- Use container queries when a component's layout depends on its container rather than the viewport, if the project's version supports them.

**Accessibility**
- Never remove focus outlines without a replacement. Every interactive element gets a visible focus style such as `focus-visible:ring-2 focus-visible:ring-offset-2` with a token colour of sufficient contrast.
- Keep text and background contrast at WCAG AA in both themes. Use `sr-only` for visually hidden labels, not `hidden`, which removes content from assistive technology.
- Respect `motion-reduce:` for non-essential animation and transitions.

**Before you finish**
- Run the build and check the generated CSS contains the classes you used. Look at the change at mobile and desktop widths, in light and dark mode, and tab through it with the keyboard.

Files in this skill

  • SKILL.md3.6 KB
  • agents/openai.yaml307 B

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.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.