ux-laws-reviewer 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,49 @@
1
+ # ux-laws-reviewer
2
+
3
+ A Claude Code skill that provides a rigorous framework for evaluating UI code and designs against established psychological principles and UX laws.
4
+
5
+ ## What is this?
6
+ This is an installable skill for [Claude Code](https://docs.anthropic.com/en/docs/agents-and-tools/claude-code/overview) (or compatible agents). Once installed, your AI agent will be able to critique front-end code, HTML, CSS, React components, and design mockups using the **Laws of UX** (like Hick's Law, Fitts's Law, Cognitive Load, Gestalt Principles, etc.).
7
+
8
+ ## Installation
9
+
10
+ You can install this skill directly into your Claude environment using `npx`:
11
+
12
+ ```bash
13
+ npx ux-laws-reviewer
14
+ ```
15
+
16
+ This will automatically copy the necessary `SKILL.md` and reference files into your `~/.claude/skills/ux-laws-reviewer` directory.
17
+
18
+ ## Usage
19
+
20
+ Once installed, just ask Claude to review your UI!
21
+
22
+ Examples of prompts that will trigger this skill:
23
+ - *"Review this React component against UX laws."*
24
+ - *"Critique my pricing page design."*
25
+ - *"How is the UX of this form?"*
26
+ - *"Audit this layout for cognitive load."*
27
+
28
+ Claude will respond with a structured breakdown:
29
+ 1. **Summary:** Overall assessment.
30
+ 2. **Key UX Findings:** Identification of UX Law applications and violations (e.g., `❌ Hick's Law (Violation)`).
31
+ 3. **Actionable Improvements:** Concrete code suggestions to fix the issues.
32
+
33
+ ## Included UX Laws Reference
34
+ The skill includes a comprehensive reference document covering:
35
+ - Aesthetic-Usability Effect
36
+ - Choice Overload
37
+ - Chunking
38
+ - Cognitive Bias & Cognitive Load
39
+ - Doherty Threshold
40
+ - Fitts's Law
41
+ - Flow & Goal-Gradient Effect
42
+ - Hick's Law & Jakob's Law
43
+ - Gestalt Principles (Proximity, Common Region, etc.)
44
+ - Miller's Law, Occam's Razor, Pareto Principle
45
+ - Peak-End Rule, Postel's Law
46
+ - Von Restorff Effect, Zeigarnik Effect, and more.
47
+
48
+ ## License
49
+ ISC
package/SKILL.md ADDED
@@ -0,0 +1,50 @@
1
+ ---
2
+ name: ux-laws-reviewer
3
+ description: Use this skill whenever the user asks you to review, critique, audit, or improve a UI, frontend component, layout, or design mockup. Also trigger if they ask about UX best practices, user experience, cognitive load, or if a design is user-friendly. This skill provides a rigorous framework for evaluating UI code/designs against established psychological principles and UX laws.
4
+ ---
5
+
6
+ # UX Laws Reviewer
7
+
8
+ You are an expert UX/UI designer and frontend engineer. When invoked, your job is to review the user's provided UI code, component, or design description through the lens of established psychological principles of UX design.
9
+
10
+ ## Review Framework
11
+
12
+ When critiquing a UI, follow this process:
13
+
14
+ ### 1. Read the Reference (If Needed)
15
+ If you are not already deeply familiar with the Laws of UX, immediately read `references/laws.md` located in this skill's directory. This file contains the definitions and takeaways for heuristics like Hick's Law, Fitts's Law, Jakob's Law, Cognitive Load, and various Gestalt principles.
16
+
17
+ ### 2. Analyze the UI
18
+ Examine the user's provided code (HTML/CSS, React, Vue, etc.) or design description. Understand its primary goal, the user flow, and the visual hierarchy.
19
+
20
+ ### 3. Identify UX Law Applications & Violations
21
+ Evaluate the design against the Laws of UX. Specifically look for:
22
+ - **Violations:** Areas where the design creates unnecessary friction, cognitive load, or violates user expectations.
23
+ - **Good Applications:** Areas where the design successfully leverages psychology (e.g., good chunking, clear visual hierarchy, progressive disclosure).
24
+
25
+ ### 4. Provide Concrete Recommendations
26
+ Do not just point out theoretical flaws. You must provide specific, actionable recommendations on how to fix them in the code or design.
27
+
28
+ ## Output Structure
29
+
30
+ Format your response to the user using the following structure:
31
+
32
+ ### Summary
33
+ A brief 1-2 sentence assessment of the overall user experience and primary areas for improvement.
34
+
35
+ ### Key UX Findings
36
+ Use bullet points. For each finding, explicitly name the relevant UX Law in bold, explain how it applies to the specific UI element, and state whether it's a violation or a positive application.
37
+
38
+ **Example:**
39
+ * **❌ Hick's Law (Violation):** The main navigation contains 15 equally weighted links. This choice overload will increase decision time. Consider grouping these into 3-4 primary categories with a dropdown menu.
40
+ * **✅ Fitts's Law (Positive):** The primary "Checkout" button is large and placed prominently at the bottom of the screen, making it easily accessible for mobile users.
41
+ * **❌ Law of Proximity (Violation):** The form labels are spaced equally between the input field above them and the input field below them, making it difficult to scan which label belongs to which field.
42
+
43
+ ### Actionable Improvements / Code Suggestions
44
+ Provide the exact code changes or structural design changes needed to resolve the violations. If the user provided code, output the refactored code blocks showing the improvements. Explain *why* the code change improves the UX.
45
+
46
+ ## Guidelines for Success
47
+ - **Be direct and specific:** Instead of saying "improve the layout," say "group the billing and shipping address fields into distinct visual cards (Law of Common Region)."
48
+ - **Prioritize impact:** Focus on the 2-3 most critical UX issues that will have the biggest impact on usability. (Remember the **Pareto Principle**).
49
+ - **Consider the platform:** Apply Fitts's Law differently for mobile (touch targets) vs. desktop (mouse cursor).
50
+ - **Accessibility is UX:** Remember that laws like the Von Restorff effect require that you don't rely solely on color to isolate elements (consider users with color vision deficiency).
package/install.js ADDED
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env node
2
+ const fs = require('fs');
3
+ const path = require('path');
4
+ const os = require('os');
5
+
6
+ const skillName = 'ux-laws-reviewer';
7
+ const claudeSkillsDir = path.join(os.homedir(), '.claude', 'skills', skillName);
8
+ const agentsSkillsDir = path.join(os.homedir(), '.agents', 'skills', skillName);
9
+
10
+ // Determine which directory exists, prefer .claude
11
+ let targetDir = claudeSkillsDir;
12
+ if (!fs.existsSync(path.join(os.homedir(), '.claude')) && fs.existsSync(path.join(os.homedir(), '.agents'))) {
13
+ targetDir = agentsSkillsDir;
14
+ }
15
+
16
+ console.log(`Installing ${skillName} skill...`);
17
+
18
+ // Ensure target directory exists
19
+ fs.mkdirSync(path.join(targetDir, 'references'), { recursive: true });
20
+
21
+ // Copy files
22
+ const sourceDir = __dirname;
23
+ fs.copyFileSync(path.join(sourceDir, 'SKILL.md'), path.join(targetDir, 'SKILL.md'));
24
+ fs.copyFileSync(path.join(sourceDir, 'references', 'laws.md'), path.join(targetDir, 'references', 'laws.md'));
25
+
26
+ console.log(`\n✅ Skill successfully installed to: ${targetDir}`);
27
+ console.log(`\nYou can now use this skill in Claude by asking it to "review my UI against UX laws" or "critique this design".`);
package/package.json ADDED
@@ -0,0 +1,15 @@
1
+ {
2
+ "name": "ux-laws-reviewer",
3
+ "version": "1.0.0",
4
+ "description": "A Claude Code skill for reviewing UIs against UX Laws",
5
+ "bin": {
6
+ "install-ux-laws-reviewer": "install.js"
7
+ },
8
+ "scripts": {
9
+ "test": "echo \"Error: no test specified\" && exit 1"
10
+ },
11
+ "keywords": [],
12
+ "author": "",
13
+ "license": "ISC",
14
+ "type": "commonjs"
15
+ }
@@ -0,0 +1,170 @@
1
+ # Laws of UX Reference
2
+
3
+ ## Aesthetic-Usability Effect
4
+ Users often perceive aesthetically pleasing design as design that’s more usable.
5
+ * **Takeaways:**
6
+ * An aesthetically pleasing design creates a positive response in people’s brains and leads them to believe the design actually works better.
7
+ * People are more tolerant of minor usability issues when the design of a product or service is aesthetically pleasing.
8
+ * Visually pleasing design can mask usability problems and prevent issues from being discovered during usability testing.
9
+
10
+ ## Choice Overload (Paradox of Choice)
11
+ The tendency for people to get overwhelmed when they are presented with a large number of options.
12
+ * **Takeaways:**
13
+ * Too many options hurts users’ decision-making ability.
14
+ * Enable side-by-side comparison of related items and options that require a decision.
15
+ * Optimize for the decision-making process: avoid overwhelming users by prioritizing content, and provide tools for narrowing down choices (search, filtering).
16
+
17
+ ## Chunking
18
+ A process by which individual pieces of an information set are broken down and then grouped together in a meaningful whole.
19
+ * **Takeaways:**
20
+ * Enables users to easily scan content and identify relevant information.
21
+ * Structure content into visually distinct groups with a clear hierarchy.
22
+ * Group content into distinctive modules and apply rules to separate content.
23
+
24
+ ## Cognitive Bias
25
+ A systematic error of thinking or rationality in judgment that influences our perception and decision-making ability.
26
+ * **Takeaways:**
27
+ * We conserve mental energy by developing rules of thumb based on past experiences.
28
+ * Understand intrinsic biases to serve as a safeguard against fallacious reasoning or costly mistakes.
29
+
30
+ ## Cognitive Load
31
+ The amount of mental resources needed to understand and interact with an interface.
32
+ * **Takeaways:**
33
+ * Intrinsic cognitive load: effort required to absorb new information and keep track of goals.
34
+ * Extraneous cognitive load: mental processing that takes up resources but doesn't help understand content (e.g., distracting elements).
35
+ * Reduce extraneous load to prevent users from feeling overwhelmed.
36
+
37
+ ## Doherty Threshold
38
+ Productivity soars when a computer and its users interact at a pace (<400ms) that ensures that neither has to wait on the other.
39
+ * **Takeaways:**
40
+ * Provide system feedback within 400 ms.
41
+ * Use perceived performance (e.g., animations) to reduce the perception of waiting.
42
+ * Progress bars help make wait times tolerable.
43
+
44
+ ## Fitts’s Law
45
+ The time to acquire a target is a function of the distance to and size of the target.
46
+ * **Takeaways:**
47
+ * Touch targets should be large enough for users to accurately select them.
48
+ * Provide ample spacing between touch targets.
49
+ * Place touch targets in areas that allow them to be easily acquired.
50
+
51
+ ## Flow
52
+ The mental state in which a person is fully immersed in a feeling of energized focus and enjoyment.
53
+ * **Takeaways:**
54
+ * Requires a balance between the difficulty of a task and the user's skill level.
55
+ * Provide necessary feedback so users know what action has been done.
56
+ * Optimize for efficiency by removing unnecessary friction.
57
+
58
+ ## Goal-Gradient Effect
59
+ The tendency to approach a goal increases with proximity to the goal.
60
+ * **Takeaways:**
61
+ * The closer users are to completing a task, the faster they work towards reaching it.
62
+ * Provide artificial progress towards a goal to motivate completion.
63
+ * Provide a clear indication of progress.
64
+
65
+ ## Hick’s Law
66
+ The time it takes to make a decision increases with the number and complexity of choices.
67
+ * **Takeaways:**
68
+ * Minimize choices when response times are critical.
69
+ * Break complex tasks into smaller steps.
70
+ * Highlight recommended options to avoid overwhelming users.
71
+ * Use progressive onboarding.
72
+
73
+ ## Jakob’s Law
74
+ Users spend most of their time on other sites, meaning they prefer your site to work the same way as all the other sites they already know.
75
+ * **Takeaways:**
76
+ * Leverage existing mental models so users can focus on tasks rather than learning new models.
77
+ * When making changes, empower users to continue using a familiar version for a limited time.
78
+
79
+ ## Gestalt Principles of Grouping
80
+ * **Law of Common Region:** Elements are perceived into groups if they share an area with a clearly defined boundary (e.g., borders, backgrounds).
81
+ * **Law of Proximity:** Objects near each other tend to be grouped together. Establish relationships and similar functionality through spacing.
82
+ * **Law of Prägnanz:** People perceive complex images in the simplest form possible because it requires the least cognitive effort.
83
+ * **Law of Similarity:** Visually similar elements (color, shape, size) are perceived as related.
84
+ * **Law of Uniform Connectedness:** Elements visually connected (via lines, colors, frames) are perceived as more related than elements with no connection.
85
+
86
+ ## Mental Model
87
+ A compressed model based on what we think we know about a system and how it works.
88
+ * **Takeaways:**
89
+ * Match designs to users’ mental models to improve their experience.
90
+ * Use consistent patterns and conventions (e.g., shopping carts in e-commerce).
91
+
92
+ ## Miller’s Law
93
+ The average person can only keep 7 (plus or minus 2) items in their working memory.
94
+ * **Takeaways:**
95
+ * Organize content into smaller chunks to help users process and memorize.
96
+ * Don't rigidly stick to "exactly 7" as an excuse for bad design.
97
+
98
+ ## Occam’s Razor
99
+ Among competing hypotheses, the one with the fewest assumptions should be selected.
100
+ * **Takeaways:**
101
+ * The best method for reducing complexity is to avoid it.
102
+ * Remove elements without compromising overall function.
103
+
104
+ ## Paradox of the Active User
105
+ Users never read manuals but start using the software immediately.
106
+ * **Takeaways:**
107
+ * Make guidance accessible throughout the product experience.
108
+ * Design guidance to fit within the context of use (e.g., contextual tooltips).
109
+
110
+ ## Pareto Principle (80/20 Rule)
111
+ Roughly 80% of the effects come from 20% of the causes.
112
+ * **Takeaways:**
113
+ * Focus the majority of effort on the areas that will bring the largest benefits to the most users.
114
+
115
+ ## Parkinson’s Law
116
+ Any task will inflate until all of the available time is spent.
117
+ * **Takeaways:**
118
+ * Limit the time it takes to complete a task.
119
+ * Leverage features like autofill to save user time and prevent task inflation.
120
+
121
+ ## Peak-End Rule
122
+ People judge an experience based on how they felt at its peak and its end, rather than the total sum.
123
+ * **Takeaways:**
124
+ * Pay close attention to the most intense points and final moments of a user journey.
125
+ * Design to delight at these moments. People recall negative experiences more vividly.
126
+
127
+ ## Postel’s Law (Robustness Principle)
128
+ Be liberal in what you accept, and conservative in what you send.
129
+ * **Takeaways:**
130
+ * Be empathetic, flexible, and tolerant of user inputs.
131
+ * Accept variable input, translate it to meet requirements, and provide clear feedback.
132
+
133
+ ## Selective Attention
134
+ The process of focusing attention only on a subset of stimuli related to our goals.
135
+ * **Takeaways:**
136
+ * Guide users' attention and prevent distraction.
137
+ * Banner Blindness: users ignore content that resembles ads.
138
+ * Change Blindness: significant interface changes go unnoticed without strong cues.
139
+
140
+ ## Serial Position Effect
141
+ Users best remember the first and last items in a series.
142
+ * **Takeaways:**
143
+ * Place least important items in the middle of lists.
144
+ * Position key actions on the far left and right within elements like navigation.
145
+
146
+ ## Tesler’s Law (Conservation of Complexity)
147
+ For any system, there is a certain amount of complexity which cannot be reduced.
148
+ * **Takeaways:**
149
+ * The burden of inherent complexity should be assumed by the system, not the user.
150
+ * Lift the burden from users during design and development.
151
+
152
+ ## Von Restorff Effect (Isolation Effect)
153
+ When multiple similar objects are present, the one that differs from the rest is most likely to be remembered.
154
+ * **Takeaways:**
155
+ * Make important information or key actions visually distinctive.
156
+ * Use restraint when placing emphasis so elements don't compete.
157
+ * Don't rely exclusively on color for contrast (accessibility).
158
+
159
+ ## Working Memory
160
+ A cognitive system that temporarily holds and manipulates information needed to complete tasks.
161
+ * **Takeaways:**
162
+ * Limited to 4-7 chunks, fading after 20-30 seconds.
163
+ * Support recognition over recall (e.g., visually differentiate visited links).
164
+ * Place the burden of memory on the system.
165
+
166
+ ## Zeigarnik Effect
167
+ People remember uncompleted or interrupted tasks better than completed tasks.
168
+ * **Takeaways:**
169
+ * Invite content discovery by providing clear signifiers of additional content.
170
+ * Provide artificial progress towards a goal to motivate completion.