Skip to content

Rules for an AI coding agent to filter out generic AI-generated UI designs, text, and code.

v2.4.1: guide.md + fixes for #1 #2 #3 #6 #7

miqdadbadzubair-designa3eb220b8845
diff --git a/.gitignore b/.gitignore
index 0acaebc..9f71a01 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,6 @@
-# Dokumen audit/review internal — tidak untuk dipublish ke repo
+# Internal audit/review documents (not published to the repo)
docs/
+issue/
# OS noise
.DS_Store
diff --git a/README.md b/README.md
index 8df6d9f..2db27c0 100644
--- a/README.md
+++ b/README.md
@@ -9,7 +9,9 @@
# antislop
-> **Anti AI Slop: Design & Copy Rules.** A rules file for AI coding agents. It stops them from generating generic "AI slop" UI and copy, without letting the result turn sterile. It is a **filter, not a style guide**: no prescribed colors, fonts, or layouts.
+> **Anti AI Slop: Design & Copy Rules.** A rules file for AI coding agents. It stops them from generating generic "AI slop" UI and copy, without letting the result turn sterile. It is a **filter, not a style guide**: no prescribed colors, fonts, or layouts. It is not only for building pages: it also writes and audits copy, so AI text stops reading like AI. And it never beautifies on its own; `DESIGN.md` (yours) is where beauty and direction come from.
+
+> **New here? Start with the [guide](guide.md).** It explains what antislop is and how to install it, from zero.
## What it does
@@ -22,7 +24,7 @@ The core prevents slop but cannot invent direction. `DESIGN.md` (yours) supplies
## Install
-**The easy way (wizard).** Download the core once, tell your agent to read it, and the wizard does the rest: it asks which skills to install, downloads them into the same folder, and appends a managed pointer block to your entry file.
+**The easy way (wizard).** Download the core once and tell your agent to read it. The wizard installs the skills you pick and sets up the pointer for you.
```bash
curl -o antislop.md https://raw.githubusercontent.com/miqdadbadjuber/anti-slop/main/antislop.md
@@ -47,13 +49,21 @@ curl -o antislop.md https://raw.githubusercontent.com/miqdadbadjuber/anti-slop/m
`antislop.md` alone is a complete filter. Skills add depth for one concern at a time; the wizard installs them, or download any you want the same way (`curl -o <skill-name>.md`).
+`antislop-human` also runs `scripts/contrast-check.py` to verify color pairs you cannot judge by eye. Fetch it the same way, if you want it (optional — the skill falls back to the formula and reference table without it):
+
+```bash
+curl -o scripts/contrast-check.py https://raw.githubusercontent.com/miqdadbadjuber/anti-slop/main/scripts/contrast-check.py
+```
+
Then add a pointer block to your entry file, listing exactly the skills you installed:
```md
+<!-- antislop: auto-managed block, do not edit -->
## antislop
-For UI or copy work, read `antislop.md` (core) and then the skill for the task:
+For UI, copy, or people work, read `antislop.md` (core) and then the skill for the task:
- UI / visual: `antislop-ui.md`
- Copy & text: `antislop-copywriting.md`
+- People: `antislop-human.md`
Before starting, ask the user when antislop applies: during the work, or after it is done.
```
@@ -65,12 +75,12 @@ You can optionally put a dial line in `DESIGN.md` (`Dial: ENERGY 2 / RHYTHM 3 /
|-------|----------------|----------|
| `antislop-ui` | UI / visual: layout, color, components, decoration, motion, structure | v2.2.0 |
| `antislop-copywriting` | Copy & text: headlines, CTAs, tone, fake stats, anti-AI-writing patterns, markdown hygiene | v2.3.0 |
-| `antislop-human` | Human: contrast, keyboard, focus, states | v2.4.0 (planned) |
+| `antislop-human` | Human: contrast, keyboard, focus, states | v2.4.0 |
| `antislop-layoutmobile` | Mobile layout: responsive breakpoints, grids, overflow, tap targets | v2.5.0 (planned) |
| `antislop-docs` | Documentation: READMEs, API references, changelogs, tutorials | v2.6.0 (planned) |
| `antislop-identity` | Identity & naming: product names, taglines, brand voice | v2.7.0 (planned) |
-Pick what matches the work: UI work → `antislop-ui`, copy work → `antislop-copywriting`, both → "All", or none (the core alone is a complete filter).
+Pick what matches the work: UI work → `antislop-ui`, copy work → `antislop-copywriting`, people work → `antislop-human`, more than one → "All", or none (the core alone is a complete filter).
## Usage Modes
diff --git a/ROADMAP.md b/ROADMAP.md
index 8a04ed5..55f5990 100644
--- a/ROADMAP.md
+++ b/ROADMAP.md
@@ -1,10 +1,10 @@
# antislop: Roadmap to v3.0.0
-> How antislop grows from a single rules file into an installable, cross-agent skill/plugin. See [README.md](README.md) for the product itself.
+> How antislop grows from a single rules file into an installable, cross-agent skill/plugin. New to antislop? Read the [guide](guide.md) first. See [README.md](README.md) for the product.
## Where we are
-The latest release is **v2.3.0**. antislop is now a **system**: a lean, always-loaded **core** (`antislop.md`, the complete rules filter, unchanged and backward compatible) plus two **skills**: `antislop-ui` (UI / visual) and `antislop-copywriting` (copy & text).
+The latest release is **v2.4.1**. antislop is now a **system**: a lean, always-loaded **core** (`antislop.md`, the complete rules filter, unchanged and backward compatible) plus three **skills**: `antislop-ui` (UI / visual), `antislop-copywriting` (copy & text), and `antislop-human` (human / accessibility). v2.4.1 adds a plain-English `guide.md` and fixes the gate items, contrast table, and dangling references found in issues #1, #2, #3, #6, #7.
The **First-Run Install Wizard** is still the install path: download `antislop.md` once, tell your agent to read it, and the agent walks you through choosing skills, downloads them into the same folder, and sets up the pointer for you. It is an offer, not a requirement: `antislop.md` alone remains a complete filter.
@@ -16,7 +16,7 @@ antislop grows toward v3.0.0 by adding one concern per version, each as a separa
> Each +0.1 version ships exactly one new skill.
-This keeps the filter pull-only-what-you-need, and it makes the v3 packaging mechanical rather than a rewrite.
+This keeps the filter pull-only-what-you-need, and it makes the v3 packaging mechanical rather than a rewrite. Occasional +0.1 patches ship something that is not a skill, like v2.4.1's plain-English `guide.md`; those do not change the skill plan.
### The skill plan
@@ -44,7 +44,8 @@ Target release: end of Q3 2026.
- [x] v2.1.1 - English only; Indonesian mirrors removed
- [x] v2.2.0 - core + First-Run Install Wizard + `antislop-ui` skill
- [x] v2.3.0 - `antislop-copywriting` skill
-- [ ] v2.4.0 - `antislop-human`
+- [x] v2.4.0 - `antislop-human`
+- [ ] v2.4.1 - `guide.md`: plain-English guide for people new to antislop (not a skill); fixes for issues #1, #2, #3, #6, #7
- [ ] v2.5.0 - `antislop-layoutmobile`
- [ ] v2.6.0 - `antislop-docs`
- [ ] v2.7.0 - `antislop-identity`
@@ -52,4 +53,4 @@ Target release: end of Q3 2026.
## Not in scope
-antislop stays a **filter, not a style guide**: no prescribed aesthetics, no per-framework recipes, no trend bans. UX and motion are folded into `antislop-ui` rather than separate skills, and data-integrity rules already live in the core.
+antislop stays a **filter, not a style guide**: no prescribed aesthetics, no per-framework recipes, no trend bans. It never beautifies on its own; direction and beauty are yours, in `DESIGN.md`. It is not limited to building pages: the same filter writes and audits copy (`antislop-copywriting`). UX and motion are folded into `antislop-ui` rather than separate skills, and data-integrity rules already live in the core.
diff --git a/antislop-copywriting.md b/antislop-copywriting.md
index c2d2d58..4d7bb39 100644
--- a/antislop-copywriting.md
+++ b/antislop-copywriting.md
@@ -216,6 +216,7 @@
- **After:**
> It blends OKRs, KPIs, and visual strategy tools for planning.
- **Rule:** R-36.
+- **Carve-out:** the structural labels inside the antislop rules themselves (the `**FORBIDDEN**` / `**REQUIRED**` markers in `antislop.md`) are documentation conventions, not the mechanical bold-every-key-term pattern above, and are exempt.
### Inline-Header Lists
@@ -228,6 +229,7 @@
- **After:**
> The update improves the interface, speeds up load times, and encrypts data in transit.
- **Rule:** R-36.
+- **Carve-out:** the `- **Tell:**` / `- **Why:**` / `- **Fix:**` headers that structure every antislop skill entry are a documentation convention, not the header-restates-the-item habit above, and are exempt.
### Emojis in Headings
diff --git a/antislop-human.md b/antislop-human.md
index ee73664..4a5e466 100644
--- a/antislop-human.md
+++ b/antislop-human.md
@@ -2,7 +2,7 @@
> Anti AI Slop: Design & Copy Rules. Human skill
-> Part of the antislop system. Read together with `antislop.md` (the core). This skill deep-dives the human concern: the UI must stay usable by people with different eyes, hands, and setups. Contrast, keyboard, focus, states, and the mobile details that exclude people. The layout mechanics behind mobile (breakpoints, grids, overflow, tap targets) live in `antislop-layoutmobile`.
+> Part of the antislop system. Read together with `antislop.md` (the core). This skill deep-dives the human concern: the UI must stay usable by people with different eyes, hands, and setups. Contrast, keyboard, focus, states, and the mobile details that exclude people.
## How to use this skill
@@ -10,7 +10,7 @@
- Every entry has the same shape: **Tell** (the pattern), **Why** (who it excludes, and why it reads as unfinished), **Fix** (what to do instead), with the governing core rule cited as R-XX.
- Accessibility is not a checklist of extras bolted on at the end. It is part of the core promise that "the UI holds up" (C-4). The Delivery Gate in the core remains the gate; the "Human Skill Checklist" at the end of this file is the supplement to run alongside it.
- The contrast checker (formula + reference table + script) lives in this skill. Use it for every color pairing you cannot verify by eye.
-- For the layout mechanics behind mobile (breakpoints, grids, overflow, tap targets), load `antislop-layoutmobile` together with this skill. This skill keeps only the mobile details that exclude people: zooming, and the on-screen keyboard.
+- This skill keeps only the mobile details that exclude people: zooming, and the on-screen keyboard.
## Color & Contrast
@@ -63,14 +63,14 @@ The script exists so agents stop hallucinating AA. It takes two hex colors and p
| Pairing (text on background) | Ratio | Normal text (4.5) | Large text (3.0) |
|------------------------------|-------|-------------------|------------------|
-| Black on white | 21.0 | Pass | Pass |
-| White on black | 21.0 | Pass | Pass |
-| White on #333333 | 12.6 | Pass | Pass |
-| White on #666666 | 5.7 | Pass | Pass |
-| #777777 on white | 4.5 | Borderline, compute | Pass |
-| White on #888888 | 3.5 | Fail | Pass |
-| White on #999999 | 2.8 | Fail | Fail |
-| #555555 on black | 2.8 | Fail | Fail |
+| Black on white | 21.00 | Pass | Pass |
+| White on black | 21.00 | Pass | Pass |
+| White on #333333 | 12.63 | Pass | Pass |
+| White on #666666 | 5.74 | Pass | Pass |
+| #777777 on white | 4.48 | Fail | Pass |
+| White on #888888 | 3.54 | Fail | Pass |
+| White on #999999 | 2.85 | Fail | Fail |
+| #555555 on black | 2.82 | Fail | Fail |
Read the table as a sanity check, not as a substitute. Any pairing not listed, or anything near a threshold, goes through the formula or the script.
@@ -116,7 +116,7 @@ Read the table as a sanity check, not as a substitute. Any pairing not listed, o
## Zoom & Mobile Use
-The layout mechanics behind mobile (breakpoints, grids, overflow, tap targets) live in `antislop-layoutmobile`. This section keeps only the mobile details that exclude people: zooming, and the on-screen keyboard.
+The layout mechanics behind mobile (breakpoints, grids, overflow, tap targets) are the concern of `antislop-layoutmobile` (planned for v2.5.0); until it ships, treat them as part of R-03 (Mobile Responsiveness). This section keeps only the mobile details that exclude people: zooming, and the on-screen keyboard.
### Text That Cannot Zoom
@@ -127,7 +127,7 @@ The layout mechanics behind mobile (breakpoints, grids, overflow, tap targets) l
### Mobile Keyboard Covers the Form
- **Tell:** inputs at the bottom of the viewport hidden behind the on-screen keyboard, with no scroll-into-view and no room for the input.
-- **Why:** a form the user cannot see or reach is a form they cannot complete. It is a mobile-only exclusion (R-35).
+- **Why:** a form the user cannot see or reach is a form they cannot complete. It is a mobile-only exclusion (R-03).
- **Fix:** when an input is focused, it scrolls into view above the keyboard, with enough bottom padding that the focused field is never covered. Test with a real device or an emulated keyboard.
## Human Skill Checklist
diff --git a/antislop.md b/antislop.md
index ba640c0..8b5b5a7 100644
--- a/antislop.md
+++ b/antislop.md
@@ -31,11 +31,11 @@ If no antislop pointer exists and this file is being read for the first time, ru
- **3. The user skips direction for now.** Proceed without a `DESIGN.md`. Any UI built this way must be labeled *"draft without direction"* with dials ENERGY 1 / RHYTHM 1 / MOTION 1 (R-37), and is not a shippable deliverable.
4. **Download the chosen skill file(s)** into the same folder as this file, level with it, pinned to the release tag that matches this version so a newer skill never mixes with an older core. When `antislop-human` is chosen, also download its contrast-check script into a `scripts/` subfolder:
```bash
- curl -o antislop-ui.md https://raw.githubusercontent.com/miqdadbadjuber/anti-slop/v2.4.0/antislop-ui.md
- curl -o antislop-copywriting.md https://raw.githubusercontent.com/miqdadbadjuber/anti-slop/v2.4.0/antislop-copywriting.md
- curl -o antislop-human.md https://raw.githubusercontent.com/miqdadbadjuber/anti-slop/v2.4.0/antislop-human.md
+ curl -o antislop-ui.md https://raw.githubusercontent.com/miqdadbadjuber/anti-slop/v2.4.1/antislop-ui.md
+ curl -o antislop-copywriting.md https://raw.githubusercontent.com/miqdadbadjuber/anti-slop/v2.4.1/antislop-copywriting.md
+ curl -o antislop-human.md https://raw.githubusercontent.com/miqdadbadjuber/anti-slop/v2.4.1/antislop-human.md
mkdir -p scripts
- curl -o scripts/contrast-check.py https://raw.githubusercontent.com/miqdadbadjuber/anti-slop/v2.4.0/scripts/contrast-check.py
+ curl -o scripts/contrast-check.py https://raw.githubusercontent.com/miqdadbadjuber/anti-slop/v2.4.1/scripts/contrast-check.py
```
5. **Append the pointer block at the END of the project's entry file** (the file the running tool reads at session start: `CLAUDE.md` for Claude Code, `AGENTS.md` for Codex, `GEMINI.md` for Gemini CLI, and so on). If that file does not exist, create it. Never modify existing content:
```md
@@ -131,7 +131,7 @@ Anything presented as fact (testimonials, statistics, security claims) is real a
## Part 1: AI Slop Patterns (Warning Signs)
-These are the most common patterns found in AI-generated designs. Use this table to **audit** your output: scan for clusters, then ask each one "what does this serve?" A single pattern from this list is fine if it serves a purpose, unless a **Hard Gate** rule in Part 2 forbids it (R-02, R-17, R-18, R-23 to R-28, R-32 to R-38). What makes a design slop is many of these appearing together with no reason. This is a **diagnostic scan, not a ban list**: Part 1 itself bans nothing, but the Hard Gate rules in Part 2 are absolute, and every other pattern must pass the purpose test (Part 2, Purpose-Gate group).
+These are the most common patterns found in AI-generated designs. Use this table to **audit** your output: scan for clusters, then ask each one "what does this serve?" A single pattern from this list is fine if it serves a purpose, unless a **Hard Gate** rule in Part 2 forbids it (R-02, R-03, R-17, R-18, R-23 to R-28, R-32 to R-38). What makes a design slop is many of these appearing together with no reason. This is a **diagnostic scan, not a ban list**: Part 1 itself bans nothing, but the Hard Gate rules in Part 2 are absolute, and every other pattern must pass the purpose test (Part 2, Purpose-Gate group).
### Visual & Color
@@ -228,6 +228,7 @@ These rules protect honesty, function, and accessibility. Breaking any of them i
- **FORBIDDEN**: em dash character (`—`) in any text
- Use comma (`,`), period (`.`), colon (`:`), or parentheses `()` instead
- Text must feel natural and human
+- **Carve-out**: documentation of this rule is exempt: the numbered section headings in this file (`R-XX — Title` rules and `C-1` to `C-5` principles), the em dash example in Part 1, the rule's own definition, any Delivery Gate item that quotes it, and the `Em Dashes` section in `antislop-copywriting.md`. These are documentation structure, not UI text.
#### R-03 — Mobile Responsiveness
@@ -587,11 +588,11 @@ The gate has four blocks: Hard Gate (absolute), Purpose-Gate (technique + writte
Before declaring the design done, answer every question below. All answers must be **no**:
-- [ ] Is there an em dash (`—`) anywhere in the text, outside the allowed R-02 example? *(R-02)*
+- [ ] Is there an em dash (`—`) anywhere in the text, outside the R-02 carve-out? *(R-02)*
- [ ] Is there any horizontal overflow, text escaping its container, or broken layout on mobile? *(R-03)*
- [ ] Are there any statistics without a real source (10K+ Users, 99.9% Uptime, etc.)? *(R-17)*
- [ ] Are there any fictional testimonials (AI avatars, random names or job titles)? *(R-18)*
-- [ ] Were any visual assets (logo, avatar/profile photo, statistics, testimonials, or navigation structure) created without explicit instructions or confirmation, or without an honest placeholder? *(R-23)*
+- [ ] Were any visual assets (logo, avatar/profile photo, statistics, testimonials, or navigation structure) created without explicit instructions or confirmation, and without an honest placeholder? *(R-23)*
- [ ] Are there navbar links pointing to sections or pages that do not exist? *(R-24)*
- [ ] Is there any text with contrast below the WCAG AA standard (4.5:1 for normal text, 3:1 for large text)? *(R-25)*
- [ ] Are there any buttons, dropdowns, or forms that do nothing, with no real behavior and no `// TODO` + visible label? *(R-26)*
@@ -600,9 +601,9 @@ Before declaring the design done, answer every question below. All answers must
- [ ] Can the UI not be navigated by keyboard (Tab, Enter, Escape) or is there no visible focus state? *(R-32)*
- [ ] Was any feature added by patching source/CSS with an external script instead of writing it in source? *(R-33)*
- [ ] If a theme toggle exists, does one mode (light or dark) break styles, fonts, or layout? *(R-34)*
-- [ ] Was the app run/built and every interactive element exercised before delivery? *(R-35)*
+- [ ] Was the app delivered without being run or built, or with any interactive element left unexercised? *(R-35)*
- [ ] Are there any fabricated security, compliance, performance, or customer claims? *(R-36)*
-- [ ] Was the design built without a style direction, or was it built without direction AND not labeled *"draft without direction"* with honest default dials ENERGY 1 / RHYTHM 1 / MOTION 1? *(R-37)*
+- [ ] Was the design built without direction and not labeled *"draft without direction"* with honest default dials ENERGY 1 / RHYTHM 1 / MOTION 1? *(R-37)*
- [ ] Is there any realistically-styled content that was fabricated (testimonials, features, statistics, ghost links, fictional team) without a real source? *(R-38)*
### Block 2: Purpose-Gate (technique allowed, reason required)
diff --git a/guide.md b/guide.md
new file mode 100644
index 0000000..1334d1e
--- /dev/null
+++ b/guide.md
@@ -0,0 +1,98 @@
+# The antislop guide
+
+antislop is a rules file you give to the AI assistant you already talk to, like ChatGPT, Claude, or Gemini. It stops that AI from making slop: pages and text that look generic and obviously made by AI. It is a filter, not a style guide. It never picks your colors or fonts. It removes the slop and leaves the direction to you.
+
+## What is slop?
+
+Slop is the default AI look and sound:
+
+- The same color-fading banner at the top, the same rounded cards, the same "Unlock the power of..." headline.
+- Text that sounds excited and says nothing.
+- Pages that look fine in a screenshot but fail real people: text that blends into its background, keyboard-only users locked out.
+
+If you have used AI to build a page or write a line of copy, you have seen slop. antislop exists to remove it.
+
+## What you can use it for
+
+antislop is not only for building pages. Any AI output that can get sloppy benefits:
+
+- Build a new page or app: layout, color, parts of the page, animation, structure.
+- Write or rewrite copy: headlines, buttons, emails, and tone that do not sound AI-made.
+- Keep the page usable by people: readable colors, keyboard use, clear focus, and button states.
+- Check work you already have: it can list what to fix.
+
+The main file (the core) covers all of it. Skills (see What is a skill?) go deeper into one concern when you want more.
+
+## Why use it?
+
+Without a filter, AI output looks and sounds the same everywhere. With antislop, the result is specific and alive, not just clean: every major choice needs a reason, written down.
+
+One thing antislop does not do: make things pretty. It removes slop. If you have a specific look in mind, write it down in a file called DESIGN.md and the AI builds toward it. You don't have to make one. Without a DESIGN.md, the AI labels its work "draft without direction" instead of passing it off as finished (see Words used here).
+
+## What you need
+
+One file: `antislop.md`, and the AI assistant you already use.
+
+The file holds all the rules the AI follows, plus the wizard that installs skills for you. Nothing else is required. Skills are optional add-ons; you do not need any to start.
+
+## What is a skill?
+
+A skill is an optional file that goes deeper into one concern. The core works alone; a skill adds depth for one topic.
+
+- `antislop-ui`: look and feel. Layout, color, parts of the page, animation.
+- `antislop-copywriting`: the text. Headlines, buttons, tone, made-up statistics.
+- `antislop-human`: the people. Readable colors, keyboard use, clear focus, and button states.
+
+Pick the one that matches your work. UI work means `antislop-ui`. Copy work means `antislop-copywriting`. People work means `antislop-human`. More than one? Ask for "All". None? The core alone is enough.
+
+## How to install
+
+Three steps.
+
+**1. Download `antislop.md` once.** Two ways:
+
+- From the browser: open the repository page (the GitHub page where the product's files live, [here](https://github.com/miqdadbadjuber/anti-slop)), open `antislop.md`, and click the Download button.
+- From the terminal (the black window where you type commands):
+
+ ```bash
+ curl -o antislop.md https://raw.githubusercontent.com/miqdadbadjuber/anti-slop/main/antislop.md
+ ```
+
+**2. Put the file where your AI can read it, then tell it what you want.**
+
+`antislop.md` is a plain text file, so the AI can read it. If your AI works with files (like Claude, Gemini, or Cursor), save `antislop.md` in the same folder as your work. Not sure which folder? Ask your AI where to put it. If your AI is a chat window (like ChatGPT on the web), open `antislop.md` in a text editor (Notepad works), copy everything, and paste it into the chat.
+
+Then tell it what you want. Say:
+
+> Read `antislop.md` and follow its install instructions. I want the UI and copywriting skill.
+
+If you pasted the contents instead of giving the file, say: "Follow the install instructions I pasted. I want the UI and copywriting skill." The AI follows the instructions, downloads the skills you asked for, and saves a note to use them next time. That is the whole setup. Say "core only" to skip skills.
+
+**3. Answer the wizard's questions.**
+
+It confirms which skills you want and asks when antislop should apply: while the AI is working (during), or after the work is done, to check it (after). Pick "during" for new work.
+
+Done. Want to skip the wizard? There is a manual setup too; see the README, the product's main page, [here](README.md).
+
+## Why is one file enough?
+
+The main file holds everything: the rules and the wizard. Skills are optional depth, downloaded only when you need them. That keeps the filter light and your AI fast.
+
+## Where is this going?
+
+Every new version of antislop adds one skill. Next up: mobile layout, documentation, and identity. The end goal is v3.0.0, the whole system packaged as an installable plugin (an add-on you install once, like an app). See the roadmap, the page that lists what is coming next, [here](ROADMAP.md).
+
+## Words used here
+
+- **Slop**: output that looks or reads generic and AI-made.
+- **Agent**: another word for your AI assistant, like ChatGPT, Claude, or Gemini.
+- **Core**: `antislop.md`, the main file that holds all the rules and the wizard.
+- **Skill**: an optional file that goes deeper into one concern.
+- **Copy**: the words on a page.
+- **Contrast**: how clearly text stands out from its background.
+- **Wizard**: the install instructions inside `antislop.md`. When you tell your AI to read the file, it follows them and asks you questions.
+- **Filter**: removes the bad and keeps the good. antislop removes slop, not your direction.
+- **UI**: the look of a page or app.
+- **DESIGN.md**: a file you write with your UI direction: who it is for, the mood, the colors. antislop does not invent direction.
+
+For the full product, see the [README](README.md).
diff --git a/scripts/contrast-check.py b/scripts/contrast-check.py
index 0036d1e..aff9c2d 100644
--- a/scripts/contrast-check.py
+++ b/scripts/contrast-check.py
@@ -4,15 +4,24 @@
Usage:
python contrast-check.py "#FFFFFF" "#777777"
python contrast-check.py FFFFFF 777777
+ python contrast-check.py --selftest
Prints the contrast ratio and a PASS/FAIL verdict for normal text (4.5:1)
and large text (3:1, 18px+ per antislop R-25). Exit code 0 only when both
verdicts pass, so scripts can chain on it.
+
+--selftest parses the reference table out of antislop-human.md (the doc is
+the source of truth, not a list copied into this script) and recomputes
+every row with the formula, checking the ratio and both verdict columns.
"""
+import os
import re
import sys
+REFERENCE_HEADER = "| Pairing (text on background) | Ratio | Normal text (4.5) | Large text (3.0) |"
+NAMED_COLORS = {"black": (0, 0, 0), "white": (255, 255, 255)}
+
def parse_hex(value):
value = value.strip().lstrip("#")
@@ -23,6 +32,23 @@ def parse_hex(value):
return tuple(int(value[i:i + 2], 16) for i in (0, 2, 4))
+def parse_pairing(pairing):
+ """Turn 'White on #333333' or '#555555 on black' into two RGB tuples."""
+ colors = []
+ for token in re.split(r"\s+on\s+", pairing):
+ token = token.strip()
+ match = re.search(r"#[0-9A-Fa-f]{3,6}", token)
+ if match:
+ colors.append(parse_hex(match.group(0)))
+ elif token.lower() in NAMED_COLORS:
+ colors.append(NAMED_COLORS[token.lower()])
+ else:
+ raise ValueError(f"cannot parse {token!r} from pairing {pairing!r}")
+ if len(colors) != 2:
+ raise ValueError(f"expected two colors in pairing {pairing!r}")
+ return tuple(colors)
+
+
def linearize(channel):
c = channel / 255.0
if c <= 0.03928:
@@ -36,17 +62,97 @@ def luminance(rgb):
def contrast_ratio(color_a, color_b):
- lum_a, lum_b = luminance(parse_hex(color_a)), luminance(parse_hex(color_b))
+ lum_a, lum_b = luminance(color_a), luminance(color_b)
lighter, darker = sorted((lum_a, lum_b), reverse=True)
return (lighter + 0.05) / (darker + 0.05)
+def reference_doc_path():
+ here = os.path.dirname(os.path.abspath(__file__))
+ candidates = (
+ os.path.join(here, os.pardir, "antislop-human.md"),
+ os.path.join(here, "antislop-human.md"),
+ os.path.join(os.getcwd(), "antislop-human.md"),
+ )
+ for path in candidates:
+ if os.path.isfile(path):
+ return path
+ return None
+
+
+def parse_reference_rows(path):
+ """Parse the reference table rows out of antislop-human.md."""
+ rows = []
+ with open(path, encoding="utf-8") as handle:
+ in_table = False
+ for raw in handle:
+ line = raw.rstrip("\n")
+ if line.startswith(REFERENCE_HEADER):
+ in_table = True
+ continue
+ if not in_table:
+ continue
+ if not line.startswith("|"):
+ break
+ if line.startswith("|---"):
+ continue
+ cells = [cell.strip() for cell in line.strip().strip("|").split("|")]
+ if len(cells) != 4:
+ continue
+ pairing, ratio, normal, large = cells
+ rows.append({
+ "pairing": pairing,
+ "ratio": float(ratio),
+ "normal": normal,
+ "large": large,
+ })
+ return rows
+
+
+def selftest():
+ doc = reference_doc_path()
+ if doc is None:
+ print("selftest: antislop-human.md not found next to the script; cannot check the table")
+ return 2
+ try:
+ rows = parse_reference_rows(doc)
+ except (OSError, ValueError) as exc:
+ print(f"selftest: could not read the table from antislop-human.md: {exc}")
+ return 1
+ if not rows:
+ print("selftest: no reference rows found in antislop-human.md")
+ return 1
+
+ failures = 0
+ for row in rows:
+ color_a, color_b = parse_pairing(row["pairing"])
+ computed = round(contrast_ratio(color_a, color_b), 2)
+ expected_normal = "Pass" if computed >= 4.5 else "Fail"
+ expected_large = "Pass" if computed >= 3.0 else "Fail"
+ if f"{computed:.2f}" != f"{row['ratio']:.2f}":
+ failures += 1
+ print(f"selftest: {row['pairing']}: table says {row['ratio']}, the formula says {computed:.2f}")
+ if row["normal"] != expected_normal:
+ failures += 1
+ print(f"selftest: {row['pairing']}: normal text marked {row['normal']}, should be {expected_normal}")
+ if row["large"] != expected_large:
+ failures += 1
+ print(f"selftest: {row['pairing']}: large text marked {row['large']}, should be {expected_large}")
+
+ if failures:
+ return 1
+ print(f"selftest: {len(rows)} reference pairs OK")
+ return 0
+
+
def main(argv):
+ if len(argv) == 1 and argv[0] == "--selftest":
+ return selftest()
if len(argv) != 2:
- print("usage: python contrast-check.py <hex1> <hex2>")
+ print("usage: python contrast-check.py <hex1> <hex2> | --selftest")
return 2
try:
- ratio = contrast_ratio(*argv)
+ ratio = contrast_ratio(parse_hex(argv[0]), parse_hex(argv[1]))
except ValueError as exc:
print(f"error: {exc}")
return 2