feat: initial commit for Paralax creative engineering system
This commit is contained in:
1222
.agents/skills/frontend-design/SKILL.md
Normal file
1222
.agents/skills/frontend-design/SKILL.md
Normal file
File diff suppressed because it is too large
Load Diff
178
.agents/skills/frontend-design/redesign.md
Normal file
178
.agents/skills/frontend-design/redesign.md
Normal file
@@ -0,0 +1,178 @@
|
||||
# Redesign Existing Projects
|
||||
|
||||
> Variant of [frontend-design](SKILL.md). Audit-first upgrade of an existing UI without breaking functionality.
|
||||
|
||||
|
||||
# Redesign Skill
|
||||
|
||||
## How This Works
|
||||
|
||||
When applied to an existing project, follow this sequence:
|
||||
|
||||
1. **Scan** — Read the codebase. Identify the framework, styling method (Tailwind, vanilla CSS, styled-components, etc.), and current design patterns.
|
||||
2. **Diagnose** — Run through the audit below. List every generic pattern, weak point, and missing state you find.
|
||||
3. **Fix** — Apply targeted upgrades working with the existing stack. Do not rewrite from scratch. Improve what's there.
|
||||
|
||||
## Design Audit
|
||||
|
||||
### Typography
|
||||
|
||||
Check for these problems and fix them:
|
||||
|
||||
- **Browser default fonts or Inter everywhere.** Replace with a font that has character. Good options: `Geist`, `Outfit`, `Cabinet Grotesk`, `Satoshi`. For editorial/creative projects, pair a serif header with a sans-serif body.
|
||||
- **Headlines lack presence.** Increase size for display text, tighten letter-spacing, reduce line-height. Headlines should feel heavy and intentional.
|
||||
- **Body text too wide.** Limit paragraph width to roughly 65 characters. Increase line-height for readability.
|
||||
- **Only Regular (400) and Bold (700) weights used.** Introduce Medium (500) and SemiBold (600) for more subtle hierarchy.
|
||||
- **Numbers in proportional font.** Use a monospace font or enable tabular figures (`font-variant-numeric: tabular-nums`) for data-heavy interfaces.
|
||||
- **Missing letter-spacing adjustments.** Use negative tracking for large headers, positive tracking for small caps or labels.
|
||||
- **All-caps subheaders everywhere.** Try lowercase italics, sentence case, or small-caps instead.
|
||||
- **Orphaned words.** Single words sitting alone on the last line. Fix with `text-wrap: balance` or `text-wrap: pretty`.
|
||||
|
||||
### Color and Surfaces
|
||||
|
||||
- **Pure `#000000` background.** Replace with off-black, dark charcoal, or tinted dark (`#0a0a0a`, `#121212`, or a dark navy).
|
||||
- **Oversaturated accent colors.** Keep saturation below 80%. Desaturate accents so they blend with neutrals instead of screaming.
|
||||
- **More than one accent color.** Pick one. Remove the rest. Consistency beats variety.
|
||||
- **Mixing warm and cool grays.** Stick to one gray family. Tint all grays with a consistent hue (warm or cool, not both).
|
||||
- **Purple/blue "AI gradient" aesthetic.** This is the most common AI design fingerprint. Replace with neutral bases and a single, considered accent.
|
||||
- **Generic `box-shadow`.** Tint shadows to match the background hue. Use colored shadows (e.g., dark blue shadow on a blue background) instead of pure black at low opacity.
|
||||
- **Flat design with zero texture.** Add subtle noise, grain, or micro-patterns to backgrounds. Pure flat vectors feel sterile.
|
||||
- **Perfectly even gradients.** Break the uniformity with radial gradients, noise overlays, or mesh gradients instead of standard linear 45-degree fades.
|
||||
- **Inconsistent lighting direction.** Audit all shadows to ensure they suggest a single, consistent light source.
|
||||
- **Random dark sections in a light mode page (or vice versa).** A single dark-background section breaking an otherwise light page looks like a copy-paste accident. Either commit to a full dark mode or keep a consistent background tone throughout. If contrast is needed, use a slightly darker shade of the same palette — not a sudden jump to `#111` in the middle of a cream page.
|
||||
- **Empty, flat sections with no visual depth.** Sections that are just text on a plain background feel unfinished. Add high-quality background imagery (blurred, overlaid, or masked), subtle patterns, or ambient gradients. Use reliable placeholder sources like `https://picsum.photos/seed/{name}/1920/1080` when real assets are not available. Experiment with background images behind hero sections, feature blocks, or CTAs — even a subtle full-width photo at low opacity adds presence.
|
||||
|
||||
### Layout
|
||||
|
||||
- **Everything centered and symmetrical.** Break symmetry with offset margins, mixed aspect ratios, or left-aligned headers over centered content.
|
||||
- **Three equal card columns as feature row.** This is the most generic AI layout. Replace with a 2-column zig-zag, asymmetric grid, horizontal scroll, or masonry layout.
|
||||
- **Using `height: 100vh` for full-screen sections.** Replace with `min-height: 100dvh` to prevent layout jumping on mobile browsers (iOS Safari viewport bug).
|
||||
- **Complex flexbox percentage math.** Replace with CSS Grid for reliable multi-column structures.
|
||||
- **No max-width container.** Add a container constraint (around 1200-1440px) with auto margins so content doesn't stretch edge-to-edge on wide screens.
|
||||
- **Cards of equal height forced by flexbox.** Allow variable heights or use masonry when content varies in length.
|
||||
- **Uniform border-radius on everything.** Vary the radius: tighter on inner elements, softer on containers.
|
||||
- **No overlap or depth.** Elements sit flat next to each other. Use negative margins to create layering and visual depth.
|
||||
- **Symmetrical vertical padding.** Top and bottom padding are always identical. Adjust optically — bottom padding often needs to be slightly larger.
|
||||
- **Dashboard always has a left sidebar.** Try top navigation, a floating command menu, or a collapsible panel instead.
|
||||
- **Missing whitespace.** Double the spacing. Let the design breathe. Dense layouts work for data dashboards, not for marketing pages.
|
||||
- **Buttons not bottom-aligned in card groups.** When cards have different content lengths, CTAs end up at random heights. Pin buttons to the bottom of each card so they form a clean horizontal line regardless of content above.
|
||||
- **Feature lists starting at different vertical positions.** In pricing tables or comparison cards, the list of features should start at the same Y position across all columns. Use consistent spacing above the list or fixed-height title/price blocks.
|
||||
- **Inconsistent vertical rhythm in side-by-side elements.** When placing cards, columns, or panels next to each other, align shared elements (titles, descriptions, prices, buttons) across all items. Misaligned baselines make the layout look broken.
|
||||
- **Mathematical alignment that looks optically wrong.** Centering by the math doesn't always look centered to the eye. Icons next to text, play buttons in circles, or text in buttons often need 1-2px optical adjustments to feel right.
|
||||
|
||||
### Interactivity and States
|
||||
|
||||
- **No hover states on buttons.** Add background shift, slight scale, or translate on hover.
|
||||
- **No active/pressed feedback.** Add a subtle `scale(0.98)` or `translateY(1px)` on press to simulate a physical click.
|
||||
- **Instant transitions with zero duration.** Add smooth transitions (200-300ms) to all interactive elements.
|
||||
- **Missing focus ring.** Ensure visible focus indicators for keyboard navigation. This is an accessibility requirement, not optional.
|
||||
- **No loading states.** Replace generic circular spinners with skeleton loaders that match the layout shape.
|
||||
- **No empty states.** An empty dashboard showing nothing is a missed opportunity. Design a composed "getting started" view.
|
||||
- **No error states.** Add clear, inline error messages for forms. Do not use `window.alert()`.
|
||||
- **Dead links.** Buttons that link to `#`. Either link to real destinations or visually disable them.
|
||||
- **No indication of current page in navigation.** Style the active nav link differently so users know where they are.
|
||||
- **Scroll jumping.** Anchor clicks jump instantly. Add `scroll-behavior: smooth`.
|
||||
- **Animations using `top`, `left`, `width`, `height`.** Switch to `transform` and `opacity` for GPU-accelerated, smooth animation.
|
||||
|
||||
### Content
|
||||
|
||||
- **Generic names like "John Doe" or "Jane Smith".** Use diverse, realistic-sounding names.
|
||||
- **Fake round numbers like `99.99%`, `50%`, `$100.00`.** Use organic, messy data: `47.2%`, `$99.00`, `+1 (312) 847-1928`.
|
||||
- **Placeholder company names like "Acme Corp", "Nexus", "SmartFlow".** Invent contextual, believable brand names.
|
||||
- **AI copywriting cliches.** Never use "Elevate", "Seamless", "Unleash", "Next-Gen", "Game-changer", "Delve", "Tapestry", or "In the world of...". Write plain, specific language.
|
||||
- **Exclamation marks in success messages.** Remove them. Be confident, not loud.
|
||||
- **"Oops!" error messages.** Be direct: "Connection failed. Please try again."
|
||||
- **Passive voice.** Use active voice: "We couldn't save your changes" instead of "Mistakes were made."
|
||||
- **All blog post dates identical.** Randomize dates to appear real.
|
||||
- **Same avatar image for multiple users.** Use unique assets for every distinct person.
|
||||
- **Lorem Ipsum.** Never use placeholder latin text. Write real draft copy.
|
||||
- **Title Case On Every Header.** Use sentence case instead.
|
||||
|
||||
### Component Patterns
|
||||
|
||||
- **Generic card look (border + shadow + white background).** Remove the border, or use only background color, or use only spacing. Cards should exist only when elevation communicates hierarchy.
|
||||
- **Always one filled button + one ghost button.** Add text links or tertiary styles to reduce visual noise.
|
||||
- **Pill-shaped "New" and "Beta" badges.** Try square badges, flags, or plain text labels.
|
||||
- **Accordion FAQ sections.** Use a side-by-side list, searchable help, or inline progressive disclosure.
|
||||
- **3-card carousel testimonials with dots.** Replace with a masonry wall, embedded social posts, or a single rotating quote.
|
||||
- **Pricing table with 3 towers.** Highlight the recommended tier with color and emphasis, not just extra height.
|
||||
- **Modals for everything.** Use inline editing, slide-over panels, or expandable sections instead of popups for simple actions.
|
||||
- **Avatar circles exclusively.** Try squircles or rounded squares for a less generic look.
|
||||
- **Light/dark toggle always a sun/moon switch.** Use a dropdown, system preference detection, or integrate it into settings.
|
||||
- **Footer link farm with 4 columns.** Simplify. Focus on main navigational paths and legally required links.
|
||||
|
||||
### Iconography
|
||||
|
||||
- **Lucide or Feather icons exclusively.** These are the "default" AI icon choice. Use Phosphor, Heroicons, or a custom set for differentiation.
|
||||
- **Rocketship for "Launch", shield for "Security".** Replace cliche metaphors with less obvious icons (bolt, fingerprint, spark, vault).
|
||||
- **Inconsistent stroke widths across icons.** Audit all icons and standardize to one stroke weight.
|
||||
- **Missing favicon.** Always include a branded favicon.
|
||||
- **Stock "diverse team" photos.** Use real team photos, candid shots, or a consistent illustration style instead of uncanny stock imagery.
|
||||
|
||||
### Code Quality
|
||||
|
||||
- **Div soup.** Use semantic HTML: `<nav>`, `<main>`, `<article>`, `<aside>`, `<section>`.
|
||||
- **Inline styles mixed with CSS classes.** Move all styling to the project's styling system.
|
||||
- **Hardcoded pixel widths.** Use relative units (`%`, `rem`, `em`, `max-width`) for flexible layouts.
|
||||
- **Missing alt text on images.** Describe image content for screen readers. Never leave `alt=""` or `alt="image"` on meaningful images.
|
||||
- **Arbitrary z-index values like `9999`.** Establish a clean z-index scale in the theme/variables.
|
||||
- **Commented-out dead code.** Remove all debug artifacts before shipping.
|
||||
- **Import hallucinations.** Check that every import actually exists in `package.json` or the project dependencies.
|
||||
- **Missing meta tags.** Add proper `<title>`, `description`, `og:image`, and social sharing meta tags.
|
||||
|
||||
### Strategic Omissions (What AI Typically Forgets)
|
||||
|
||||
- **No legal links.** Add privacy policy and terms of service links in the footer.
|
||||
- **No "back" navigation.** Dead ends in user flows. Every page needs a way back.
|
||||
- **No custom 404 page.** Design a helpful, branded "page not found" experience.
|
||||
- **No form validation.** Add client-side validation for emails, required fields, and format checks.
|
||||
- **No "skip to content" link.** Essential for keyboard users. Add a hidden skip-link.
|
||||
- **No cookie consent.** If required by jurisdiction, add a compliant consent banner.
|
||||
|
||||
## Upgrade Techniques
|
||||
|
||||
When upgrading a project, pull from these high-impact techniques to replace generic patterns:
|
||||
|
||||
### Typography Upgrades
|
||||
- **Variable font animation.** Interpolate weight or width on scroll or hover for text that feels alive.
|
||||
- **Outlined-to-fill transitions.** Text starts as a stroke outline and fills with color on scroll entry or interaction.
|
||||
- **Text mask reveals.** Large typography acting as a window to video or animated imagery behind it.
|
||||
|
||||
### Layout Upgrades
|
||||
- **Broken grid / asymmetry.** Elements that deliberately ignore column structure — overlapping, bleeding off-screen, or offset with calculated randomness.
|
||||
- **Whitespace maximization.** Aggressive use of negative space to force focus on a single element.
|
||||
- **Parallax card stacks.** Sections that stick and physically stack over each other during scroll.
|
||||
- **Split-screen scroll.** Two halves of the screen sliding in opposite directions.
|
||||
|
||||
### Motion Upgrades
|
||||
- **Smooth scroll with inertia.** Decouple scrolling from browser defaults for a heavier, cinematic feel.
|
||||
- **Staggered entry.** Elements cascade in with slight delays, combining Y-axis translation with opacity fade. Never mount everything at once.
|
||||
- **Spring physics.** Replace linear easing with spring-based motion for a natural, weighty feel on all interactive elements.
|
||||
- **Scroll-driven reveals.** Content entering through expanding masks, wipes, or draw-on SVG paths tied to scroll progress.
|
||||
|
||||
### Surface Upgrades
|
||||
- **True glassmorphism.** Go beyond `backdrop-filter: blur`. Add a 1px inner border and a subtle inner shadow to simulate edge refraction.
|
||||
- **Spotlight borders.** Card borders that illuminate dynamically under the cursor.
|
||||
- **Grain and noise overlays.** A fixed, pointer-events-none overlay with subtle noise to break digital flatness.
|
||||
- **Colored, tinted shadows.** Shadows that carry the hue of the background rather than using generic black.
|
||||
|
||||
## Fix Priority
|
||||
|
||||
Apply changes in this order for maximum visual impact with minimum risk:
|
||||
|
||||
1. **Font swap** — biggest instant improvement, lowest risk
|
||||
2. **Color palette cleanup** — remove clashing or oversaturated colors
|
||||
3. **Hover and active states** — makes the interface feel alive
|
||||
4. **Layout and spacing** — proper grid, max-width, consistent padding
|
||||
5. **Replace generic components** — swap cliche patterns for modern alternatives
|
||||
6. **Add loading, empty, and error states** — makes it feel finished
|
||||
7. **Polish typography scale and spacing** — the premium final touch
|
||||
|
||||
## Rules
|
||||
|
||||
- Work with the existing tech stack. Do not migrate frameworks or styling libraries.
|
||||
- Do not break existing functionality. Test after every change.
|
||||
- Before importing any new library, check the project's dependency file first.
|
||||
- If the project uses Tailwind, check the version (v3 vs v4) before modifying config.
|
||||
- If the project has no framework, use vanilla CSS.
|
||||
- Keep changes reviewable and focused. Small, targeted improvements over big rewrites.
|
||||
145
.agents/skills/frontend-design/scripts/accessibility_checker.py
Normal file
145
.agents/skills/frontend-design/scripts/accessibility_checker.py
Normal file
@@ -0,0 +1,145 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Lightweight static accessibility audit for HTML, JSX, and TSX.
|
||||
|
||||
This checker intentionally limits itself to findings that can be inferred from
|
||||
source. Component names such as ``<Button>`` and ``<InputGroup>`` are not
|
||||
mistaken for native HTML elements.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import re
|
||||
import sys
|
||||
from datetime import datetime
|
||||
from pathlib import Path
|
||||
|
||||
SKIP_DIRS = {"node_modules", ".next", "dist", "build", ".git", "coverage", "out"}
|
||||
|
||||
|
||||
def find_html_files(project_path: Path) -> list[Path]:
|
||||
files = [
|
||||
path
|
||||
for path in project_path.rglob("*")
|
||||
if path.is_file()
|
||||
and path.suffix.lower() in {".html", ".jsx", ".tsx"}
|
||||
and not any(part in SKIP_DIRS for part in path.parts)
|
||||
]
|
||||
return sorted(files)
|
||||
|
||||
|
||||
def _opening_tags(content: str, tag: str) -> list[str]:
|
||||
return re.findall(rf"<{tag}\b[^>]*>", content, re.DOTALL)
|
||||
|
||||
|
||||
def check_accessibility(file_path: Path) -> list[str]:
|
||||
issues: list[str] = []
|
||||
content = file_path.read_text("utf-8", errors="ignore")
|
||||
lowered = content.lower()
|
||||
|
||||
for input_tag in _opening_tags(content, "input"):
|
||||
normalized = input_tag.lower()
|
||||
if re.search(r'type\s*=\s*["\']hidden["\']', normalized):
|
||||
continue
|
||||
accessible = any(
|
||||
token in normalized
|
||||
for token in ("aria-label=", "aria-labelledby=", "id=", "{...", "name=")
|
||||
)
|
||||
if not accessible:
|
||||
issues.append("Native input without id, name, aria-label, or aria-labelledby")
|
||||
break
|
||||
|
||||
for match in re.finditer(r"<button\b([^>]*)>(.*?)</button\s*>", content, re.DOTALL):
|
||||
attributes, body = match.groups()
|
||||
if "aria-label=" in attributes.lower() or "aria-labelledby=" in attributes.lower():
|
||||
continue
|
||||
text = re.sub(r"<[^>]+>|\{[^}]+\}", "", body).strip()
|
||||
has_child_content = bool(re.search(r"<[A-Za-z]", body) or re.search(r"\{[^}]+\}", body))
|
||||
if not text and not has_child_content:
|
||||
issues.append("Native button without accessible text or label")
|
||||
break
|
||||
|
||||
html_tags = _opening_tags(content, "html")
|
||||
if html_tags and not any(re.search(r"\blang\s*=", tag, re.IGNORECASE) for tag in html_tags):
|
||||
issues.append("Missing lang attribute on <html>")
|
||||
|
||||
if _opening_tags(content, "body"):
|
||||
has_skip_link = bool(
|
||||
re.search(r"href\s*=\s*[\"']#(?:main|main-content)[\"']", content, re.IGNORECASE)
|
||||
)
|
||||
if not has_skip_link:
|
||||
issues.append("Document body is missing a skip-to-main-content link")
|
||||
|
||||
non_interactive_click = re.finditer(
|
||||
r"<(div|span|li|section|article)\b([^>]*)\bonClick\s*=([^>]*)>",
|
||||
content,
|
||||
re.DOTALL,
|
||||
)
|
||||
for _, before, after in non_interactive_click:
|
||||
attributes = f"{before} {after}".lower()
|
||||
keyboard_enabled = "onkeydown=" in attributes or "onkeyup=" in attributes
|
||||
semantic_button = 'role="button"' in attributes or "role='button'" in attributes
|
||||
focusable = "tabindex=" in attributes
|
||||
if not (keyboard_enabled and semantic_button and focusable):
|
||||
issues.append("Non-interactive element with onClick lacks role, tabIndex, or keyboard handler")
|
||||
break
|
||||
|
||||
positive_tabindex = re.findall(r"tabIndex\s*=\s*[\"']([1-9]\d*)[\"']", content, re.IGNORECASE)
|
||||
if positive_tabindex:
|
||||
issues.append("Avoid positive tabIndex values")
|
||||
|
||||
for media_tag in re.findall(r"<(?:audio|video)\b[^>]*>", content, re.DOTALL):
|
||||
if "autoplay" in media_tag.lower() and "muted" not in media_tag.lower():
|
||||
issues.append("Autoplay media should be muted")
|
||||
break
|
||||
|
||||
for div_tag in re.findall(r"<div\b[^>]*role\s*=\s*[\"']button[\"'][^>]*>", content, re.DOTALL):
|
||||
lowered_tag = div_tag.lower()
|
||||
if "tabindex=" not in lowered_tag or ("onkeydown=" not in lowered_tag and "onkeyup=" not in lowered_tag):
|
||||
issues.append("role='button' requires tabIndex and a keyboard handler")
|
||||
break
|
||||
|
||||
return issues
|
||||
|
||||
|
||||
def main() -> int:
|
||||
project_path = Path(sys.argv[1] if len(sys.argv) > 1 else ".").resolve()
|
||||
if not project_path.is_dir():
|
||||
print(json.dumps({"error": f"Directory not found: {project_path}"}))
|
||||
return 2
|
||||
|
||||
print(f"\n{'=' * 60}\n[ACCESSIBILITY CHECKER] WCAG Static Audit\n{'=' * 60}")
|
||||
print(f"Project: {project_path}")
|
||||
print(f"Time: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}\n" + "-" * 60)
|
||||
|
||||
files = find_html_files(project_path)
|
||||
print(f"Found {len(files)} HTML/JSX/TSX files")
|
||||
all_issues = []
|
||||
for file_path in files:
|
||||
issues = check_accessibility(file_path)
|
||||
if issues:
|
||||
all_issues.append({"file": str(file_path.relative_to(project_path)), "issues": issues})
|
||||
|
||||
print("\n" + "=" * 60 + "\nACCESSIBILITY ISSUES\n" + "=" * 60)
|
||||
if all_issues:
|
||||
for item in all_issues[:20]:
|
||||
print(f"\n{item['file']}:")
|
||||
for issue in item["issues"]:
|
||||
print(f" - {issue}")
|
||||
else:
|
||||
print("No statically detectable accessibility issues found.")
|
||||
|
||||
total_issues = sum(len(item["issues"]) for item in all_issues)
|
||||
output = {
|
||||
"script": "accessibility_checker",
|
||||
"project": str(project_path),
|
||||
"files_checked": len(files),
|
||||
"files_with_issues": len(all_issues),
|
||||
"issues_found": total_issues,
|
||||
"passed": total_issues == 0,
|
||||
}
|
||||
print("\n" + json.dumps(output, indent=2))
|
||||
return 0 if output["passed"] else 1
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
722
.agents/skills/frontend-design/scripts/ux_audit.py
Normal file
722
.agents/skills/frontend-design/scripts/ux_audit.py
Normal file
@@ -0,0 +1,722 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
UX Audit Script - Full Frontend Design Coverage
|
||||
|
||||
Analyzes code for compliance with:
|
||||
|
||||
1. CORE PSYCHOLOGY LAWS:
|
||||
- Hick's Law (nav items, form complexity)
|
||||
- Fitts' Law (target sizes, touch targets)
|
||||
- Miller's Law (chunking, memory limits)
|
||||
- Von Restorff Effect (primary CTA visibility)
|
||||
- Serial Position Effect (important items at start/end)
|
||||
|
||||
2. EMOTIONAL DESIGN (Don Norman):
|
||||
- Visceral (first impressions, gradients, animations)
|
||||
- Behavioral (feedback, usability, performance)
|
||||
- Reflective (brand story, values, identity)
|
||||
|
||||
3. TRUST BUILDING:
|
||||
- Security signals (SSL, encryption on forms)
|
||||
- Social proof (testimonials, reviews, logos)
|
||||
- Authority indicators (certifications, awards, media)
|
||||
|
||||
4. COGNITIVE LOAD MANAGEMENT:
|
||||
- Progressive disclosure (accordion, tabs, "Advanced")
|
||||
- Visual noise (too many colors/borders)
|
||||
- Familiar patterns (labels, standard conventions)
|
||||
|
||||
5. PERSUASIVE DESIGN (Ethical):
|
||||
- Smart defaults (pre-selected options)
|
||||
- Anchoring (original vs discount price)
|
||||
- Social proof (live indicators, numbers)
|
||||
- Progress indicators (progress bars, steps)
|
||||
|
||||
6. TYPOGRAPHY SYSTEM (9 sections):
|
||||
- Font Pairing (max 3 families)
|
||||
- Line Length (45-75ch)
|
||||
- Line Height (proper ratios)
|
||||
- Letter Spacing (uppercase, display text)
|
||||
- Weight and Emphasis (contrast levels)
|
||||
- Responsive Typography (clamp())
|
||||
- Hierarchy (sequential headings)
|
||||
- Modular Scale (consistent ratios)
|
||||
- Readability (chunking, subheadings)
|
||||
|
||||
7. VISUAL EFFECTS (10 sections):
|
||||
- Glassmorphism (blur + transparency)
|
||||
- Neomorphism (dual shadows, inset)
|
||||
- Shadow Hierarchy (elevation levels)
|
||||
- Gradients (usage, overuse)
|
||||
- Border Effects (complexity check)
|
||||
- Glow Effects (text-shadow, box-shadow)
|
||||
- Overlay Techniques (image text readability)
|
||||
- GPU Acceleration (transform/opacity vs layout)
|
||||
- Performance (will-change usage)
|
||||
- Effect Selection (purpose over decoration)
|
||||
|
||||
8. COLOR SYSTEM (7 sections):
|
||||
- PURPLE BAN (Critical Maestro rule - #8B5CF6, #A855F7, etc.)
|
||||
- 60-30-10 Rule (dominant, secondary, accent)
|
||||
- Color Scheme Patterns (monochromatic, analogous)
|
||||
- Dark Mode Compliance (no pure black/white)
|
||||
- WCAG Contrast (low-contrast detection)
|
||||
- Color Psychology Context (food + blue = bad)
|
||||
- HSL-Based Palettes (recommended approach)
|
||||
|
||||
9. ANIMATION GUIDE (6 sections):
|
||||
- Duration Appropriateness (50ms minimum, 1s max transitions)
|
||||
- Easing Functions (ease-out for entry, ease-in for exit)
|
||||
- Micro-interactions (hover/focus feedback)
|
||||
- Loading States (skeleton, spinner, progress)
|
||||
- Page Transitions (fade/slide for routing)
|
||||
- Scroll Animation Performance (no layout properties)
|
||||
|
||||
10. MOTION GRAPHICS (7 sections):
|
||||
- Lottie Animations (reduced motion fallbacks)
|
||||
- GSAP Memory Leaks (kill/revert on unmount)
|
||||
- SVG Animation Performance (stroke-dashoffset sparingly)
|
||||
- 3D Transforms (perspective parent, mobile warning)
|
||||
- Particle Effects (mobile fallback)
|
||||
- Scroll-Driven Animations (throttle with rAF)
|
||||
- Motion Decision Tree (functional vs decorative)
|
||||
|
||||
11. ACCESSIBILITY:
|
||||
- Alt text for images
|
||||
- Reduced motion checks
|
||||
- Form labels
|
||||
|
||||
Total: 80+ checks across all design principles
|
||||
"""
|
||||
|
||||
import sys
|
||||
import os
|
||||
import re
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
class UXAuditor:
|
||||
def __init__(self):
|
||||
self.issues = []
|
||||
self.warnings = []
|
||||
self.passed_count = 0
|
||||
self.files_checked = 0
|
||||
|
||||
def audit_file(self, filepath: str) -> None:
|
||||
try:
|
||||
with open(filepath, 'r', encoding='utf-8', errors='replace') as f:
|
||||
content = f.read()
|
||||
except: return
|
||||
|
||||
self.files_checked += 1
|
||||
filename = os.path.basename(filepath)
|
||||
|
||||
# Pre-calculate common flags
|
||||
has_long_text = bool(re.search(r'<p|<div.*class=.*text|article|<span.*text', content, re.IGNORECASE))
|
||||
has_form = bool(re.search(r'<form|<input|password|credit|card|payment', content, re.IGNORECASE))
|
||||
complex_elements = len(re.findall(r'<input|<select|<textarea|<option', content, re.IGNORECASE))
|
||||
|
||||
# --- 1. PSYCHOLOGY LAWS ---
|
||||
# Hick's Law
|
||||
nav_items = len(re.findall(r'<NavLink|<Link|<a\s+href|nav-item', content, re.IGNORECASE))
|
||||
if nav_items > 7:
|
||||
self.warnings.append(f"[Hick's Law] {filename}: {nav_items} nav items (Max 7). Consider grouping into categorized submenus.")
|
||||
|
||||
# Fitts' Law
|
||||
if re.search(r'height:\s*([0-3]\d)px', content) or re.search(r'h-[1-9]\b|h-10\b', content):
|
||||
self.warnings.append(f"[Fitts' Law] {filename}: Small targets (< 44px)")
|
||||
|
||||
# Miller's Law
|
||||
form_fields = len(re.findall(r'<input|<select|<textarea', content, re.IGNORECASE))
|
||||
if form_fields > 7 and not re.search(r'step|wizard|stage', content, re.IGNORECASE):
|
||||
self.warnings.append(f"[Miller's Law] {filename}: Complex form ({form_fields} fields)")
|
||||
|
||||
# Von Restorff
|
||||
if 'button' in content.lower() and not re.search(r'primary|bg-primary|Button.*primary|variant=["\']primary', content, re.IGNORECASE):
|
||||
self.warnings.append(f"[Von Restorff] {filename}: No primary CTA")
|
||||
|
||||
# Serial Position Effect - Important items at beginning/end
|
||||
if nav_items > 3:
|
||||
# Check if last nav item is important (contact, login, etc.)
|
||||
nav_content = re.findall(r'<NavLink|<Link|<a\s+href[^>]*>([^<]+)</a>', content, re.IGNORECASE)
|
||||
if nav_content and len(nav_content) > 2:
|
||||
last_item = nav_content[-1].lower() if nav_content else ''
|
||||
if not any(x in last_item for x in ['contact', 'login', 'sign', 'get started', 'cta', 'button']):
|
||||
self.warnings.append(f"[Serial Position] {filename}: Last nav item may not be important. Place key actions at start/end.")
|
||||
|
||||
# --- 1.5 EMOTIONAL DESIGN (Don Norman) ---
|
||||
|
||||
# Visceral: First impressions (aesthetics, gradients, animations)
|
||||
has_hero = bool(re.search(r'hero|<h1|banner', content, re.IGNORECASE))
|
||||
if has_hero:
|
||||
# Check for visual appeal elements
|
||||
has_gradient = bool(re.search(r'gradient|linear-gradient|radial-gradient', content))
|
||||
has_animation = bool(re.search(r'@keyframes|transition:|animate-', content))
|
||||
has_visual_interest = has_gradient or has_animation
|
||||
|
||||
if not has_visual_interest and not re.search(r'background:|bg-', content):
|
||||
self.warnings.append(f"[Visceral] {filename}: Hero section lacks visual appeal. Consider gradients or subtle animations.")
|
||||
|
||||
# Behavioral: Instant feedback and usability
|
||||
if 'onClick' in content or '@click' in content or 'onclick' in content:
|
||||
has_feedback = re.search(r'transition|animate|hover:|focus:|disabled|loading|spinner', content, re.IGNORECASE)
|
||||
has_state_change = re.search(r'setState|useState|disabled|loading', content)
|
||||
|
||||
if not has_feedback and not has_state_change:
|
||||
self.warnings.append(f"[Behavioral] {filename}: Interactive elements lack immediate feedback. Add hover/focus/disabled states.")
|
||||
|
||||
# Reflective: Brand story, values, identity
|
||||
has_reflective = bool(re.search(r'about|story|mission|values|why we|our journey|testimonials', content, re.IGNORECASE))
|
||||
if has_long_text and not has_reflective:
|
||||
self.warnings.append(f"[Reflective] {filename}: Long-form content without brand story/values. Add 'About' or 'Why We Exist' section.")
|
||||
|
||||
# --- 1.6 TRUST BUILDING (Enhanced) ---
|
||||
|
||||
# Security signals
|
||||
if has_form:
|
||||
security_signals = re.findall(r'ssl|secure|encrypt|lock|padlock|https', content, re.IGNORECASE)
|
||||
if len(security_signals) == 0 and not re.search(r'checkout|payment', content, re.IGNORECASE):
|
||||
self.warnings.append(f"[Trust] {filename}: Form without security indicators. Add 'SSL Secure' or lock icon.")
|
||||
|
||||
# Social proof elements
|
||||
social_proof = re.findall(r'review|testimonial|rating|star|trust|trusted by|customer|logo', content, re.IGNORECASE)
|
||||
if len(social_proof) > 0:
|
||||
self.passed_count += 1
|
||||
else:
|
||||
if has_long_text:
|
||||
self.warnings.append(f"[Trust] {filename}: No social proof detected. Consider adding testimonials, ratings, or 'Trusted by' logos.")
|
||||
|
||||
# Authority indicators
|
||||
has_footer = bool(re.search(r'footer|<footer', content, re.IGNORECASE))
|
||||
if has_footer:
|
||||
authority = re.findall(r'certif|award|media|press|featured|as seen in', content, re.IGNORECASE)
|
||||
if len(authority) == 0:
|
||||
self.warnings.append(f"[Trust] {filename}: Footer lacks authority signals. Add certifications, awards, or media mentions.")
|
||||
|
||||
# --- 1.7 COGNITIVE LOAD MANAGEMENT ---
|
||||
|
||||
# Progressive disclosure
|
||||
if complex_elements > 5:
|
||||
has_progressive = re.search(r'step|wizard|stage|accordion|collapsible|tab|more\.\.\.|advanced|show more', content, re.IGNORECASE)
|
||||
if not has_progressive:
|
||||
self.warnings.append(f"[Cognitive Load] {filename}: Many form elements without progressive disclosure. Consider accordion, tabs, or 'Advanced' toggle.")
|
||||
|
||||
# Visual noise check
|
||||
has_many_colors = len(re.findall(r'#[0-9a-fA-F]{3,6}|rgb|hsl', content)) > 15
|
||||
has_many_borders = len(re.findall(r'border:|border-', content)) > 10
|
||||
if has_many_colors and has_many_borders:
|
||||
self.warnings.append(f"[Cognitive Load] {filename}: High visual noise detected. Many colors and borders increase cognitive load.")
|
||||
|
||||
# Familiar patterns
|
||||
if re.search(r'<input|<select|<textarea', content, re.IGNORECASE):
|
||||
has_standard_labels = bool(re.search(r'<label|placeholder|aria-label|htmlFor', content, re.IGNORECASE))
|
||||
if not has_standard_labels:
|
||||
self.issues.append(f"[Cognitive Load] {filename}: Form inputs without labels. Use <label> for accessibility and clarity.")
|
||||
|
||||
# --- 1.8 PERSUASIVE DESIGN (Ethical) ---
|
||||
|
||||
# Smart defaults
|
||||
if has_form:
|
||||
has_defaults = bool(re.search(r'checked|selected|default|value=["\'].*["\']', content))
|
||||
radio_inputs = len(re.findall(r'type=["\']radio', content, re.IGNORECASE))
|
||||
if radio_inputs > 0 and not has_defaults:
|
||||
self.warnings.append(f"[Persuasion] {filename}: Radio buttons without default selection. Pre-select recommended option.")
|
||||
|
||||
# Anchoring (showing original price)
|
||||
if re.search(r'price|pricing|cost|\$\d+', content, re.IGNORECASE):
|
||||
has_anchor = bool(re.search(r'original|was|strike|del|save \d+%', content, re.IGNORECASE))
|
||||
if not has_anchor:
|
||||
self.warnings.append(f"[Persuasion] {filename}: Prices without anchoring. Show original price to frame discount value.")
|
||||
|
||||
# Social proof live indicators
|
||||
has_social = bool(re.search(r'join|subscriber|member|user', content, re.IGNORECASE))
|
||||
if has_social:
|
||||
has_count = bool(re.findall(r'\d+[+kmb]|\d+,\d+', content))
|
||||
if not has_count:
|
||||
self.warnings.append(f"[Persuasion] {filename}: Social proof without specific numbers. Use 'Join 10,000+' format.")
|
||||
|
||||
# Progress indicators
|
||||
if has_form:
|
||||
has_progress = bool(re.search(r'progress|step \d+|complete|%|bar', content, re.IGNORECASE))
|
||||
if complex_elements > 5 and not has_progress:
|
||||
self.warnings.append(f"[Persuasion] {filename}: Long form without progress indicator. Add progress bar or 'Step X of Y'.")
|
||||
|
||||
# --- 2. TYPOGRAPHY SYSTEM (Complete Coverage) ---
|
||||
|
||||
# 2.1 Font Pairing - Too many font families
|
||||
font_families = set()
|
||||
# Check for @font-face, Google Fonts, font-family declarations
|
||||
font_faces = re.findall(r'@font-face\s*\{[^}]*family:\s*["\']?([^;"\'\s}]+)', content, re.IGNORECASE)
|
||||
google_fonts = re.findall(r'fonts\.googleapis\.com[^"\']*family=([^"&]+)', content, re.IGNORECASE)
|
||||
font_family_css = re.findall(r'font-family:\s*([^;]+)', content, re.IGNORECASE)
|
||||
|
||||
for font in font_faces: font_families.add(font.strip().lower())
|
||||
for font in google_fonts:
|
||||
for f in font.replace('+', ' ').split('|'):
|
||||
font_families.add(f.split(':')[0].strip().lower())
|
||||
for family in font_family_css:
|
||||
# Extract first font from stack
|
||||
first_font = family.split(',')[0].strip().strip('"\'')
|
||||
|
||||
if first_font.lower() not in {'sans-serif', 'serif', 'monospace', 'cursive', 'fantasy', 'system-ui', 'inherit', 'arial', 'georgia', 'times new roman', 'courier new', 'verdana', 'helvetica', 'tahoma'}:
|
||||
font_families.add(first_font.lower())
|
||||
|
||||
if len(font_families) > 3:
|
||||
self.issues.append(f"[Typography] {filename}: {len(font_families)} font families detected. Limit to 2-3 for cohesion.")
|
||||
|
||||
# 2.2 Line Length - Character-based width
|
||||
if has_long_text and not re.search(r'max-w-(?:prose|[\[\\]?\d+ch[\]\\]?)|max-width:\s*\d+ch', content):
|
||||
self.warnings.append(f"[Typography] {filename}: No line length constraint (45-75ch). Use max-w-prose or max-w-[65ch].")
|
||||
|
||||
# 2.3 Line Height - Proper leading ratios
|
||||
# Check for text without proper line-height
|
||||
text_elements = len(re.findall(r'<p|<span|<div.*text|<h[1-6]', content, re.IGNORECASE))
|
||||
if text_elements > 0 and not re.search(r'leading-|line-height:', content):
|
||||
self.warnings.append(f"[Typography] {filename}: Text elements found without line-height. Body: 1.4-1.6, Headings: 1.1-1.3")
|
||||
|
||||
# Check for heading-specific line height issues
|
||||
if re.search(r'<h[1-6]|text-(?:xl|2xl|3xl|4xl|5xl|6xl)', content, re.IGNORECASE):
|
||||
# Extract line-height values
|
||||
line_heights = re.findall(r'(?:leading-|line-height:\s*)([\d.]+)', content)
|
||||
for lh in line_heights:
|
||||
if float(lh) > 1.5:
|
||||
self.warnings.append(f"[Typography] {filename}: Heading has line-height {lh} (>1.3). Headings should be tighter (1.1-1.3).")
|
||||
|
||||
# 2.4 Letter Spacing (Tracking)
|
||||
# Uppercase without tracking
|
||||
if re.search(r'uppercase|text-transform:\s*uppercase', content, re.IGNORECASE):
|
||||
if not re.search(r'tracking-|letter-spacing:', content):
|
||||
self.warnings.append(f"[Typography] {filename}: Uppercase text without tracking. ALL CAPS needs +5-10% spacing.")
|
||||
|
||||
# Large text (display/hero) should have negative tracking
|
||||
if re.search(r'text-(?:4xl|5xl|6xl|7xl|8xl|9xl)|font-size:\s*[3-9]\dpx', content):
|
||||
if not re.search(r'tracking-tight|letter-spacing:\s*-[0-9]', content):
|
||||
self.warnings.append(f"[Typography] {filename}: Large display text without tracking-tight. Big text needs -1% to -4% spacing.")
|
||||
|
||||
# 2.5 Weight and Emphasis - Contrast levels
|
||||
# Check for adjacent weight levels (poor contrast)
|
||||
weights = re.findall(r'font-weight:\s*(\d+)|font-(?:thin|extralight|light|normal|medium|semibold|bold|extrabold|black)|fw-(\d+)', content, re.IGNORECASE)
|
||||
weight_values = []
|
||||
for w in weights:
|
||||
val = w[0] or w[1]
|
||||
if val:
|
||||
# Map named weights to numbers
|
||||
weight_map = {'thin': '100', 'extralight': '200', 'light': '300', 'normal': '400', 'medium': '500', 'semibold': '600', 'bold': '700', 'extrabold': '800', 'black': '900'}
|
||||
val = weight_map.get(val.lower(), val)
|
||||
try:
|
||||
weight_values.append(int(val))
|
||||
except: pass
|
||||
|
||||
# Check for adjacent weights (400/500, 500/600, etc.)
|
||||
for i in range(len(weight_values) - 1):
|
||||
diff = abs(weight_values[i] - weight_values[i+1])
|
||||
if diff == 100:
|
||||
self.warnings.append(f"[Typography] {filename}: Adjacent font weights ({weight_values[i]}/{weight_values[i+1]}). Skip at least 2 levels for contrast.")
|
||||
|
||||
# Too many weight levels
|
||||
unique_weights = set(weight_values)
|
||||
if len(unique_weights) > 4:
|
||||
self.warnings.append(f"[Typography] {filename}: {len(unique_weights)} font weights. Limit to 3-4 per page.")
|
||||
|
||||
# 2.6 Responsive Typography - Fluid sizing with clamp()
|
||||
has_font_sizes = bool(re.search(r'font-size:|text-(?:xs|sm|base|lg|xl|2xl)', content))
|
||||
if has_font_sizes and not re.search(r'clamp\(|responsive:', content):
|
||||
self.warnings.append(f"[Typography] {filename}: Fixed font sizes without clamp(). Consider fluid typography: clamp(MIN, PREFERRED, MAX)")
|
||||
|
||||
# 2.7 Hierarchy - Heading structure
|
||||
headings = re.findall(r'<(h[1-6])', content, re.IGNORECASE)
|
||||
if headings:
|
||||
# Check for skipped levels (h1 -> h3)
|
||||
for i in range(len(headings) - 1):
|
||||
curr = int(headings[i][1])
|
||||
next_h = int(headings[i+1][1])
|
||||
if next_h > curr + 1:
|
||||
self.warnings.append(f"[Typography] {filename}: Skipped heading level (h{curr} -> h{next_h}). Maintain sequential hierarchy.")
|
||||
|
||||
# Check if h1 exists for main content
|
||||
if 'h1' not in [h.lower() for h in headings] and has_long_text:
|
||||
self.warnings.append(f"[Typography] {filename}: No h1 found. Each page should have one primary heading.")
|
||||
|
||||
# 2.8 Modular Scale - Consistent sizing
|
||||
# Extract font-size values
|
||||
font_sizes = re.findall(r'font-size:\s*(\d+(?:\.\d+)?)(px|rem|em)', content)
|
||||
size_values = []
|
||||
for size, unit in font_sizes:
|
||||
if unit == 'rem' or unit == 'em':
|
||||
size_values.append(float(size))
|
||||
elif unit == 'px':
|
||||
size_values.append(float(size) / 16) # Normalize to rem
|
||||
|
||||
if len(size_values) > 2:
|
||||
# Check if sizes follow a modular scale roughly
|
||||
sorted_sizes = sorted(set(size_values))
|
||||
ratios = []
|
||||
for i in range(1, len(sorted_sizes)):
|
||||
if sorted_sizes[i-1] > 0:
|
||||
ratios.append(sorted_sizes[i] / sorted_sizes[i-1])
|
||||
|
||||
# Common scale ratios: 1.067, 1.125, 1.2, 1.25, 1.333, 1.5, 1.618
|
||||
common_ratios = {1.067, 1.125, 1.2, 1.25, 1.333, 1.5, 1.618}
|
||||
for ratio in ratios[:3]: # Check first 3 ratios
|
||||
if not any(abs(ratio - cr) < 0.05 for cr in common_ratios):
|
||||
self.warnings.append(f"[Typography] {filename}: Font sizes may not follow modular scale (ratio: {ratio:.2f}). Consider consistent ratio like 1.25 (Major Third).")
|
||||
break
|
||||
|
||||
# 2.9 Readability - Content chunking
|
||||
# Check for very long paragraphs (>5 lines estimated)
|
||||
paragraphs = re.findall(r'<p[^>]*>([^<]+)</p>', content, re.IGNORECASE)
|
||||
for p in paragraphs:
|
||||
word_count = len(p.split())
|
||||
if word_count > 100: # ~5-6 lines
|
||||
self.warnings.append(f"[Typography] {filename}: Long paragraph detected ({word_count} words). Break into 3-4 line chunks for readability.")
|
||||
|
||||
# Check for missing subheadings in long content
|
||||
if len(paragraphs) > 5:
|
||||
subheadings = len(re.findall(r'<h[2-6]', content, re.IGNORECASE))
|
||||
if subheadings == 0:
|
||||
self.warnings.append(f"[Typography] {filename}: Long content without subheadings. Add h2/h3 to break up text.")
|
||||
|
||||
# --- 3. VISUAL EFFECTS (visual-effects.md) ---
|
||||
|
||||
# Glassmorphism Check
|
||||
if 'backdrop-filter' in content or 'blur(' in content:
|
||||
if not re.search(r'background:\s*rgba|bg-opacity|bg-[a-z0-9]+\/\d+', content):
|
||||
self.warnings.append(f"[Visual] {filename}: Blur used without semi-transparent background (Glassmorphism fail)")
|
||||
|
||||
# GPU Acceleration / Performance
|
||||
if re.search(r'@keyframes|transition:', content):
|
||||
expensive_props = re.findall(r'width|height|top|left|right|bottom|margin|padding', content)
|
||||
if expensive_props:
|
||||
self.warnings.append(f"[Performance] {filename}: Animating expensive properties ({', '.join(set(expensive_props))}). Use transform/opacity where possible.")
|
||||
|
||||
# Reduced Motion
|
||||
if not re.search(r'prefers-reduced-motion', content):
|
||||
self.warnings.append(f"[Accessibility] {filename}: Animations found without prefers-reduced-motion check")
|
||||
|
||||
# Natural Shadows
|
||||
shadows = re.findall(r'box-shadow:\s*([^;]+)', content)
|
||||
for shadow in shadows:
|
||||
# Check if natural (Y > X) or multiple layers
|
||||
if ',' not in shadow and not re.search(r'\d+px\s+[1-9]\d*px', shadow): # Simple heuristic for Y-offset
|
||||
self.warnings.append(f"[Visual] {filename}: Simple/Unnatural shadow detected. Consider multiple layers or Y > X offset for realism.")
|
||||
|
||||
# --- 3.1 NEOMORPHISM CHECK ---
|
||||
# Check for neomorphism patterns (dual shadows with opposite directions)
|
||||
neo_shadows = re.findall(r'box-shadow:\s*([^;]+)', content)
|
||||
for shadow in neo_shadows:
|
||||
# Neomorphism has two shadows: positive offset + negative offset
|
||||
if ',' in shadow and '-' in shadow:
|
||||
# Check for inset pattern (pressed state)
|
||||
if 'inset' in shadow:
|
||||
self.warnings.append(f"[Visual] {filename}: Neomorphism inset detected. Ensure adequate contrast for accessibility.")
|
||||
|
||||
# --- 3.2 SHADOW HIERARCHY ---
|
||||
# Count shadow levels to check for elevation consistency
|
||||
shadow_count = len(shadows)
|
||||
if shadow_count > 0:
|
||||
# Check for shadow opacity levels (should indicate hierarchy)
|
||||
opacities = re.findall(r'rgba?\([^)]+,\s*([\d.]+)\)', content)
|
||||
shadow_opacities = [float(o) for o in opacities if float(o) < 0.5]
|
||||
if shadow_count >= 3 and len(shadow_opacities) > 0:
|
||||
# Check if there's variety in shadow opacities for different elevations
|
||||
unique_opacities = len(set(shadow_opacities))
|
||||
if unique_opacities < 2:
|
||||
self.warnings.append(f"[Visual] {filename}: All shadows at same opacity level. Vary shadow intensity for elevation hierarchy.")
|
||||
|
||||
# --- 3.3 GRADIENT CHECKS ---
|
||||
# Check for gradient usage
|
||||
has_gradient = bool(re.search(r'gradient|linear-gradient|radial-gradient|conic-gradient', content))
|
||||
if has_gradient:
|
||||
# Warn about mesh/aurora gradients (can be overused)
|
||||
gradient_count = len(re.findall(r'gradient', content, re.IGNORECASE))
|
||||
if gradient_count > 5:
|
||||
self.warnings.append(f"[Visual] {filename}: Many gradients detected ({gradient_count}). Ensure this serves purpose, not decoration.")
|
||||
else:
|
||||
# Check if hero section exists without gradient
|
||||
if has_hero and not re.search(r'background:|bg-', content):
|
||||
self.warnings.append(f"[Visual] {filename}: Hero section without visual interest. Consider gradient for depth.")
|
||||
|
||||
# --- 3.4 BORDER EFFECTS ---
|
||||
# Check for gradient borders or animated borders
|
||||
has_border = bool(re.search(r'border:|border-', content))
|
||||
if has_border:
|
||||
# Check for overly complex borders
|
||||
border_count = len(re.findall(r'border:', content))
|
||||
if border_count > 8:
|
||||
self.warnings.append(f"[Visual] {filename}: Many border declarations ({border_count}). Simplify for cleaner look.")
|
||||
|
||||
# --- 3.5 GLOW EFFECTS ---
|
||||
# Check for text-shadow or multiple box-shadow layers (glow effects)
|
||||
text_shadows = re.findall(r'text-shadow:', content)
|
||||
for ts in text_shadows:
|
||||
# Multiple text-shadow layers indicate glow
|
||||
if ',' in ts:
|
||||
self.warnings.append(f"[Visual] {filename}: Text glow effect detected. Ensure readability is maintained.")
|
||||
|
||||
# Check for box-shadow glow (multiple layers with 0 offset)
|
||||
glow_shadows = re.findall(r'box-shadow:\s*[^;]*0\s+0\s+', content)
|
||||
if len(glow_shadows) > 2:
|
||||
self.warnings.append(f"[Visual] {filename}: Multiple glow effects detected. Use sparingly for emphasis only.")
|
||||
|
||||
# --- 3.6 OVERLAY TECHNIQUES ---
|
||||
# Check for image overlays (for readability)
|
||||
has_images = bool(re.search(r'<img|background-image:|bg-\[url', content))
|
||||
if has_images and has_long_text:
|
||||
has_overlay = bool(re.search(r'overlay|rgba\(0|gradient.*transparent|::after|::before', content))
|
||||
if not has_overlay:
|
||||
self.warnings.append(f"[Visual] {filename}: Text over image without overlay. Add gradient overlay for readability.")
|
||||
|
||||
# --- 3.7 PERFORMANCE: will-change ---
|
||||
# Check for will-change usage
|
||||
if re.search(r'will-change:', content):
|
||||
will_change_props = re.findall(r'will-change:\s*([^;]+)', content)
|
||||
for prop in will_change_props:
|
||||
prop = prop.strip().lower()
|
||||
if prop in ['width', 'height', 'top', 'left', 'right', 'bottom', 'margin', 'padding']:
|
||||
self.issues.append(f"[Performance] {filename}: will-change on '{prop}' (layout property). Use only for transform/opacity.")
|
||||
|
||||
# Check for excessive will-change usage
|
||||
will_change_count = len(re.findall(r'will-change:', content))
|
||||
if will_change_count > 3:
|
||||
self.warnings.append(f"[Performance] {filename}: Many will-change declarations ({will_change_count}). Use sparingly, only for heavy animations.")
|
||||
|
||||
# --- 3.8 EFFECT SELECTION ---
|
||||
# Check for effect overuse (too many visual effects)
|
||||
effect_count = (
|
||||
(1 if has_gradient else 0) +
|
||||
shadow_count +
|
||||
len(re.findall(r'backdrop-filter|blur\(', content)) +
|
||||
len(re.findall(r'text-shadow:', content))
|
||||
)
|
||||
if effect_count > 10:
|
||||
self.warnings.append(f"[Visual] {filename}: Many visual effects ({effect_count}). Ensure effects serve purpose, not decoration.")
|
||||
|
||||
# Check for static/flat design (no depth)
|
||||
if has_long_text and effect_count == 0:
|
||||
self.warnings.append(f"[Visual] {filename}: Flat design with no depth. Consider shadows or subtle gradients for hierarchy.")
|
||||
|
||||
# --- 4. COLOR SYSTEM (color-system.md) ---
|
||||
|
||||
# 4.1 PURPLE BAN - Critical check from color-system.md
|
||||
purple_hexes = ['#8B5CF6', '#A855F7', '#9333EA', '#7C3AED', '#6D28D9',
|
||||
'#8B5CF6', '#A78BFA', '#C4B5FD', '#DDD6FE', '#EDE9FE',
|
||||
'#8b5cf6', '#a855f7', '#9333ea', '#7c3aed', '#6d28d9',
|
||||
'purple', 'violet', 'fuchsia', 'magenta', 'lavender']
|
||||
for purple in purple_hexes:
|
||||
if purple.lower() in content.lower():
|
||||
self.issues.append(f"[Color] {filename}: PURPLE DETECTED ('{purple}'). Banned by Maestro rules. Use Teal/Cyan/Emerald instead.")
|
||||
break
|
||||
|
||||
# 4.2 60-30-10 Rule check
|
||||
# Count color usage to estimate ratio
|
||||
color_hex_count = len(re.findall(r'#[0-9a-fA-F]{3,6}', content))
|
||||
hsl_count = len(re.findall(r'hsl\(', content))
|
||||
total_colors = color_hex_count + hsl_count
|
||||
if total_colors > 3:
|
||||
# Check for dominant colors (should be ~60%)
|
||||
bg_declarations = re.findall(r'(?:background|bg-|bg\[)([^;}\s]+)', content)
|
||||
text_declarations = re.findall(r'(?:color|text-)([^;}\s]+)', content)
|
||||
if len(bg_declarations) > 0 and len(text_declarations) > 0:
|
||||
# Just warn if too many distinct colors
|
||||
unique_hexes = set(re.findall(r'#[0-9a-fA-F]{6}', content))
|
||||
if len(unique_hexes) > 5:
|
||||
self.warnings.append(f"[Color] {filename}: {len(unique_hexes)} distinct colors. Consider 60-30-10 rule: dominant (60%), secondary (30%), accent (10%).")
|
||||
|
||||
# 4.3 Color Scheme Pattern Detection
|
||||
# Detect monochromatic (same hue, different lightness)
|
||||
hsl_matches = re.findall(r'hsl\((\d+),\s*\d+%,\s*\d+%\)', content)
|
||||
if len(hsl_matches) >= 3:
|
||||
hues = [int(h) for h in hsl_matches]
|
||||
hue_range = max(hues) - min(hues)
|
||||
if hue_range < 10:
|
||||
self.warnings.append(f"[Color] {filename}: Monochromatic palette detected (hue variance: {hue_range}deg). Ensure adequate contrast.")
|
||||
|
||||
# 4.4 Dark Mode Compliance
|
||||
# Check for pure black (#000000) or pure white (#FFFFFF) text (forbidden)
|
||||
if re.search(r'color:\s*#000000|#000\b', content):
|
||||
self.warnings.append(f"[Color] {filename}: Pure black (#000000) detected. Use #1a1a1a or darker grays for better dark mode.")
|
||||
if re.search(r'background:\s*#ffffff|#fff\b', content) and re.search(r'dark:\s*|dark:', content):
|
||||
self.warnings.append(f"[Color] {filename}: Pure white background in dark mode context. Use slight off-white (#f9fafb) for reduced eye strain.")
|
||||
|
||||
# 4.5 WCAG Contrast Pattern Check
|
||||
# Look for potential low-contrast combinations
|
||||
light_bg_light_text = bool(re.search(r'bg-(?:gray|slate|zinc)-50|bg-white.*text-(?:gray|slate)-[12]', content))
|
||||
dark_bg_dark_text = bool(re.search(r'bg-(?:gray|slate|zinct)-9|bg-black.*text-(?:gray|slate)-[89]', content))
|
||||
if light_bg_light_text or dark_bg_dark_text:
|
||||
self.warnings.append(f"[Color] {filename}: Possible low-contrast combination detected. Verify WCAG AA (4.5:1 for text).")
|
||||
|
||||
# 4.6 Color Psychology Context Check
|
||||
# Warn if blue used for food/restaurant context
|
||||
has_blue = bool(re.search(r'bg-blue|text-blue|from-blue|#[0-9a-fA-F]*00[0-9A-Fa-f]{2}|#[0-9a-fA-F]*1[0-9A-Fa-f]{2}', content))
|
||||
has_food_context = bool(re.search(r'restaurant|food|cooking|recipe|menu|dish|meal', content, re.IGNORECASE))
|
||||
if has_blue and has_food_context:
|
||||
self.warnings.append(f"[Color] {filename}: Blue color in food context. Blue suppresses appetite; consider warm colors (red, orange, yellow).")
|
||||
|
||||
# 4.7 HSL-Based Palette Detection
|
||||
# Check if using HSL for palette (recommended in color-system.md)
|
||||
has_color_vars = bool(re.search(r'--color-|color-|primary-|secondary-', content))
|
||||
if has_color_vars and not re.search(r'hsl\(', content):
|
||||
self.warnings.append(f"[Color] {filename}: Color variables without HSL. Consider HSL for easier palette adjustment (Hue, Saturation, Lightness).")
|
||||
|
||||
# --- 5. ANIMATION GUIDE (animation-guide.md) ---
|
||||
|
||||
# 5.1 Duration Appropriateness
|
||||
# Check for excessively long or short animations
|
||||
durations = re.findall(r'(?:duration|animation-duration|transition-duration):\s*([\d.]+)(s|ms)', content)
|
||||
for duration, unit in durations:
|
||||
duration_ms = float(duration) * (1000 if unit == 's' else 1)
|
||||
if duration_ms < 50:
|
||||
self.warnings.append(f"[Animation] {filename}: Very fast animation ({duration}{unit}). Minimum 50ms for visibility.")
|
||||
elif duration_ms > 1000 and 'transition' in content.lower():
|
||||
self.warnings.append(f"[Animation] {filename}: Long transition ({duration}{unit}). Transitions should be 100-300ms for responsiveness.")
|
||||
|
||||
# 5.2 Easing Function Correctness
|
||||
# Check for incorrect easing patterns
|
||||
if re.search(r'ease-in\s+.*entry|fade-in.*ease-in', content):
|
||||
self.warnings.append(f"[Animation] {filename}: Entry animation with ease-in. Entry should use ease-out for snappy feel.")
|
||||
if re.search(r'ease-out\s+.*exit|fade-out.*ease-out', content):
|
||||
self.warnings.append(f"[Animation] {filename}: Exit animation with ease-out. Exit should use ease-in for natural feel.")
|
||||
|
||||
# 5.3 Micro-interaction Feedback Patterns
|
||||
# Check for interactive elements without hover/focus states
|
||||
interactive_elements = len(re.findall(r'<button|<a\s+href|onClick|@click', content))
|
||||
has_hover_focus = bool(re.search(r'hover:|focus:|:hover|:focus', content))
|
||||
if interactive_elements > 2 and not has_hover_focus:
|
||||
self.warnings.append(f"[Animation] {filename}: Interactive elements without hover/focus states. Add micro-interactions for feedback.")
|
||||
|
||||
# 5.4 Loading State Indicators
|
||||
# Check for loading patterns
|
||||
has_async = bool(re.search(r'async|await|fetch|axios|loading|isLoading', content))
|
||||
has_loading_indicator = bool(re.search(r'skeleton|spinner|progress|loading|<circle.*animate', content))
|
||||
if has_async and not has_loading_indicator:
|
||||
self.warnings.append(f"[Animation] {filename}: Async operations without loading indicator. Add skeleton or spinner for perceived performance.")
|
||||
|
||||
# 5.5 Page Transition Patterns
|
||||
# Check for page/view transitions
|
||||
has_routing = bool(re.search(r'router|navigate|Link.*to|useHistory', content))
|
||||
has_page_transition = bool(re.search(r'AnimatePresence|motion\.|transition.*page|fade.*route', content))
|
||||
if has_routing and not has_page_transition:
|
||||
self.warnings.append(f"[Animation] {filename}: Routing detected without page transitions. Consider fade/slide for context continuity.")
|
||||
|
||||
# 5.6 Scroll Animation Performance
|
||||
# Check for scroll-driven animations
|
||||
has_scroll_anim = bool(re.search(r'onScroll|scroll.*trigger|IntersectionObserver', content))
|
||||
if has_scroll_anim:
|
||||
# Check if using expensive properties in scroll handlers
|
||||
if re.search(r'onScroll.*[^\w](width|height|top|left)', content):
|
||||
self.issues.append(f"[Animation] {filename}: Scroll handler animating layout properties. Use transform/opacity for 60fps.")
|
||||
|
||||
# --- 6. MOTION GRAPHICS (motion-graphics.md) ---
|
||||
|
||||
# 6.1 Lottie Animation Checks
|
||||
has_lottie = bool(re.search(r'lottie|Lottie|@lottie-react', content))
|
||||
if has_lottie:
|
||||
# Check for reduced motion fallback
|
||||
has_lottie_fallback = bool(re.search(r'prefers-reduced-motion.*lottie|lottie.*isPaused|lottie.*stop', content))
|
||||
if not has_lottie_fallback:
|
||||
self.warnings.append(f"[Motion] {filename}: Lottie animation without reduced-motion fallback. Add pause/stop for accessibility.")
|
||||
|
||||
# 6.2 GSAP Memory Leak Risks
|
||||
has_gsap = bool(re.search(r'gsap|ScrollTrigger|from\(.*gsap', content))
|
||||
if has_gsap:
|
||||
# Check for cleanup patterns
|
||||
has_gsap_cleanup = bool(re.search(r'kill\(|revert\(|useEffect.*return.*gsap', content))
|
||||
if not has_gsap_cleanup:
|
||||
self.issues.append(f"[Motion] {filename}: GSAP animation without cleanup (kill/revert). Memory leak risk on unmount.")
|
||||
|
||||
# 6.3 SVG Animation Performance
|
||||
svg_animations = re.findall(r'<animate|<animateTransform|stroke-dasharray|stroke-dashoffset', content)
|
||||
if len(svg_animations) > 3:
|
||||
self.warnings.append(f"[Motion] {filename}: Multiple SVG animations detected. Ensure stroke-dashoffset is used sparingly for mobile performance.")
|
||||
|
||||
# 6.4 3D Transform Performance
|
||||
has_3d_transform = bool(re.search(r'transform3d|perspective\(|rotate3d|translate3d', content))
|
||||
if has_3d_transform:
|
||||
# Check for perspective on parent
|
||||
has_perspective_parent = bool(re.search(r'perspective:\s*\d+px|perspective\s*\(', content))
|
||||
if not has_perspective_parent:
|
||||
self.warnings.append(f"[Motion] {filename}: 3D transform without perspective parent. Add perspective: 1000px for realistic depth.")
|
||||
|
||||
# Warn about mobile performance
|
||||
self.warnings.append(f"[Motion] {filename}: 3D transforms detected. Test on mobile; can impact performance on low-end devices.")
|
||||
|
||||
# 6.5 Particle Effect Warnings
|
||||
# Check for canvas/WebGL particle systems
|
||||
has_particles = bool(re.search(r'particle|canvas.*loop|requestAnimationFrame.*draw|Three\.js', content))
|
||||
if has_particles:
|
||||
self.warnings.append(f"[Motion] {filename}: Particle effects detected. Ensure fallback or reduced-quality option for mobile devices.")
|
||||
|
||||
# 6.6 Scroll-Driven Animation Performance
|
||||
has_scroll_driven = bool(re.search(r'IntersectionObserver.*animate|scroll.*progress|view-timeline', content))
|
||||
if has_scroll_driven:
|
||||
# Check for throttling/debouncing
|
||||
has_throttle = bool(re.search(r'throttle|debounce|requestAnimationFrame', content))
|
||||
if not has_throttle:
|
||||
self.issues.append(f"[Motion] {filename}: Scroll-driven animation without throttling. Add requestAnimationFrame for 60fps.")
|
||||
|
||||
# 6.7 Motion Decision Tree - Context Check
|
||||
# Check if animation serves purpose (not just decoration)
|
||||
total_animations = (
|
||||
len(re.findall(r'@keyframes|transition:|animate-', content)) +
|
||||
(1 if has_lottie else 0) +
|
||||
(1 if has_gsap else 0)
|
||||
)
|
||||
if total_animations > 5:
|
||||
# Check if animations are functional
|
||||
functional_animations = len(re.findall(r'hover:|focus:|disabled|loading|error|success', content))
|
||||
if functional_animations < total_animations / 2:
|
||||
self.warnings.append(f"[Motion] {filename}: Many animations ({total_animations}). Ensure majority serve functional purpose (feedback, guidance), not decoration.")
|
||||
|
||||
# --- 7. ACCESSIBILITY ---
|
||||
if re.search(r'<img(?![^>]*alt=)[^>]*>', content):
|
||||
self.issues.append(f"[Accessibility] {filename}: Missing img alt text")
|
||||
|
||||
def audit_directory(self, directory: str) -> None:
|
||||
extensions = {'.tsx', '.jsx', '.html', '.vue', '.svelte', '.css'}
|
||||
for root, dirs, files in os.walk(directory):
|
||||
dirs[:] = [d for d in dirs if d not in {'node_modules', '.git', 'dist', 'build', '.next', 'ui'}]
|
||||
for file in files:
|
||||
if Path(file).suffix in extensions:
|
||||
self.audit_file(os.path.join(root, file))
|
||||
|
||||
def get_report(self):
|
||||
return {
|
||||
"files_checked": self.files_checked,
|
||||
"issues": self.issues,
|
||||
"warnings": self.warnings,
|
||||
"passed_checks": self.passed_count,
|
||||
"compliant": len(self.issues) == 0
|
||||
}
|
||||
|
||||
def main():
|
||||
if len(sys.argv) < 2: sys.exit(1)
|
||||
|
||||
path = sys.argv[1]
|
||||
is_json = "--json" in sys.argv
|
||||
|
||||
auditor = UXAuditor()
|
||||
if os.path.isfile(path): auditor.audit_file(path)
|
||||
else: auditor.audit_directory(path)
|
||||
|
||||
report = auditor.get_report()
|
||||
|
||||
if is_json:
|
||||
print(json.dumps(report))
|
||||
else:
|
||||
# Use ASCII-safe output for Windows console compatibility
|
||||
print(f"\n[UX AUDIT] {report['files_checked']} files checked")
|
||||
print("-" * 50)
|
||||
if report['issues']:
|
||||
print(f"[!] ISSUES ({len(report['issues'])}):")
|
||||
for i in report['issues'][:10]: print(f" - {i}")
|
||||
if report['warnings']:
|
||||
print(f"[*] WARNINGS ({len(report['warnings'])}):")
|
||||
for w in report['warnings'][:15]: print(f" - {w}")
|
||||
print(f"[+] PASSED CHECKS: {report['passed_checks']}")
|
||||
status = "PASS" if report['compliant'] else "FAIL"
|
||||
print(f"STATUS: {status}")
|
||||
|
||||
sys.exit(0 if report['compliant'] else 1)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
92
.agents/skills/frontend-design/style-brutalist.md
Normal file
92
.agents/skills/frontend-design/style-brutalist.md
Normal file
@@ -0,0 +1,92 @@
|
||||
# Style: Industrial Brutalist
|
||||
|
||||
> Variant of [frontend-design](SKILL.md). Use when the brief calls for raw, terminal/industrial, data-heavy aesthetics.
|
||||
|
||||
|
||||
# SKILL: Industrial Brutalism & Tactical Telemetry UI
|
||||
|
||||
## 1. Skill Meta
|
||||
**Name:** Industrial Brutalism & Tactical Telemetry Interface Engineering
|
||||
**Description:** Advanced proficiency in architecting web interfaces that synthesize mid-century Swiss Typographic design, industrial manufacturing manuals, and retro-futuristic aerospace/military terminal interfaces. This discipline requires absolute mastery over rigid modular grids, extreme typographic scale contrast, purely utilitarian color palettes, and the programmatic simulation of analog degradation (halftones, CRT scanlines, bitmap dithering). The objective is to construct digital environments that project raw functionality, mechanical precision, and high data density, deliberately discarding conventional consumer UI patterns.
|
||||
|
||||
## 2. Visual Archetypes
|
||||
The design system operates by merging two distinct but highly compatible visual paradigms. **Pick ONE per project and commit to it. Do not alternate or mix both modes within the same interface.**
|
||||
|
||||
### 2.1 Swiss Industrial Print
|
||||
Derived from 1960s corporate identity systems and heavy machinery blueprints.
|
||||
* **Characteristics:** High-contrast light modes (newsprint/off-white substrates). Reliance on monolithic, heavy sans-serif typography. Unforgiving structural grids outlined by visible dividing lines. Aggressive, asymmetric use of negative space punctuated by oversized, viewport-bleeding numerals or letterforms. Heavy use of primary red as an alert/accent color.
|
||||
|
||||
### 2.2 Tactical Telemetry & CRT Terminal
|
||||
Derived from classified military databases, legacy mainframes, and aerospace Heads-Up Displays (HUDs).
|
||||
* **Characteristics:** Dark mode exclusivity. High-density tabular data presentation. Absolute dominance of monospaced typography. Integration of technical framing devices (ASCII brackets, crosshairs). Application of simulated hardware limitations (phosphor glow, scanlines, low bit-depth rendering).
|
||||
|
||||
## 3. Typographic Architecture
|
||||
Typography is the primary structural and decorative infrastructure. Imagery is secondary. The system demands extreme variance in scale, weight, and spacing.
|
||||
|
||||
### 3.1 Macro-Typography (Structural Headers)
|
||||
* **Classification:** Neo-Grotesque / Heavy Sans-Serif.
|
||||
* **Optimal Web Fonts:** Neue Haas Grotesk (Black), Inter (Extra Bold/Black), Archivo Black, Roboto Flex (Heavy), Monument Extended.
|
||||
* **Implementation Parameters:**
|
||||
* **Scale:** Deployed at massive scales using fluid typography (e.g., `clamp(4rem, 10vw, 15rem)`).
|
||||
* **Tracking (Letter-spacing):** Extremely tight, often negative (`-0.03em` to `-0.06em`), forcing glyphs to form solid architectural blocks.
|
||||
* **Leading (Line-height):** Highly compressed (`0.85` to `0.95`).
|
||||
* **Casing:** Exclusively uppercase for structural impact.
|
||||
|
||||
### 3.2 Micro-Typography (Data & Telemetry)
|
||||
* **Classification:** Monospace / Technical Sans.
|
||||
* **Optimal Web Fonts:** JetBrains Mono, IBM Plex Mono, Space Mono, VT323, Courier Prime.
|
||||
* **Implementation Parameters:**
|
||||
* **Scale:** Fixed and small (`10px` to `14px` / `0.7rem` to `0.875rem`).
|
||||
* **Tracking:** Generous (`0.05em` to `0.1em`) to simulate mechanical typewriter spacing or terminal matrices.
|
||||
* **Leading:** Standard to tight (`1.2` to `1.4`).
|
||||
* **Casing:** Exclusively uppercase. Used for all metadata, navigation, unit IDs, and coordinates.
|
||||
|
||||
### 3.3 Textural Contrast (Artistic Disruption)
|
||||
* **Classification:** High-Contrast Serif.
|
||||
* **Optimal Web Fonts:** Playfair Display, EB Garamond, Times New Roman.
|
||||
* **Implementation Parameters:** Used exceedingly sparingly. Must be subjected to heavy post-processing (halftone filters, 1-bit dithering) to degrade vector perfection and create textural juxtaposition against the clean sans-serifs.
|
||||
|
||||
## 4. Color System
|
||||
The color architecture is uncompromising. Gradients, soft drop shadows, and modern translucency are strictly prohibited. Colors simulate physical media or primitive emissive displays.
|
||||
|
||||
**CRITICAL: Choose ONE substrate palette per project and use it consistently. Never mix light and dark substrates within the same interface.**
|
||||
|
||||
### If Swiss Industrial Print (Light):
|
||||
* **Background:** `#F4F4F0` or `#EAE8E3` (Matte, unbleached documentation paper).
|
||||
* **Foreground:** `#050505` to `#111111` (Carbon Ink).
|
||||
* **Accent:** `#E61919` or `#FF2A2A` (Aviation/Hazard Red). This is the ONLY accent color. Used for strike-throughs, thick structural dividing lines, or vital data highlights.
|
||||
|
||||
### If Tactical Telemetry (Dark):
|
||||
* **Background:** `#0A0A0A` or `#121212` (Deactivated CRT. Avoid pure `#000000`).
|
||||
* **Foreground:** `#EAEAEA` (White phosphor). This is the primary text color.
|
||||
* **Accent:** `#E61919` or `#FF2A2A` (Aviation/Hazard Red). Same red, same rules.
|
||||
* **Terminal Green (`#4AF626`):** Optional. Use ONLY for a single specific UI element (e.g., one status indicator or one data readout) — never as a general text color. If it doesn't serve a clear purpose, omit it entirely.
|
||||
|
||||
## 5. Layout and Spatial Engineering
|
||||
The layout must appear mathematically engineered. It rejects conventional web padding in favor of visible compartmentalization.
|
||||
|
||||
* **The Blueprint Grid:** Strict adherence to CSS Grid architectures. Elements do not float; they are anchored precisely to grid tracks and intersections.
|
||||
* **Visible Compartmentalization:** Extensive utilization of solid borders (`1px` or `2px solid`) to delineate distinct zones of information. Horizontal rules (`<hr>`) frequently span the entire container width to segregate operational units.
|
||||
* **Bimodal Density:** Layouts oscillate between extreme data density (tightly packed monospace metadata clustered together) and vast expanses of calculated negative space framing macro-typography.
|
||||
* **Geometry:** Absolute rejection of `border-radius`. All corners must be exactly 90 degrees to enforce mechanical rigidity.
|
||||
|
||||
## 6. UI Components and Symbology
|
||||
Standard web UI conventions are replaced with utilitarian, industrial graphic elements.
|
||||
|
||||
* **Syntax Decoration:** Utilization of ASCII characters to frame data points.
|
||||
* *Framing:* `[ DELIVERY SYSTEMS ]`, `< RE-IND >`
|
||||
* *Directional:* `>>>`, `///`, `\\\\`
|
||||
* **Industrial Markers:** Prominent integration of registration (`®`), copyright (`©`), and trademark (`™`) symbols functioning as structural geometric elements rather than legal text.
|
||||
* **Technical Assets:** Integration of crosshairs (`+`) at grid intersections, repeating vertical lines (barcodes), thick horizontal warning stripes, and randomized string data (e.g., `REV 2.6`, `UNIT / D-01`) to simulate active mechanical processes.
|
||||
|
||||
## 7. Textural and Post-Processing Effects
|
||||
To prevent the design from appearing purely digital, simulated analog degradation is engineered into the frontend via CSS and SVG filters.
|
||||
|
||||
* **Halftone and 1-Bit Dithering:** Transforming continuous-tone images or large serif typography into dot-matrix patterns. Achieved via pre-processing or CSS `mix-blend-mode: multiply` overlays combined with SVG radial dot patterns.
|
||||
* **CRT Scanlines:** For terminal interfaces, applying a `repeating-linear-gradient` to the background to simulate horizontal electron beam sweeps (e.g., `repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0,0,0,0.1) 2px, rgba(0,0,0,0.1) 4px)`).
|
||||
* **Mechanical Noise:** A global, low-opacity SVG static/noise filter applied to the DOM root to introduce a unified physical grain across both dark and light modes.
|
||||
|
||||
## 8. Web Engineering Directives
|
||||
1. **Grid Determinism:** Utilize `display: grid; gap: 1px;` with contrasting parent/child background colors to generate mathematically perfect, razor-thin dividing lines without complex border declarations.
|
||||
2. **Semantic Rigidity:** Construct the DOM using precise semantic tags (`<data>`, `<samp>`, `<kbd>`, `<output>`, `<dl>`) to accurately reflect the technical nature of the telemetry.
|
||||
3. **Typography Clamping:** Implement CSS `clamp()` functions exclusively for macro-typography to ensure massive text scales aggressively while maintaining structural integrity across viewports.
|
||||
85
.agents/skills/frontend-design/style-minimalist.md
Normal file
85
.agents/skills/frontend-design/style-minimalist.md
Normal file
@@ -0,0 +1,85 @@
|
||||
# Style: Minimalist / Editorial
|
||||
|
||||
> Variant of [frontend-design](SKILL.md). Use when the brief calls for clean, monochrome, editorial minimalism.
|
||||
|
||||
|
||||
# Protocol: Premium Utilitarian Minimalism UI Architect
|
||||
|
||||
## 1. Protocol Overview
|
||||
Name: Premium Utilitarian Minimalism & Editorial UI
|
||||
Description: An advanced frontend engineering directive for generating highly refined, ultra-minimalist, "document-style" web interfaces analogous to top-tier workspace platforms. This protocol strictly enforces a high-contrast warm monochrome palette, bespoke typographic hierarchies, meticulous structural macro-whitespace, bento-grid layouts, and an ultra-flat component architecture with deliberate muted pastel accents. It actively rejects standard generic SaaS design trends.
|
||||
|
||||
## 2. Absolute Negative Constraints (Banned Elements)
|
||||
The AI must strictly avoid the following generic web development defaults:
|
||||
- DO NOT use the "Inter", "Roboto", or "Open Sans" typefaces.
|
||||
- DO NOT use generic, thin-line icon libraries like "Lucide", "Feather", or standard "Heroicons".
|
||||
- DO NOT use Tailwind's default heavy drop shadows (e.g., `shadow-md`, `shadow-lg`, `shadow-xl`). Shadows must be practically non-existent or heavily customized to be ultra-diffuse and low opacity (< 0.05).
|
||||
- DO NOT use primary colored backgrounds for large elements or sections (e.g., no bright blue, green, or red hero sections).
|
||||
- DO NOT use gradients, neon colors, or 3D glassmorphism (beyond subtle navbar blurs).
|
||||
- DO NOT use `rounded-full` (pill shapes) for large containers, cards, or primary buttons.
|
||||
- DO NOT use emojis anywhere in code, markup, text content, headings, or alt text. Replace with proper icons or clean SVG primitives.
|
||||
- DO NOT use generic placeholder names like "John Doe", "Acme Corp", or "Lorem Ipsum". Use realistic, contextual content.
|
||||
- DO NOT use AI copywriting clichés: "Elevate", "Seamless", "Unleash", "Next-Gen", "Game-changer", "Delve". Write plain, specific language.
|
||||
|
||||
## 3. Typographic Architecture
|
||||
The interface must rely on extreme typographic contrast and premium font selection to establish an editorial feel.
|
||||
- Primary Sans-Serif (Body, UI, Buttons): Use clean, geometric, or system-native fonts with character. Target: `font-family: 'SF Pro Display', 'Geist Sans', 'Helvetica Neue', 'Switzer', sans-serif`.
|
||||
- Editorial Serif (Hero Headings & Quotes): Target: `font-family: 'Lyon Text', 'Newsreader', 'Playfair Display', 'Instrument Serif', serif`. Apply tight tracking (`letter-spacing: -0.02em` to `-0.04em`) and tight line-height (`1.1`).
|
||||
- Monospace (Code, Keystrokes, Meta-data): Target: `font-family: 'Geist Mono', 'SF Mono', 'JetBrains Mono', monospace`.
|
||||
- Text Colors: Body text must never be absolute black (`#000000`). Use off-black/charcoal (`#111111` or `#2F3437`) with a generous `line-height` of `1.6` for legibility. Secondary text should be muted gray (`#787774`).
|
||||
|
||||
## 4. Color Palette (Warm Monochrome + Spot Pastels)
|
||||
Color is a scarce resource, utilized only for semantic meaning or subtle accents.
|
||||
- Canvas / Background: Pure White `#FFFFFF` or Warm Bone/Off-White `#F7F6F3` / `#FBFBFA`.
|
||||
- Primary Surface (Cards): `#FFFFFF` or `#F9F9F8`.
|
||||
- Structural Borders / Dividers: Ultra-light gray `#EAEAEA` or `rgba(0,0,0,0.06)`.
|
||||
- Accent Colors: Exclusively use highly desaturated, washed-out pastels for tags, inline code backgrounds, or subtle icon backgrounds.
|
||||
- Pale Red: `#FDEBEC` (Text: `#9F2F2D`)
|
||||
- Pale Blue: `#E1F3FE` (Text: `#1F6C9F`)
|
||||
- Pale Green: `#EDF3EC` (Text: `#346538`)
|
||||
- Pale Yellow: `#FBF3DB` (Text: `#956400`)
|
||||
|
||||
## 5. Component Specifications
|
||||
- Bento Box Feature Grids:
|
||||
- Utilize asymmetrical CSS Grid layouts.
|
||||
- Cards must have exactly `border: 1px solid #EAEAEA`.
|
||||
- Border-radius must be crisp: `8px` or `12px` maximum.
|
||||
- Internal padding must be generous (e.g., `24px` to `40px`).
|
||||
- Primary Call-To-Action (Buttons):
|
||||
- Solid background `#111111`, text `#FFFFFF`.
|
||||
- Slight border-radius (`4px` to `6px`). No box-shadow.
|
||||
- Hover state should be a subtle color shift to `#333333` or a micro-scale `transform: scale(0.98)`.
|
||||
- Tags & Status Badges:
|
||||
- Pill-shaped (`border-radius: 9999px`), very small typography (`text-xs`), uppercase with wide tracking (`letter-spacing: 0.05em`).
|
||||
- Background must use the defined Muted Pastels.
|
||||
- Accordions (FAQ):
|
||||
- Strip all container boxes. Separate items only with a `border-bottom: 1px solid #EAEAEA`.
|
||||
- Use a clean, sharp `+` and `-` icon for the toggle state.
|
||||
- Keystroke Micro-UIs:
|
||||
- Render shortcuts as physical keys using `<kbd>` tags: `border: 1px solid #EAEAEA`, `border-radius: 4px`, `background: #F7F6F3`, using the Monospace font.
|
||||
- Faux-OS Window Chrome:
|
||||
- When mocking up software, wrap it in a minimalist container with a white top bar containing three small, light gray circles (replicating macOS window controls).
|
||||
|
||||
## 6. Iconography & Imagery Directives
|
||||
- System Icons: Use "Phosphor Icons (Bold or Fill weights)" or "Radix UI Icons" for a technical, slightly thicker-stroke aesthetic. Standardize stroke width across all icons.
|
||||
- Illustrations: Monochromatic, rough continuous-line ink sketches on a white background, featuring a single offset geometric shape filled with a muted pastel color.
|
||||
- Photography: Use high-quality, desaturated images with a warm tone. Apply subtle overlays (`opacity: 0.04` warm grain) to blend photos into the monochrome palette. Never use oversaturated stock photos. Use reliable placeholders like `https://picsum.photos/seed/{context}/1200/800` when real assets are unavailable.
|
||||
- Hero & Section Backgrounds: Sections should not feel empty and flat. Use subtle full-width background imagery at very low opacity, soft radial light spots (`radial-gradient` with warm tones at `opacity: 0.03`), or minimal geometric line patterns to add depth without breaking the clean aesthetic.
|
||||
|
||||
## 7. Subtle Motion & Micro-Animations
|
||||
Motion should feel invisible — present but never distracting. The goal is quiet sophistication, not spectacle.
|
||||
- Scroll Entry: Elements fade in gently as they enter the viewport. Use `translateY(12px)` + `opacity: 0` resolving over `600ms` with `cubic-bezier(0.16, 1, 0.3, 1)`. Use `IntersectionObserver`, never `window.addEventListener('scroll')`.
|
||||
- Hover States: Cards lift with an ultra-subtle shadow shift (`box-shadow` transitioning from `0 0 0` to `0 2px 8px rgba(0,0,0,0.04)` over `200ms`). Buttons respond with `scale(0.98)` on `:active`.
|
||||
- Staggered Reveals: Lists and grid items enter with a cascade delay (`animation-delay: calc(var(--index) * 80ms)`). Never mount everything at once.
|
||||
- Background Ambient Motion: Optional. A single, very slow-moving radial gradient blob (`animation-duration: 20s+`, `opacity: 0.02-0.04`) drifting behind hero sections. Must be applied to a `position: fixed; pointer-events: none` layer. Never on scrolling containers.
|
||||
- Performance: Animate exclusively via `transform` and `opacity`. No layout-triggering properties (`top`, `left`, `width`, `height`). Use `will-change: transform` sparingly and only on actively animating elements.
|
||||
|
||||
## 8. Execution Protocol
|
||||
When tasked with writing frontend code (HTML, React, Tailwind, Vue) or designing a layout:
|
||||
1. Establish the macro-whitespace first. Use massive vertical padding between sections (e.g., `py-24` or `py-32` in Tailwind).
|
||||
2. Constrain the main typography content width to `max-w-4xl` or `max-w-5xl`.
|
||||
3. Apply the custom typographic hierarchy and monochromatic color variables immediately.
|
||||
4. Ensure every card, divider, and border adheres strictly to the `1px solid #EAEAEA` rule.
|
||||
5. Add scroll-entry animations to all major content blocks.
|
||||
6. Ensure sections have visual depth through imagery, ambient gradients, or subtle textures — no empty flat backgrounds.
|
||||
7. Provide code that reflects this high-end, uncluttered, editorial aesthetic natively without requiring manual adjustments.
|
||||
Reference in New Issue
Block a user