スキル一覧に戻る
krwhynot

ui-ux-design-principles

by krwhynot

1🍴 0📅 2026年1月21日
GitHubで見るManusで実行

SKILL.md


name: ui-ux-design-principles description: Use when designing UI, auditing UI/UX, choosing colors, implementing buttons/forms, or making layout decisions. Covers WCAG 2.1 AA form accessibility (aria-invalid, role="alert", aria-describedby, focus management), UX laws (Fitts, Hick, Jakob), color theory (60-30-10), touch targets (44px). Prevents hardcoded hex, accessibility violations, missing ARIA attributes.

UI/UX Design Principles

Overview

Systematic framework for making UI/UX decisions grounded in cognitive science and user experience laws. This skill provides universal principles that apply to any project, with project-specific implementation details in resource files.

Core Mission: Design experiences that are fast under pressure, effortless under fatigue, predictable by pattern, and emotionally confident.

The Sienna Protocol

Every UI/UX decision follows this structured approach:

1. Cognitive Audit (Before Design)

Identify context and friction:

  • Who: User role, expertise level, frequency of use
  • Where: Device (desktop/tablet/mobile), environment (office/field/dim lighting)
  • What: Task goals, current pain points, cognitive load
  • Which laws: Identify violated UX principles (see table below)

2. Strategy Selection

StrategyFocusBest For
A - Familiar EfficiencyLow learning curve, speedPower users, CRM/Excel veterans
B - Progressive ClarityReduced cognitive loadNew users, complex onboarding
C - Hybrid Field ResilienceHigh contrast, large targets, feedback-richField use, tablets, challenging environments
D - Behavioral MomentumHabit loops, emotional reinforcementRepetitive workflows, gamification

Default recommendation: Strategy C (Hybrid Field Resilience) balances accessibility, speed, and adaptability.

3. Decision Matrix Evaluation

Score each criterion (1-5), multiply by weight:

CriterionWeightTargetQuick Check
Usability×3≥4Can complete task without training?
Speed×3≥4Task time acceptable?
Accessibility×3≥4Touch ≥44px? Contrast ≥4.5:1?
Familiarity×2≥4Follows platform conventions?
Cognitive Load×2≥4≤7 visible choices?
Visual Clarity×2≥4Clear hierarchy?
Feedback×2≥4Response <400ms?
Adaptability×2≥4Works across devices?

Redesign triggers:

  • Accessibility < 4 → WCAG blocker
  • Usability < 3 → Users can't complete tasks
  • Speed < 3 → Workflow unacceptably slow
  • 3+ criteria < 4 → Review against UX Laws

4. Implementation Spec

Output concrete, actionable code with:

  • Exact CSS/Tailwind classes
  • ARIA attributes for accessibility
  • Responsive breakpoints
  • Feedback patterns (loading states, success confirmation)

UX Laws Reference

Interaction Laws

LawPrincipleImplementation
Jakob's LawUsers spend most time on OTHER sites; expect familiar patternsUse standard nav positions, button styles, form layouts
Hick's LawDecision time increases with choicesLimit visible options to 5-7; use progressive disclosure
Fitts's LawLarger + closer targets = faster/easier to hitMin 44px touch targets; important actions largest
Tesler's LawComplexity can't be eliminated, only movedPush complexity to system logic, not user workflows
Miller's LawWorking memory holds ~7 itemsChunk information; avoid forcing mental juggling
Doherty Threshold<400ms response maintains flow stateShow immediate feedback; use optimistic updates

Visual & Cognitive Laws

LawPrincipleImplementation
Aesthetic-UsabilityBeautiful interfaces seem easier to useConsistent styling increases perceived reliability
Peak-End RuleUsers remember most intense moment + endingEnd flows with clear confirmation, positive closure
Von Restorff EffectDifferent items stand outUse accent colors sparingly for CTAs
Serial Position EffectFirst and last items remembered bestPut key actions at start/end of lists
Gestalt: ProximityClose items appear groupedUse spacing to show relationships
Gestalt: SimilaritySimilar items appear relatedConsistent button styles, text treatments
Gestalt: ContinuityEye follows smooth pathsAlign elements; guide natural reading flow

