Hub rules-tailwindcss

rules-tailwindcss

v4 public Verified

Tailwind CSS

Tailwind CSS is a utility-first CSS framework for rapid UI development. These rules govern dynamic class construction safety, configuration best practices, and purging optimization for AI agents.

@sigmashakeinc 4 pulls 17 rules published Apr 8, 2026 synced Oct 11, 2026 sigmashakeinc/rules/rulesets/rules-tailwindcss →
Severity
6 error 10 warn 1 info
demo.cast
Tailwind CSS is a utility-first CSS framework for rapid UI development. These rules govern dynamic class construction safety, configuration best practices, and purging optimization for AI agents.

Rules index

17 governance rules

Indexed from the repository's .rules files, grouped by technology. Expand any rule to read the raw source.

tailwindcss

tailwindcss-ask-content-glob-too-broad warning ask

RISK: A bare './**/*' content glob scans node_modules, .env, and build artifacts — secrets can leak into the generated CSS as class strings, and builds become very slow. FIX: Restrict to source dirs, e.g. ['./src/**/*.{js,ts,jsx,tsx,html}'].

Rule source requires an active Pro or Enterprise subscription.
tailwindcss-ask-safelist-from-variable warning ask

RISK: Building safelist from a variable/import can pull untrusted strings into CSS generation, bloating output or enabling regex DoS. FIX: Inline a static array of safelisted classes or {pattern: /.../} entries.

Rule source requires an active Pro or Enterprise subscription.
tailwindcss-deny-arbitrary-url-interpolation error block

RISK: Interpolating values into a Tailwind arbitrary url() class enables CSS-based data exfiltration (the URL is fetched by the browser even though React escapes attributes). FIX: Use a fixed allow-list of asset URLs or set the background via a sanitized inline style with a parsed URL.

Rule source requires an active Pro or Enterprise subscription.
tailwindcss-deny-javascript-url-arbitrary error block

RISK: javascript: URLs inside Tailwind arbitrary values execute in some legacy contexts and indicate an XSS sink. FIX: Remove the javascript: URL; use event handlers in JS instead.

Rule source requires an active Pro or Enterprise subscription.
tailwindcss-deny-jit-mode error block

RISK: 'mode: jit' was removed — JIT is always-on since v3.0 and the key is invalid in v4. FIX: Delete the mode key entirely.

Rule source requires an active Pro or Enterprise subscription.
tailwindcss-deny-play-cdn-prod error block

RISK: Tailwind Play CDN is dev-only per official docs — it ships the full generator, runs at runtime, and is a supply-chain dependency on a third-party origin. FIX: Install tailwindcss as a build dependency (npm i tailwindcss @tailwindcss/postcss) and compile locally.

Rule source requires an active Pro or Enterprise subscription.
tailwindcss-deny-postcss-vulnerable error block

RISK: PostCSS <8.4.31 is vulnerable to CVE-2023-44270 (ReDoS in line/source-map parsing). FIX: Upgrade to postcss ^8.4.31 or newer.

Rule source requires an active Pro or Enterprise subscription.
tailwindcss-deny-wildcard-safelist error block

RISK: A '.*' safelist disables purging and ships a multi-MB CSS bundle. FIX: Use precise class names or scoped {pattern: /^bg-(red|blue)-\d+$/} entries.

Rule source requires an active Pro or Enterprise subscription.
tailwindcss-warn-apply-in-css-modules info log

RISK: In Tailwind v4, @apply inside CSS Modules / scoped stylesheets needs an explicit '@reference' to the main stylesheet or it silently produces no styles. FIX: Add '@reference "../app.css";' (or your entry) at the top of the module.

Rule source requires an active Pro or Enterprise subscription.
tailwindcss-warn-apply-in-templated-css warning log

RISK: @apply with template-interpolated class names executes at build time on attacker-controllable input and can pull arbitrary utilities into a selector. FIX: Use only static class names with @apply; compose dynamic styles in JS.

Rule source requires an active Pro or Enterprise subscription.
tailwindcss-warn-decoration-slice warning log

RISK: decoration-slice/clone utilities were removed in v4. FIX: Use box-decoration-slice / box-decoration-clone.

Rule source requires an active Pro or Enterprise subscription.
tailwindcss-warn-deprecated-flex-shrink-grow warning log

RISK: flex-shrink-* and flex-grow-* were renamed to shrink-* / grow-* in Tailwind v4. FIX: Replace with shrink-0, grow, etc.

Rule source requires an active Pro or Enterprise subscription.
tailwindcss-warn-deprecated-opacity-utils warning log

RISK: bg-opacity-*/text-opacity-*/etc were removed in Tailwind v4. FIX: Use slash color syntax such as bg-black/50, text-white/75.

Rule source requires an active Pro or Enterprise subscription.
tailwindcss-warn-dynamic-class warning log

RISK: Dynamically constructing Tailwind classes via concatenation/interpolation breaks JIT detection so styles are missing in production. FIX: Use complete class strings, a clsx/cva mapping, or an explicit safelist.

Rule source requires an active Pro or Enterprise subscription.
tailwindcss-warn-purge-key warning log

RISK: The 'purge' config key was renamed to 'content' in v3 and removed in v4. FIX: Rename to 'content' (v3) or migrate to v4 CSS-first @source directives.

Rule source requires an active Pro or Enterprise subscription.
tailwindcss-warn-v3-directives warning log

RISK: The @tailwind base/components/utilities directives are deprecated in Tailwind v4. FIX: Replace with a single '@import "tailwindcss";' at the top of your entry CSS (see v4 upgrade guide).

Rule source requires an active Pro or Enterprise subscription.
tailwindcss-warn-v4-postcss-plugin warning log

RISK: In Tailwind v4 the PostCSS plugin moved to the separate '@tailwindcss/postcss' package; using 'tailwindcss' directly in postcss.config will fail to build. FIX: Install @tailwindcss/postcss and reference it instead.

Rule source requires an active Pro or Enterprise subscription.

Version metadata

Published metadata

The hash-locked record of this published ruleset. When source contents change, the maintainer resyncs and the version bumps.

Version
v4
Published
Apr 8, 2026
Source commits
0
Synced
Oct 11, 2026
Hash
e48fb43459c4b61ee7a847287d087df0eb0a2d0b26e46b000aa702a1e3f0ac69
Signature
Verified (publisher key)
Tested with
claude-code@current
Plan
Starter (free)
Visibility
Public

Source history

Recent commits

Latest commits touching rulesets/rules-tailwindcss/.sigmashake/rules in sigmashakeinc/rules/rulesets/rules-tailwindcss. The published version only bumps when a maintainer resyncs.

No commit history available.