keys
Reads every component’s api.yaml and produces analysis/keys.yaml: every Figma layer and property name that falls outside the safe key grammar, grouped by component so it reads as a checklist, then by cause and by frequency.
Requires a declared convention
This analyzer reports names the producer recorded in $extensions['com.figma'].name, which only happens when figma.naming declares a source convention:
naming: SENTENCEUnder the default NONE, no convention is declared, no names are recorded, and this report is empty. That is correct rather than a failure — nothing has diverged from a convention you never stated.
Use When
- You want a per-component list of Figma names to tidy, in the order a designer would work through them.
- You want to find a badly-formed name that repeats across the library, where one rename fixes dozens of specs.
- You want to see which kinds of naming problem dominate before deciding what to fix first.
- You want to confirm a naming cleanup actually landed, by diffing the aggregate between runs.
Invocation
specs analyze keysOutput
Writes a single file to analysis/ after all components are processed.
specs/ analysis/ keys.yaml # cross-library aggregate ds-button/ api.yaml ds-alert/ api.yamlSections
summary
Counts for the library as a whole, and the distribution of causes.
summary: namingConvention: SENTENCE measured: true totalComponents: 69 componentsWithDivergence: 52 totalNames: 948 divergentNames: 75 detections: 75 causeDistribution: mixed-letter-digit: 42 casing: 28 symbol: 2 separator: 1 digit-initial: 1 already-a-key: 1divergentNames counts names with something wrong; detections counts edits to make. The two are equal unless objectProps is folding properties, because a folded name can be wrong in both halves and those halves are edited in different places. Everything grouped below — byComponent, byCause, causeDistribution — counts detections.
Read measured before any of the counts. Without a declared naming convention there is nothing to measure names against, so every name passes and divergentNames is 0 however the library is named — which is indistinguishable from a library that round-trips perfectly. measured: false and namingConvention: null say which it is, in the file rather than only in the terminal that produced it:
summary: namingConvention: null measured: false totalNames: 490 divergentNames: 0 causeDistribution: {}Declare naming in config/conventions/figma.yaml to make the check run.
byComponent
The checklist. Names are grouped under the component they belong to, because that is the unit a designer opens and edits.
byComponent: dsAlert: divergent: 1 props: - key: fullBleed figmaName: Full Bleed cause: casing dsAvatar: divergent: 2 props: - key: a11yLabel figmaName: A11y label cause: mixed-letter-digit anatomy: - key: startIcon figmaName: Start Icon cause: casingNames appear under props (component property names) or anatomy (layer names). A surface with nothing to fix is omitted.
Object prop members
With objectProps declared, a Figma property named Margin.Compact folds into a member of a margin prop. The fold itself has no Figma name — the members do — so each member is listed under its own prop.member key, carrying the flat source name as it stands in the file:
byComponent: dsCard: divergent: 2 props: - key: margin.variant1 figmaName: AnObjectProp.Variant1 cause: casing segment: AnObjectProp - key: margin.variant1 figmaName: AnObjectProp.Variant1 cause: mixed-letter-digit segment: Variant1Compound names are measured one segment at a time, so the separator you declared is never reported as a symbol problem. segment appears only on these rows and names the half that failed — without it the row shows a whole name beside a cause that describes part of it, and the separator reads as the defect.
A name wrong in both halves gets a row for each. AnObjectProp.Variant1 above is two problems: a camel-cased group name, and a member name that runs letters into digits. They sit in different places in Figma and are two separate edits, so they are two detections sharing one key. Reporting only the first meant fixing it revealed a second problem that had been there all along, and a cleanup took as many passes as the worst name had bad segments.
Rows for one name stay in the order its segments appear, so the group name always reads before the member name.
Each member counts as one of totalNames; the fold counts as none.
byCause
The same names grouped by what is wrong with them, most common first. Useful for deciding what to fix in bulk: a library with 28 casing problems and 2 symbol problems has one systemic issue and two one-offs.
byCause: - cause: casing occurrences: 28 names: - Alternate Half - Children minItems - DS Bottom SheetbyName
Each distinct Figma name with the components it appears in, most frequent first. This is the counterweight to the per-component checklist — a name wrong in forty components is one decision, not forty.
byName: - figmaName: A11y label occurrences: 42 components: - dsAvatar - dsBadge - dsButton cause: mixed-letter-digitRows are grouped by name and cause, so one name can appear twice. That happens where objectProps folds a property in some components and excludes it in others: the same Margin.Compact is measured whole where it stays a flat prop, and segment by segment where it folded — symbol in the first case, whatever the bad segment is in the second. They are two different edits, and one row could not name both.
Causes
| Cause | Meaning | Example |
|---|---|---|
separator | Leading, trailing, or repeated spaces | Label |
symbol | A character outside letters, digits, and single spaces | Cut & paste |
non-ascii | A non-ASCII character | Étiquette |
mixed-letter-digit | Letters and digits share a word, so the boundary is lost | A11y label |
digit-initial | The name begins with a digit | 0000 0000 0000 0000 |
casing | Characters are fine, but casing diverges from the declared convention | Start Icon under SENTENCE |
already-a-key | Not a defect — a name authored in a key convention rather than as a display name | x-figmacollapse |
A name is reported under the most specific cause that applies, since that is the edit to make. already-a-key is listed last because it is a deliberate authoring choice, not a problem: such names are retained as authored.
One cause per name, except across the halves of a folded object-prop member — each half gets its own cause, because each is its own edit.
Fixing What It Finds
Nothing here is a validation failure. Every name it lists is fully supported — its Figma name is recorded, so the spec round-trips correctly either way. The report exists so naming can be tidied at the source, which makes the extensions disappear and the specs smaller.
Two things worth knowing before a cleanup:
- Renaming a layer or property in Figma changes the spec key too, which is a breaking change for anything consuming that key.
- The report cannot see names in a catalog that has never declared
figma.naming. Declare a convention first, generate, then analyze.
See Also
- Key Formatting guide — the safe key grammar and what happens to unsafe names
- Figma Keys — declaring the source convention this analyzer depends on
- Object Props — the fold whose members this report measures one segment at a time
- Analyze overview — options shared by every analyzer