Code Patterns for UX Laws

// Fitts's Law: Large touch target (44px minimum)
<Button className="h-11 min-w-[44px] px-4">
  Save
</Button>

// Hick's Law: Progressive disclosure
<Accordion>
  <AccordionItem value="advanced">
    <AccordionTrigger>Advanced Options</AccordionTrigger>
    <AccordionContent>
      {/* Hidden until explicitly requested */}
    </AccordionContent>
  </AccordionItem>
</Accordion>

// Doherty Threshold: Immediate feedback
<Button onClick={async () => {
  toast.loading("Saving...");  // Instant feedback (<100ms)
  await save();
  toast.success("Saved!");     // Closure (Peak-End)
}}>
  Save
</Button>

// Miller's Law: Chunked information
<Tabs defaultValue="basics">
  <TabsList>
    <TabsTrigger value="basics">Basics</TabsTrigger>
    <TabsTrigger value="details">Details</TabsTrigger>
    <TabsTrigger value="advanced">Advanced</TabsTrigger>
  </TabsList>
  {/* Max 5-7 fields per tab */}
</Tabs>

Accessibility Non-Negotiables

These are blockers - no exceptions:

RequirementStandardImplementation
Touch targets44×44px minimumh-11 w-11 or min-h-[44px] min-w-[44px]
Color contrastWCAG AA (4.5:1 text)Use semantic colors, never pure gray on white
Semantic HTMLNative elements<button> not <div onClick>
LabelsAll inputs labeledVisible label or aria-label / sr-only
Keyboard navFull functionalityTab order logical, Enter/Space work
Focus visibleClear indicator:focus-visible with visible ring
MotionRespect preferencesprefers-reduced-motion support

ARIA Patterns

// Dialog/Modal
<div role="dialog" aria-modal="true" aria-labelledby="dialog-title">
  <h2 id="dialog-title">Edit Contact</h2>
  {/* Focus trap required */}
</div>

// Live regions for updates
<div aria-live="polite" aria-atomic="true">
  {statusMessage}
</div>

// Form errors (basic)
<input aria-invalid={hasError} aria-describedby="error-msg" />
<span id="error-msg" role="alert">{errorText}</span>

Form Accessibility Patterns (WCAG 2.1 AA)

Required for ALL form inputs:

// ✅ CORRECT: Accessible form field with React Hook Form
function AccessibleInput({ name, label, errors, register }) {
  const hasError = !!errors[name];
  const errorId = `${name}-error`;

  return (
    <div>
      {/* 1. Visible label with htmlFor */}
      <label htmlFor={name}>{label}</label>

      {/* 2. Input with ARIA attributes */}
      <input
        id={name}
        aria-invalid={hasError ? 'true' : 'false'}
        aria-describedby={hasError ? errorId : undefined}
        {...register(name)}
      />

      {/* 3. Error with role="alert" for screen readers */}
      {hasError && (
        <span id={errorId} role="alert" className="text-destructive">
          {errors[name]?.message}
        </span>
      )}
    </div>
  );
}

// ❌ WRONG: Inaccessible form field
<input {...register('email')} />
{errors.email && <span>{errors.email.message}</span>}
// Missing: label, aria-invalid, aria-describedby, role="alert"

Form Accessibility Checklist:

RequirementImplementationScreen Reader Behavior
Label association<label htmlFor={id}>"Email, edit text"
Invalid statearia-invalid="true""Invalid entry" announced
Error descriptionaria-describedby={errorId}Error message read with field
Error announcementrole="alert"Immediate announcement on error
Required indicationaria-required="true""Required" announced

Focus Management on Validation Failure:

// ✅ CORRECT: Focus first invalid field after submit
const { handleSubmit, setFocus } = useForm();

const onSubmit = handleSubmit(
  (data) => { /* success */ },
  (errors) => {
    // Focus first errored field
    const firstError = Object.keys(errors)[0];
    if (firstError) setFocus(firstError);
  }
);

Live Validation Feedback:

// ✅ CORRECT: Live region for validation status
<div aria-live="polite" aria-atomic="true" className="sr-only">
  {isSubmitting && "Validating form..."}
  {isSubmitSuccessful && "Form submitted successfully"}
  {Object.keys(errors).length > 0 &&
    `Form has ${Object.keys(errors).length} errors`}
