| name | ds-audit |
| description | Audit a React + Tailwind codebase against the SaaS Panel design system and report violations ranked by impact, with the exact fix for each. Use when the user asks to review, audit, check or fix UI consistency, before merging a screen, when a screen "looks off" compared to the rest of the product, or to find drift such as fixed page sizes, drawers used for record details, Tabs used as page sub-navigation, hardcoded hex colors, missing loading/error/empty states, or unpatched shadcn primitives. |
| license | MIT |
| compatibility | Any React + Tailwind CSS codebase. Assumes the SaaS Panel design system is installed or being adopted; read-only by default. |
| metadata | {"version":"1.0.0","part-of":"saas-panel-design-system"} |
Audit against the SaaS Panel design system
Read-only by default: find and report, fix only when the user asks. Rank
findings by what a user actually feels, not by how many times a rule appears.
Reference material: ../saas-panel-design-system/references/. The full
antipattern catalog with the historical bug behind each rule is in
16-checklists-e-antipadroes.md.
Scope
Ask (or infer from context) what to audit:
- the current diff / branch →
git diff main...HEAD --name-only | grep -E '\.tsx?$'
- one screen or directory
- the whole
src/ (say up front that this can be long, and report by severity)
Detection sweep
Run these first — they find most of the drift in seconds. Each hit is a
candidate, not yet a finding: open the file and confirm before reporting.
grep -rn "PAGE_SIZE\s*=\s*[0-9]" src --include=*.tsx
grep -rln "components/ui/sheet" src --include=*.tsx
grep -rln "components/ui/tabs" src --include=*.tsx
grep -rnE "#[0-9a-fA-F]{6}\b" src --include=*.tsx
grep -rn "window.confirm" src --include=*.tsx
grep -rn "h-\[[0-9]\+vh\]" src --include=*.tsx
grep -rn "text-primary\b" src --include=*.tsx | grep -v "dark:" | head -20
grep -rn "toast(" src/components src/pages --include=*.tsx
grep -rn "\.slice(.*currentPage" src --include=*.tsx
grep -rn "onChange=.*setSearch" src --include=*.tsx
grep -rLn "tabular-nums" src --include=*.tsx
grep -rn "ArrowLeft\|ChevronLeft" src/pages --include=*.tsx
Checklist by area
Confirm each candidate against the rule. Only report what you verified.
Structure (blocker)
Data behaviour (blocker/high)
States (high)
Style (high/medium)
Primitives (medium)
Compare against ../saas-panel-design-system/assets/primitives/:
Accessibility (high)
Report format
Group by severity, most severe first. One line per finding, with the exact
location and the exact fix. Do not pad the report with rules that passed.
## Design system audit — <scope>
### Blockers (2)
1. `src/pages/Contacts.tsx:34` — fixed `PAGE_SIZE = 10`.
→ `usePagination(sorted, { auto: true })` + `<ListCard ref availableHeight>`.
Why it matters: half-empty list on any large screen.
2. `src/components/ContactDrawer.tsx` — record details rendered in a `<Sheet>`.
→ Rebuild with `<DetailModal>` + section sidebar (references/10-padrao-modais.md).
### High (3)
…
### Medium (5)
…
### Clean
Tokens, primitives and states follow the system in the audited scope.
Close with the single highest-leverage fix — the one that removes the most
inconsistency for the least work — and offer to apply the fixes.
When fixing
Only after the user asks. Then:
- Fix blockers first; do not bundle unrelated refactors.
- Copy from
../saas-panel-design-system/assets/ instead of hand-writing.
- Re-run
tsc --noEmit, lint and build.
- Report what changed, what you deliberately left alone, and why.