Best practices

How to get a good CCAC score

The four levels explained on /spec/quality, turned into concrete things to actually go fix.

The CCAC model explains what the score measures. This is the companion piece: what to actually change in a file to move each number, assuming a file has already cleared the Valid + Intact gate (a file that fails either isn’t scored at all).

Clean — remove waste

  • Delete nodes with no layout or visual purpose — the classic case is an empty spacer element; see Spacing and gaps.
  • Flatten unnecessary nesting: a row wrapped in a col wrapped in a frame, where one container would do.
  • Remove declared tokens or styles that nothing in the file actually references.

Consistent — agree with yourself

  • Replace repeated literal values (a color, a spacing number used five times) with a single declared token, referenced everywhere.
  • Pick one system and stay in it — don’t mix ad hoc pixel values with token references for the same kind of value across the file.

Accessible — stay legible

  • Check text-to-background contrast against WCAG 2.2 visual criteria, particularly on colored fills and overlays.
  • Keep tap targets (buttons, interactive rows) at a real minimum size — a role="button" that’s visually tiny still fails this even though it validates.
  • Don’t drop text size below what the criteria allow for body copy.

Comprehensible — be readable by a machine

  • Add role= to every structural node it applies to, from the closed 53-role vocabulary — a button without role="button" scores as if it isn’t one.
  • Prefer the most specific correct role over a generic one when the vocabulary has it.
  • Understand the score is reach-coverage, not a flat tag-everything ratio: each declared role documents its own subtree as far as its catalog-defined reach allows. A self-contained widget’s reach covers everything inside it; a card’s reach covers one chrome level before its contents need their own roles. A few roles placed on the right nodes can legitimately cover a large share of the tree.

None of this is a gate — a low score is still a valid, packable file. The score is a diagnostic, not a blocker; treat a low number as a punch list, not a rejection. The scoring model (RFC-0040) and the role vocabulary it reads (RFC-0041) both document the exact mechanics if you want the full reasoning.

Frequently asked

Do I need a perfect CCAC score to ship a .gui file?

No. A low score still describes a valid, packable file — the score is advisory, not a gate. Any pass/fail threshold is a decision made by whatever tool consumes the score, not by the format itself.

What’s the fastest single fix to improve a low score?

Usually adding role= to structural nodes (Comprehensible) or swapping repeated literal values for tokens (Consistent) — both are mechanical changes, not redesigns, and both move the number directly.

Does Comprehensible require tagging every single node with a role?

No — it’s reach-coverage, not full coverage. Each declared role documents its own subtree as far as its catalog-defined reach allows (a self-contained widget’s reach covers everything inside it; a card’s reach covers one chrome level before its payload needs its own roles), so a handful of well-placed roles can cover a large share of the tree without individually tagging every node.