Malevich

AI-Things / Skills / Skill/

Malevich audit

Inspect existing HTML/CSS for Malevich design-system conformance — token use, BEM convention, component selection, modifier applicability, accessibility, and the common anti-patterns that erode visual consistency.

audit · intermediate · updated 2026-05-21

When to run an audit

Audit triggers a different mindset than authoring. The goal is not to write what should be there — it's to find what shouldn't be, prove it from the conventions, and propose minimal changes.

Three common audit modes:

  1. Pre-merge audit — code arrives via PR; check it against the system before approving.
  2. Migration audit — older code uses Malevich loosely; produce a list of upgrades to make it strict.
  3. Vendor audit — code arrives from an external source (designer, AI generation, snippet site); decide whether it's worth adopting.

The procedure is the same for all three; the disposition differs.

Read first

Before touching the code:

  1. llm-wiki/glossary.md — the CSS-conventions section: BEM with short modifiers, the data-{category} modifier attributes, and the retirement of both the m- custom-element prefix (ADR-0004) and the t- tweak prefix (ADR-0007).
  2. llm-wiki/architecture.md — token tiers and composition direction.
  3. packages/lint/ — the active lint rules, with passing and failing examples.

You should be able to recite the lint rules from memory:

The audit pass — order matters

Run the passes in this order. Each builds on the previous; reversing them produces noisy reports.

Pass 1 — Tokens

Find every literal value: hex codes, rgb(), hsl(), named colors, pixel values that aren't 0 or a hairline 1px, em/rem that aren't 1em, and raw durations or shadows. For each:

If a file uses color: #333 five times, that's one violation — the absence of an appropriate semantic token at the call site, repeated five times. Group them.

Pass 2 — BEM and class structure

Read every class selector. For each:

Pass 3 — Component identity

For each visible UI control, identify the Malevich component it corresponds to. Check:

This pass is the highest-impact and the slowest. Don't skip it.

Pass 4 — Composition direction

Verify no component sits inside a higher layer than it should:

Pass 5 — Accessibility

For each interactive element:

Accessibility violations are not "nice to have." Treat them with the same severity as token violations.

Pass 6 — Modifiers

If the code uses data-{category} modifiers (data-surface, data-effect, data-behavior, …):

Any t--prefixed tweak class or data-tweak attribute is a v0.1.0 artifact — flag it and propose the data-{category} equivalent.

Reporting format

Produce one report, three sections.

Severity

Report shape

For each finding:

[severity] [pass] [file:line] short title
  what:    one sentence of what's wrong
  why:     one sentence of why it's wrong (cite the rule)
  fix:     the proposed minimal change, as code

Example:

[major] [tokens] index.css:42 raw color in card body
  what: `color: #444` appears in `.card__body`.
  why:  raw values are forbidden outside the token sources
        (malevich/no-raw-values).
  fix:  `color: var(--color-ink-subtle);`

Summary

End with three counts (N blockers, N major, N minor) and a one-line disposition: "Approve after blockers fixed" / "Request changes" / "Reject — consider rewriting."

What audit is NOT

When the audit finds nothing

A real possibility. Say so plainly: "Audit complete. No violations found. Approve." Don't manufacture findings to fill a quota.