</div>

Color System Principles

The 60-30-10 Rule

RolePercentageUsage
Dominant (60%)Background, large surfacesbg-background, bg-card
Secondary (30%)Supporting elements, sectionsbg-muted, border-border
Accent (10%)CTAs, highlights, focus statesbg-primary, text-primary

Semantic Color Categories

CategoryPurposeExamples
BrandIdentity, primary actionsPrimary button, logo, key CTAs
NeutralText, backgrounds, bordersBody text, cards, dividers
StatusFeedback statesSuccess (green), Warning (amber), Error (red), Info (blue)
InteractiveHover, focus, active statesButton hover, focus rings, selected items

Color Anti-Patterns

ProblemWhy It FailsFix
Hardcoded hex valuesBypasses design systemUse semantic tokens
Pure black #000Too harsh, poor readabilityUse slate-900 or similar
Pure white #FFFGlare, accessibility issuesUse slate-50 or warm white
Too many accent colorsCognitive overload, no hierarchyMax 2 accent colors
Color-only meaningFails colorblind usersAdd icons, text, patterns

Response Format

When answering UI/UX questions, structure responses as:

1) Cognitive Audit (2-4 sentences)

  • Context: role, device, environment
  • Friction points identified
  • UX laws at stake

2) Strategy Recommendation

  • Choose A/B/C/D with rationale
  • Brief pros/cons

3) Implementation Spec

  • Concrete code/CSS
  • ARIA attributes
  • Responsive considerations
  • Feedback patterns

Example:

Audit: Field sales rep on iPad in warehouse (dim lighting, possible gloves). Current filter panel has 15 visible options (Hick's Law violation) with 38px buttons (Fitts's Law violation).

Strategy: C - Hybrid Field Resilience. High contrast, large targets essential for environment.

Implementation:

<FilterPanel className="bg-card p-4">
  {/* Grouped to reduce visible choices */}
  <FilterGroup label="Status">
    <FilterButton className="h-11 min-w-[44px] text-base">
      Active
    </FilterButton>
  </FilterGroup>
</FilterPanel>

Quick Checklists

Pre-Design Checklist

  • Identified user context (who, where, what device)
  • Listed UX laws that apply
  • Chosen strategy (A/B/C/D)
  • Mapped colors to semantic tokens

Pre-Commit Checklist

  • Touch targets ≥ 44px on ALL screen sizes
  • No hardcoded colors (hex, rgb, hsl)
  • ARIA labels on interactive elements
  • Keyboard navigation works
  • Feedback on all actions (<400ms)
  • Tested on primary target device

Form-Specific Accessibility Checklist

  • All inputs have associated <label htmlFor={id}>
  • Invalid fields have aria-invalid="true"
  • Error messages have role="alert"
  • Errors linked via aria-describedby
  • Required fields have aria-required="true"
  • Focus moves to first error on submit failure
  • Live region announces validation status

Optimization Triggers

TriggerProblemAction
PerformanceFeedback >400msAdd skeleton/shimmer loader
VisualContrast <4.5:1Use semantic colors with higher contrast
ErgonomicTargets <44pxIncrease padding/hit area
Cognitive>7 visible choicesProgressive disclosure, grouping
FeedbackMissing statesAdd loading, success, error states
EmotionalAbrupt flow endingsAdd microcopy, confirmation

Resource Files

Universal Principles

Project-Specific Implementation


Core Beliefs

  • Design is a system, not an aesthetic
  • Every pixel must serve cognition or confidence
  • Accessibility and speed are fundamentals, not features
  • We don't redesign for beauty; we redesign for measurable improvement
  • Familiarity reduces friction; innovation must earn its cost

Cross-Reference

See also: engineering-constitution skill for:

  • Error handling patterns
  • Validation (Zod schemas)
  • Form state management
  • Testing patterns

スコア

総合スコア

50/100

リポジトリの品質指標に基づく評価

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

0/10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新がある

0/10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

0/5

レビュー

💬

レビュー機能は近日公開予定です