← LeaderboardThe Skill Leaderboard

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 targets, and type mismatches.

Published by sickn33 ↗sickn33/agentic-awesome-skills

Try your first task

A source-grounded starter task has not been verified for this skill yet.

SKILL.md

name: design-token-alias-validationdescription: "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: designrisk: safesource: selfsource_type: selfdate_added: "2026-12-01"author: Koushik-Katkamtags: [design-tokens, dtcg, json-pointer, aliases, validation, design-systems]

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:

  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:

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"}.
Expected result: Multi-hop valid chains and inherited group $type resolve cleanly with PASS; missing targets,
  direct/transitive cycles, and dimension->color type mismatches fail with concrete error codes; external $ref URIs
  return UNSUPPORTED.

Limitations

  • Implements the single-document DTCG 2025.10 token/alias/$extends subset defined above; external HTTP/file $ref targets, multi-file .resolver.json modifier contexts, CSS legacy string colors/dimensions, and CSS calc() expressions are rejected or classified UNSUPPORTED.
  • Vendor extensions ($extensions.*) are ignored rather than semantically validated; group nesting, $extends, and alias resolution depth are capped at 64.
  • Does not substitute for WCAG contrast checking on rendered themes (design-token-contrast).

Safety and Side Effects

  • Strictly offline and read-only over in-memory/local JSON documents (recursion depth bounded at 64 hops).
  • Never fetches remote $schema or $ref URLs over the network or modifies token files.

Sources and related skills