Skip to content
Back to skills

Cognitive Load

ASecurity

Measure how much a web page asks of its reader, screen by screen, and cut it until it fits a budget for that reader. Use before publishing or sharing any page, explainer, report, landing page, docs page, dashboard or app screen, and whenever a page is called "too dense", "too much text", "overwhelming", "busy" or "hard to scan". It opens the page in a headless browser, counts only what is visible (words, things to click, attention-grabbing styles, text styles, code), checks how it is laid out...

  • 3 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added November 20, 2026
designgobashnodeexpressapi

Works with

  • cli
  • api

Security analysis

A96/100
  • mediumInstalls packages at runtime which could introduce malicious dependencies

Pro scans all 2 files and shows the line behind each finding

Scanned November 20, 2026

npx -y skills add andrueandersoncs/cognitive-load --skill cognitive-load --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Cognitive Load?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Cognitive Load
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/andrueandersoncs-cognitive-load/badge)](https://www.skillsdirectory.com/skills/andrueandersoncs-cognitive-load)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: cognitive-load
description: Measure how much a web page asks of its reader, screen by screen, and cut it until it fits a budget for that reader. Use before publishing or sharing any page, explainer, report, landing page, docs page, dashboard or app screen, and whenever a page is called "too dense", "too much text", "overwhelming", "busy" or "hard to scan". It opens the page in a headless browser, counts only what is visible (words, things to click, attention-grabbing styles, text styles, code), checks how it is laid out (text size, line spacing, line length, tap targets) and flags every screen or panel over budget. Budgets come from built-in reader profiles (newcomer by default, plain-language reader, skimmer, developer, daily app user) or a cognitive-load.json settings file.
---

# Cognitive load

A page can be correct and still lose its reader because each screen asks too much at once. This skill measures that, per screen, with numbers, so "too dense" becomes something you can check and fix before anyone sees the page.

## What it measures

For each screen (or each panel of an app), counting only what is actually visible in the window — not text scrolled away, hidden, folded inside a closed `<details>`, or covered by a sticky header, a fixed banner or a modal. Something covers what's under it if it has a background colour or gradient at least half opaque, or a blur; a background image laid over text is taken as see-through decoration. Each screen starts just below a sticky header, so what the header covers is counted on the screen before:

| Measure | What it counts |
|---|---|
| words | words of prose a person would read |
| targets | separate things asking to be looked at or clicked: buttons, links, fields, list items, code blocks, quotes. A list item with a link or button in it counts once |
| emphasis | things styled to grab attention: red text, underlines, and bold runs or links inside a sentence. A link on its own (a menu item, a button) is a target, not emphasis |
| styles | distinct text styles (font, size, weight, colour) — visual noise. All code counts as one style |
| code | lines of code showing; a snippet inside a sentence counts as one line |
| **burden** | a weighted sum of the five. For the default reader: words ÷ 20 + targets + 2 × emphasis + styles + code ÷ 2 |

It also checks how that content is laid out. These are limits of their own, not part of the burden:

| Layout | What it checks |
|---|---|
| size | text size in px: four words in five should be at least this big |
| spacing | line spacing (distance between lines ÷ text size) in prose that wraps: four words in five should have at least this much. Headings and text of 24px or more are left out |
| line | line length in characters: four words in five should sit in lines no longer than this |
| taps | controls too small to tap reliably: under 24×24 px and closer than 24 px to another control (WCAG 2.5.8). A link in a line of text is exempt, as in WCAG. Unlike WCAG, buttons left at the browser's default size still count: they are small on a phone |

## Pick the reader

How much is too much depends on who is reading. Choose a profile before you measure. If the user hasn't said who the page is for and the page doesn't make it obvious, ask. When in doubt, use `general`.

| Profile | Reader | Use for | words | targets | emphasis | styles | code | burden |
|---|---|---|---|---|---|---|---|---|
| `general` (default) | a newcomer reading with care | explainers, reports, help articles, onboarding | 110 | 12 | 6 | 7 | 0 | 30 |
| `plain` | someone who needs plain language: a second language, low literacy, a cognitive disability, or stress | health, money, legal and public-service pages, forms, error screens | 90 | 8 | 4 | 5 | 0 | 22 |
| `skimmer` | a visitor deciding in seconds whether to stay | landing pages, pricing, announcements, newsletters | 60 | 10 | 6 | 6 | 0 | 24 |
| `technical` | a developer or specialist reading on purpose | API references, tutorials, READMEs, changelogs | 160 | 24 | 8 | 9 | 30 | 50 |
| `operator` | a daily user of an app who knows the layout | dashboards, admin panels, internal tools, inboxes | 80 | 30 | 8 | 8 | 0 | 35 |

Layout limits for each profile:

| Profile | size ≥ | spacing ≥ | line ≤ | taps ≤ |
|---|---|---|---|---|
| `general` | 16px | 1.3 | 80 | 0 |
| `plain` | 16px | 1.5 | 70 | 0 |
| `skimmer` | 16px | 1.3 | 80 | 0 |
| `technical` | 14px | 1.3 | 100 | 0 |
| `operator` | 12px | 1.3 | 100 | 0 |

The numbers are the most one screen may show (and, for size and spacing, the least). Three profiles also change a weight in the burden: for `plain` every 15 words cost a point instead of 20, for `technical` 5 lines of code cost a point instead of 2, and for `operator` two familiar controls cost one point. `--profiles` prints each profile with the reasoning behind it.

The `general` budgets come from working memory (about four to seven chunks at a glance) and reading pace (about 200 words a minute): one screen should be readable in about 30 seconds and offer a handful of choices. The others start from the same idea for their reader. The layout limits follow common reading guidance: 16px body text, lines of at most 80 characters (WCAG 1.4.8), and for `plain` line spacing of 1.5 and lines of about 70 characters, as dyslexia-friendly style guides advise.

Pick the profile for the people who will actually read the page, never to make a page pass. A help article does not become `technical` because it has a code sample in it.

## Setup

The script needs Node 18+ and Playwright with Chromium. If `require('playwright')` fails, install it in the project being measured:

```bash
npm i -D playwright && npx playwright install chromium
```

The script also finds a global Playwright install.

## Run it

The script is `scripts/attention.cjs` in this skill's folder. Pass a URL or a local HTML file.

**A reading page** (article, explainer, report, landing page) — the default. It scrolls one screen at a time at desktop (1440×900) and phone (390×844) width:

```bash
node <skill-dir>/scripts/attention.cjs dist/explainer.html
node <skill-dir>/scripts/attention.cjs http://localhost:3000/pricing --profile skimmer
node <skill-dir>/scripts/attention.cjs dist/docs/api.html --profile technical
```

**An app with panels** — name each panel with a CSS selector:

```bash
node <skill-dir>/scripts/attention.cjs http://localhost:3000 --profile operator --region list=#list --region detail=#detail
```

**An app in several states** — write a states file and the regions are measured in each one. Steps run in order on one page:

```json
[
  { "name": "At rest", "steps": [] },
  { "name": "Item selected", "steps": [{ "click": "#list li:first-child" }] },
  { "name": "Details open", "steps": [{ "click": "#detail .more" }, { "waitFor": "document.querySelector('#detail .loaded')" }] }
]
```

Step kinds: `click` (selector), `eval` (JS run in the page), `waitFor` (JS expression), `wait` (ms), `scroll` (y).

```bash
node <skill-dir>/scripts/attention.cjs http://localhost:3000 --region list=#list --region detail=#detail --states states.json
```

Other options: `--budget words=150,burden=35` changes a limit on top of the profile, `--weights code=0.25` changes what a measure adds to the burden, `--ready "window.appReady"` waits for the page, `--alarm "var(--danger)"` adds a page's alarm colour if it isn't plainly red, `--ignore "#dev-toolbar"` leaves an element out of every count, `--json` prints machine-readable output, `--help` lists everything.

Exit code is 0 within budget, 2 if anything is over, 1 if the run failed — so it can gate a build.

## Settings file

For a project, put the settings in `cognitive-load.json` where you run the script (or pass `--config file.json`). It can hold any setting from the command line, define your own profiles, give a panel its own budget, and list the pages to measure, each with its own reader:

```json
{
  "profile": "general",
  "profiles": {
    "support-agent": { "extends": "operator", "reader": "a support agent working the queue all day", "budget": { "targets": 20 } }
  },
  "pages": [
    { "url": "dist/index.html", "profile": "skimmer" },
    { "url": "dist/docs/api.html", "profile": "technical" },
    { "url": "http://localhost:3000/orders", "profile": "support-agent", "ready": "window.appReady",
      "regions": { "list": { "selector": "#list", "budget": { "targets": 25 } }, "detail": "#detail" },
      "states": "states/orders.json" }
  ]
}
```

- With `pages` listed, run the script with no URL to measure them all; it exits 2 if any page is over. Name one page (`attention.cjs dist/index.html`) to measure just that one with its settings.
- Settings at the top level apply to every page; a page's own settings win; the command line wins over both. `budget` and `weights` adjust the chosen profile rather than replace it.
- Settings keys: `profile`, `budget`, `weights`, `sizes`, `viewport`, `settle`, `ready`, `alarms`, `ignore`, `label`, `regions`, `states`. Page URLs and states files are relative to the settings file.
- A custom profile `extends` a built-in or another custom profile (`general` if not given) and can set `reader`, `fits`, `why`, `budget` and `weights`. Keep its burden about 80% of what a screen at every other limit would score, as the built-in ones do.
- Unknown keys are errors, so a typo can't quietly fall back to a default. `--no-config` ignores the file.

Use `ignore` only for things the page's reader won't see (a dev toolbar, a debug overlay), or for chrome the page's author doesn't control when judging one page inside it (a docs site's sidebar). An ignored element is also treated as see-through, so whatever it covers counts, as if it had been dismissed. Say so when you report the result. Never use it to make a page pass.

## Read the result

An example:

```
Reader: general — a newcomer reading with care.
Budget per screen: words ≤ 110, targets ≤ 12, emphasis ≤ 6, styles ≤ 7, code ≤ 0, burden ≤ 30.  * = over budget.
Layout: size ≥ 16px, spacing ≥ 1.3, line ≤ 80 chars, taps ≤ 0.
Burden = words/20 + targets + 2×emphasis + styles + code/2

screen                  words  targets emphasis   styles     code   burden     size  spacing     line     taps  headings
desktop screen 1         210*       7        2        9*       0       31*      16      1.5       96*       0   What it does / How it works
phone screen 1            85        6        2        7        0       21       14*     1.5       42        2*  What it does
```

`*` marks a measure over budget, or for size and spacing, under its minimum. `–` means there was nothing to check, such as no wrapping prose for spacing. The headings column says which part of the page that screen shows, so you know where to cut. Check both widths: a desktop screen that passes can be two dense phone screens, and the reverse. With `--json`, each row lists its `over` measures.

## Cut until it passes

Draft, measure, cut, measure again. Publish only when every screen is within budget for the reader you chose. What usually works:

- **Lead with the answer, not a paragraph.** A big number or one short sentence instead of an opening paragraph.
- **Short list items.** Two to six words each; one line per example.
- **Fold detail away.** Put long explanations, code and sources behind a `<details>` toggle — folded content does not count until opened.
- **Fewer styles.** One body style, one heading style, one muted style. Every extra size or colour is another thing to parse.
- **Spend emphasis carefully.** Red, bold and links inside a sentence all pull the eye. If everything is highlighted, nothing is.
- **Split, don't shrink.** If a screen is over on words, move half of it to the next section rather than reducing the font.
- **Keep text readable.** Body text at 16px or more with a line height of about 1.5. A screen that is too full needs cutting, not smaller type.
- **Cap the line length.** Give the text column a `max-width` of about `70ch`, so lines stay under 80 characters on wide screens.
- **Give small controls room.** Make buttons and icon links at least 24×24 px (44 px is kinder on phones), or space them apart.

Do not game the numbers (tiny text, text in images, hiding content from the measure, a looser profile than the real reader). The goal is a page its reader can take in, and the numbers are only a check on that.

Files in this skill

  • SKILL.md12.2 KB
  • scripts/attention.cjs41.6 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in design →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.