用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/mikailustuner/OmniRule --skill css-variables命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
Bun runtime: HTTP server, file I/O, SQLite, test runner, package manager, bundler — all-in-one JS toolchain.
Clerk: Drop-in auth UI, Organizations, User management, JWT templates, webhooks, Next.js middleware integration.
Gelişmiş masaüstü, tarayıcı ve işletim sistemi kontrol yeteneği. Görsel (koordinat tabanlı) fare/klavye otomasyonu, DOM manipülasyonu, pencere yönetimi, gelişmiş dosya, ağ ve süreç yönetimini kapsar.
基于 SOC 职业分类
正在显示 SKILL.md
| name | css-variables |
| description | Custom properties, theming, runtime changes |
| triggers | {"extensions":[".css",".scss"],"keywords":["--var","custom properties","CSS variables","design tokens","theme","var("]} |
| auto_load_when | Working with CSS custom properties or design tokens |
| agent | style-architect |
| tools | ["Read","Write","Bash"] |
Focus: Custom properties, theming, runtime changes
When to use custom properties:
├── Theming → yes
├── Responsive values → yes
├── Runtime changes → yes
├── Shared values → yes
When to use for:
├── Colors → yes
├── Spacing → yes
├── Typography → yes
├── Animations → yes
└── Breakpoints → yes (with calc)
When to avoid:
├── Static values → hardcode
├── Once-only → hardcode
├── Performance-critical → hardcode
└── Complex calculation → precalculate
When to use CSS variables:
├── Runtime theming → yes
├── Multiple themes → yes
├── User preference → yes
└── No framework → yes
When to use framework theming:
├── Design system → yes
├── Dark mode built-in → yes
├── Theme provider → yes
└── CSS-only theme → CSS variables
When to structure:
├── By category → colors/typography/spacing
├── By component → component-scoped
├── Global then scoped → yes
└── Flat → avoid for scaling
When to use global:
├── Shared values → yes
├── Defaults → yes
├── Token values → yes
└── Cross-component → yes
When to use scoped:
├── Component-specific → yes
├── Override global → yes
├── Shadow DOM → required
└── Isolation → yes
When to use --css-var-prefix:
├── Design system → yes
├── Third-party conflict → yes
├── All same prefix → consistent
└── No conflict → optional
When to change via JS:
├── User interaction → yes
├── Theme toggle → yes
├── Device preference → yes
└── Feature detection → yes
When to change via CSS:
├── Media queries → yes
├── Hover/focus → yes
├── Container queries → yes
└── @supports → yes
When to use prefers-color-scheme:
├── System dark mode → yes
├── User preference → yes
├── Fallback → yes
└── Manual toggle → also provide
When to add fallback:
├── Old browser → yes
└── Unknown support → yes
Fallback syntax:
color: var(--primary, #0066cc);
padding: var(--spacing-md, 1rem);
When to use:
├── Primitive value → yes
├── Complex value → pre-define
└── Last resort → always provide
When NOT to use:
├── Always supported → no fallback needed
├── Required value → no fallback hides
└── Empty var → use differently
When to use calc():
├── Responsive sizing → yes
├── Combining variables → yes
└── Mixed units → yes
When to use clamp():
├── Fluid sizing → yes
├── Min/max bound → yes
└── Range control → yes
When to use min()/max():
├── Responsive bounds → yes
├── Fluid typography → yes
└── Container queries → yes
When to precalculate:
├── Many calculations → slow
├── Same result → pre-calc
└── Print/offline → pre-calc
❌ Defining CSS variables inside component selectors (scope too narrow)
✅ Define tokens at :root; override per component/theme
❌ Variable names that describe appearance (--blue-500)
✅ Semantic names: --color-primary, --color-text-muted
❌ Duplicating values instead of referencing variables
✅ Reference variables everywhere — single source of truth
❌ JavaScript setting CSS variables on every frame
✅ Use CSS calc() and CSS math instead; JS for initial set only
❌ No fallback for browsers that don't support var()
✅ var(--value, fallback) — always provide fallback
| Task | Syntax | Example |
|---|---|---|
| Define token | :root { --name: value } | --spacing-4: 1rem |
| Use token | var(--name) | padding: var(--spacing-4) |
| Fallback | var(--name, fallback) | color: var(--text, #000) |
| Dark theme | [data-theme="dark"] { } | Override tokens |
| JS read | getPropertyValue | getComputedStyle(el) |
| JS set | setProperty | el.style.setProperty |