# Anti-pattern catalogue, the 8 checks + tuning discipline

`check_anti_patterns` (rule source: `packages/gen-ui/a2ui/retrieval/anti-patterns.js`)
runs eight checks against rendered HTML:

- `noBareDivs`, use a layout component (`col-ui`, `row-ui`, `grid-ui`, `stack-ui`).
- `noBareInputs`, use `input-ui` / `select-ui` / `check-ui`.
- `cardStructure`, flags incorrect card nesting (section > header, etc.).
- `columnWrap`, section content must be wrapped in `col-ui`.
- `noHardcodedColors`, no hex/rgb in inline `style` attributes.
- `noInlineLayout`, no `display: flex` / `grid` in inline styles.
- `noInventedComponents`, every `*-ui` tag must exist in the catalog.
- `slotOnContainer`, `slot` attributes belong on content elements, not containers.

## Tuning discipline

- **Don't bypass `validate_schema`.** A low structural score usually explains
  anti-pattern findings; fix the A2UI JSON before chasing HTML-level issues.
- **Don't act on stub outputs.** Without the API key loaded, `thinking` mode
  silently falls back to `StubLLMAdapter`'s canned 6-component card, any
  finding or feedback against it is noise. Check the output shape first.
- **Don't commit intermediate JSON.** Scratch files go under the session
  scratchpad or `.gitignore`d paths; the corpus is harvester-generated into
  `packages/gen-ui/engine/corpus/chunks/` via `npm run harvest:chunks`.
- **One rule at a time**, and after any rule/threshold change re-run
  `npm run mcp:smoke` plus a spot-check over known-clean corpus HTML to
  measure the false-positive delta before landing.
