UI Craft

v1.0.0
io.github.educlopez/ui-craft Checked 4 hours ago Published 4 days ago

UI quality checks: anti-slop, accessibility, design tokens, scoring and workflow routing.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

route_task Route Task

Call this FIRST on any UI request, before reading reference files. Takes the task in natural language and returns the references, commands and MCP tools that cover it, ranked, plus the single first move to make. Deterministic lexical ranking over a synonym map, so a prompt reaches the right entry even when its words do not match our filenames — "analytics panel" finds recipe-dashboard.md, which never says analytics. Recipes are also indexed by what they contain, so "pricing block" finds recipe-landing.md. Returns POINTERS only: every design rule stays in the files it points at. An unmatched…

ParameterTypeDescription
prompt *stringThe task in natural language — e.g. "analytics panel with KPIs"
limitintegerMax hits per kind (default 5, clamped to 12)

check_anti_slop Check Anti-Slop

Scans source code for anti-slop violations using the deterministic rules from ui-craft-detect. Accepts either a `code` string (inline source) or a `path` string (file or directory). Returns findings with severity, rule ID, file, line, and message. These are the 43 deterministic rules only — no taste or aesthetic judgment.

ParameterTypeDescription
codestringInline source code to scan (alternative to path)
pathstringFile or directory path to scan (alternative to code)

tokens_lint Tokens Lint

Static analysis for off-system token values: raw hex colors, non-scale border-radius px values, non-8pt spacing values, and magic z-index integers. Token scale source of truth: references/tokens.md. Accepts `code` string or `path`. Returns structured findings + summary.

ParameterTypeDescription
codestringInline source code to lint (alternative to path)
pathstringFile or directory path to lint (alternative to code)

acceptance_bar Acceptance Bar

Returns the deterministic acceptance checklist for a UI surface. Data is bundled from recipe-dashboard.md, recipe-landing.md, recipe-auth.md, and finish-bar.md. Surfaces: dashboard, landing, auth, generic. Returns DATA only — no scoring or judgment. Scoring uses check_anti_slop + tokens_lint results.

ParameterTypeDescription
surface *stringThe UI surface to retrieve the acceptance bar for

ux_coverage UX Coverage

Returns the parts a screen of a given kind needs in order to be complete, and the contract for reporting them. This is the COMPLETENESS axis — "does this screen have the parts screens of its kind need". It is not the distinction axis: acceptance_bar and score_ui answer "is this designed". Report the two side by side; never fold coverage into a score, a count or a percentage. Report-only — coverage never gates and never fails a build. Archetypes: data-table, settings, search-filter, detail-view, empty-first-run, billing, pricing, docs-page, checkout, onboarding, destructive-confirm, invite-…

ParameterTypeDescription
archetypestringScreen archetype to retrieve coverage parts for. Accepts the key, the label, or a synonym ("table", "plans", "are you sure"). Omit to list the catalogue.

score_ui Score UI

Composite design-quality scorer (UICraftScore). Combines three deterministic dimensions into a single 0-100 score + letter grade (A/B/C/D/F) + per-dimension subscores and findings. Dimensions: anti-slop (38 rules via ui-craft-detect), token-discipline (raw hex / off-scale values), and static a11y (5 checks: img-no-alt, non-semantic-interactive, positive-tabindex, aria-invalid-no-describedby, no-reduced-motion). Accepts either a `code` string (inline source) or a `path` string (file). Formula: score = 100 − (antiSlop_crit×8) − (antiSlop_major×4) − (antiSlop_warn×1) − (token_findingsÃ…

ParameterTypeDescription
codestringInline source code to score (alternative to path)
pathstringFile path to score (alternative to code)

fold_candidates Fold Candidates

Draws composition classes for a landing fold, preferring ones this project has not spent yet. Variety cannot be requested in prose — asking a model to "be different" returns its default every time — so the class is drawn instead — ordered by a per-project seed, then by what this project has already spent. Pass the classes already used in this project as `used`. Classes: type-only, full-bleed-overlay, split, stacked, product-dominant, band. `split` is drawn last on purpose: it is the fold every generator reaches for unprompted. Returns each class with what it demands and what it sacrifice…

ParameterTypeDescription
countintegerHow many candidates to draw (default 3)
seedstringOverrides the per-project seed. Defaults to the working directory, which is what makes two projects draw differently while one project stays stable across runs.
usedarrayComposition class ids already used in this project (deprioritised in the draw)

check_fold Check Fold

Renders a URL and reports what its fold actually is: a screenshot, the composition class it belongs to, drift from the class you set out to build, three judged invariants, and four measurements reported WITHOUT a verdict. The unjudged four (identification, single dominance, asymmetry, restraint budget) are measured but not scored: calibration against reference landing pages showed those thresholds do not yet discriminate, so they are yours to interpret. Treat the screenshot as the primary output — look at it. Invariant 7 (a costly detail) is unmeasurable by construction: pass what you commit…

ParameterTypeDescription
url *stringURL of the rendered page — a local dev server URL is fine
costly_detailstringThe one element of this fold that could not have come from a template, and what it cost
expected_classstringThe composition class you set out to build, to detect drift
heightintegerViewport height (default 900)
widthintegerViewport width (default 1440)