Design Token Enforcement
Skill7 starsChanged 5 months agoMITView on GitHub
デザイントークンを使わずに直書きされた色・余白・フォントサイズ・角丸・シャドウを検出する。Figma Variables / Tailwind config / CSS custom properties のルールに違反する実装を指摘する。
In this repository140 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .codex/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- static/llms.txtllms.txt
- ask-codexSkill
- river-review-disciplineSkill
- skill-creatorSkill
- skill-ops-plannerSkill
- skill-optimizerSkill
- commandsSkill
- adversarial-reviewSkill
- review-teamSkill
- river-review-architectureSkill
- river-review-codeSkill
- river-review-docsSkill
- river-review-frontendSkill
- river-review-performanceSkill
- river-review-security-auditSkill
- river-review-securitySkill
- river-reviewSkill
- river-review-testingSkill
- unknown-coverage-reviewSkill
- Coverage and Failure Path GapsSkill
- Flaky Test Risk CheckSkill
- GitHub Actions Workflow Security ReviewSkill
- Standard Review Policy for DownstreamSkill
- Test Assertion Effectiveness 常に PASS するテストの検出Skill
- Test Presence for Changed CodeSkill
- Test Naming and StructureSkill
- テスト観点レビュー(差分ドリブン)Skill
- a11y Accessible Name BasicsSkill
- Agent Skill Bridge ReviewSkill
- Altitude Generalization GuardSkill
- API Compatibility and Test Gap ReviewSkill
- Assumption Resolution Trace Plan の前提解消トレーサビリティSkill
- Async Correctness 非同期処理の正しさ検証Skill
- Behavior-Structure Separation 振る舞い変更と構造変更の分離・外部挙動維持Skill
- Closure Scope Retention GuardSkill
- Component Variants / States Documentation コンポーネント状態の文書化Skill
- Configuration File ReviewSkill
- Cross-File Leakage リファクタ後の caller 側残骸検出Skill
- Design Source-of-Truth Conformance デザイン定義準拠Skill
- Design System Component Reuse GuardSkill
- Detector Detection Power 検査器の検出力の検証Skill
- Documentation Hygiene ドキュメント衛生Skill
- End-to-End Wiring 末端到達・貫通の検証Skill
- Existing-Pattern Conformance 既存パターン準拠の確認Skill
- Firebase Security Rules ReviewSkill
- Fix Scope Integrity 指摘対応ループのスコープ逸脱・前提破壊検出Skill
- GitHubレビューコメント対応(修正案つき)Skill
- Hallucinated Reference 幻覚的参照の実在確認Skill
- Hello Skill (Always-On Sample)Skill
- i18n Unused Key ReviewSkill
- Impact Evidence Coverage 影響・失敗系・外部依存の証拠充足Skill
- Independent Review SynthesisSkill
- Invisible Unicode Injection Scan 不可視 Unicode コード注入検出Skill
- Knowledge-to-Code Alignment 新知識のコード反映・設計知識の保全Skill
- Laravel Eloquent N+1 and Query Efficiency ReviewSkill
- Laravel Mass Assignment and Authorization ReviewSkill
- The first 60 shown.
The file
Files
Goal / 目的
- フロントエンド差分においてデザイントークンを使わず生の値をハードコードしている箇所を検出する。
- Figma Variables / Tailwind config / CSS custom properties などトークンシステムが存在するプロジェクトで、規約違反の実装を早期に指摘する。
- 「直し方」まで提示し、修正コストを最小化する。
Non-goals / 扱わないこと
- デザイントークンシステム自体の設計・命名規則の議論。
- Figma ファイルと実装の完全な同期チェック(別の CI/CD 統合が担う領域)。
- トークンの意味論的な正しさ(例: セマンティックトークン vs プリミティブトークン)の判定。
- テストファイル・Storybook ファイルの厳密なチェック(警告のみ)。
False-positive guards / 抑制条件
- Tailwind ユーティリティクラス (
bg-blue-500,p-4,text-sm,rounded-lgなど) はトークンシステムの一部であるため指摘しない。 - CSS カスタムプロパティの参照 (
var(--color-primary),var(--spacing-md)) は違反ではない。 - Tailwind の
theme()関数 / トークン参照関数 (tokens.spacing.md,theme('colors.primary')) は違反ではない。 - テンプレートリテラル内に変数を含むインラインスタイル (
style={{ color: `${brandColor}` }}) は動的計算の可能性があるため "uncertain" として示す(finding ではない)。 - テストファイル (
*.test.tsx,*.spec.tsx,*.stories.tsx) は lenient モードで扱い、明確な問題のみ指摘する。 0/100%/transparent/inherit/currentColorなどの CSS 予約値はトークン違反としない。
Rules / ルール
1. 色のハードコード
- className / style prop / CSS / SCSS に
#XXXXXX,#XXX,rgb(...),rgba(...),hsl(...),hsla(...)を生で書いている場合は違反。 - 例:
style={{ color: '#3B82F6' }},background-color: rgb(59, 130, 246)
2. Tailwind 任意値による余白のハードコード
- Tailwind の arbitrary values (
p-[16px],gap-[8px],mt-[24px],mx-[1.5rem]など) は、Tailwind config / デザイントークンに対応するスケール値がある場合に違反。 p-4/gap-2などの標準クラスへの置き換えを提案する。
3. フォントサイズのハードコード
style={{ fontSize: '14px' }},font-size: 14px,fontSize: 14など style prop / CSS 内でフォントサイズを生値で記述している場合は違反。
4. 角丸のハードコード
style={{ borderRadius: '8px' }},border-radius: 8px,rounded-[8px]などを生値で記述している場合は違反。
5. ボックスシャドウのハードコード
style={{ boxShadow: '0 2px 4px rgba(0,0,0,0.1)' }},box-shadow: 0 4px 6px -1px ...などを生値で記述している場合は違反。
Evidence / 根拠の取り方
- 差分のコードを引用し、どの行・どの値がトークン違反かを明示する。
- 可能であれば対応するトークン名 / Tailwind クラス / CSS カスタムプロパティの候補を 1 つ提示する。
- プロジェクトに
tailwind.config.*やtokens.tsなどが見える場合はそれを参照する旨を示す。
Output / 出力
Finding:何が違反か(具体的な値の種類)Evidence:ファイル名:行 — コードスニペットTokenSuggestion:置き換え候補のトークン / クラス / CSS カスタムプロパティSeverity:minor固定Confidence:事実確認 =high/ 文脈が必要 =medium/ 動的計算の可能性あり =low
違反が無ければ No findings と記入し、適用した抑制条件を記載する。
評価指標(Evaluation)
- 合格基準: 差分内の生値を直接引用し、対応トークン候補が具体的に示されている。
- 不合格基準: Tailwind ユーティリティクラスを違反と誤報する / 差分外コードを指摘する / 一般論のみで根拠なし。
人間に返す条件(Human Handoff)
- プロジェクト固有のトークン命名規則が不明で候補を断定できない場合は "候補が特定できません — デザインシステムドキュメントを確認してください" と添える。
- デザイントークンシステム自体が存在しないプロジェクトと判断できる場合は全指摘を
Confidence: lowに下げ、導入提案として示す。
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

