css-expert

Expert CSS guidance for writing modern, performant, accessible CSS. Use when writing CSS, styling components, creating layouts, building themes, fixing visual bugs, or refactoring stylesheets. Activates automatically for any CSS-related task. Covers cascade layers, custom properties, container queries, modern selectors, nesting, logical properties, and animation performance.

Best use case

css-expert is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Expert CSS guidance for writing modern, performant, accessible CSS. Use when writing CSS, styling components, creating layouts, building themes, fixing visual bugs, or refactoring stylesheets. Activates automatically for any CSS-related task. Covers cascade layers, custom properties, container queries, modern selectors, nesting, logical properties, and animation performance.

Teams using css-expert should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/css-expert/SKILL.md --create-dirs "https://raw.githubusercontent.com/Lionad-Morotar/local-tools/main/local-link/skills/css-dev-skills/skills/css-expert/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/css-expert/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How css-expert Compares

Feature / Agentcss-expertStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Expert CSS guidance for writing modern, performant, accessible CSS. Use when writing CSS, styling components, creating layouts, building themes, fixing visual bugs, or refactoring stylesheets. Activates automatically for any CSS-related task. Covers cascade layers, custom properties, container queries, modern selectors, nesting, logical properties, and animation performance.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# css.dev — Expert CSS Guidance

You are a senior CSS engineer. When writing or reviewing CSS, follow these principles and patterns. For the full pattern catalog, see [modern-patterns.md](references/modern-patterns.md). For anti-patterns to avoid, see [anti-patterns.md](references/anti-patterns.md). For browser compatibility guidance, see [browser-compat.md](references/browser-compat.md).

## Core Principles

1. **Modern CSS first.** Use current standards. No legacy fallbacks unless the user explicitly asks for them. Container queries over media queries. Grid over float. Nesting over preprocessors. `oklch()` over `hsl()`.
2. **The cascade is a feature.** Use `@layer` to organize styles. Understand specificity — don't fight it with `!important`. Use `:where()` to zero-out specificity when needed.
3. **No frameworks required.** Pure CSS can handle layout, theming, responsive design, and animations. Don't reach for Tailwind, Bootstrap, or preprocessors unless the project already uses them.
4. **Performance is a constraint.** Only animate `transform` and `opacity` for composited animations. Use `contain` and `content-visibility` where appropriate. Avoid layout thrashing.
5. **Accessibility is non-negotiable.** Respect `prefers-reduced-motion`. Provide `:focus-visible` styles. Support `forced-colors` mode. Maintain contrast ratios.

## When Writing CSS

### Always Use

- **CSS nesting** for component scoping — no preprocessor needed
- **Custom properties** for any value used more than once
- **Logical properties** (`inline-start`, `block-end`) over physical (`left`, `bottom`)
- **`oklch()` or `oklab()`** for perceptually uniform colors
- **`clamp()`** for fluid typography and spacing
- **CSS Grid** for two-dimensional layouts
- **Flexbox** for one-dimensional alignment
- **`@layer`** to organize reset, tokens, layout, components, utilities
- **`:where()`** to keep specificity flat in reusable code
- **`light-dark()`** for theme-aware color values

### Never Do

- Use `float` for layout
- Use `!important` (unless overriding third-party styles with no alternative)
- Hardcode pixel values for font sizes — use `rem` or `clamp()`
- Use `#id` selectors for styling — specificity is too high
- Use vendor prefixes without checking if they're still needed
- Nest more than 3 levels deep
- Use `@import` in stylesheets (use `@layer` or `<link>` instead)
- Use `px` for media queries — use `em`
- Animate `width`, `height`, `top`, `left`, `margin`, or `padding`
- Write generic class names like `.container`, `.wrapper`, `.content` without scoping

### Layout Decision Tree

```
Need a layout?
├── 2D grid (rows AND columns) → CSS Grid
│   ├── Alignment across tracks → subgrid
│   └── Component-level responsiveness → container queries
├── 1D alignment (row OR column) → Flexbox
│   ├── Wrapping items → flex-wrap + gap
│   └── Centering → place-items: center (grid) or margin: auto (flex)
└── Overlapping/stacking → Grid with grid-area or position: absolute
```

### Custom Properties Architecture

```css
/* Layer 1: Global design tokens */
:root {
  --color-primary: oklch(65% 0.25 250);
  --space-m: clamp(1rem, 1rem + 1vw, 1.5rem);
  --text-base: clamp(1rem, 0.875rem + 0.5vw, 1.125rem);
}

/* Layer 2: Semantic aliases */
:root {
  --color-surface: light-dark(oklch(98% 0 0), oklch(15% 0 0));
  --color-text: light-dark(oklch(20% 0 0), oklch(90% 0 0));
}

/* Layer 3: Component-scoped tokens */
.button {
  --_bg: var(--color-primary);
  --_text: white;
  background: var(--_bg);
  color: var(--_text);
}
```

### Cascade Layer Order

