ModernCSS.AI

Modern CSS, written consistently.

Opinionated rules on top of Modern Web Guidance: a coding agent skill applies them and a Stylelint config enforces them.

Get started

Pair it with the Modern Web Guidance skill.

With the skill

This code applies the rules on layers, scope, nesting, relative colors, and container units.

@layer components {
  @scope (.card) to (.slot) {
    :scope {
      color: light-dark(oklch(96% 0 0deg), oklch(25% 0 0deg));
      container-type: inline-size;
      padding-block: clamp(1rem, 2cqi, 2rem);

      &:hover {
        background-color: oklch(from currentcolor l c h / 10%);
      }
    }
  }
}
Without the skill
.card {
  color: #f5f5f5;
  width: 600px;
  padding: 16px 0;
}
@media (max-width: 768px) {
  .card {
    padding: 12px 0;
  }
}
.card:hover {
  background-color: #e0e0e0;
}

Claude Opus 5.5, with and without the skill.

What are the rules

Read the full rules

Catch mistakes

Even with the skill, agents won't always get it right.

Use Stylelint with stylelint-config-modern to enforce every rule a linter can.

Run npm create stylelint@latest first if your project doesn't use Stylelint yet.

Then extend it in your stylelint.config.mjs:

 export default {
   extends: [
     "stylelint-config-standard",
+    "stylelint-config-modern",
   ],
 };

Why these rules

Left alone, agents default to the outdated CSS they were trained on. The Modern Web Guidance skill fixes that at scale.

It still leaves choices open: which color space, whether to scope, when to nest, how to size type. The rules in this skill make them once, so agents and people write the same CSS.

Get started

Contribute

Spotted a choice left open or a gap that needs plugging? Open an issue to propose a rule that settles or plugs it.

Get involved on GitHub