- Home
- Skills
- Frontend & Web Apps
- lawful-ui: Make Your UI Obey the Law
Works with the AI Agents you already use
lawful-ui: Make Your UI Obey the Law
Your agent builds UI that follows 30 Laws of UX and 20 Laws of UI, and audits existing screens with measured evidence and a prioritized fix list.
Free
lawful-ui: Make Your UI Obey the Law
Example session with this skill installed
Please test this sign-up page: http://127.0.0.1:8765/violations.html
- Read your context and instructions
- Compiled the lawful-ui
Summary
Excerpt from a real run, translated from Indonesian (the request was made in Indonesian, and the skill reports in the user's language). The complete report, with all 23 findings and the coverage table for all 50 laws, is at https://github.com/SandroDuarsa/lawful-ui/blob/main/demo/sample-report.md
This page is not ready to ship. A paid add-on is ticked by default, and sign-up never visibly completes: the most prominent button is dead, and the "OK" button accepts an empty form and then shows the empty form again with no message. On a phone the content runs 757 px past the screen and zoom is blocked. Fix the pre-ticked insurance first (F-01), then the submit flow with its validation and confirmation (F-02, F-03).
| Critical | High | Medium | Low |
|---|---|---|---|
| 2 | 8 | 10 | 3 |
UX score: 18 / 100 · UI score: 31 / 100
Evidence: the running page in a browser at 1280 × 800 and 375 × 812, measured with the bundled probe, plus real clicks, typing, Tab, submit, and reload.
Findings (3 of 23)
F-01 Premium insurance (Rp 49,000) is ticked by default: Critical
- Component: S1-C14 · Where:
form#signup > label > input[type=checkbox] - Law: L04 Cognitive Bias
- Evidence (
measured):checked = truewhen the page loads, and again after every reload and submit. - Impact: a user who does not notice pays Rp 49,000 for something they did not choose.
- Fix: remove the
checkedattribute and offer insurance as an explicit choice at the payment step.
F-03 Three competing buttons; the most prominent one does nothing: High
- Component: S1-C16 · Where:
button.btn-a,button.btn-b,button.btn-c
Law: L10 Hick's Law, L28 Von Restorff Effect, L15 Law of Similarity, L17 Mental Model, L06 Doherty Threshold, U01 Visual Hierarchy, U07 Color System, U10 Consistency
- Evidence (
measured):
| Button | Size | Style | Behaviour |
|---|---|---|---|
| OK | 56.2 × 36 px | red, radius 4 | the only type=submit |
| Daftar Sekarang | 162.7 × 42.5 px | blue, bold, radius 20 | click: 0 DOM changes, no navigation within 1 second |
| Lanjut | 56.7 × 30 px | green, radius 0 | same, dead |
Impact: users press the largest button, nothing happens, and they have to guess that the red "OK" is the sign-up button.
- Fix: keep one primary button (
type=submit, 44 px tall) and remove "OK" and "Lanjut".
F-08 Keyboard focus is invisible: High
- Component: all controls · Where: CSS rule
button:focus, input:focus, a:focus { outline: none; } - Law: U14 Focus Visibility
Evidence (measured): Tab passes 38 stops; 36 of them have outline-style: none with nothing in its place. It takes 19 Tab presses to reach the first field.
- Impact: keyboard users cannot tell which control they are on, while Enter submits the form.
- Fix: remove that rule and add
:focus-visible { outline: 2px solid #1a56db; outline-offset: 2px }.
Law coverage
| Set | PASS | WARN | FAIL | N/A |
|---|---|---|---|---|
| 30 Laws of UX | 1 | 8 | 19 | 2 |
| 20 Laws of UI | 1 | 9 | 8 | 2 |
Fix order
- F-01: remove the pre-ticked insurance. It is one line and it concerns the user's money.
- Change the form to
method="post"so the password does not appear in the URL. - F-02 and F-03: one working sign-up button, per-field validation, and a confirmation page.
- F-05: remove the fixed 1100 px width and the zoom block so the page works on phones.
Not tested
Page speed (the page was served from localhost), behaviour on a real touch device, screen readers, and text at 200% zoom. The full report says what each would need.
Connects securely to your tools. The creator never sees your data.
About this skill
lawful-ui gives your agent two sets of laws and two ways to use them.
The laws
- 30 Laws of UX: Fitts's Law, Hick's Law, Jakob's Law, Miller's Law, the Peak-End Rule, and the rest, restated as test criteria.
- 20 Laws of UI: visual hierarchy, alignment, spacing, typography, color, contrast, touch targets, interactive states, focus visibility, form layout, motion, responsive layout. Drawn from WCAG 2.2, Apple's Human Interface Guidelines, and Material Design 3.
Build mode
Loads whenever you ask the agent to create or change an interface. You do not have to mention UX. The agent builds to the laws from the start: one primary action per view, full-size touch targets, a spacing and type scale, contrast that passes, labelled fields, every state designed, a layout that works at 320 px, no dark patterns. For a new screen it checks its own work and closes with a short "Lawful check" note.
It sets constraints, not a style. Your brand, palette, and layout stay yours, and an existing design system wins wherever it meets the thresholds.
Test mode
Loads when you ask the agent to test, QA, audit, or review an interface. It lists every component on every screen, measures it, checks each one against the laws that apply, and writes a report: findings ordered by severity, each with evidence, the cost to the user, and one concrete fix. The report also has a coverage table for all 50 laws, a UX score and a UI score, and a list of what could not be tested and why.
It works on a running app, on source code alone, or on screenshots, and labels each finding by where the evidence came from.
What is in the package
SKILL.md: the two modes.references/: the build rules, the test workflow, both sets of laws, checklists per component type, and guides for web and for Android, iOS, Flutter, and React Native.scripts/ux_probe.js: reads a web page and reports target sizes, contrast failures, form-field problems, pre-ticked boxes, spacing scale, alignment, removed focus outlines, image problems, and blocked zoom. It only reads the page.scripts/ux_checks.js: dead-control test, focus check, state rules, grayscale and text-spacing views.scripts/serve.py: serves the scripts, and optionally a page on disk, on localhost only.scripts/android_targets.py: reads an Android view-hierarchy dump and reports tap targets under 48 dp.assets/report-template.md: the report format.
No API keys and nothing to install. The scripts send no data anywhere.
Limits
It is a heuristic audit. It finds likely problems and does not replace testing with real users. Build mode has been tried on web; mobile frameworks are covered by guidance and are less tested.
Open source under MIT: https://github.com/SandroDuarsa/lawful-ui
A heuristic audit: it finds likely problems and does not replace testing with real users. Measured results need a browser tool that can run JavaScript (web) or a view-hierarchy dump (Android); otherwise findings are read from code or screenshots and labelled as inferred. There is no measuring script for iOS yet. Build mode has been tried on web; mobile frameworks are covered by guidance and are less tested. Not for backend-only, API, or unit-test work with no user interface.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before any payment.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
7 uses
Times used to date
Free forever
No account required to browse
Trust & safety
Security scan
Security scan passed 6 days ago
- Free with an Agensi account
Permissions
Read and write files: reading your UI code, writing UI in Build mode, saving the report. Terminal: running the optional Python helper scripts. Browser and network: only to load the page you ask it to test; serve.py listens on localhost only. The scripts send no data anywhere.