Adapters
Adapters
Adapters normalize tool outputs into Variable Contract format and transform Variable Contract format into tool inputs.
Why adapters exist
Design tools export variables in formats that include tool-specific metadata and syntax. Variable Contract defines a canonical format for version control. Adapters bridge the gap between tool formats and the contract.
Adapter responsibilities
Adapters MUST:
- Normalize naming to match Variable Contract naming convention
- Convert reference syntax to canonical format (
{path.to.token}) - Move tool metadata to
$extensions - Validate that output conforms to Variable Contract rules
Adapters MAY:
- Preserve tool metadata in
$extensionsfor round-trip workflows - Transform types if tool uses different type names
- Handle mode differences between tools
Adapter types
Input adapters
Input adapters convert tool exports into Variable Contract format.
Examples:
- Figma Variables export → Variable Contract
- Tokens Studio export → Variable Contract
Output adapters
Output adapters convert Variable Contract format into tool or platform formats.
Examples:
- Variable Contract → Style Dictionary → CSS variables
- Variable Contract → TypeScript types
- Variable Contract → Tailwind CSS v4 (
@themedirective)
Adapter pattern
A typical adapter workflow:
- Read tool export JSON
- Extract tool-specific metadata
- Normalize naming (if needed)
- Convert references to canonical format
- Move metadata to
$extensions - Validate output against Variable Contract
- Write normalized JSON
Failure modes
If adapters fail:
- Tool metadata leaks into contract properties
- Invalid references break resolution
- Naming violations cause validation failures
- Type mismatches break consumption
Adapter documentation
- Figma Adapter - Figma Variables export normalization
- Tokens Studio Adapter - Tokens Studio export normalization
- Style Dictionary Adapter - Variable Contract to CSS/TypeScript/etc.
- Tailwind Adapter - Tailwind theme configuration generation
Out of scope
- Runtime adapter libraries (implement adapters as needed)
- Adapter testing frameworks
- Cross-tool synchronization (handle via version control)