Skip to content

Your app looks AI-generated. Vincent Van Gogh noticed. An agent skill that finds and fixes AI-looking UI and UX in mobile apps, web apps, and websites.

feat: web apps and websites, and lessons from hallmark and unslop (#5)

erKamad723bdcdbab
diff --git a/README.md b/README.md
index 6e9ede6..b51a377 100644
--- a/README.md
+++ b/README.md
@@ -18,6 +18,8 @@ Then tell your agent:
/unslopovich review my app
```
+Mobile apps, web apps, and websites. Same doctor, different reflexes: on a phone it checks you didn't build a website, and on the web it checks you didn't break one.
+
## The doctor did the reading
Dr. Unslopovich scanned 105,027 App Store reviews from 299 top apps. Exactly one mentioned a purple gradient. It was asking for one.
@@ -65,7 +67,7 @@ The chart lives in `.unslopovich/chart.md`. It's where you tell the doctor that
## The detector
-Twenty-one rules that read SwiftUI, UIKit, Compose, Android XML, React Native, Flutter, and Ionic source. No model, no network, no dependencies. The skill runs it for you, and it works on its own too:
+Thirty-one rules that read SwiftUI, UIKit, Compose, Android XML, React Native, Flutter, Ionic, React, Vue, Svelte, Astro, HTML, CSS, and Tailwind classes. No model, no network, no dependencies. The skill runs it for you, and it works on its own too:
```bash
npx unslopovich detect src/
@@ -75,6 +77,10 @@ npx unslopovich detect --list-rules # every rule and its fix
It catches purple gradients and the project template's leftover purple, nested cards, decorative status dots, gradient text, glow shadows, emoji icons, unvirtualized lists, text that ignores the user's font size, disabled back gestures, hamburger menus, hover in a touch app, keyboards covering inputs, invented stats, and "Oops! Something went wrong".
+On the web it adds clickable divs, removed focus rings, disabled zoom, images without alt text, tracked-caps eyebrows, icons in tinted squares, `transition-all`, cards that grow on hover, things that pulse forever, and "Trusted by 10,000+ teams".
+
+It reads the nearest `package.json` to tell a phone app from a website, so hover is a problem in your Expo app and fine on your Next.js site. `--platform web` or `--platform mobile` settles it when it guesses wrong.
+
Exit code `2` means findings, so it can gate a pull request. Silence one line with `// unslopovich-ignore <rule-id>` (`<!-- unslopovich-ignore <rule-id> -->` in XML), or a whole rule in `.unslopovich/config.json`:
```json
@@ -95,14 +101,22 @@ Sample verdicts. Yours may be worse.
## Treats
-SwiftUI, UIKit, Jetpack Compose, React Native, Expo, Flutter, Ionic, Capacitor, Angular Native, and NativeScript.
+**Mobile:** SwiftUI, UIKit, Jetpack Compose, React Native, Expo, Flutter, Ionic, Capacitor, Angular Native, and NativeScript.
+
+**Web:** React, Next.js, Vue, Nuxt, Svelte, Astro, Angular, and plain HTML and CSS, Tailwind and shadcn/ui included.
It reads your theme, finds the problems, fixes the shared components first, and uses your platform's native building blocks. It won't move your users' favorite button without asking.
It also won't trade your purple gradient for the other default, the calm white one every model reaches for. A treated screen has to pass one test: cover the logo, and it should still look like your app.
+Before a big change it tells you how sick the patient is (heavy, light, or healthy) and writes a five-line direction for you to approve. Healthy screens get told they're healthy and left alone.
+
Only want the bad news? Ask for a review and it stops at the diagnosis.
+## Prior art
+
+The doctor trained under good people. [Impeccable](https://github.com/pbakaus/impeccable) by Paul Bakaus showed that a deterministic detector and design vocabulary beat a longer prompt. [Hallmark](https://github.com/Nutlope/hallmark) by Together AI showed the value of a floor that never bends, defaults you can only waive on the record, and a fresh-eyed reviewer at the end. [Unslop](https://github.com/heydamir/unslop) by Damir Sokolovsky ([@heydamir](https://x.com/heydamir)) showed that deciding how much to change comes before changing anything, and that richness belongs in the content, not the chrome. Unslopovich is for the screens they leave to others: native mobile apps, and the parts of a web app people use every day.
+
## Other agents
Installs for Claude Code by default. The skill is `SKILL.md` plus a `reference/` folder it reads on demand and the detector in `scripts/`. For any other agent that reads `SKILL.md`, point it at that agent's skills folder:
diff --git a/SKILL.md b/SKILL.md
index 5123215..3a62436 100644
--- a/SKILL.md
+++ b/SKILL.md
@@ -1,14 +1,14 @@
---
name: unslopovich
-description: Find and fix AI-generated, vibe-coded, or website-looking UI and UX in mobile apps on any stack, including SwiftUI, UIKit, Jetpack Compose, React Native, Expo, Flutter, Ionic, Capacitor, Angular Native, and NativeScript. Use when a mobile app looks generic or AI-made, feels like a website in a phone, or when asked to review, audit, critique, polish, unslop, or make screens feel native. Commands - review, treat, scan, chart, follow-up.
-argument-hint: "[review | treat | scan | chart | follow-up] [screens or path]"
+description: Find and fix AI-generated, vibe-coded, or template-looking UI and UX in mobile apps, web apps, and websites. Mobile - SwiftUI, UIKit, Jetpack Compose, React Native, Expo, Flutter, Ionic, Capacitor, Angular Native, NativeScript. Web - React, Next.js, Vue, Nuxt, Svelte, Astro, Angular, plain HTML and CSS, Tailwind. Use when an app or site looks generic or AI-made, a mobile app feels like a website in a phone, or when asked to review, audit, critique, polish, unslop, or make screens feel native or designed. Commands - review, treat, scan, chart, follow-up.
+argument-hint: "[review | treat | scan | chart | follow-up] [screens, pages, or path]"
---
# Dr. Unslopovich
-You are Dr. Unslopovich, a fussy mobile design critic who is hard to impress and precise about why. Keep the personality to the verdict line and the odd dry remark. Findings, code, and instructions stay plain.
+You are Dr. Unslopovich, a fussy design critic who is hard to impress and precise about why. Keep the personality to the verdict line and the odd dry remark. Findings, code, and instructions stay plain.
-Users don't leave over a purple gradient. They leave over a slow list, a moved button, a popup in the middle of a task, and a screen that says "Oops". Check those first. Then check whether the app looks like this product or like every other generated app, including the tasteful generated look that replaced the purple one.
+Users don't leave over a purple gradient. They leave over a slow list, a moved button, a popup in the middle of a task, a page that jumps while it loads, and a screen that says "Oops". Check those first. Then check whether the product looks like itself or like every other generated app, including the tasteful generated look that replaced the purple one.
`<skill-dir>` below means the folder that contains this file.
@@ -17,7 +17,7 @@ Users don't leave over a purple gradient. They leave over a slow list, a moved b
| Command | What it does | Stops after |
|---|---|---|
| `review [screens]` | Full diagnosis with scores. Default for "review", "audit", "critique", "check". | The report |
-| `treat [screens]` | Diagnose, fix, verify. Default for "fix", "unslop", "polish", "make it native". | Verified fixes, before and after |
+| `treat [screens]` | Diagnose, agree a direction, fix, verify. Default for "fix", "unslop", "polish", "make it native", "redesign". | Verified fixes, before and after |
| `scan [path]` | Run the detector only and triage its hits into the report format. Fast, code only. | The triaged list |
| `chart` | Write or refresh `.unslopovich/chart.md`, the project's standing context. | The chart |
| `follow-up [screens]` | Re-review the screens from the last visit and compare scores. | The comparison |
@@ -28,40 +28,48 @@ With no command and no clear intent, ask which one in a single line. With a clea
Each command runs only the steps it needs:
-- `review` and `follow-up`: steps 1 to 8, then 11. No edits.
+- `review` and `follow-up`: steps 1 to 8, then 12. No edits.
- `treat`: every step.
- `scan`: steps 1, 2, and 7, then triage the hits into the report format and stop. No screenshots, no scores, no saved visit.
- `chart`: steps 1 and 2, then write the chart as [reference/chart.md](reference/chart.md) describes and stop.
1. **Read the chart.** If `.unslopovich/chart.md` exists, read it: platforms, stack, top tasks, brand decisions, accepted exceptions. Do not re-flag anything it accepts. If it is missing, infer what you can from the code and offer `chart` at the end instead of blocking on it. See [reference/chart.md](reference/chart.md).
-2. **Identify the stack and platforms.** Read the project config. Note whether the app ships on iOS, Android, or both, then read the matching guides: [reference/ios.md](reference/ios.md), [reference/android.md](reference/android.md), and for cross-platform stacks [reference/stacks.md](reference/stacks.md).
-3. **Set the scope.** Use the screens the user named. If none, take the first-run path and the main screen a returning user sees. Name the one or two tasks people open those screens to do. Do not sweep the whole app unasked.
-4. **Find the existing design decisions.** Read the theme, tokens, shared components, and any style guide. Respect a real brand: logo, brand color, typeface, design system. If a tell matches the real brand, the brand wins. Put it under Ask first.
-5. **Look at the running app when you can.** Screenshot the scoped screens on a simulator, emulator, or device, in light and dark, and at the largest text size. If you cannot run it, say so, review from code, and mark hit areas and text scaling as estimated. Treat committed screenshots as possibly stale.
-6. **Form your own read first.** Walk each top task as three people: a first-time user, a returning user in a hurry with one thumb, and a user with the largest text and a screen reader on. Note what slows each of them before you run the detector, so the rule list does not become the review.
-7. **Run the detector.** `node <skill-dir>/scripts/detect.js <source dirs> --json`. It reads code, not screens, and catches patterns that are easy to skim past. Verify every hit in context before reporting it: a hit is evidence, not a finding. If Node is missing, skip it and say so under Not checked.
-8. **Diagnose.** Check the tells in [reference/tells.md](reference/tells.md) and performance with [reference/performance.md](reference/performance.md), then score and write the report as [reference/report.md](reference/report.md) describes. Rank anything that blocks or slows a task above anything visual.
-9. **Treat at the source.** For `treat` only. Read [reference/treatment.md](reference/treatment.md) before the first edit. Fix tokens and shared components first, then screens.
-10. **Verify.** Build and re-check the changed screens in light, dark, the largest text size, and every screen size the app supports. Tap every changed control. Run the detector again on the changed files. State plainly what you could not check.
-11. **Record the visit.** Save the report to `.unslopovich/visits/<YYYY-MM-DD-HHmm>-<scope>.md` unless the chart opts out. Mention the path in one line.
+2. **Identify the stack and platforms.** Read the project config. Note what it ships to, then read the matching guides: [reference/ios.md](reference/ios.md) and [reference/android.md](reference/android.md) for native apps, [reference/stacks.md](reference/stacks.md) for cross-platform stacks, and [reference/web.md](reference/web.md) for web apps and websites. A web project is either an app people work in or a site that persuades people to act; [reference/web.md](reference/web.md) says how each is judged.
+3. **Set the scope.** Use the screens or pages the user named. If none, take the first-run path and the main screen a returning user sees, or for a site the home page and the page that holds its main action. Name the one or two tasks people come to do there. Do not sweep the whole product unasked.
+4. **Find the existing design decisions.** Read the theme, tokens, shared components, and any style guide. Respect a real brand: logo, brand color, typeface, design system. If a tell matches the real brand, the brand wins. Put it under Ask first. A violet gradient or a sparkle in the logo is still a tell unless the user says it is the brand.
+5. **Look at the running product when you can.** Mobile: screenshot on a simulator, emulator, or device, in light and dark, and at the largest text size. Web: screenshot at 375, 768, 1280, and 1920 wide, in light and dark, and at 200% zoom. If you cannot run it, say so, review from code, and mark what you estimated. Treat committed screenshots as possibly stale.
+6. **Form your own read first.** Walk each top task as three people: a first-time user; a returning user in a hurry, one thumb on a phone or keyboard only on the web; and a user with the largest text and a screen reader on. Note what slows each of them before you run the detector, so the rule list does not become the review.
+7. **Run the detector.** `node <skill-dir>/scripts/detect.js <source dirs> --json`. It reads code, not screens, and catches patterns that are easy to skim past. It picks mobile or web rules from the nearest `package.json`; pass `--platform web` or `--platform mobile` if it guesses wrong. Verify every hit in context before reporting it: a hit is evidence, not a finding. If Node is missing, skip it and say so under Not checked.
+8. **Diagnose.** Check the tells in [reference/tells.md](reference/tells.md) (and [reference/web.md](reference/web.md) for web) and performance with [reference/performance.md](reference/performance.md), then score and write the report as [reference/report.md](reference/report.md) describes. Rank anything that blocks or slows a task above anything visual.
+9. **Decide how much to change, then agree a direction.** For `treat` only. Read [reference/treatment.md](reference/treatment.md). Call the case heavy, light, or healthy. For heavy, write the five-line direction it describes. Show the diagnosis and the direction and wait for the user's answer before the first edit, unless they already said to go ahead.
+10. **Treat at the source.** For `treat` only. Fix tokens and shared components first, then screens, in the pass order [reference/treatment.md](reference/treatment.md) gives.
+11. **Verify.** Build and re-check the changed screens in light, dark, the largest text size, and every screen size the product supports. Tap or tab through every changed control. Run the detector again on the changed files. Then get a fresh look: if you can start a sub-agent, give it only the after screenshots and the product's one-line description, and ask whether the screens could belong to another product and what reads as generated. Act on what it finds. Budget: one batched look, one fix batch, one confirming look. State plainly what you could not check.
+12. **Record the visit.** Save the report to `.unslopovich/visits/<YYYY-MM-DD-HHmm>-<scope>.md` unless the chart opts out. Mention the path in one line.
## The short list
-The full catalog, with detector rule ids, is in [reference/tells.md](reference/tells.md). The ones that matter most:
+The full catalog, with detector rule ids, is in [reference/tells.md](reference/tells.md); web-only tells are in [reference/web.md](reference/web.md). The ones that matter most:
-- Frequently used controls moved, removed, or buried. A familiar gesture given a new meaning.
-- Popups, promos, and AI features in the path of the core task.
-- Numbers and labels that are not true: failed loads shown as empty, invented stats, "recent" that is not recent.
-- Slow lists, slow typing, slow tab switches. You cannot see these in code, so say so.
-- Website in a phone: hamburger menus, heroes, hover, centered modals, hand-built back buttons.
+- Frequently used controls moved, removed, or buried. A familiar gesture or URL given a new meaning.
+- Popups, promos, cookie walls, and AI features in the path of the core task.
+- Numbers, labels, and claims that are not true: failed loads shown as empty, invented stats, "Trusted by 10,000+ teams" nobody counted.
+- Slow lists, slow typing, slow pages, layout that jumps. You cannot see these in code, so say so.
+- On a phone, a website in a phone: hamburger menus, heroes, hover, centered modals, hand-built back buttons.
+- On the web, an app that breaks the web: divs for buttons, no focus ring, a back button that loses the page, zoom turned off.
- Missing loading, empty, error, and offline states. "Oops! Something went wrong".
-- The generated look, old and new: purple gradients and sparkles, and also the tasteful default of white cards, thin gray borders, one blue accent, an icon in a tinted square on every row, and a colored dot beside every label.
+- The generated look, old and new: purple gradients and sparkles, and also the tasteful default of white cards, thin gray borders, one blue accent, an icon in a tinted square on every row, tracked capitals above every heading, and a colored dot beside every label.
## Rules that do not bend
-- Never move, remove, or redefine a frequently used control or gesture without asking.
+- Never move, remove, or redefine a frequently used control, gesture, or URL without asking.
- Never change business logic, data flow, or analytics.
- Never add a dependency, change the navigation structure, or change the visual identity without asking.
- Never call performance healthy without profiling. A static review says "not profiled".
-- Never polish invented data. Mark it.
+- Never invent or polish data, metrics, quotes, logos, or testimonials. Mark placeholders as placeholders.
- Never trade one generic look for another. The after must look more like this product, not more like a template.
+- Never change a healthy screen just to make it different. Say it is healthy.
+- Never report a check as passed that you did not run.
+
+## Credits
+
+Unslopovich builds on ideas from three skills. [Impeccable](https://github.com/pbakaus/impeccable) by Paul Bakaus (Apache 2.0): a deterministic detector, references loaded on demand, and scored reports. [Hallmark](https://github.com/Nutlope/hallmark) by Together AI (MIT): a floor that never bends, waivers on the record, the neighbor test, and a fresh-context reviewer. [Unslop](https://github.com/heydamir/unslop) by Damir Sokolovsky, [@heydamir](https://x.com/heydamir) (CC BY 4.0): deciding how much to change before changing anything, the direction written before editing, and fixing in passes. No text or code was copied; the ideas are adapted in our own words.
diff --git a/bin/install.js b/bin/install.js
index b432cbf..c6a28c6 100755
--- a/bin/install.js
+++ b/bin/install.js
@@ -10,7 +10,7 @@ if (args[0] === "detect") {
return;
}
-const usage = "Usage:\n npx unslopovich [--dir <skills folder>] install the skill\n npx unslopovich detect [paths...] scan mobile source for slop";
+const usage = "Usage:\n npx unslopovich [--dir <skills folder>] install the skill\n npx unslopovich detect [paths...] scan mobile and web source for slop";
if (args.includes("--help") || args.includes("-h")) {
console.log(usage);
diff --git a/package.json b/package.json
index bc5b38c..a1006ae 100644
--- a/package.json
+++ b/package.json
@@ -5,7 +5,7 @@
"type": "git",
"url": "git+https://github.com/erkamyaman/unslopovich.git"
},
- "description": "Your app looks AI-generated. Dr. Unslopovich noticed. An agent skill that finds and fixes AI-looking UI and UX in mobile apps.",
+ "description": "Your app looks AI-generated. Dr. Unslopovich noticed. An agent skill that finds and fixes AI-looking UI and UX in mobile apps, web apps, and websites.",
"bin": {
"unslopovich": "bin/install.js"
},
@@ -26,7 +26,11 @@
"flutter",
"swiftui",
"jetpack-compose",
- "linter"
+ "linter",
+ "web",
+ "nextjs",
+ "tailwind",
+ "accessibility"
],
"license": "MIT",
"scripts": {
diff --git a/reference/performance.md b/reference/performance.md
index 6157e1d..cae61a4 100644
--- a/reference/performance.md
+++ b/reference/performance.md
@@ -35,6 +35,13 @@ These are leads. Report them under Noticeable with "suspected", not as measured
- Every SDK initialized before the first frame
- Fonts, remote config, and analytics blocking the first screen
+**Web**
+- `<img>` without `width` and `height` or an aspect ratio, so the page jumps as images load
+- Hero images not preloaded, or every image loaded eagerly
+- Web fonts blocking text with no `font-display`, or four families and weights where one would do
+- Client components and large libraries shipped for content that could render on the server
+- Layout read and written in the same frame inside scroll handlers
+
**Animation**
- JS-driven animations on React Native where the native driver or Reanimated is available
- Layout animations on every list row
@@ -50,6 +57,7 @@ Only when the user wants it and you can run the app. Use release or profile buil
| React Native, Expo | Perf Monitor, React DevTools profiler, Flashlight on Android | JS and UI thread FPS while scrolling, commit durations |
| Flutter | DevTools Performance view in profile mode | Frame build and raster times over 16 ms, shader jank |
| Ionic, Capacitor | Safari Web Inspector or Chrome DevTools against the device WebView | Long tasks, layout shifts, scroll FPS |
+| Web | Lighthouse in a production build, the DevTools Performance panel with CPU throttling, field data from the Chrome UX Report when the site has traffic | LCP, INP, and CLS; long tasks over 50 ms; bundle size per route |
## What to write
diff --git a/reference/report.md b/reference/report.md
index e96a800..0c3b606 100644
--- a/reference/report.md
+++ b/reference/report.md
@@ -17,7 +17,7 @@ Score each dimension 0 to 4 from what you saw. A score needs a reason: the worst
|---|---|---|---|
| Task path | Can people do what they came to do, fast, with controls where they expect them and nothing in the way? | Core task blocked or interrupted | Core task direct, thumb reachable, uninterrupted |
| Truth | Do labels, numbers, and states say what is true? | Errors shown as empty, invented data | Every number and state is real and labeled |
-| Native fit | Navigation, gestures, controls, and safe areas as the platform expects | A website in a phone | A fluent user trusts every screen |
+| Native fit | Navigation, gestures, controls, and safe areas as the platform expects. On the web: real buttons and links, URLs and back that work, focus, zoom, and native form controls | A website in a phone, or a web page that breaks the web | A fluent user trusts every screen |
| States and input | Loading, empty, error, offline, pressed, keyboard | Happy path only | Every state designed and reachable |
| Access | Targets, contrast, text scaling, screen reader labels and order | Unusable with a screen reader or large text | Labeled, ordered, scales cleanly |
| Specificity | Does it look like this product, not a template, old or new? | Could be any app; generated tells throughout | Built from this product's content and voice |
@@ -55,6 +55,9 @@ Minor
Ask first
- <file:line> <what is wrong> -> <proposed fix and what it would change for users>
+Waived
+- <rule or tell> kept because <reason>, recorded in the chart
+
Worth keeping
- <what already works and should survive the treatment>
@@ -64,6 +67,8 @@ Not checked
Leave out empty sections, except Not checked.
+If the screen is healthy, the verdict says so and the report is short. A report that invents problems to fill its sections is its own kind of slop.
+
## The verdict line
One sentence, dry, specific to this app. It names the worst thing, not the funniest. It is never cruel about the person and never about AI use; the patient is the screen.
diff --git a/reference/tells.md b/reference/tells.md
index a6da8bd..2182f13 100644
--- a/reference/tells.md
+++ b/reference/tells.md
@@ -4,6 +4,8 @@ Each tell names what to look for. Where the detector can see it in code, its rul
Check in this order. The order follows what users complain about, not what is easy to spot.
+This catalog covers native and web. Section 3 is for native apps only; web apps and websites have their own floor and tells in [web.md](web.md).
+
## 1. User friction
Users complain about these far more than about how an app looks.
@@ -29,10 +31,11 @@ The app says something that is not so.
- "Recent" lists that are not recent, "live" data that is cached
- Buttons that go somewhere other than their label says
- Stat tiles with invented or placeholder numbers [`invented-stat`]. Real data in a tile is not a tell.
+- Social proof and speed claims nobody supplied: "Trusted by 10,000+ teams", "10x faster", logo walls, testimonials [`unverified-claim`]
- Trust or privacy claims the code contradicts, such as "no tracking" beside an ad SDK
- Wrong or approximate logos
-## 3. Website in a phone
+## 3. Website in a phone (native apps)
- Hamburger menu in place of tabs for the few top destinations [`drawer-nav`]
- Marketing hero, feature grid, or footer inside the app
@@ -52,6 +55,7 @@ The app says something that is not so.
- Swipe back or predictive back broken [`back-gesture`]
- Long lists without pull to refresh where freshness matters, or without virtualization [`unvirtualized-list`]
- Every element fading and sliding in on mount, or animation that blocks input
+- Motion by habit: transitions on every property [`transition-all`], cards that grow on hover [`hover-scale`], dots and badges that pulse forever [`decorative-pulse`]
- Haptics on everything, or none on moments that deserve confirmation
- Fixed heights or fixed text sizes that clip when the user enlarges text [`fixed-text-size`]
@@ -73,9 +77,9 @@ The look that replaced the purple one. It reads as tasteful and calm, and it is
- Everything on white or off-white, every group in a rounded card with a 1px gray border and a soft shadow, one radius everywhere
- One blue or black accent, with nothing else in the palette carrying meaning
-- An icon in a tinted rounded square at the start of every row
+- An icon in a tinted rounded square at the start of every row [`icon-tile`]
- A small colored dot beside labels that carries no status the user acts on [`status-dot`]. A dot that marks unread or online, has a text or shape backup, and is consistent across the app is a status, not a tell.
-- Section headers like "Overview", "Quick actions", "Recent activity", in small gray caps or with letter spacing
+- Section headers like "Overview", "Quick actions", "Recent activity", in small gray caps or with letter spacing [`tracked-caps-label`]
- Large empty margins presented as calm, so the content a user came for gets less of the screen than the chrome
- Gray secondary text under every title, repeating it in other words
- A stat row of three numbers at the top of every main screen
diff --git a/reference/treatment.md b/reference/treatment.md
index 1427ba4..879d0d6 100644
--- a/reference/treatment.md
+++ b/reference/treatment.md
@@ -2,23 +2,57 @@
Read this before the first edit. The diagnosis says what is wrong. This says how to fix it without making a different mess.
+The triage, the direction, and the pass order are adapted from [Unslop](https://github.com/heydamir/unslop) by Damir Sokolovsky ([@heydamir](https://x.com/heydamir)), licensed CC BY 4.0. The neighbor test, the waivers, and the fresh-context reviewer are adapted from [Hallmark](https://github.com/Nutlope/hallmark) (MIT).
+
+## How much to change
+
+Read the diagnosis honestly and call the case before you plan anything.
+
+- **Heavy.** Generated tells across color, type, icons, copy, and layout, or a Task path or Truth score of 2 or less. Run the full treatment: direction, then every pass.
+- **Light.** A screen that is mostly designed, with a few tells left. Fix only the findings. Keep the palette, type, layout, and visuals. Bigger ideas go in the report as suggestions, not changes.
+- **Healthy.** Say so plainly. Offer two or three small refinements with exact values, and apply them only if the user agrees. Never change a good screen just to make it different.
+
+## Direction
+
+For a heavy case, write five short lines before touching anything, derived from what the product does and who uses it, never from what is in fashion. Show them with the diagnosis and wait for the user's answer, because changing direction later means redoing everything. Skip the wait only when the user already said to go ahead.
+
+- **Product.** What it does and for whom, in one plain sentence.
+- **Use.** Where and how people use it: one-handed on a train, at a desk all day, in a kitchen with wet hands, once a month at tax time. This sets density, target sizes, and contrast.
+- **Character.** Two or three concrete words, such as "exact, calm, a little dry" or "quick, friendly, loud". Clean, modern, sleek, minimal, and premium are not allowed: they describe every template.
+- **The bright spot.** The one or two places where the screen gets color and care, chosen from the content: the zone that needs attention, the chart that answers the question, the photo of the dish. Everything else stays quiet.
+- **Signature.** One small detail only this product would have, used consistently. One, not five.
+
+If the product has a real brand, the direction is built around it. In a light case, the direction is the existing brand; do not write a new one.
+
## Order of work
-1. Tokens: color roles, type scale, spacing scale, radius, elevation.
+1. Tokens: color roles, type scale, spacing scale, radius, elevation, motion.
2. Shared components: buttons, list rows, cards, headers, empty and error states.
3. Screens, in the order of the findings: Critical, then Noticeable, then Minor.
4. Ask first items only after the user answers.
+For visual work on a screen, go in passes and finish each one across the whole screen before the next. Spacing first, because everything reads differently once the rhythm is right. Copy before type, because the length of a headline decides its size. Motion last, because it should fit a screen that already works without it.
+
+1. Spacing: one small scale, related things closer than unrelated ones, rows of one kind the same height
+2. Color: semantic roles, one accent, color only where it means something
+3. Icons: one set, one size, one stroke, the text color; emoji and decorative icons go
+4. Copy: the product's nouns and verbs, errors with a cause and a next step, no hype, no invented claims
+5. Type: platform styles or one scale, two weights, sentence case, tabular figures for numbers
+6. Layout: content first, native structure, one primary action
+7. Details: states, radius that nests, focus, pressed, empty, error, offline
+8. Motion: what explains a change stays, what loops or decorates goes
+
## Rules of the fix
- Remove before adding. Most screens improve by losing containers, colors, captions, and copy.
-- Keep frequently used controls and gestures where users expect them. Ask before moving, removing, or redefining one.
+- Keep frequently used controls, gestures, and URLs where users expect them. Ask before moving, removing, or redefining one.
- Keep business logic, data flow, and analytics unchanged.
- Ask before changing the navigation structure or the product's visual identity.
- Ask before adding a dependency. Use what the platform and the project already have.
-- Mark invented data and placeholder content instead of polishing it.
+- Never invent a metric, quote, logo, or testimonial. Ask whether a claim is real; if not, remove it and list it in the report.
+- Mark placeholder content as placeholder instead of polishing it. Mock data looks plausible, never `123,456` or `[X]`.
- Keep the diff to the agreed screens and the shared code they need.
-- Use the platform's native building blocks (see [ios.md](ios.md), [android.md](android.md), [stacks.md](stacks.md)) before custom ones.
+- Use the platform's building blocks before custom ones: [ios.md](ios.md), [android.md](android.md), [stacks.md](stacks.md), [web.md](web.md).
## Do not swap one default for another
@@ -28,35 +62,42 @@ A treated screen gets its character from the product, not from a style:
- **Content first.** The thing the user came for, their orders, their zones, their messages, gets the most space and the strongest type. Chrome, greetings, and section labels get less. If the after shows less real content than the before, look again.
- **The product's own nouns.** Headers name what is there ("Kitchen lights", "Due this week"), not a dashboard category ("Overview", "Quick actions").
-- **Color with a job.** Keep the brand color. Give color to state and meaning (selected, overdue, offline, destructive), not to decoration. If the app has no brand color, ask before inventing one.
+- **Color with a job.** Keep the brand color. Give color to state and meaning (selected, overdue, offline, destructive), not to decoration. If the product has no brand color, ask before inventing one.
+- **Quiet chrome, one bright spot.** Navigation, buttons, and labels stay quiet; the bright spot from the direction carries the color and the care.
- **Hierarchy from type and space first.** Size, weight, and grouping before containers, borders, and tints. A list is usually better than a stack of cards.
-- **Native over bespoke.** A system list, a system sheet, a system tab bar, styled with the brand's type and color, beats a hand-built imitation of any of them.
+- **Native over bespoke.** A system list, sheet, or tab bar, or on the web a real button, link, dialog, and select, styled with the brand, beats a hand-built imitation.
- **Density that fits the use.** A tool used many times a day can be dense. Generous whitespace is a choice for a reason, not a default.
## The floor
-Every changed screen meets these before you call it done.
+Every changed screen meets these before you call it done. They do not bend.
-- Touch targets at least 44pt on iOS and 48dp on Android, including padding and expanded hit areas such as `hitSlop`.
+- Touch targets at least 44pt on iOS and 48dp on Android, including padding and expanded hit areas such as `hitSlop`. On the web, at least 24 by 24 CSS pixels, 44 for primary touch targets.
- Contrast 4.5:1 for body text, 3:1 for large text and meaningful icons, in light and dark.
-- Platform text styles or a named scale. Text follows the user's size setting and nothing clips at the largest size.
+- Platform text styles or a named scale. Text follows the user's size setting or browser zoom and nothing clips at the largest size or 200%.
- Content and controls clear of the notch, Dynamic Island, home indicator, status bar, and keyboard. Backgrounds may run edge to edge.
-- One primary action per screen, within thumb reach.
+- One primary action per screen, within thumb reach on a phone.
- Spacing from a small scale. Related items closer than unrelated ones.
- Semantic color roles: background, surface, text, secondary text, accent, destructive. Dark mode is a real palette, not an inversion.
-- Tabs for three to five peer destinations, push for drilling in, sheets for short side tasks.
-- Icon-only controls labeled for screen readers. Logical focus order. Reduce Motion honored. Color never the only signal.
-- Pressed, disabled, loading, empty, error, and offline states for everything you touched.
-- On apps that ship to both platforms, each platform's patterns. Share the brand, not every control.
+- Native navigation: tabs for three to five peer destinations, push for drilling in, sheets for short side tasks; on the web, real links and a working back button.
+- Icon-only controls labeled for screen readers. Logical focus order and a visible focus style. Reduce Motion honored. Color never the only signal.
+- Pressed, hover where there is a pointer, focus, disabled, loading, empty, error, and offline states for everything you touched.
+- On products that ship to several platforms, each platform's patterns. Share the brand, not every control.
+
+## Waivers
+
+A tell can stay when there is a real reason: the brand, a user need, a platform constraint. Record it under Accepted in `.unslopovich/chart.md` with the reason, and list it under Waived in the report. A tell kept without a reason is not a waiver; it is a finding.
## Self-check before you hand it back
Answer each in one line in the treatment summary.
-1. **Cover the logo.** Could the after screen belong to an unrelated app? If yes, it is not done.
-2. **Count the containers.** Did the number of cards, borders, and tinted backgrounds go down?
-3. **Count the colors.** Does every color on screen carry meaning?
-4. **Find the dots.** Every small colored dot, badge, and pill: what status does it show, and would a color-blind user get it?
-5. **Find the task.** Is the top task's control in the same place or better, and reachable with one thumb?
-6. **Run the detector** on the changed files. Explain any hit you kept.
-7. **Say what you did not check**, performance included.
+1. **Cover the logo.** Could the after screen belong to an unrelated product? If yes, it is not done.
+2. **The neighbor test.** Would a competitor in the same category get this exact screen from the same request? If yes, change one decision and say which.
+3. **Count the containers.** Did the number of cards, borders, and tinted backgrounds go down?
+4. **Count the colors.** Does every color on screen carry meaning?
+5. **Find the dots.** Every small colored dot, badge, and pill: what status does it show, and would a color-blind user get it?
+6. **Find the task.** Is the top task's control in the same place or better, and reachable with one thumb or one Tab?
+7. **Run the detector** on the changed files. Explain any hit you kept.
+8. **The fresh look.** What did the fresh-context reviewer say, and what did you change because of it? If you could not start one, say so.
+9. **Say what you did not check**, performance included. A check you did not run is not a pass.
diff --git a/reference/web.md b/reference/web.md
new file mode 100644
index 0000000..51def1b
--- /dev/null
+++ b/reference/web.md
@@ -0,0 +1,83 @@
+# The web
+
+For web apps and websites: React, Next.js, Vue, Nuxt, Svelte, Astro, Angular, plain HTML and CSS, Tailwind, and component kits such as shadcn/ui.
+
+Everything in [tells.md](tells.md) still applies, except section 3 (Website in a phone), which is for native apps. This file adds what is different on the web.
+
+## Two kinds of page
+
+Decide which one you are looking at, because they fail differently.
+
+- **An app** is where people work: dashboards, editors, settings, admin, inboxes, checkout. Judge it like a mobile app: task path first, density that fits daily use, quiet chrome, the content carries the color. A landing-page hero inside an app is a tell.
+- **A site** persuades someone to act: a landing page, pricing, a portfolio, a restaurant, an event. Judge it on whether a visitor understands the offer and finds the action within seconds, and whether it could belong to anyone else.
+
+A product's marketing site and its app are two scopes. Review one at a time.
+
+## The web floor
+
+These break the web for real people. They are Critical or Noticeable, whatever the look.
+
+- **Real controls.** Actions are `<button>`, navigation is `<a href>`. A `div` or `span` with a click handler is unreachable by keyboard and silent to screen readers [`clickable-div`].
+- **Visible focus.** Every interactive element shows a `:focus-visible` style, in the palette, instantly. `outline: none` with nothing in its place locks keyboard users out [`focus-removed`].
+- **Zoom stays on.** No `maximum-scale=1` or `user-scalable=no` [`zoom-disabled`]. Inputs at 16px stop iOS from zooming on focus.
+- **Text alternatives.** Every content image has alt text; decoration has `alt=""` [`img-no-alt`].
+- **URLs mean something.** The back button returns to the previous view. Filters, tabs, search, and pagination that someone would share live in the URL. Opening in a new tab works.
+- **Contrast** 4.5:1 for body text and 3:1 for large text and meaningful icons, in light and dark.
+- **Reduced motion.** Every animation has a `prefers-reduced-motion: reduce` fallback. Content is visible without it.
+- **No horizontal scroll** at 375 wide, and the layout holds at 1920: the content width is capped and centered, the gutters grow.
+- **Forms** have labels (not placeholders as labels), the right `type` and `autocomplete`, errors next to the field in words, and the entered data kept after an error.
+- **Nothing invented.** No customer counts, logo walls, testimonials, ratings, or case studies the user did not supply [`unverified-claim`, `invented-stat`].
+
+## Web tells
+
+### App screens
+
+- A dashboard that opens with a greeting and three stat cards instead of the thing the user came to do
+- Every section in a bordered card, cards in a uniform grid, one radius everywhere
+- Stat cards with sparklines, icons, and colored deltas with no "vs" (what changed, compared to what?)
+- Charts with a rainbow of colors inside one series, glowing bars, or placeholder data
+- A sidebar with an icon in a tinted square beside every item [`icon-tile`], or uneven row heights and gaps
+- Tables that are cards on desktop, or cards that should have been a table
+- `transition-all` [`transition-all`], cards that grow on hover [`hover-scale`], skeletons and dots that pulse forever [`decorative-pulse`]
+- Modals for things that should be a page or an inline edit; toasts for errors the user has to act on
+
+### Sites
+
+- The centered hero: tracked-caps eyebrow pill [`tracked-caps-label`] ("✨ New: AI-powered"), a gradient headline [`gradient-text`, `slop-gradient`], a subhead that repeats it, two buttons, and a blurred blob behind
+- A hero that does not show the product, or shows a hand-drawn fake browser window
+- Three feature cards with an icon tile, a two-word title, and a sentence each, repeated for every section
+- Logo walls, testimonial grids with stock avatars, "Trusted by 10,000+ teams", "10x faster" [`unverified-claim`]
+- A pricing table with a glowing "Most popular" card and a checklist that is the same on every plan
+- An email sign-up band at the end of every page, whatever the page is for
+- Scroll-jacking, parallax, and every section fading up on scroll
+- More than about 80 words on one screen of a landing page; a headline longer than two lines at 1280 wide
+- The hero's headline, sentence, and main action not all visible at 1280 by 800
+
+### The web's new default
+
+The calm generated look on the web is specific enough to name: Inter or Geist everywhere, zinc or slate neutrals, `rounded-lg border shadow-sm` cards, `text-muted-foreground` under every title, a `Badge` on every row, a two-column bento grid, and a dark mode that is the same layout in gray. Kits like shadcn/ui are fine as building blocks; untouched defaults on every surface are the tell. Ask what in the page is specific to this product. If the answer is only the copy, it is the default.
+
+## Native building blocks for the web
+
+Prefer the platform to a custom imitation.
+
+| Need | Use |
+|---|---|
+| Actions and links | `<button>`, `<a href>` |
+| Dialogs | `<dialog>` with `showModal()`, or the project's accessible dialog component |
+| Menus and popovers | the `popover` attribute, or the project's menu component with arrow-key support |
+| Disclosure | `<details>` and `<summary>` |
+| Choices | `<select>`, radio groups, checkboxes; `<input type="date">` and friends before a custom picker |
+| Page changes | real routes and links; View Transitions for continuity |
+| Layout | CSS grid with `minmax(0, 1fr)`, `clamp()` for type, container queries for components |
+| Theming | CSS custom properties at `:root`, `prefers-color-scheme`, `color-scheme` |
+| Motion | `transform` and `opacity`, named transition properties, `prefers-reduced-motion` |
+| Browser surfaces | theme `::selection`, `accent-color`, `caret-color`, scrollbar colors, and focus rings from the palette |
+
+## Checking it
+
+- Screenshot the scoped pages with Playwright or the browser at 375, 768, 1280, and 1920 wide. Emulate dark with `colorScheme: 'dark'` and reduced motion with `reducedMotion: 'reduce'`.
+- Zoom to 200% and check nothing overlaps or disappears.
+- Tab through every changed page from the address bar. Every stop is visible and in reading order; Enter and Space work; Escape closes what opened.
+- Run Lighthouse or the browser's accessibility panel for contrast and missing names. They catch a floor, not quality.
+- For a live site with no code, save the page and work on a local copy; say in the report that the result is a redesign in code for whoever owns the site.
diff --git a/scripts/detect.js b/scripts/detect.js
index 60ea157..908ac00 100644
--- a/scripts/detect.js
+++ b/scripts/detect.js
@@ -22,6 +22,8 @@ const STACK_BY_EXT = {
".js": "js",
".mjs": "js",
".vue": "web",
+ ".svelte": "web",
+ ".astro": "web",
".html": "web",
".xml": "xml",
".css": "css",
@@ -227,6 +229,10 @@ const rules = [
const snippet = code.slice(m.index, m.index + 400);
if (hexColors(snippet).some(isSlopHue) || SLOP_COLOR_NAME.test(snippet.slice(0, 250))) hits.push(m.index);
}
+ // Tailwind: bg-gradient-to-r from-violet-600 to-fuchsia-500
+ for (const m of matches(/["'`][^"'`\n]*\bbg-(?:gradient|linear|radial|conic)-[^"'`\n]*["'`]/, code)) {
+ if (/\b(?:from|via|to)-(?:purple|violet|indigo|fuchsia|pink)-\d{2,3}\b/.test(m[0])) hits.push(m.index);
+ }
return hits;
},
},
@@ -238,7 +244,7 @@ const rules = [
message: "Gradient-filled text.",
fix: "Emphasize with weight or size from the type scale, in a solid theme color.",
find({ code }) {
- const re = /<MaskedView|\bShaderMask\s*\(|\.foregroundStyle\(\s*(?:LinearGradient|\.linearGradient)|\.foregroundStyle\([^)]*Gradient|brush\s*=\s*Brush\.\w+Gradient|background-clip:\s*text|-webkit-background-clip:\s*text/;
+ const re = /<MaskedView|\bShaderMask\s*\(|\.foregroundStyle\(\s*(?:LinearGradient|\.linearGradient)|\.foregroundStyle\([^)]*Gradient|brush\s*=\s*Brush\.\w+Gradient|background-clip:\s*text|-webkit-background-clip:\s*text|\bbg-clip-text\b/;
return [...matches(re, code)].map((m) => m.index);
},
},
@@ -294,7 +300,9 @@ const rules = [
if (new RegExp(`height:\\s*${n}\\b`).test(around) && radius && +radius[1] >= n / 2) hits.push(m.index);
}
for (const m of matches(/["'`][^"'`\n]*\b(?:[wh]|size)-(?:1|1\.5|2|2\.5|3)\b[^"'`\n]*["'`]/, code)) {
- if (/\brounded-full\b/.test(m[0]) && /\b(?:size-|w-(?:1|1\.5|2|2\.5|3)\b[^"'`]*\bh-|h-(?:1|1\.5|2|2\.5|3)\b[^"'`]*\bw-)/.test(m[0])) hits.push(m.index);
+ const dim = "(?:1|1\\.5|2|2\\.5|3)\\b";
+ const both = new RegExp(`\\bw-${dim}`).test(m[0]) && new RegExp(`\\bh-${dim}`).test(m[0]);
+ if (/\brounded-full\b/.test(m[0]) && (both || new RegExp(`\\bsize-${dim}`).test(m[0]))) hits.push(m.index);
}
}
if (stack === "swift") {
@@ -388,6 +396,8 @@ const rules = [
const hits = [];
for (const m of matches(re, code)) {
if ((m[1] || m[2]) === "✨") continue; // reported by sparkle-icon
+ const lineStart = code.lastIndexOf("\n", m.index) + 1;
+ if (/\b(?:console|logger|log)\.\w+\(|new Response\(|throw new/.test(code.slice(lineStart, m.index))) continue;
hits.push(m.index);
}
return hits;
@@ -484,6 +494,7 @@ const rules = [
family: "native-fit",
severity: "noticeable",
stacks: null,
+ platforms: ["mobile", "universal"],
message: "Hamburger menu or navigation drawer. It hides the top destinations behind a tap.",
fix: "Ask first. Use tabs for three to five peer destinations; keep a drawer only for many destinations or a large-screen rail.",
find({ code }) {
@@ -497,6 +508,7 @@ const rules = [
family: "native-fit",
severity: "minor",
stacks: ["js", "web", "css"],
+ platforms: ["mobile"],
message: "Hover behavior in a touch app. Nobody hovers on a phone.",
fix: "Make the information or control visible without hover, or guard it with @media (hover: hover) for pointer devices only.",
find({ code }) {
@@ -536,6 +548,181 @@ const rules = [
return hits;
},
},
+ {
+ id: "tracked-caps-label",
+ family: "looks-generated",
+ severity: "minor",
+ stacks: ["js", "web", "css", "swift"],
+ message: "Small label in tracked capitals, the eyebrow above every section.",
+ fix: "Use sentence case in the body face, one step smaller, without letter spacing. Or delete the label and let the heading carry the section.",
+ find({ code, stack }) {
+ const hits = [];
+ for (const m of matches(/["'`][^"'`\n]*\buppercase\b[^"'`\n]*["'`]/, code)) {
+ if (/\btracking-(?:wide|wider|widest|\[\d)/.test(m[0])) hits.push(m.index);
+ }
+ if (stack === "js") {
+ for (const m of matches(/textTransform:\s*["']uppercase["']/, code)) {
+ const around = code.slice(Math.max(0, m.index - 160), m.index + 160);
+ const ls = /letterSpacing:\s*(\d+(?:\.\d+)?)/.exec(around);
+ if (ls && +ls[1] >= 0.8) hits.push(m.index);
+ }
+ }
+ if (stack === "css" || stack === "web") {
+ for (const m of matches(/text-transform:\s*uppercase/, code)) {
+ const open = code.lastIndexOf("{", m.index);
+ const close = code.indexOf("}", m.index);
+ const block = code.slice(open, close === -1 ? undefined : close);
+ if (/letter-spacing:\s*(?:0?\.(?:0[5-9]|[1-9])\d*em|[1-9][\d.]*px)/.test(block)) hits.push(m.index);
+ }
+ }
+ if (stack === "swift") {
+ for (const m of matches(/\.textCase\(\s*\.uppercase\s*\)/, code)) {
+ const around = code.slice(Math.max(0, m.index - 160), m.index + 160);
+ if (/\.(?:tracking|kerning)\(\s*[1-9]/.test(around)) hits.push(m.index);
+ }
+ }
+ return hits;
+ },
+ },
+ {
+ id: "icon-tile",
+ family: "looks-generated",
+ severity: "minor",
+ stacks: ["js", "web"],
+ message: "Icon in a tinted rounded square, the generated default for every row and feature card.",
+ fix: "Put the icon inline in the text color, or drop it. Keep a tile only where the shape carries meaning, like an app icon.",
+ find({ code }) {
+ const hits = [];
+ for (const m of matches(/["'`][^"'`\n]{0,300}["'`]/, code)) {
+ const c = m[0];
+ if (!/\brounded-(?:md|lg|xl|2xl|3xl|full)\b/.test(c)) continue;
+ if (!/\bbg-(?:[a-z]+-(?:50|100)|[a-z]+(?:-\d{3})?\/(?:5|10|15|20)|primary\/\d+|accent)\b/.test(c)) continue;
+ if (!/\b(?:size|h|w)-(?:8|9|10|11|12|14)\b/.test(c)) continue;
+ if (!/\b(?:items-center|place-items-center|justify-center)\b/.test(c)) continue;
+ hits.push(m.index);
+ }
+ return hits;
+ },
+ },
+ {
+ id: "transition-all",
+ family: "motion",
+ severity: "minor",
+ stacks: ["js", "web", "css"],
+ message: "Transition on every property (first use in this file).",
+ fix: "Name the properties: transition-colors, or transition-[transform,opacity]. Never animate width, height, top, or left.",
+ find({ code }) {
+ // Reported once per file: it is usually a habit, not a one-off.
+ const first = matches(/\btransition-all\b|transition(?:-property)?:\s*all\b/, code).next();
+ return first.done ? [] : [first.value.index];
+ },
+ },
+ {
+ id: "hover-scale",
+ family: "motion",
+ severity: "minor",
+ stacks: ["js", "web", "css"],
+ message: "Cards that grow on hover.",
+ fix: "Show hover with a quick color or surface change. Keep scale for a small press-down on buttons.",
+ find({ code }) {
+ return [...matches(/\b(?:group-)?hover:(?:-translate-y-\d|scale-1(?:0[2-9]|[1-9]\d))\b|:hover\s*\{[^}]*transform:\s*scale\(1\.(?:0[2-9]|[1-9])/, code)].map((m) => m.index);
+ },
+ },
+ {
+ id: "decorative-pulse",
+ family: "motion",
+ severity: "minor",
+ stacks: ["js", "web"],
+ message: "Pulsing or pinging element that is not a loading skeleton.",
+ fix: "Animate only what is live or loading. Remove looping motion from badges, dots, and buttons.",
+ find({ code }) {
+ const hits = [];
+ for (const m of matches(/["'`][^"'`\n]*\banimate-(?:pulse|ping)\b[^"'`\n]*["'`]/, code)) {
+ if (/\banimate-pulse\b/.test(m[0]) && /\bbg-(?:gray|slate|zinc|neutral|stone|muted)\b|skeleton/i.test(m[0])) continue;
+ hits.push(m.index);
+ }
+ return hits;
+ },
+ },
+ {
+ id: "unverified-claim",
+ family: "truthfulness",
+ severity: "noticeable",
+ stacks: null,
+ message: "Social proof or speed claim that the page does not back up.",
+ fix: "Use a real, sourced number with what it compares to, or remove it. Never ship invented customer counts, logo walls, or testimonials.",
+ find({ code }) {
+ const re = /\b(?:trusted|loved|used) by (?:over |more than )?[\d,.]+\s*[kKM]?\+?\s*(?:teams|companies|developers|users|customers|people|businesses)|\bjoin (?:over |more than )?[\d,.]+\s*[kKM]?\+?\s+(?:teams|companies|developers|users|customers|people|others|creators)|\b\d+x (?:faster|better|more productive|cheaper)\b/i;
+ return [...matches(re, code)].map((m) => m.index);
+ },
+ },
+ {
+ id: "clickable-div",
+ family: "accessibility",
+ severity: "noticeable",
+ stacks: ["js", "web"],
+ message: "Click handler on a div or span. Keyboard and screen reader users cannot reach it.",
+ fix: "Use a <button> for actions and an <a href> for navigation. They come with focus, Enter and Space, and the right role.",
+ find({ code }) {
+ const hits = [];
+ for (const m of matches(/<(?:div|span|li|td|img)\b[^<>]*?\s(?:onClick|@click|v-on:click|on:click)\s*=/, code)) {
+ const tagEnd = code.indexOf(">", m.index + m[0].length);
+ const tag = code.slice(m.index, tagEnd === -1 ? undefined : tagEnd);
+ if (/\brole\s*=|\btab[iI]ndex\s*=/.test(tag)) continue;
+ hits.push(m.index);
+ }
+ return hits;
+ },
+ },
+ {
+ id: "focus-removed",
+ family: "accessibility",
+ severity: "noticeable",
+ stacks: ["js", "web", "css"],
+ message: "Focus outline removed with nothing in its place.",
+ fix: "Keep a visible :focus-visible style in the palette: a 2px outline or ring with an offset.",
+ find({ code, stack }) {
+ const hits = [];
+ for (const m of matches(/["'`][^"'`\n]*\b(?:focus:)?outline-none\b[^"'`\n]*["'`]/, code)) {
+ // Focus styles often sit in another string of the same cn(...) call.
+ const around = code.slice(Math.max(0, m.index - 400), m.index + m[0].length + 400);
+ if (/\b(?:focus|focus-visible|focus-within|group-focus-visible|peer-focus-visible):|data-\[(?:highlighted|selected|focus|focused)|aria-selected:|data-\[state=/.test(around)) continue;
+ hits.push(m.index);
+ }
+ if ((stack === "css" || stack === "web") && !/focus-visible/.test(code)) {
+ for (const m of matches(/outline:\s*(?:none|0)\b/, code)) hits.push(m.index);
+ }
+ return hits;
+ },
+ },
+ {
+ id: "img-no-alt",
+ family: "accessibility",
+ severity: "noticeable",
+ stacks: ["js", "web"],
+ message: "Image without alt text.",
+ fix: "Describe what the image shows, or use alt=\"\" for pure decoration.",
+ find({ code }) {
+ const hits = [];
+ for (const m of matches(/<img(?=[\s/>])/, code)) {
+ const end = code.indexOf(">", m.index);
+ const tag = code.slice(m.index, end === -1 ? undefined : end);
+ if (!/[\s:]alt\s*=|\{\s*\.\.\./.test(tag)) hits.push(m.index);
+ }
+ return hits;
+ },
+ },
+ {
+ id: "zoom-disabled",
+ family: "accessibility",
+ severity: "noticeable",
+ stacks: ["js", "web"],
+ message: "Pinch zoom disabled in the viewport settings.",
+ fix: "Remove maximum-scale and user-scalable from the viewport. If inputs zoom on focus in iOS, give them a 16px font size instead.",
+ find({ code }) {
+ return [...matches(/user-scalable\s*=\s*(?:no|0)|maximum-scale\s*=\s*1(?:\.0+)?(?![\d.])|userScalable:\s*false|maximumScale:\s*1(?:\.0+)?(?![\d.])/, code)].map((m) => m.index);
+ },
+ },
{
id: "oops-error",
family: "copy",
@@ -623,17 +810,38 @@ function loadConfig(root) {
return { ignoreRules: [], ignorePaths: [] };
}
-// True when the nearest package.json (up to the filesystem root) ships the app to the web too.
-function isUniversalApp(dir) {
- for (let d = dir; ; d = path.dirname(d)) {
- try {
- const pkg = fs.readFileSync(path.join(d, "package.json"), "utf8");
- return /"react-native-web"|"@expo\/metro-runtime"/.test(pkg);
- } catch {
- // Keep looking upward.
- }
- if (path.dirname(d) === d) return false;
+// What the nearest package.json says the code ships to: "mobile", "universal"
+// (mobile and web), "web", or "unknown". Some rules only apply to one of them.
+const kindCache = new Map();
+function projectKind(dir) {
+ if (kindCache.has(dir)) return kindCache.get(dir);
+ let kind = "unknown";
+ let pkg = null;
+ try {
+ pkg = fs.readFileSync(path.join(dir, "package.json"), "utf8");
+ } catch {
+ // No package.json here.
}
+ if (pkg !== null) {
+ const deps = (() => {
+ try {
+ const j = JSON.parse(pkg);
+ return Object.keys({ ...j.dependencies, ...j.devDependencies, ...j.peerDependencies });
+ } catch {
+ return [];
+ }
+ })();
+ const has = (re) => deps.some((d) => re.test(d));
+ const mobile = has(/^(?:react-native|expo|@capacitor\/|@ionic\/|nativescript|@nativescript\/)/);
+ const universal = has(/^(?:react-native-web|@expo\/metro-runtime)$/);
+ const web = has(/^(?:react-dom|next|vue|nuxt|svelte|@sveltejs\/kit|astro|@angular\/core|solid-js|@remix-run\/|vite|preact|gatsby)$/);
+ kind = mobile ? (universal ? "universal" : "mobile") : web ? "web" : "unknown";
+ }
+ // A package.json that names no platform (a tooling or workspace package)
+ // says nothing, so keep looking upward.
+ if (kind === "unknown" && path.dirname(dir) !== dir) kind = projectKind(path.dirname(dir));
+ kindCache.set(dir, kind);
+ return kind;
}
function walk(target, opts, out = []) {
@@ -684,10 +892,12 @@ function scanSource(text, file, options = {}) {
const starts = lineStarts(text);
const lines = text.split("\n");
const ignoreRules = new Set(options.ignoreRules || []);
+ const kind = options.kind || "unknown";
const findings = [];
for (const rule of rules) {
if (ignoreRules.has(rule.id)) continue;
if (rule.stacks && !rule.stacks.includes(stack)) continue;
+ if (rule.platforms && kind !== "unknown" && !rule.platforms.includes(kind)) continue;
const seen = new Set();
for (const index of rule.find({ code, stack, file })) {
const line = lineAt(starts, index);
@@ -716,8 +926,6 @@ function scan(targets, opts = {}) {
const root = path.resolve(target);
const config = loadConfig(fs.statSync(root).isDirectory() ? root : path.dirname(root));
const ignoreRules = [...config.ignoreRules, ...(opts.ignoreRules || [])];
- // Apps that also ship to the web legitimately use hover there.
- if (isUniversalApp(fs.statSync(root).isDirectory() ? root : path.dirname(root))) ignoreRules.push("hover-only");
for (const file of walk(root, opts)) {
const rel = path.relative(process.cwd(), file) || file;
if (config.ignorePaths.some((p) => rel.split(path.sep).join("/").includes(p))) continue;
@@ -730,7 +938,8 @@ function scan(targets, opts = {}) {
}
if (text.length > 1_000_000) continue;
filesScanned++;
- findings.push(...scanSource(text, rel, { ignoreRules }));
+ const kind = opts.platform || projectKind(path.dirname(file));
+ findings.push(...scanSource(text, rel, { ignoreRules, kind }));
}
}
findings.sort((a, b) => SEVERITY_RANK[a.severity] - SEVERITY_RANK[b.severity] || a.file.localeCompare(b.file) || a.line - b.line);
@@ -769,9 +978,11 @@ function listRules() {
.join("\n");
}
-const USAGE = `Usage: unslopovich detect [paths...] [--json] [--ignore rule,rule] [--include-tests] [--list-rules]
+const USAGE = `Usage: unslopovich detect [paths...] [--json] [--platform mobile|web] [--ignore rule,rule] [--include-tests] [--list-rules]
-Scans mobile source for generated-looking UI and website-in-a-phone patterns.
+Scans mobile and web source for generated-looking UI, website-in-a-phone patterns,
+and accessibility and motion defaults. The platform comes from the nearest
+package.json; --platform overrides it.
Exit code: 0 clean, 2 findings, 1 error.
Silence one line with a comment: unslopovich-ignore <rule-id>
Project config: .unslopovich/config.json { "ignoreRules": [], "ignorePaths": [] }`;
@@ -788,11 +999,18 @@ function main(argv) {
}
const json = args.includes("--json");
const includeTests = args.includes("--include-tests");
+ let platform = null;
const ignoreRules = [];
const targets = [];
for (let i = 0; i < args.length; i++) {
const a = args[i];
- if (a === "--ignore") {
+ if (a === "--platform") {
+ platform = args[++i];
+ if (!["mobile", "web", "universal"].includes(platform)) {
+ console.error(USAGE);
+ return 1;
+ }
+ } else if (a === "--ignore") {
if (!args[i + 1]) {
console.error(USAGE);
return 1;
@@ -812,7 +1030,7 @@ function main(argv) {
}
let result;
try {
- result = scan(targets.length ? targets : ["."], { includeTests, ignoreRules });
+ result = scan(targets.length ? targets : ["."], { includeTests, ignoreRules, platform });
} catch (err) {
console.error(err.message);
return 1;
diff --git a/test/detect.test.js b/test/detect.test.js
index e61f0eb..2894246 100644
--- a/test/detect.test.js
+++ b/test/detect.test.js
@@ -46,7 +46,7 @@ test("Flutter slop is caught", () => {
});
test("every rule has a fixture that triggers it", () => {
- const all = new Set(scan([path.join(fixtures, "slop")]).findings.map((f) => f.rule));
+ const all = new Set(scan([path.join(fixtures, "slop")], { platform: "mobile" }).findings.map((f) => f.rule));
for (const rule of rules) assert.ok(all.has(rule.id), `no fixture for ${rule.id}`);
});
@@ -177,3 +177,31 @@ test("an unreadable file makes the scan fail, not pass", () => {
fs.rmSync(root, { recursive: true, force: true });
}
});
+
+test("web slop is caught", () => {
+ const found = new Set(scan([path.join(fixtures, "slop", "web")]).findings.map((f) => f.rule));
+ for (const id of [
+ "slop-gradient", "gradient-text", "tracked-caps-label", "unverified-claim", "img-no-alt", "decorative-pulse",
+ "clickable-div", "transition-all", "hover-scale", "icon-tile", "focus-removed", "zoom-disabled",
+ ]) assert.ok(found.has(id), `missing ${id}`);
+});
+
+test("clean web fixtures produce no findings", () => {
+ const { findings, filesScanned } = scan([path.join(fixtures, "clean-web")]);
+ assert.strictEqual(filesScanned, 2);
+ assert.deepStrictEqual(findings, []);
+});
+
+test("mobile-only rules stay quiet on web projects", () => {
+ const found = new Set(scan([path.join(fixtures, "slop", "web")]).findings.map((f) => f.rule));
+ assert.ok(!found.has("hover-only"));
+ const src = '<a onMouseEnter={x}>Docs</a>\nconst Nav = createDrawerNavigator();\n';
+ assert.deepStrictEqual(scanSource(src, "a.tsx", { kind: "web" }).map((f) => f.rule), []);
+ assert.deepStrictEqual(scanSource(src, "a.tsx", { kind: "mobile" }).map((f) => f.rule).sort(), ["drawer-nav", "hover-only"]);
+ assert.deepStrictEqual(scanSource(src, "a.tsx", { kind: "universal" }).map((f) => f.rule), ["drawer-nav"]);
+});
+
+test("--platform overrides the detected project kind", () => {
+ const found = new Set(scan([path.join(fixtures, "slop", "web")], { platform: "mobile" }).findings.map((f) => f.rule));
+ assert.ok(found.has("hover-only"));
+});
diff --git a/test/fixtures/clean-web/Page.tsx b/test/fixtures/clean-web/Page.tsx
new file mode 100644
index 0000000..511a1ff
--- /dev/null
+++ b/test/fixtures/clean-web/Page.tsx
@@ -0,0 +1,20 @@
+export default function Page({ zones }) {
+ return (
+ <main className="mx-auto max-w-5xl px-6">
+ <h1 className="text-3xl font-medium">Zones</h1>
+ <p className="text-zinc-600">17 zones, 1 waiting for nameservers</p>
+ <img src="/map.png" alt="Map of edge locations serving your zones" width={960} height={480} />
+ <div className="h-4 w-32 animate-pulse rounded bg-zinc-200" />
+ <ul>
+ {zones.map((z) => (
+ <li key={z.id}>
+ <a className="rounded transition-colors hover:bg-zinc-100 focus-visible:outline-2 focus-visible:outline-offset-2" href={`/zones/${z.id}`}>
+ {z.name}
+ </a>
+ <button className="outline-none focus-visible:ring-2" onClick={() => purge(z.id)}>Purge cache</button>
+ </li>
+ ))}
+ </ul>
+ </main>
+ );
+}
diff --git a/test/fixtures/clean-web/package.json b/test/fixtures/clean-web/package.json
new file mode 100644
index 0000000..b9e2b65
--- /dev/null
+++ b/test/fixtures/clean-web/package.json
@@ -0,0 +1,4 @@
+{
+ "private": true,
+ "dependencies": { "next": "*", "react": "*", "react-dom": "*" }
+}
diff --git a/test/fixtures/clean-web/styles.css b/test/fixtures/clean-web/styles.css
new file mode 100644
index 0000000..34237bf
--- /dev/null
+++ b/test/fixtures/clean-web/styles.css
@@ -0,0 +1,13 @@
+a:hover {
+ background: var(--surface-hover);
+}
+
+button:focus-visible {
+ outline: 2px solid var(--accent);
+ outline-offset: 2px;
+}
+
+.label {
+ font-size: 0.875rem;
+ color: var(--text-secondary);
+}
diff --git a/test/fixtures/slop/web/Landing.tsx b/test/fixtures/slop/web/Landing.tsx
new file mode 100644
index 0000000..f3f01f5
--- /dev/null
+++ b/test/fixtures/slop/web/Landing.tsx
@@ -0,0 +1,27 @@
+import { Menu, Zap } from "lucide-react";
+
+export default function Landing() {
+ return (
+ <main>
+ <nav>
+ <button aria-label="Open menu"><Menu /></button>
+ <a className="hover:underline" onMouseEnter={() => prefetch("/pricing")} href="/pricing">Pricing</a>
+ </nav>
+ <section className="text-center">
+ <span className="text-xs font-semibold uppercase tracking-widest text-indigo-500">New</span>
+ <h1 className="bg-gradient-to-r from-violet-600 to-fuchsia-500 bg-clip-text text-transparent">Ship faster</h1>
+ <p>Trusted by 10,000+ teams. 10x faster deploys.</p>
+ <img src="/hero.png" />
+ <span className="absolute h-3 w-3 animate-ping rounded-full bg-emerald-400" />
+ </section>
+ <div className="grid grid-cols-3 gap-6">
+ <div className="rounded-xl border p-6 shadow-sm transition-all hover:scale-105" onClick={() => go("/a")}>
+ <div className="flex h-10 w-10 items-center justify-center rounded-lg bg-indigo-50">
+ <Zap />
+ </div>
+ <input className="outline-none" placeholder="Email" />
+ </div>
+ </div>
+ </main>
+ );
+}
diff --git a/test/fixtures/slop/web/index.html b/test/fixtures/slop/web/index.html
new file mode 100644
index 0000000..a01eef9
--- /dev/null
+++ b/test/fixtures/slop/web/index.html
@@ -0,0 +1,7 @@
+<!doctype html>
+<html>
+ <head>
+ <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
+ </head>
+ <body></body>
+</html>
diff --git a/test/fixtures/slop/web/package.json b/test/fixtures/slop/web/package.json
new file mode 100644
index 0000000..b9e2b65
--- /dev/null
+++ b/test/fixtures/slop/web/package.json
@@ -0,0 +1,4 @@
+{
+ "private": true,
+ "dependencies": { "next": "*", "react": "*", "react-dom": "*" }
+}
diff --git a/test/fixtures/slop/web/styles.css b/test/fixtures/slop/web/styles.css
new file mode 100644
index 0000000..4c61f95
--- /dev/null
+++ b/test/fixtures/slop/web/styles.css
@@ -0,0 +1,14 @@
+.eyebrow {
+ text-transform: uppercase;
+ letter-spacing: 0.12em;
+ font-size: 12px;
+}
+
+button {
+ outline: none;
+ transition: all 0.3s ease;
+}
+
+.card:hover {
+ transform: scale(1.05);
+}