Skip to main content

Overview

Ditto spec files use YAML frontmatter in .ditto.md files. Everything lives between the --- delimiters; the markdown body below the closing --- is unused. There are two types: workspace specs and component specs.

Workspace spec

A repo has a single workspace.ditto.md somewhere under the CLI’s configured roots. It holds universal style guide rules that carry no tags — these apply to every surface in every component. It also carries an inventory of all tags available on the platform.

Component spec

Each component that renders user-facing text gets an index.ditto.md Ditto spec file in its directory.

component

The component name (string). Set when you run ditto-spec scaffold.

tags

Component-level tags (array of strings) that describe what the component is in your design system — e.g. [dialog, confirmation] for a confirmation modal, [card, product] for a product card. Style guide rules matching any of these tags apply to all surfaces in the component, cascading content governance to every piece of text it renders. Edit these freely. This is the primary mechanism for integrating Ditto specs into a design system. A component’s tags capture its role as a design system element, pulling in rules about how that type of component should read — tone, voice, constraints. The individual surfaces then carry their own tags for more specific rules (see below).

surfaces

Each key is a surface — a distinct piece of user-facing text the component renders.

rules

Populated by ditto-spec pull. Style guide rules come in two shapes:

locales

Populated by ditto-spec pull. Keyed by locale code (e.g. de-DE). Contains the same style guide rule shapes as rules, scoped to a specific locale. Locale-scoped rules apply in addition to base rules when writing copy for that locale.

Style guide rule hierarchy

Base style guide rules always apply. Locale-scoped rules apply only when writing copy for the matching locale — they never conflict because each locale is a separate scope.

Developer-owned vs CLI-managed keys

Never edit rules or locales by hand. Run ditto-spec pull to update them from the platform.

Surface naming conventions

Check the tags key in workspace.ditto.md for tags available on the platform. Prefer reusing an existing tag over creating a new one — only tags that exist on the platform will match style guide rules.

Tagging in a design system

Ditto specs support two levels of tagging that mirror how design systems organize components:
  • Component-level tags describe the component itself — its role in the design system. A DialogueModal tagged [dialog, confirmation] pulls in style guide rules about how confirmation dialogs should read. These rules apply to every surface in the component.
  • Surface-level tags describe each individual piece of text — its function within the component. An actionText surface tagged [call-to-action] pulls in rules specific to CTAs (e.g. “lead with a verb”). These rules apply only to that surface.
Both levels work together. For a DialogueModal:
The headline surface inherits style guide rules matched by dialog, confirmation (from the component), plus rules matched by heading, dialog-title (from the surface). If a rule matches both levels, it appears once at component level — broader scope wins. This means you can create style guide rules on the Ditto platform scoped to design system concepts (dialog, card, form, navigation) and have them automatically cascade to every component tagged with that concept, while surface-level tags layer on more specific guidance.

File discovery

The CLI searches directories listed in the roots config for any *.ditto.md files. workspace.ditto.md is identified by its workspace: true key; all other .ditto.md files are treated as component Ditto specs.