本文へスキップ
Skillpedia
WebサイトとUI(フロントエンド)75k · #2797

css-custom-properties

できること

このスキルは、共有のデザイントークンとすべきハードコードされた値が、スタイルシートにないかを確認します。テーマや全体的なスタイルの変更を簡単にしたい開発者向けです。

使う場面

  • ✓同じ色や余白の値が、多くの場所に現れているとき。
  • ✓ダークモードや新しいブランドのテーマを追加したいとき。
  • ✓一つのデザインの値を変えるのに、多くの行を編集しなければならないとき。

スキルのリンク

https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/css-custom-properties/SKILL.md

コピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。

使い方

いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。

貼り付け用メッセージ

このスキルを使って手伝ってください:https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/css-custom-properties/SKILL.md このリンクのSKILL.mdファイルを読んで、私の作業でその指示に従ってください。
こういうスキルを、AIが自分で見つけてくれたら?無料のSkillpedia MCPをインストール。1行で、作業の前に15,000+のスキルから探してくれます。1分でインストール →

AIへの頼み方の例

“私のスタイルシートで繰り返されているブランドの色と余白の値を、共有のカスタムプロパティにまとめてください。”

毎週5つの新しいスキル。1分で読めます。

仕組み

エージェントは、繰り返される値をルート要素のカスタムプロパティとして定義し、ハードコードされた各使用箇所を、必要に応じてフォールバック付きのvar参照に置き換えます。

技術的な内容(元のSKILL.md)

作者による元のテキスト(英語)をGitHubからそのまま表示しています。

Use CSS custom properties for design tokens

Hard-coded color values and magic numbers scattered across CSS files make global changes (a rebrand, a dark mode, a spacing adjustment) require finding and updating dozens of individual lines. Custom properties centralize these values so one change propagates everywhere — and enable runtime theming that preprocessor variables cannot.

Quick Reference

  • Define reusable values as --variable-name on :root
  • Custom properties cascade and inherit — they can be overridden at any scope
  • Use var(--name, fallback) to provide fallback values
  • Custom properties are runtime values — JavaScript can read and write them

Check

Find hard-coded color values, spacing values, and font sizes in this CSS file that should be replaced with CSS custom properties.

Fix

Extract repeated and meaningful values into CSS custom properties on :root and replace all usages with var() references.

Explain

Explain CSS custom properties: how they differ from preprocessor variables, how cascade and inheritance work, and how to use them for theming.

Code Review

Review stylesheets, component styles, and responsive states related to Use CSS custom properties for design tokens. Flag exact selectors, declarations, or breakpoints that violate the rule in the rendered UI.


For full implementation details, code examples, and framework-specific guidance, see references/rule.md.

Rule page: https://frontendchecklist.io/rules/css/css-custom-properties

よくある質問

カスタムプロパティは、プリプロセッサーの変数とどう違いますか?

どの範囲でも上書きでき、JavaScriptで読み書きできる実行時の値だと、このスキルは説明しています。

ダークモードに役立ちますか?

はい。プリプロセッサーの変数ではできない、実行時のテーマ設定を可能にすると、このスキルは説明しています。

フォールバックは何をしますか?

カスタムプロパティが設定されていない場合に、予備の値を提供します。

詳細

作者による元の説明

Use when reviewing stylesheets, component styles, and responsive behavior related to Use CSS custom properties for design tokens. Check the rendered layout across breakpoints and interaction states before proposing a fix.

repo: thedaviddias/Front-End-Checklist

人気

GitHubのスター
75k
ランキング
#2797
ライセンス
MIT
更新日
2026/10/31

このスキルは役に立ちますか?

0

ログイン して投票しましょう。

コメント

  • …

このリポジトリの他のスキル

似ているスキル