# Design Token Alias Validation

> Audit DTCG 2025.10 design-token alias chains offline across curly-brace references, JSON Pointer $ref, $extends, group $type inheritance, cycles, missing target

- Skill: `ranbot-ai/design-token-alias-validation` (Agent Skill)
- Install (CLI): `npx get-skill add ranbot-ai/design-token-alias-validation`
- Raw SKILL.md: https://api.skillmd.com/api/skills/ranbot-ai/design-token-alias-validation/raw
- Safety review: pending
- Works with: any agent that reads SKILL.md (Claude Code, Claude.ai, Cursor, Codex, Windsurf, 60+ more)
- Category: Coding & Dev Tools
- Author: ranbot-ai (https://skillmd.com/u/ranbot-ai)
- Updated: 2026-12-03
- Page: https://skillmd.com/skills/ranbot-ai/design-token-alias-validation

---

---
name: design-token-alias-validation
description: Audit DTCG 2025.10 design-token alias chains offline across curly-brace references, JSON Pointer $ref, $extends, group $type inheritance, cycles, missing targets, and type mismatches. 
category: Document Processing
source: antigravity
tags: [python, node, api, ai, agent, design, document, tailwind, rag, cro]
url: https://github.com/sickn33/antigravity-awesome-skills/tree/main/skills/design-token-alias-validation
---


# Design Token Alias Validation

## Overview

Validate a focused subset of the **Design Tokens Community Group (DTCG) Format Module `2025.10`** offline using `jsonschema==4.26.0` and `referencing==0.37.0`: verifies curly-brace `{group.token}` aliases, RFC 6901 JSON Pointer `$ref` references, group `$type` and `$extends` inheritance, multi-hop alias resolution inside leaf and composite values, circular reference detection, missing alias targets, and incompatible resolved token types.

Distinction from existing design and token skills:
- `ui-tokens`: manages StyleSeed Next.js/Tailwind v4 token files (`tokens/*.json` mapped to `css/theme.css` `@theme inline`) rather than DTCG `2025.10` token validation.
- `design-how-token-mapping`: produces read-only styling audits mapping hardcoded CSS values to semantic CSS variables using OKLCH delta-E rather than DTCG JSON alias/pointer validation.
- `design-theme-guide`: creates business palette/typography registers rather than resolving DTCG `$value`/`$type`/`$ref` alias graphs.
- `design-system` and `design-token-contrast`: cover frontend layout invariants and WCAG CSS contrast auditing rather than DTCG `2025.10` JSON reference graphs.

## When to Use

- Validating DTCG `2025.10` token JSON bundles in CI before exporting CSS/iOS/Android platform artifacts.
- Catching broken token aliases (`{color.missing}` or `{"$ref": "#/color/missing/$value"}`), circular loops (`a -> b -> a`), or type errors (`dimension` token aliasing a `color` token).
- Auditing inherited group `$type` and `$extends` overrides across light/semantic token layers.
- Do **not** use this skill to treat Style Dictionary v3, Figma Variables exports, or CSS custom properties as universally DTCG `2025.10` compliant without confirming spec conformance.

## Prerequisites

- Python `3.10+` with `jsonschema`, `referencing`, and `pytest` (tested with Python `3.12.10`, `jsonschema==4.26.0`, `referencing==0.37.0`, `pytest==9.1.1`).
- Local DTCG `2025.10` JSON token document(s).
- **No network requests, Figma credentials, or platform build steps required.**

## How It Works

### 1. Documented DTCG 2025.10 implemented subset

This validator explicitly implements and documents the following DTCG `2025.10` subset (without claiming full DTCG Resolver Module `.resolver.json` context evaluation or external URI fetching):
- Token leaf nodes require both an effective `$type` (inherited from nearest ancestor group `$type` or explicit string on the token) and either `$value` or token-level `$ref`. Untyped leaf tokens (`MISSING_TOKEN_TYPE`) and non-string `$type` values fail explicitly; unrecognized string `$type` values return `UNSUPPORTED`.
- Group inheritance via `$extends` (`"{group.path}"` or `{"$ref": "#/group/path"}`) performs recursive deep-merge with bounded nesting/extends depth (`64`) so overriding nested subgroups preserves deeper sibling tokens.
- Structured DTCG `2025.10` value validation (`color` objects with `colorSpace` + numeric/`"none"` `components`, `dimension` objects with numeric `value` + `px`/`rem` `unit`, `shadow` objects validated via a real `referencing.Registry` with `jsonschema.Draft202012Validator`); legacy CSS strings are rejected rather than treated as conformant DTCG `2025.10` values.
- Leaf and composite-field curly-brace references (`"{a.b.c}"`) and intra-document RFC 6901 JSON Pointer references (`{"$ref": "#/a/b"}` or `{"$ref": "#/a/b/$value"}`, decoding URI-fragment percent escapes, requiring canonical array indices, unescaping `~1`/`~0`, validating `~` escape syntax, rejecting external non-`#` URIs as `UNSUPPORTED`).

### 2. Validate alias chains, cycles, and inherited types

Run the local verification suite in [DTCG alias validation harness](references/dtcg-alias-validation-harness.md):

1. Parse JSON cleanly (`INVALID_INPUT` on invalid JSON or non-object root).
2. Expand `$extends` group inheritance with visited-path tracking and recursion bounds (`CIRCULAR_EXTENDS` / `MISSING_ALIAS_TARGET` / `RESOLUTION_DEPTH_EXCEEDED`).
3. Compute each token's effective inherited `$type` from nearest ancestor group `$type` -> token `$type` (bounding group tree nesting at `64`).
4. Resolve every `{path}` and `{"$ref": "#/..."}` recursively across chains (`a -> b -> c`) and composite fields (`shadow.color`, `border.width`):
   - Missing targets -> `MISSING_ALIAS_TARGET`.
   - Cycles across `{...}`, `$ref`, or mixed references -> `CIRCULAR_ALIAS`.
   - Target effective `$type` differs from referencing token's effective `$type` -> `INCOMPATIBLE_RESOLVED_TYPE`.
   - Unrecognized `$type` -> `UNSUPPORTED` (`UNSUPPORTED_TOKEN_TYPE`).

## Examples

Run the self-contained verification suite in [DTCG alias validation harness](references/dtcg-alias-validation-harness.md):

```text
User request: "Audit our tokens.json for DTCG 2025.10 curly-brace and JSON Pointer alias errors and type mismatches."
Inputs: Local DTCG 2025.10 JSON document with inherited group $type, $extends, {a.b}, and {"$ref": "#/a/b/$value"}.

