Skip to content

Commit 0d89b19

Browse files
committed
feat(dont-make-me-think): add screenshot pre-processing script for UI review (#73)
2 parents 107ba47 + b5f4c56 commit 0d89b19

3 files changed

Lines changed: 962 additions & 5 deletions

File tree

skills/dont-make-me-think/SKILL.md

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
11
---
22
name: dont-make-me-think
3-
description: "Review UI for usability using Steve Krug's principles; produce a scannable report. Use for usability audits, UX review, or UI feedback on screenshots, URLs, or code. Don't use for brand design critique, WCAG audits, or backend/API review."
3+
description: "Review UI for usability issues using Steve Krug's principles and produce a scannable report. Use when asked for a usability audit, UX review, or UI feedback on screenshots, URLs, or code. Don't use for visual/brand design critique, accessibility (WCAG) audits, or backend/API review."
44
license: MIT
55
effort: medium
66
metadata:
7-
version: 1.2.3
7+
version: 1.3.0
88
author: Luong NGUYEN <luongnv89@gmail.com>
99
---
1010

1111
# Don't Make Me Think — Usability Review & Redesign
1212

1313
Evaluate and improve UIs through Steve Krug's "Don't Make Me Think" principles. The report itself must practice what Krug preaches: scannable, visual, zero fluff. A human should skim it in 30 seconds; an AI agent should be able to parse it and start fixing.
1414

15-
Triggers and exclusions are set by the frontmatter `description` above. Accepted inputs are listed in Input Handling below.
15+
## When to Use
16+
17+
Trigger this skill when the user asks for a usability audit, UX review, or UI feedback on a screenshot, live URL, or HTML/CSS code. Do not use for visual/brand critique, WCAG accessibility audits, or backend/API review — route those elsewhere.
1618

1719
## Instructions
1820

@@ -30,11 +32,33 @@ Follow this workflow to keep the agent's context budget tight:
3032
- **Input available**: one of — live URL, screenshot/image, HTML/CSS code, wireframe, or verbal description
3133
- **Code editor access** (Redesign Mode only): write permission to the UI source files being modified
3234

33-
## Input Handling
35+
## Screenshot Pre-processing
36+
37+
When the input is a screenshot (image file), run the pre-processing script **before** visual analysis. This produces a structured report the agent can consume without generating image-processing code at runtime.
38+
39+
```bash
40+
python3 scripts/process_screenshots.py <image_path> [--recursive]
41+
```
42+
43+
Output: JSON to stdout (structured data), markdown to stderr (human-readable). Both are always produced.
44+
45+
The script extracts:
46+
- **Metadata**: dimensions, format, file size, aspect ratio
47+
- **Color palette**: dominant colors (primary, secondary, accent, background, text)
48+
- **Layout regions**: navigation bars, buttons, image placeholders, text blocks, footers
49+
- **Visual density**: low / medium / high (Laplacian variance)
50+
- **Quality score**: 0.0–1.0 (blur, compression artifacts, resolution)
51+
- **Warnings**: issues that may affect review accuracy
52+
53+
Use the JSON output (stdout) to populate the review with factual data. Use the markdown output (stderr) for quick human verification.
54+
55+
If the script fails or the image is invalid, fall back to visual analysis and note the failure.
56+
57+
### Input Handling
3458

3559
| Input type | Action |
3660
|---|---|
37-
| Screenshot/image | Analyze visually |
61+
| Screenshot/image | Pre-process with `scripts/process_screenshots.py`, then analyze visually |
3862
| Live URL | Use `/browse` to navigate, screenshot, interact |
3963
| HTML/CSS/JS code | Read code, focus on user experience |
4064
| Wireframe/mockup | Focus on information architecture, not polish |
@@ -192,6 +216,7 @@ If working with code, edit files directly only after confirmation. For screensho
192216
| Situation | Action |
193217
|---|---|
194218
| `/browse` fails or URL is unreachable | Ask user for a screenshot or HTML export; do not proceed with assumptions |
219+
| Screenshot pre-processing fails | Fall back to visual analysis; note the failure in the review |
195220
| Screenshot cannot be loaded or parsed | Ask user to re-share as PNG/JPEG or paste the relevant HTML |
196221
| HTML/CSS code is incomplete | Note missing sections in the review; evaluate only what is present |
197222
| No input provided | Ask for one of: URL, screenshot, code snippet, or verbal description before starting |
@@ -220,6 +245,8 @@ Thinking Cost: HIGH — 3 critical issues found (disabled button, missing nav la
220245
| User wants "just a quick check" | Deliver a condensed review (top 3 issues only) rather than the full 10-lens report |
221246
| Redesign Mode on a CSS framework (Tailwind, Bootstrap) | Preserve the framework classes; only change values, not the framework itself |
222247
| UI has no issues | Output the scorecard with high scores and a "What Works" section only; do not fabricate problems |
248+
| Multiple screenshots provided | Pre-process each with the script; run batch analysis (`--recursive` if directory) |
249+
| Screenshot is very large (>4K) | Note in the review that detail may be excessive; consider recommending downscaled reference |
223250

224251
## Acceptance Criteria
225252

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# Screenshot Pre-processing Reference
2+
3+
When a screenshot is provided as input, run `scripts/process_screenshots.py` before visual analysis. This produces structured data so the agent doesn't need to generate image-processing code at runtime.
4+
5+
## Usage
6+
7+
```bash
8+
# Single image
9+
python3 scripts/process_screenshots.py screenshot.png
10+
11+
# Multiple images
12+
python3 scripts/process_screenshots.py img1.png img2.png img3.png
13+
14+
# Directory (non-recursive)
15+
python3 scripts/process_screenshots.py ./screenshots/
16+
17+
# Directory (recursive)
18+
python3 scripts/process_screenshots.py ./screenshots/ --recursive
19+
20+
# Write markdown report to file
21+
python3 scripts/process_screenshots.py screenshot.png -o report.md
22+
23+
# Quiet mode (suppress progress)
24+
python3 scripts/process_screenshots.py screenshot.png --quiet
25+
```
26+
27+
## Output
28+
29+
Two outputs are always produced:
30+
31+
1. **JSON to stdout** — structured data for the agent to consume programmatically
32+
2. **Markdown to stderr** — human-readable report for quick verification
33+
34+
Use `-o report.md` to write markdown to a file instead of stderr.
35+
36+
## What the Script Extracts
37+
38+
### Metadata
39+
- Filename, file size, format, dimensions, aspect ratio, color mode, alpha channel flag
40+
41+
### Color Palette (8-color k-means)
42+
- Primary, secondary, accent, background, text colors (hex)
43+
- Total unique color count
44+
45+
### Layout Regions (OpenCV-based heuristics)
46+
- **Navigation bars** — horizontal uniform-color strips at top
47+
- **Buttons** — rectangular regions with text-like contrast
48+
- **Image placeholders** — large uniform rectangles with moderate std dev
49+
- **Text blocks** — regions with high edge density (Sobel operator)
50+
- **Footer** — horizontal uniform-color strips at bottom
51+
52+
### Visual Density
53+
- Low / Medium / High — based on Laplacian variance
54+
55+
### Quality Score (0.0–1.0)
56+
- Penalizes: low resolution, excessive resolution, blur, compression artifacts
57+
58+
## How to Use the Output in a Review
59+
60+
1. **Parse the JSON** (stdout) to get factual data
61+
2. **Populate the scorecard** with visual_density and quality_score
62+
3. **Reference the color palette** when discussing design consistency
63+
4. **Use layout regions** to pinpoint where issues are located
64+
5. **Check warnings** for quality concerns that might affect the review
65+
66+
Example:
67+
```json
68+
{
69+
"images": [{
70+
"visual_density": "high",
71+
"quality_score": 0.8,
72+
"color_palette": { "primary": "#242223", "background": "#ab99a7" },
73+
"layout_summary": "Footer at bottom; 17 text regions",
74+
"interactive_elements_estimated": 3
75+
}]
76+
}
77+
```
78+
79+
This tells the reviewer: the page is dense, slightly compressed, dark-on-light theme, with ~3 interactive elements.
80+
81+
## Supported Formats
82+
83+
PNG, JPG/JPEG, GIF, WEBP, BMP, TIFF. Max file size: 50 MB.
84+
85+
## Dependencies
86+
87+
- Pillow 12.x
88+
- OpenCV 4.x
89+
- NumPy
90+
91+
All are available in the skills environment. No external APIs or OCR engines required.

0 commit comments

Comments
 (0)