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

.card {
  color: #f5f5f5;
  width: 600px;
  padding: 16px 0;
}
@media (max-width: 768px) {
  .card {
    padding: 12px 0;
  }
}
.card:hover {
  background-color: #e0e0e0;
}
@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%);
      }
    }
  }
}

Layers, scope, nesting, relative colors, andcontainer units afterwards.

Before & after with Claude Opus 5.5.

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.

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.

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