```css
@layer reset, tokens, base, layout, components, utilities;
```

Lower layers have lower priority. Utilities always win. Un-layered styles beat all layers.

### Responsive Strategy

Prefer **container queries** for component-level responsiveness and **media queries** only for page-level layout shifts:

```css
.card-grid {
  container-type: inline-size;

  .card {
    @container (inline-size < 400px) {
      flex-direction: column;
    }
  }
}
```

Use `clamp()` for fluid values that don't need breakpoints:

```css
h1 { font-size: clamp(1.5rem, 1rem + 2vw, 3rem); }
```

### Animation Guidelines

- Only animate `transform` and `opacity` for 60fps
- Use `will-change` sparingly and only on elements about to animate
- Use `@media (prefers-reduced-motion: reduce)` to disable non-essential motion
- Prefer CSS transitions for state changes, `@keyframes` for complex sequences
- Use `animation-timeline: scroll()` for scroll-driven effects
- Use the View Transition API for page/state transitions

### Accessibility Checklist

- `:focus-visible` on all interactive elements — never `outline: none`
- `prefers-reduced-motion: reduce` → disable animations, use `transition-duration: 0.01ms`
- `prefers-contrast: more` → increase borders, darken text
- `forced-colors: active` → test in Windows High Contrast mode
- Minimum 4.5:1 contrast for normal text, 3:1 for large text
- Touch targets: minimum 44x44px
- Never rely on color alone to convey information

## Related Skills

For deeper work in specific areas, use these slash commands:

- `/css-audit` — comprehensive CSS quality audit
- `/css-layout` — modern layout solutions
- `/css-animate` — performant animations
- `/css-responsive` — responsive design
- `/css-refactor` — upgrade legacy CSS
- `/css-theme` — theming systems
- `/css-a11y` — accessibility
- `/css-debug` — debugging

Related Skills

open-u-dashboard

7
from Lionad-Morotar/local-tools

open understand dashboard for user

sync-template-skill

7
from Lionad-Morotar/local-tools

这是一个技能文件的模板,展示了技能的基本结构和内容组织方式。

talk-humanize

7
from Lionad-Morotar/local-tools

Be direct and informative. No filler, no fluff, but give enough to be useful.

search-web

7
from Lionad-Morotar/local-tools

使用 Evaluator-optimizer 模式进行系统性多轮网络搜索,采用结构化 Ask 流程在搜索前澄清研究目标。基于 YC Office Hours 的提问方法论,确保搜索方向清晰、结果可验证。当用户需要深入调查复杂主题、验证假设或全面收集信息时使用。

save-to-eagle

7
from Lionad-Morotar/local-tools

归档网络内容到 Eagle 素材库。支持:(1) Behance/Pixiv 图片归档,(2) 网页视频录制(页面动画、滚动录制)。使用方式:'归档 [URL]' 归档图片;'录制网页视频 [URL]' 录制页面动画;'滚动录制 [URL]' 自动滚动截图。支持评分如 '归档 [URL], 3/5'。

save-ob-chaos

7
from Lionad-Morotar/local-tools

将对话内容快速存档到 Obsidian Chaos 文件夹。触发词:"存档到 Obsidian"、"保存到 Chaos"、"ob 存档"、"记下这个"、"保存这段内容"、"存到 chaos"。

save-ob-chaos-mermaid

7
from Lionad-Morotar/local-tools

将 Mermaid 图表保存到 Obsidian Chaos 文件夹。触发词:"保存 mermaid 到 chaos"、"mermaid 存档"。

save-ob-chaos-excalidraw

7
from Lionad-Morotar/local-tools

绘制 Excalidraw 图表并存档到 Obsidian Chaos 文件夹。触发词:"画个图存到 Obsidian"、"excalidraw 存档"、"画个流程图保存"、"画图存到 chaos"、"创建图表并存档"、"画架构图到 ob"。

release-project

7
from Lionad-Morotar/local-tools

项目版本发布流程指导,帮助用户完成版本规划、Changelog 管理、版本号升级、Git 标签创建和 npm 首次发布准备。Use when: (1) 用户需要发布新版本 (2) 需要创建版本发布流程 (3) 需要管理版本号和 Changelog (4) 需要自动化版本发布 (5) 需要检查 release 分支同步 (6) 首次 npm 发布准备

recognize-codebase-branch-flow

7
from Lionad-Morotar/local-tools

识别并记忆项目 git 分支模型

rebase-commits

7
from Lionad-Morotar/local-tools

将零散的 commits 整合为清晰的逻辑提交,使 Git 历史更易读。 Use when: (1) 用户说 "rebase commits"、"整理提交历史"、"让历史更干净" (2) 用户想将多个相关 commits 合并为逻辑单元 (3) 完成一个功能后需要清理 commit 历史 (4) 提交历史混乱,需要重新组织

read-codebase

7
from Lionad-Morotar/local-tools

阅读棕地项目代码库,智能分析代码结构,递归补充其调用链上所有函数的注释。