[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7D88NG8H2YN5XDJ5N4YEC42":3,"skill-same:01M7D88NG8H2YN5XDJ5N4YEC42":78},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":56,"commitSha":57,"skillDirectory":58,"forksCount":14,"repositoryHtmlUrl":59,"repositoryHomepageUrl":6,"ownerHtmlUrl":60,"ownerBlogUrl":61,"ownerDescription":62,"updatedAt":63,"install":64,"resources":77},"01M7D88NG8H2YN5XDJ5N4YEC42","Cognitive Load Analyzer",null,"Evaluate interface complexity by measuring information density, decision points, visual hierarchy, and task completion paths to reduce user cognitive burden.","GrupoANDevelopment-m\u002Falberto-ai","GrupoANDevelopment-m","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F257455179?v=4","01M7D69X2N2KEVN0SJF6WGM6SH","Antônio  Ndombe","01M7D69X3P5JTT8H8S904N3888",0,"MIT","https:\u002F\u002Fgithub.com\u002FGrupoANDevelopment-m\u002Falberto-ai\u002Fblob\u002Fmain\u002Fskills\u002Fqa\u002Fcognitive-load-analyzer\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: Cognitive Load Analyzer\ndescription: Evaluate interface complexity by measuring information density, decision points, visual hierarchy, and task completion paths to reduce user cognitive burden.\nversion: 1.0.0\nauthor: Pramod\nlicense: MIT\ntags: [cognitive-load, ux, information-architecture, complexity, usability, heuristics]\ntestingTypes: [e2e, accessibility]\nframeworks: [playwright]\nlanguages: [typescript, javascript]\ndomains: [web]\nagents: [claude-code, cursor, github-copilot, windsurf, codex, aider, continue, cline, zed, bolt, gemini-cli, amp]\n---\n\n# Cognitive Load Analyzer Skill\n\nYou are an expert QA engineer specializing in cognitive load assessment, usability heuristic evaluation, and information architecture analysis. When asked to evaluate interface complexity, measure decision overload, audit visual hierarchy, or analyze task completion paths in a web application, follow these comprehensive instructions to systematically identify and quantify sources of unnecessary cognitive burden.\n\n## Core Principles\n\n1. **Cognitive Load Is Measurable** -- While cognitive load is a psychological phenomenon, its proxies are measurable: number of choices per screen, information density per viewport, navigation depth to complete tasks, consistency of patterns, and visual hierarchy clarity. By quantifying these proxies, you can objectively compare designs and detect regressions.\n\n2. **Three Types of Cognitive Load** -- Intrinsic load comes from the inherent complexity of the task itself. Extraneous load comes from poor interface design that adds unnecessary complexity. Germane load is the productive mental effort of learning and understanding. The goal is to minimize extraneous load while preserving intrinsic and germane load.\n\n3. **Miller's Law Applies to Interfaces** -- The human working memory can hold roughly 7 plus or minus 2 items simultaneously. Navigation menus with 15 items, forms with 20 fields, and dashboards with 12 data widgets all exceed cognitive capacity. Chunk information into groups of 5-7 items maximum.\n\n4. **Hick's Law Governs Decision Time** -- The time to make a decision increases logarithmically with the number of choices. A page with 3 clear options is cognitively easy. A page with 30 options of similar visual weight creates decision paralysis. Reduce choices or create clear visual hierarchy to guide attention.\n\n5. **Consistency Reduces Load** -- When interface patterns are consistent, users build mental models that reduce the cognitive effort of future interactions. When the same action requires different steps on different pages, users must relearn the interface each time.\n\n6. **Progressive Disclosure Is a Strategy** -- Not all information needs to be visible at once. Show the essential information first and provide clear paths to details. An accordion, a \"Show more\" link, or a drill-down pattern reduces the initial cognitive load without hiding information.\n\n7. **Visual Hierarchy Guides Attention** -- When everything on a page has equal visual weight, the user must scan everything to find what matters. Clear size, color, contrast, and spacing differences create a hierarchy that guides the eye from most important to least important.\n\n## Project Structure\n\nOrganize your cognitive load analysis suite with this directory structure:\n\n```\ntests\u002F\n  cognitive-load\u002F\n    information-density.spec.ts\n    choice-overload.spec.ts\n    navigation-complexity.spec.ts\n    form-complexity.spec.ts\n    visual-hierarchy.spec.ts\n    consistency-audit.spec.ts\n    task-completion-paths.spec.ts\n  fixtures\u002F\n    cognitive-page.fixture.ts\n  helpers\u002F\n    density-calculator.ts\n    choice-counter.ts\n    hierarchy-analyzer.ts\n    consistency-checker.ts\n    task-path-tracer.ts\n    cognitive-score.ts\n  reports\u002F\n    cognitive-load-report.json\n    cognitive-load-report.html\n  thresholds\u002F\n    cognitive-thresholds.json\nplaywright.config.ts\n```\n\nEach spec file measures a different dimension of cognitive load. The helpers directory contains the measurement algorithms. Thresholds define the acceptable limits for each metric.\n\n## Detailed Guide\n\n### Step 1: Build an Information Density Calculator\n\nInformation density measures how much content is presented per unit of viewport area. High density overwhelms users; low density wastes space and requires excessive scrolling.\n\n```typescript\n\u002F\u002F helpers\u002Fdensity-calculator.ts\nimport { Page } from '@playwright\u002Ftest';\n\nexport interface DensityMetrics {\n  totalTextElements: number;\n  totalWordCount: number;\n  totalInteractiveElements: number;\n  totalImages: number;\n  viewportArea: number;\n  visibleContentArea: number;\n  textDensity: number;          \u002F\u002F words per 1000px of viewport height\n  interactiveDensity: number;   \u002F\u002F interactive elements per viewport\n  informationUnits: number;     \u002F\u002F distinct information groups\n  densityScore: number;         \u002F\u002F 0-100 composite score\n}\n\nexport class DensityCalculator {\n  async calculate(page: Page): Promise\u003CDensityMetrics> {\n    const viewport = page.viewportSize();\n    if (!viewport) throw new Error('No viewport size available');\n\n    const viewportArea = viewport.width * viewport.height;\n\n    const measurements = await page.evaluate(() => {\n      \u002F\u002F Count visible text elements\n      const textSelectors = 'p, h1, h2, h3, h4, h5, h6, span, li, td, th, label, a, button';\n      const textElements = document.querySelectorAll(textSelectors);\n      let totalWords = 0;\n      let visibleTextElements = 0;\n\n      textElements.forEach((el) => {\n        const style = window.getComputedStyle(el);\n        if (style.display !== 'none' && style.visibility !== 'hidden' && style.opacity !== '0') {\n          const text = el.textContent?.trim();\n          if (text && text.length > 0) {\n            visibleTextElements++;\n            totalWords += text.split(\u002F\\s+\u002F).filter((w) => w.length > 0).length;\n          }\n        }\n      });\n\n      \u002F\u002F Count interactive elements visible in the viewport\n      const interactiveSelectors = [\n        'a[href]', 'button', 'input', 'select', 'textarea',\n        '[role=\"button\"]', '[role=\"link\"]', '[role=\"tab\"]',\n        '[role=\"menuitem\"]', '[onclick]', '[tabindex]:not([tabindex=\"-1\"])',\n      ];\n      const interactiveElements = document.querySelectorAll(interactiveSelectors.join(', '));\n      let visibleInteractive = 0;\n      interactiveElements.forEach((el) => {\n        const rect = el.getBoundingClientRect();\n        if (rect.width > 0 && rect.height > 0 && rect.top \u003C window.innerHeight && rect.bottom > 0) {\n          visibleInteractive++;\n        }\n      });\n\n      \u002F\u002F Count images in viewport\n      const images = document.querySelectorAll('img, svg, [role=\"img\"]');\n      let visibleImages = 0;\n      images.forEach((el) => {\n        const rect = el.getBoundingClientRect();\n        if (rect.width > 0 && rect.height > 0 && rect.top \u003C window.innerHeight) {\n          visibleImages++;\n        }\n      });\n\n      \u002F\u002F Calculate visible content area\n      const bodyRect = document.body.getBoundingClientRect();\n      const visibleContentArea = Math.min(bodyRect.height, window.innerHeight) * bodyRect.width;\n\n      \u002F\u002F Count distinct information groups (sections, cards, panels)\n      const groupSelectors = 'section, article, .card, .panel, [role=\"region\"], [role=\"group\"], fieldset';\n      const groups = document.querySelectorAll(groupSelectors);\n      let visibleGroups = 0;\n      groups.forEach((el) => {\n        const rect = el.getBoundingClientRect();\n        if (rect.width > 0 && rect.height > 0 && rect.top \u003C window.innerHeight) {\n          visibleGroups++;\n        }\n      });\n\n      return {\n        visibleTextElements,\n        totalWords,\n        visibleInteractive,\n        visibleImages,\n        visibleContentArea,\n        visibleGroups,\n      };\n    });\n\n    const viewportHeightK = viewport.height \u002F 1000;\n    const textDensity = measurements.totalWords \u002F viewportHeightK;\n    const interactiveDensity = measurements.visibleInteractive;\n\n    \u002F\u002F Composite density score (0-100, lower is less dense)\n    let densityScore = 50;\n    if (textDensity > 500) densityScore += 15;\n    if (textDensity > 800) densityScore += 15;\n    if (textDensity \u003C 100) densityScore -= 10;\n    if (interactiveDensity > 20) densityScore += 10;\n    if (interactiveDensity > 40) densityScore += 10;\n    if (measurements.visibleGroups > 8) densityScore += 10;\n    densityScore = Math.max(0, Math.min(100, densityScore));\n\n    return {\n      totalTextElements: measurements.visibleTextElements,\n      totalWordCount: measurements.totalWords,\n      totalInteractiveElements: measurements.visibleInteractive,\n      totalImages: measurements.visibleImages,\n      viewportArea,\n      visibleContentArea: measurements.visibleContentArea,\n      textDensity,\n      interactiveDensity,\n      informationUnits: measurements.visibleGroups,\n      densityScore,\n    };\n  }\n}\n```\n\n### Step 2: Build a Choice Overload Counter\n\nChoice overload occurs when users face too many options of similar visual weight, causing decision paralysis.\n\n```typescript\n\u002F\u002F helpers\u002Fchoice-counter.ts\nimport { Page } from '@playwright\u002Ftest';\n\nexport interface ChoiceMetrics {\n  navigationItemCount: number;\n  formFieldCount: number;\n  callToActionCount: number;\n  filterOptionCount: number;\n  tabCount: number;\n  cardChoiceCount: number;\n  totalDecisionPoints: number;\n  choiceOverloadScore: number;  \u002F\u002F 0-100, higher = more overload\n  issues: string[];\n}\n\nexport class ChoiceCounter {\n  async count(page: Page): Promise\u003CChoiceMetrics> {\n    const metrics = await page.evaluate(() => {\n      const issues: string[] = [];\n\n      \u002F\u002F Count top-level navigation items\n      const navItems = document.querySelectorAll(\n        'nav a, nav button, [role=\"navigation\"] a, [role=\"navigation\"] button'\n      );\n      const visibleNavItems = Array.from(navItems).filter((el) => {\n        const rect = el.getBoundingClientRect();\n        return rect.width > 0 && rect.height > 0;\n      });\n      const navigationItemCount = visibleNavItems.length;\n      if (navigationItemCount > 7) {\n        issues.push(`Navigation has ${navigationItemCount} items (recommended: 5-7)`);\n      }\n\n      \u002F\u002F Count visible form fields\n      const formFields = document.querySelectorAll(\n        'input:not([type=\"hidden\"]), select, textarea, [role=\"combobox\"]'\n      );\n      const visibleFormFields = Array.from(formFields).filter((el) => {\n        const rect = el.getBoundingClientRect();\n        return rect.width > 0 && rect.height > 0 && rect.top \u003C window.innerHeight;\n      });\n      const formFieldCount = visibleFormFields.length;\n      if (formFieldCount > 7) {\n        issues.push(`${formFieldCount} form fields visible (recommended: 3-5 per step)`);\n      }\n\n      \u002F\u002F Count call-to-action buttons\n      const ctaButtons = document.querySelectorAll(\n        'button[type=\"submit\"], .btn-primary, .cta, [data-testid*=\"cta\"]'\n      );\n      const visibleCTAs = Array.from(ctaButtons).filter((el) => {\n        const rect = el.getBoundingClientRect();\n        return rect.width > 0 && rect.height > 0 && rect.top \u003C window.innerHeight;\n      });\n      const callToActionCount = visibleCTAs.length;\n      if (callToActionCount > 2) {\n        issues.push(`${callToActionCount} CTAs competing for attention (recommended: 1-2)`);\n      }\n\n      \u002F\u002F Count filter options\n      const filterElements = document.querySelectorAll(\n        '[data-testid*=\"filter\"], .filter-option, .facet'\n      );\n      const filterOptionCount = filterElements.length;\n      if (filterOptionCount > 10) {\n        issues.push(`${filterOptionCount} filter options visible (use progressive disclosure)`);\n      }\n\n      \u002F\u002F Count tabs\n      const tabs = document.querySelectorAll('[role=\"tab\"], .tab, .nav-tab');\n      const tabCount = tabs.length;\n      if (tabCount > 6) {\n        issues.push(`${tabCount} tabs visible (recommended: 4-6, use overflow for more)`);\n      }\n\n      \u002F\u002F Count choice cards in viewport\n      const cards = document.querySelectorAll('.card, article, .product-card, .pricing-card');\n      const visibleCards = Array.from(cards).filter((el) => {\n        const rect = el.getBoundingClientRect();\n        return rect.width > 0 && rect.height > 0 && rect.top \u003C window.innerHeight;\n      });\n      const cardChoiceCount = visibleCards.length;\n      if (cardChoiceCount > 9) {\n        issues.push(`${cardChoiceCount} choice cards in viewport (recommended: 6-9)`);\n      }\n\n      return {\n        navigationItemCount,\n        formFieldCount,\n        callToActionCount,\n        filterOptionCount,\n        tabCount,\n        cardChoiceCount,\n        issues,\n      };\n    });\n\n    const totalDecisionPoints =\n      metrics.navigationItemCount +\n      metrics.formFieldCount +\n      metrics.callToActionCount +\n      metrics.tabCount +\n      metrics.cardChoiceCount;\n\n    let overloadScore = 0;\n    if (totalDecisionPoints > 10) overloadScore += 15;\n    if (totalDecisionPoints > 20) overloadScore += 15;\n    if (totalDecisionPoints > 30) overloadScore += 20;\n    if (metrics.navigationItemCount > 7) overloadScore += 10;\n    if (metrics.formFieldCount > 7) overloadScore += 10;\n    if (metrics.callToActionCount > 2) overloadScore += 10;\n    if (metrics.cardChoiceCount > 9) overloadScore += 10;\n    if (metrics.tabCount > 6) overloadScore += 10;\n    overloadScore = Math.min(100, overloadScore);\n\n    return {\n      ...metrics,\n      totalDecisionPoints,\n      choiceOverloadScore: overloadScore,\n    };\n  }\n}\n```\n\n### Step 3: Build a Visual Hierarchy Analyzer\n\nVisual hierarchy determines the order in which users process page information. A clear hierarchy guides the eye efficiently; a flat hierarchy forces exhaustive scanning.\n\n```typescript\n\u002F\u002F helpers\u002Fhierarchy-analyzer.ts\nimport { Page } from '@playwright\u002Ftest';\n\nexport interface HierarchyMetrics {\n  headingLevels: Array\u003C{ level: number; count: number; text: string[] }>;\n  headingHierarchyValid: boolean;\n  fontSizeVariations: number;\n  whitespaceRatio: number;\n  primaryActionClear: boolean;\n  visualWeightDistribution: 'balanced' | 'top-heavy' | 'flat' | 'clear-hierarchy';\n  hierarchyScore: number;  \u002F\u002F 0-100, higher is better\n  issues: string[];\n}\n\nexport class HierarchyAnalyzer {\n  async analyze(page: Page): Promise\u003CHierarchyMetrics> {\n    const data = await page.evaluate(() => {\n      const issues: string[] = [];\n\n      \u002F\u002F Analyze heading hierarchy\n      const headings = document.querySelectorAll('h1, h2, h3, h4, h5, h6');\n      const levelMap = new Map\u003Cnumber, string[]>();\n      headings.forEach((h) => {\n        const level = parseInt(h.tagName.charAt(1));\n        if (!levelMap.has(level)) levelMap.set(level, []);\n        levelMap.get(level)?.push(h.textContent?.trim().substring(0, 50) || '');\n      });\n\n      const headingLevels = Array.from(levelMap.entries()).map(([level, texts]) => ({\n        level,\n        count: texts.length,\n        text: texts,\n      }));\n\n      \u002F\u002F Check for skipped heading levels\n      const sortedLevels = Array.from(levelMap.keys()).sort();\n      let hierarchyValid = true;\n      for (let i = 1; i \u003C sortedLevels.length; i++) {\n        if (sortedLevels[i] - sortedLevels[i - 1] > 1) {\n          hierarchyValid = false;\n          issues.push(`Heading hierarchy skips from h${sortedLevels[i - 1]} to h${sortedLevels[i]}`);\n        }\n      }\n\n      const h1Count = levelMap.get(1)?.length || 0;\n      if (h1Count === 0) {\n        issues.push('Page has no h1 heading');\n        hierarchyValid = false;\n      }\n      if (h1Count > 1) {\n        issues.push(`Page has ${h1Count} h1 headings (recommended: exactly 1)`);\n      }\n\n      \u002F\u002F Count distinct font sizes\n      const allElements = document.querySelectorAll('body *');\n      const fontSizes = new Set\u003Cstring>();\n      allElements.forEach((el) => {\n        const style = window.getComputedStyle(el);\n        if (style.display !== 'none' && el.textContent?.trim()) {\n          fontSizes.add(style.fontSize);\n        }\n      });\n      const fontSizeVariations = fontSizes.size;\n      if (fontSizeVariations > 8) {\n        issues.push(`${fontSizeVariations} distinct font sizes (recommended: 4-6)`);\n      }\n\n      \u002F\u002F Calculate whitespace ratio\n      const bodyRect = document.body.getBoundingClientRect();\n      const totalArea = bodyRect.width * Math.min(bodyRect.height, window.innerHeight);\n      let contentArea = 0;\n      const contentEls = document.querySelectorAll(\n        'p, h1, h2, h3, h4, h5, h6, img, button, input, select, textarea, table, ul, ol'\n      );\n      contentEls.forEach((el) => {\n        const rect = el.getBoundingClientRect();\n        if (rect.width > 0 && rect.height > 0 && rect.top \u003C window.innerHeight && rect.bottom > 0) {\n          contentArea += rect.width * rect.height;\n        }\n      });\n      const whitespaceRatio = totalArea > 0 ? 1 - contentArea \u002F totalArea : 0;\n      if (whitespaceRatio \u003C 0.2) {\n        issues.push(`Only ${(whitespaceRatio * 100).toFixed(0)}% whitespace (recommended: 30-50%)`);\n      }\n\n      \u002F\u002F Check primary CTA clarity\n      const primaryButtons = document.querySelectorAll(\n        'button[type=\"submit\"], .btn-primary, [data-testid*=\"primary\"]'\n      );\n      let primaryActionClear = false;\n      if (primaryButtons.length === 1) {\n        const style = window.getComputedStyle(primaryButtons[0]);\n        const bg = style.backgroundColor;\n        primaryActionClear =\n          bg !== 'rgba(0, 0, 0, 0)' && bg !== 'rgb(255, 255, 255)' && bg !== 'transparent';\n      }\n      if (primaryButtons.length > 1) {\n        issues.push(`${primaryButtons.length} primary CTAs compete for attention`);\n      }\n\n      return {\n        headingLevels,\n        headingHierarchyValid: hierarchyValid,\n        fontSizeVariations,\n        whitespaceRatio,\n        primaryActionClear,\n        issues,\n      };\n    });\n\n    let distribution: HierarchyMetrics['visualWeightDistribution'];\n    if (data.headingHierarchyValid && data.whitespaceRatio > 0.3 && data.fontSizeVariations \u003C= 6) {\n      distribution = 'clear-hierarchy';\n    } else if (data.fontSizeVariations \u003C= 3) {\n      distribution = 'flat';\n    } else if (data.whitespaceRatio \u003C 0.2) {\n      distribution = 'top-heavy';\n    } else {\n      distribution = 'balanced';\n    }\n\n    let score = 50;\n    if (data.headingHierarchyValid) score += 15;\n    if (data.primaryActionClear) score += 10;\n    if (data.whitespaceRatio >= 0.3 && data.whitespaceRatio \u003C= 0.5) score += 10;\n    if (data.fontSizeVariations >= 4 && data.fontSizeVariations \u003C= 6) score += 10;\n    if (data.fontSizeVariations > 8) score -= 10;\n    if (data.whitespaceRatio \u003C 0.2) score -= 15;\n    if (!data.headingHierarchyValid) score -= 10;\n    score = Math.max(0, Math.min(100, score));\n\n    return {\n      ...data,\n      visualWeightDistribution: distribution,\n      hierarchyScore: score,\n    };\n  }\n}\n```\n\n### Step 4: Build a Consistency Checker\n\nConsistency across pages reduces the cognitive cost of learning the interface.\n\n```typescript\n\u002F\u002F helpers\u002Fconsistency-checker.ts\nimport { Page } from '@playwright\u002Ftest';\n\nexport interface ConsistencyIssue {\n  category: 'naming' | 'layout' | 'interaction' | 'visual' | 'navigation';\n  description: string;\n  severity: 'high' | 'medium' | 'low';\n  pages: string[];\n  recommendation: string;\n}\n\nexport interface ConsistencyMetrics {\n  issues: ConsistencyIssue[];\n  consistencyScore: number;\n}\n\nexport class ConsistencyChecker {\n  private snapshots: Array\u003C{\n    url: string;\n    buttonLabels: string[];\n    navStructure: string[];\n    headingPattern: string[];\n    layoutPattern: string;\n  }> = [];\n\n  async captureSnapshot(page: Page): Promise\u003Cvoid> {\n    const snapshot = await page.evaluate(() => {\n      const buttons = document.querySelectorAll('button, [role=\"button\"]');\n      const buttonLabels = Array.from(buttons)\n        .map((b) => b.textContent?.trim())\n        .filter(Boolean) as string[];\n\n      const navLinks = document.querySelectorAll('nav a, [role=\"navigation\"] a');\n      const navStructure = Array.from(navLinks)\n        .map((a) => a.textContent?.trim())\n        .filter(Boolean) as string[];\n\n      const headings = document.querySelectorAll('h1, h2, h3');\n      const headingPattern = Array.from(headings).map(\n        (h) => `${h.tagName}:${h.textContent?.trim().substring(0, 30)}`\n      );\n\n      const mainContent = document.querySelector('main, [role=\"main\"]');\n      let layoutPattern = 'unknown';\n      if (mainContent) {\n        const style = window.getComputedStyle(mainContent);\n        if (style.display === 'grid') layoutPattern = 'grid';\n        else if (style.display === 'flex') layoutPattern = 'flex';\n        else layoutPattern = 'block';\n      }\n\n      return { buttonLabels, navStructure, headingPattern, layoutPattern };\n    });\n\n    this.snapshots.push({ url: page.url(), ...snapshot });\n  }\n\n  analyze(): ConsistencyMetrics {\n    const issues: ConsistencyIssue[] = [];\n\n    if (this.snapshots.length \u003C 2) {\n      return { issues, consistencyScore: 100 };\n    }\n\n    \u002F\u002F Check navigation consistency\n    const navStructures = this.snapshots.map((s) => JSON.stringify(s.navStructure));\n    if (new Set(navStructures).size > 1) {\n      issues.push({\n        category: 'navigation',\n        description: 'Navigation structure differs across pages',\n        severity: 'high',\n        pages: this.snapshots.map((s) => s.url),\n        recommendation: 'Use a consistent navigation component on all pages',\n      });\n    }\n\n    \u002F\u002F Check button label consistency for common actions\n    const allLabels = this.snapshots.flatMap((s) => s.buttonLabels);\n    const saveVariants = allLabels.filter((l) =>\n      \u002F^(save|submit|confirm|apply|done|ok|update)$\u002Fi.test(l)\n    );\n    const uniqueSaveLabels = new Set(saveVariants.map((l) => l.toLowerCase()));\n    if (uniqueSaveLabels.size > 2) {\n      issues.push({\n        category: 'naming',\n        description: `Multiple labels for save action: ${Array.from(uniqueSaveLabels).join(', ')}`,\n        severity: 'medium',\n        pages: this.snapshots.map((s) => s.url),\n        recommendation: 'Standardize on a single label for the primary save action',\n      });\n    }\n\n    const cancelVariants = allLabels.filter((l) =>\n      \u002F^(cancel|close|dismiss|back|discard)$\u002Fi.test(l)\n    );\n    const uniqueCancelLabels = new Set(cancelVariants.map((l) => l.toLowerCase()));\n    if (uniqueCancelLabels.size > 2) {\n      issues.push({\n        category: 'naming',\n        description: `Multiple labels for cancel action: ${Array.from(uniqueCancelLabels).join(', ')}`,\n        severity: 'medium',\n        pages: this.snapshots.map((s) => s.url),\n        recommendation: 'Standardize on a single label for the cancel action',\n      });\n    }\n\n    \u002F\u002F Check layout consistency\n    const layouts = this.snapshots.map((s) => s.layoutPattern);\n    if (new Set(layouts).size > 2) {\n      issues.push({\n        category: 'layout',\n        description: `${new Set(layouts).size} different layout patterns across pages`,\n        severity: 'medium',\n        pages: this.snapshots.map((s) => s.url),\n        recommendation: 'Use a consistent layout system for similar page types',\n      });\n    }\n\n    let score = 100;\n    for (const issue of issues) {\n      if (issue.severity === 'high') score -= 20;\n      else if (issue.severity === 'medium') score -= 10;\n      else score -= 5;\n    }\n\n    return { issues, consistencyScore: Math.max(0, score) };\n  }\n}\n```\n\n### Step 5: Build a Task Path Tracer\n\nMeasuring how many steps common tasks require reveals unnecessary workflow complexity.\n\n```typescript\n\u002F\u002F helpers\u002Ftask-path-tracer.ts\nimport { Page } from '@playwright\u002Ftest';\n\nexport interface TaskStep {\n  action: string;\n  url: string;\n  elementInteracted: string;\n  timestamp: number;\n  cognitiveEffort: 'low' | 'medium' | 'high';\n}\n\nexport interface TaskPath {\n  taskName: string;\n  steps: TaskStep[];\n  totalSteps: number;\n  totalTimeMs: number;\n  pagesVisited: number;\n  backtrackCount: number;\n  cognitiveScore: number;\n}\n\nexport class TaskPathTracer {\n  private steps: TaskStep[] = [];\n  private startTime: number = 0;\n  private visitedUrls: Set\u003Cstring> = new Set();\n  private urlSequence: string[] = [];\n\n  startTask(): void {\n    this.steps = [];\n    this.startTime = Date.now();\n    this.visitedUrls = new Set();\n    this.urlSequence = [];\n  }\n\n  recordStep(\n    action: string,\n    page: Page,\n    elementDescription: string,\n    effort: TaskStep['cognitiveEffort'] = 'low'\n  ): void {\n    const url = page.url();\n    this.visitedUrls.add(url);\n    this.urlSequence.push(url);\n\n    this.steps.push({\n      action,\n      url,\n      elementInteracted: elementDescription,\n      timestamp: Date.now(),\n      cognitiveEffort: effort,\n    });\n  }\n\n  completeTask(taskName: string): TaskPath {\n    const totalTimeMs = Date.now() - this.startTime;\n\n    let backtrackCount = 0;\n    const seen = new Set\u003Cstring>();\n    for (const url of this.urlSequence) {\n      if (seen.has(url)) backtrackCount++;\n      seen.add(url);\n    }\n\n    let cognitiveScore = 0;\n    cognitiveScore += this.steps.length * 5;\n    cognitiveScore += backtrackCount * 15;\n    cognitiveScore += (this.visitedUrls.size - 1) * 10;\n    for (const step of this.steps) {\n      if (step.cognitiveEffort === 'high') cognitiveScore += 10;\n      else if (step.cognitiveEffort === 'medium') cognitiveScore += 5;\n    }\n\n    return {\n      taskName,\n      steps: [...this.steps],\n      totalSteps: this.steps.length,\n      totalTimeMs,\n      pagesVisited: this.visitedUrls.size,\n      backtrackCount,\n      cognitiveScore: Math.min(100, cognitiveScore),\n    };\n  }\n}\n```\n\n### Step 6: Write Cognitive Load Tests\n\n```typescript\n\u002F\u002F tests\u002Fcognitive-load\u002Finformation-density.spec.ts\nimport { test, expect } from '@playwright\u002Ftest';\nimport { DensityCalculator } from '..\u002Fhelpers\u002Fdensity-calculator';\n\nconst pages = [\n  { name: 'Homepage', path: '\u002F' },\n  { name: 'Dashboard', path: '\u002Fdashboard' },\n  { name: 'Settings', path: '\u002Fsettings' },\n  { name: 'Product Listing', path: '\u002Fproducts' },\n];\n\ntest.describe('Information Density Analysis', () => {\n  const calculator = new DensityCalculator();\n\n  for (const pg of pages) {\n    test(`${pg.name} has acceptable information density`, async ({ page }) => {\n      await page.goto(pg.path);\n      await page.waitForLoadState('networkidle');\n\n      const metrics = await calculator.calculate(page);\n\n      expect(metrics.textDensity).toBeGreaterThan(50);\n      expect(metrics.textDensity).toBeLessThan(800);\n      expect(metrics.totalInteractiveElements).toBeLessThanOrEqual(30);\n\n      if (metrics.informationUnits > 0) {\n        expect(metrics.informationUnits).toBeLessThanOrEqual(8);\n      }\n\n      expect(metrics.densityScore).toBeLessThan(80);\n    });\n  }\n});\n```\n\n```typescript\n\u002F\u002F tests\u002Fcognitive-load\u002Fchoice-overload.spec.ts\nimport { test, expect } from '@playwright\u002Ftest';\nimport { ChoiceCounter } from '..\u002Fhelpers\u002Fchoice-counter';\n\ntest.describe('Choice Overload Analysis', () => {\n  const counter = new ChoiceCounter();\n\n  test('navigation has 7 or fewer top-level items', async ({ page }) => {\n    await page.goto('\u002F');\n    await page.waitForLoadState('networkidle');\n    const metrics = await counter.count(page);\n    expect(metrics.navigationItemCount).toBeLessThanOrEqual(7);\n  });\n\n  test('forms show 7 or fewer fields at once', async ({ page }) => {\n    await page.goto('\u002Fregister');\n    await page.waitForLoadState('networkidle');\n    const metrics = await counter.count(page);\n    expect(metrics.formFieldCount).toBeLessThanOrEqual(7);\n  });\n\n  test('no more than 2 competing CTAs per viewport', async ({ page }) => {\n    await page.goto('\u002F');\n    await page.waitForLoadState('networkidle');\n    const metrics = await counter.count(page);\n    expect(metrics.callToActionCount).toBeLessThanOrEqual(2);\n  });\n\n  test('total decision points stay under threshold', async ({ page }) => {\n    await page.goto('\u002Fdashboard');\n    await page.waitForLoadState('networkidle');\n    const metrics = await counter.count(page);\n    expect(metrics.totalDecisionPoints).toBeLessThanOrEqual(25);\n    expect(metrics.choiceOverloadScore).toBeLessThan(50);\n  });\n});\n```\n\n```typescript\n\u002F\u002F tests\u002Fcognitive-load\u002Fvisual-hierarchy.spec.ts\nimport { test, expect } from '@playwright\u002Ftest';\nimport { HierarchyAnalyzer } from '..\u002Fhelpers\u002Fhierarchy-analyzer';\n\ntest.describe('Visual Hierarchy Analysis', () => {\n  const analyzer = new HierarchyAnalyzer();\n\n  test('heading hierarchy does not skip levels', async ({ page }) => {\n    await page.goto('\u002F');\n    await page.waitForLoadState('networkidle');\n    const metrics = await analyzer.analyze(page);\n    expect(metrics.headingHierarchyValid).toBe(true);\n  });\n\n  test('whitespace ratio is between 20% and 70%', async ({ page }) => {\n    await page.goto('\u002F');\n    await page.waitForLoadState('networkidle');\n    const metrics = await analyzer.analyze(page);\n    expect(metrics.whitespaceRatio).toBeGreaterThan(0.2);\n    expect(metrics.whitespaceRatio).toBeLessThan(0.7);\n  });\n\n  test('font size variations stay reasonable', async ({ page }) => {\n    await page.goto('\u002F');\n    await page.waitForLoadState('networkidle');\n    const metrics = await analyzer.analyze(page);\n    expect(metrics.fontSizeVariations).toBeLessThanOrEqual(8);\n  });\n\n  test('hierarchy score meets minimum threshold', async ({ page }) => {\n    await page.goto('\u002F');\n    await page.waitForLoadState('networkidle');\n    const metrics = await analyzer.analyze(page);\n    expect(metrics.hierarchyScore).toBeGreaterThanOrEqual(50);\n  });\n});\n```\n\n```typescript\n\u002F\u002F tests\u002Fcognitive-load\u002Fconsistency-audit.spec.ts\nimport { test, expect } from '@playwright\u002Ftest';\nimport { ConsistencyChecker } from '..\u002Fhelpers\u002Fconsistency-checker';\n\ntest.describe('Cross-Page Consistency Audit', () => {\n  test('navigation and terminology are consistent across pages', async ({ page }) => {\n    const checker = new ConsistencyChecker();\n    const pagesToVisit = ['\u002F', '\u002Fdashboard', '\u002Fsettings', '\u002Fproducts', '\u002Fabout'];\n\n    for (const path of pagesToVisit) {\n      await page.goto(path);\n      await page.waitForLoadState('networkidle');\n      await checker.captureSnapshot(page);\n    }\n\n    const result = checker.analyze();\n\n    const highSeverity = result.issues.filter((i) => i.severity === 'high');\n    expect(highSeverity.length).toBe(0);\n    expect(result.consistencyScore).toBeGreaterThanOrEqual(70);\n  });\n});\n```\n\n```typescript\n\u002F\u002F tests\u002Fcognitive-load\u002Ftask-completion-paths.spec.ts\nimport { test, expect } from '@playwright\u002Ftest';\nimport { TaskPathTracer } from '..\u002Fhelpers\u002Ftask-path-tracer';\n\ntest.describe('Task Completion Path Complexity', () => {\n  test('user registration takes 5 or fewer steps', async ({ page }) => {\n    const tracer = new TaskPathTracer();\n    tracer.startTask();\n\n    await page.goto('\u002Fregister');\n    tracer.recordStep('Navigate to registration', page, 'URL', 'low');\n\n    await page.fill('[name=\"name\"]', 'Test User');\n    tracer.recordStep('Enter name', page, 'name input', 'low');\n\n    await page.fill('[name=\"email\"]', 'test@example.com');\n    tracer.recordStep('Enter email', page, 'email input', 'low');\n\n    await page.fill('[name=\"password\"]', 'SecurePass123!');\n    tracer.recordStep('Enter password', page, 'password input', 'medium');\n\n    await page.click('button[type=\"submit\"]');\n    tracer.recordStep('Submit form', page, 'submit button', 'low');\n\n    const result = tracer.completeTask('User Registration');\n    expect(result.totalSteps).toBeLessThanOrEqual(6);\n    expect(result.backtrackCount).toBe(0);\n    expect(result.pagesVisited).toBeLessThanOrEqual(2);\n  });\n\n  test('search task takes 3 or fewer steps', async ({ page }) => {\n    const tracer = new TaskPathTracer();\n    tracer.startTask();\n\n    await page.goto('\u002F');\n    tracer.recordStep('Start at homepage', page, 'homepage', 'low');\n\n    await page.fill('input[type=\"search\"], [data-testid=\"search-input\"]', 'test');\n    tracer.recordStep('Enter search query', page, 'search input', 'low');\n\n    await page.keyboard.press('Enter');\n    tracer.recordStep('Execute search', page, 'keyboard', 'low');\n\n    const result = tracer.completeTask('Search');\n    expect(result.totalSteps).toBeLessThanOrEqual(4);\n    expect(result.backtrackCount).toBe(0);\n  });\n});\n```\n\n## Configuration\n\n### Playwright Configuration\n\n```typescript\n\u002F\u002F playwright.config.ts\nimport { defineConfig } from '@playwright\u002Ftest';\n\nexport default defineConfig({\n  testDir: '.\u002Ftests\u002Fcognitive-load',\n  timeout: 30000,\n  retries: 0,\n  use: {\n    baseURL: process.env.BASE_URL || 'http:\u002F\u002Flocalhost:3000',\n    screenshot: 'on',\n    video: 'off',\n    trace: 'on-first-retry',\n  },\n  reporter: [\n    ['html', { open: 'never' }],\n    ['json', { outputFile: 'reports\u002Fcognitive-load-results.json' }],\n  ],\n  projects: [\n    {\n      name: 'cognitive-desktop',\n      use: { browserName: 'chromium', viewport: { width: 1440, height: 900 } },\n    },\n    {\n      name: 'cognitive-mobile',\n      use: {\n        browserName: 'chromium',\n        viewport: { width: 375, height: 812 },\n        isMobile: true,\n      },\n    },\n  ],\n});\n```\n\n### Cognitive Load Thresholds Configuration\n\n```json\n{\n  \"informationDensity\": {\n    \"maxWordsPerViewportK\": 600,\n    \"maxInteractiveElements\": 30,\n    \"maxInformationUnits\": 8,\n    \"maxDensityScore\": 75\n  },\n  \"choiceOverload\": {\n    \"maxNavigationItems\": 7,\n    \"maxFormFieldsVisible\": 7,\n    \"maxCTAs\": 2,\n    \"maxTabs\": 6,\n    \"maxCardChoices\": 9,\n    \"maxTotalDecisionPoints\": 25,\n    \"maxOverloadScore\": 50\n  },\n  \"visualHierarchy\": {\n    \"maxFontSizeVariations\": 6,\n    \"minWhitespaceRatio\": 0.3,\n    \"maxWhitespaceRatio\": 0.6,\n    \"minHierarchyScore\": 60\n  },\n  \"taskComplexity\": {\n    \"maxStepsForCommonTask\": 5,\n    \"maxPagesForCommonTask\": 3,\n    \"maxBacktracks\": 0,\n    \"maxCognitiveScore\": 40\n  }\n}\n```\n\n## Best Practices\n\n1. **Measure cognitive load on every critical page.** Homepage, dashboard, checkout, settings, and search results are high-traffic pages where cognitive load directly impacts conversion.\n\n2. **Test at mobile viewport sizes.** Mobile screens increase information density. A dashboard manageable at 1440px may be overwhelming at 375px.\n\n3. **Count decisions, not just elements.** A list of 20 read-only rows differs from 20 selectable options. Focus on elements requiring user decisions.\n\n4. **Audit consistency across at least 5 pages.** Single-page checks reveal nothing about cross-page coherence. Compare navigation, terminology, and layout patterns.\n\n5. **Measure task completion paths for the top 5 user tasks.** Registration, search, purchase, settings change, and content creation paths should all be under 5 steps.\n\n6. **Use progressive disclosure to reduce visible complexity.** Hide secondary information behind expandable sections, tabs, or drill-down patterns.\n\n7. **Apply Miller's Law to every grouping.** Navigation menus, form sections, card grids, and tab bars should contain 5-7 items maximum.\n\n8. **Apply Hick's Law to CTAs.** One primary CTA and at most one secondary per viewport. Multiple competing CTAs cause paralysis.\n\n9. **Validate heading hierarchy semantically.** Headings must follow logical order without skipping levels for both accessibility and scannability.\n\n10. **Maintain 30-50% whitespace.** Whitespace is a cognitive aid that separates information into digestible chunks. Below 30% feels cramped.\n\n11. **Standardize action labels across the application.** \"Save\" on one page and \"Submit\" on another for the same action forces reinterpretation.\n\n12. **Track cognitive load metrics over time.** As features accumulate, complexity creeps upward. Monitor per sprint to catch it early.\n\n## Anti-Patterns to Avoid\n\n1. **Showing everything at once.** Displaying all settings, all options, and all data on a single page forces users to process hundreds of items.\n\n2. **Too many navigation levels.** Navigation deeper than 3 levels forces users to track their position, consuming working memory.\n\n3. **Inconsistent terminology.** Using \"Save,\" \"Submit,\" \"Apply,\" \"Confirm,\" and \"Done\" interchangeably for the same action creates confusion.\n\n4. **Visual monotony.** When every element has the same size, color, and weight, there is no hierarchy to guide scanning.\n\n5. **Hidden primary actions.** When the most important action is buried below the fold or styled identically to secondary actions, users cannot find it.\n\n6. **Excessive form fields on one screen.** A 15-field registration form is intimidating. Break it into 3-4 steps of 3-5 fields.\n\n7. **No default selections.** Forcing every choice from scratch instead of providing smart defaults adds unnecessary cognitive work.\n\n8. **Ambiguous icons without labels.** Unlabeled icons require guessing. A gear icon could mean settings, configuration, tools, or preferences.\n\n9. **Identical visual weight for different importance levels.** When errors, info, and success messages look the same, users cannot quickly triage.\n\n10. **Context switching between pages for sub-tasks.** Navigating to a separate page for a sub-task during checkout disrupts the primary workflow.\n\n## Debugging Tips\n\n1. **Use the squint test.** Squint at the page until text is unreadable. The hierarchy should still be apparent through size, color, and spacing. If everything blurs uniformly, the hierarchy is flat.\n\n2. **Count decisions per viewport.** Scroll to any point and count every element requiring a user decision. More than 7 indicates overload.\n\n3. **Time yourself completing common tasks.** If you, an expert, take more than 30 seconds, a new user will struggle significantly more.\n\n4. **Screenshot at multiple breakpoints** (320px, 375px, 768px, 1024px, 1440px) and compare density. Mobile breakpoints often reveal hidden problems.\n\n5. **Map the information architecture.** Draw a tree of the page structure. Any branch deeper than 3 levels is a simplification candidate.\n\n6. **Read headings as a table of contents.** Extract all headings and read them as a list. If they do not tell a coherent story, the structure needs work.\n\n7. **Use a contrast checker** to verify the visual hierarchy uses sufficient differentiation. Prominent elements need high contrast; secondary ones need less.\n\n8. **Test with first-time users.** Cognitive load is highest for newcomers. Observe someone unfamiliar completing tasks. Note every hesitation, wrong click, and backtrack.\n\n9. **Track scroll depth and time-on-page.** Users scrolling past important content or spending disproportionate time indicates architecture problems.\n\n10. **Compare similar pages side by side.** Place settings next to profile, or search results next to category page. Inconsistencies become immediately visible.\n","# Cognitive Load Analyzer Skill\n\nYou are an expert QA engineer specializing in cognitive load assessment, usability heuristic evaluation, and information architecture analysis. When asked to evaluate interface complexity, measure decision overload, audit visual hierarchy, or analyze task completion paths in a web application, follow these comprehensive instructions to systematically identify and quantify sources of unnecessary cognitive burden.\n\n## Core Principles\n\n1. **Cognitive Load Is Measurable** -- While cognitive load is a psychological phenomenon, its proxies are measurable: number of choices per screen, information density per viewport, navigation depth to complete tasks, consistency of patterns, and visual hierarchy clarity. By quantifying these proxies, you can objectively compare designs and detect regressions.\n\n2. **Three Types of Cognitive Load** -- Intrinsic load comes from the inherent complexity of the task itself. Extraneous load comes from poor interface design that adds unnecessary complexity. Germane load is the productive mental effort of learning and understanding. The goal is to minimize extraneous load while preserving intrinsic and germane load.\n\n3. **Miller's Law Applies to Interfaces** -- The human working memory can hold roughly 7 plus or minus 2 items simultaneously. Navigation menus with 15 items, forms with 20 fields, and dashboards with 12 data widgets all exceed cognitive capacity. Chunk information into groups of 5-7 items maximum.\n\n4. **Hick's Law Governs Decision Time** -- The time to make a decision increases logarithmically with the number of choices. A page with 3 clear options is cognitively easy. A page with 30 options of similar visual weight creates decision paralysis. Reduce choices or create clear visual hierarchy to guide attention.\n\n5. **Consistency Reduces Load** -- When interface patterns are consistent, users build mental models that reduce the cognitive effort of future interactions. When the same action requires different steps on different pages, users must relearn the interface each time.\n\n6. **Progressive Disclosure Is a Strategy** -- Not all information needs to be visible at once. Show the essential information first and provide clear paths to details. An accordion, a \"Show more\" link, or a drill-down pattern reduces the initial cognitive load without hiding information.\n\n7. **Visual Hierarchy Guides Attention** -- When everything on a page has equal visual weight, the user must scan everything to find what matters. Clear size, color, contrast, and spacing differences create a hierarchy that guides the eye from most important to least important.\n\n## Project Structure\n\nOrganize your cognitive load analysis suite with this directory structure:\n\n```\ntests\u002F\n  cognitive-load\u002F\n    information-density.spec.ts\n    choice-overload.spec.ts\n    navigation-complexity.spec.ts\n    form-complexity.spec.ts\n    visual-hierarchy.spec.ts\n    consistency-audit.spec.ts\n    task-completion-paths.spec.ts\n  fixtures\u002F\n    cognitive-page.fixture.ts\n  helpers\u002F\n    density-calculator.ts\n    choice-counter.ts\n    hierarchy-analyzer.ts\n    consistency-checker.ts\n    task-path-tracer.ts\n    cognitive-score.ts\n  reports\u002F\n    cognitive-load-report.json\n    cognitive-load-report.html\n  thresholds\u002F\n    cognitive-thresholds.json\nplaywright.config.ts\n```\n\nEach spec file measures a different dimension of cognitive load. The helpers directory contains the measurement algorithms. Thresholds define the acceptable limits for each metric.\n\n## Detailed Guide\n\n### Step 1: Build an Information Density Calculator\n\nInformation density measures how much content is presented per unit of viewport area. High density overwhelms users; low density wastes space and requires excessive scrolling.\n\n```typescript\n\u002F\u002F helpers\u002Fdensity-calculator.ts\nimport { Page } from '@playwright\u002Ftest';\n\nexport interface DensityMetrics {\n  totalTextElements: number;\n  totalWordCount: number;\n  totalInteractiveElements: number;\n  totalImages: number;\n  viewportArea: number;\n  visibleContentArea: number;\n  textDensity: number;          \u002F\u002F words per 1000px of viewport height\n  interactiveDensity: number;   \u002F\u002F interactive elements per viewport\n  informationUnits: number;     \u002F\u002F distinct information groups\n  densityScore: number;         \u002F\u002F 0-100 composite score\n}\n\nexport class DensityCalculator {\n  async calculate(page: Page): Promise\u003CDensityMetrics> {\n    const viewport = page.viewportSize();\n    if (!viewport) throw new Error('No viewport size available');\n\n    const viewportArea = viewport.width * viewport.height;\n\n    const measurements = await page.evaluate(() => {\n      \u002F\u002F Count visible text elements\n      const textSelectors = 'p, h1, h2, h3, h4, h5, h6, span, li, td, th, label, a, button';\n      const textElements = document.querySelectorAll(textSelectors);\n      let totalWords = 0;\n      let visibleTextElements = 0;\n\n      textElements.forEach((el) => {\n        const style = window.getComputedStyle(el);\n        if (style.display !== 'none' && style.visibility !== 'hidden' && style.opacity !== '0') {\n          const text = el.textContent?.trim();\n          if (text && text.length > 0) {\n            visibleTextElements++;\n            totalWords += text.split(\u002F\\s+\u002F).filter((w) => w.length > 0).length;\n          }\n        }\n      });\n\n      \u002F\u002F Count interactive elements visible in the viewport\n      const interactiveSelectors = [\n        'a[href]', 'button', 'input', 'select', 'textarea',\n        '[role=\"button\"]', '[role=\"link\"]', '[role=\"tab\"]',\n        '[role=\"menuitem\"]', '[onclick]', '[tabindex]:not([tabindex=\"-1\"])',\n      ];\n      const interactiveElements = document.querySelectorAll(interactiveSelectors.join(', '));\n      let visibleInteractive = 0;\n      interactiveElements.forEach((el) => {\n        const rect = el.getBoundingClientRect();\n        if (rect.width > 0 && rect.height > 0 && rect.top \u003C window.innerHeight && rect.bottom > 0) {\n          visibleInteractive++;\n        }\n      });\n\n      \u002F\u002F Count images in viewport\n      const images = document.querySelectorAll('img, svg, [role=\"img\"]');\n      let visibleImages = 0;\n      images.forEach((el) => {\n        const rect = el.getBoundingClientRect();\n        if (rect.width > 0 && rect.height > 0 && rect.top \u003C window.innerHeight) {\n          visibleImages++;\n        }\n      });\n\n      \u002F\u002F Calculate visible content area\n      const bodyRect = document.body.getBoundingClientRect();\n      const visibleContentArea = Math.min(bodyRect.height, window.innerHeight) * bodyRect.width;\n\n      \u002F\u002F Count distinct information groups (sections, cards, panels)\n      const groupSelectors = 'section, article, .card, .panel, [role=\"region\"], [role=\"group\"], fieldset';\n      const groups = document.querySelectorAll(groupSelectors);\n      let visibleGroups = 0;\n      groups.forEach((el) => {\n        const rect = el.getBoundingClientRect();\n        if (rect.width > 0 && rect.height > 0 && rect.top \u003C window.innerHeight) {\n          visibleGroups++;\n        }\n      });\n\n      return {\n        visibleTextElements,\n        totalWords,\n        visibleInteractive,\n        visibleImages,\n        visibleContentArea,\n        visibleGroups,\n      };\n    });\n\n    const viewportHeightK = viewport.height \u002F 1000;\n    const textDensity = measurements.totalWords \u002F viewportHeightK;\n    const interactiveDensity = measurements.visibleInteractive;\n\n    \u002F\u002F Composite density score (0-100, lower is less dense)\n    let densityScore = 50;\n    if (textDensity > 500) densityScore += 15;\n    if (textDensity > 800) densityScore += 15;\n    if (textDensity \u003C 100) densityScore -= 10;\n    if (interactiveDensity > 20) densityScore += 10;\n    if (interactiveDensity > 40) densityScore += 10;\n    if (measurements.visibleGroups > 8) densityScore += 10;\n    densityScore = Math.max(0, Math.min(100, densityScore));\n\n    return {\n      totalTextElements: measurements.visibleTextElements,\n      totalWordCount: measurements.totalWords,\n      totalInteractiveElements: measurements.visibleInteractive,\n      totalImages: measurements.visibleImages,\n      viewportArea,\n      visibleContentArea: measurements.visibleContentArea,\n      textDensity,\n      interactiveDensity,\n      informationUnits: measurements.visibleGroups,\n      densityScore,\n    };\n  }\n}\n```\n\n### Step 2: Build a Choice Overload Counter\n\nChoice overload occurs when users face too many options of similar visual weight, causing decision paralysis.\n\n```typescript\n\u002F\u002F helpers\u002Fchoice-counter.ts\nimport { Page } from '@playwright\u002Ftest';\n\nexport interface ChoiceMetrics {\n  navigationItemCount: number;\n  formFieldCount: number;\n  callToActionCount: number;\n  filterOptionCount: number;\n  tabCount: number;\n  cardChoiceCount: number;\n  totalDecisionPoints: number;\n  choiceOverloadScore: number;  \u002F\u002F 0-100, higher = more overload\n  issues: string[];\n}\n\nexport class ChoiceCounter {\n  async count(page: Page): Promise\u003CChoiceMetrics> {\n    const metrics = await page.evaluate(() => {\n      const issues: string[] = [];\n\n      \u002F\u002F Count top-level navigation items\n      const navItems = document.querySelectorAll(\n        'nav a, nav button, [role=\"navigation\"] a, [role=\"navigation\"] button'\n      );\n      const visibleNavItems = Array.from(navItems).filter((el) => {\n        const rect = el.getBoundingClientRect();\n        return rect.width > 0 && rect.height > 0;\n      });\n      const navigationItemCount = visibleNavItems.length;\n      if (navigationItemCount > 7) {\n        issues.push(`Navigation has ${navigationItemCount} items (recommended: 5-7)`);\n      }\n\n      \u002F\u002F Count visible form fields\n      const formFields = document.querySelectorAll(\n        'input:not([type=\"hidden\"]), select, textarea, [role=\"combobox\"]'\n      );\n      const visibleFormFields = Array.from(formFields).filter((el) => {\n        const rect = el.getBoundingClientRect();\n        return rect.width > 0 && rect.height > 0 && rect.top \u003C window.innerHeight;\n      });\n      const formFieldCount = visibleFormFields.length;\n      if (formFieldCount > 7) {\n        issues.push(`${formFieldCount} form fields visible (recommended: 3-5 per step)`);\n      }\n\n      \u002F\u002F Count call-to-action buttons\n      const ctaButtons = document.querySelectorAll(\n        'button[type=\"submit\"], .btn-primary, .cta, [data-testid*=\"cta\"]'\n      );\n      const visibleCTAs = Array.from(ctaButtons).filter((el) => {\n        const rect = el.getBoundingClientRect();\n        return rect.width > 0 && rect.height > 0 && rect.top \u003C window.innerHeight;\n      });\n      const callToActionCount = visibleCTAs.length;\n      if (callToActionCount > 2) {\n        issues.push(`${callToActionCount} CTAs competing for attention (recommended: 1-2)`);\n      }\n\n      \u002F\u002F Count filter options\n      const filterElements = document.querySelectorAll(\n        '[data-testid*=\"filter\"], .filter-option, .facet'\n      );\n      const filterOptionCount = filterElements.length;\n      if (filterOptionCount > 10) {\n        issues.push(`${filterOptionCount} filter options visible (use progressive disclosure)`);\n      }\n\n      \u002F\u002F Count tabs\n      const tabs = document.querySelectorAll('[role=\"tab\"], .tab, .nav-tab');\n      const tabCount = tabs.length;\n      if (tabCount > 6) {\n        issues.push(`${tabCount} tabs visible (recommended: 4-6, use overflow for more)`);\n      }\n\n      \u002F\u002F Count choice cards in viewport\n      const cards = document.querySelectorAll('.card, article, .product-card, .pricing-card');\n      const visibleCards = Array.from(cards).filter((el) => {\n        const rect = el.getBoundingClientRect();\n        return rect.width > 0 && rect.height > 0 && rect.top \u003C window.innerHeight;\n      });\n      const cardChoiceCount = visibleCards.length;\n      if (cardChoiceCount > 9) {\n        issues.push(`${cardChoiceCount} choice cards in viewport (recommended: 6-9)`);\n      }\n\n      return {\n        navigationItemCount,\n        formFieldCount,\n        callToActionCount,\n        filterOptionCount,\n        tabCount,\n        cardChoiceCount,\n        issues,\n      };\n    });\n\n    const totalDecisionPoints =\n      metrics.navigationItemCount +\n      metrics.formFieldCount +\n      metrics.callToActionCount +\n      metrics.tabCount +\n      metrics.cardChoiceCount;\n\n    let overloadScore = 0;\n    if (totalDecisionPoints > 10) overloadScore += 15;\n    if (totalDecisionPoints > 20) overloadScore += 15;\n    if (totalDecisionPoints > 30) overloadScore += 20;\n    if (metrics.navigationItemCount > 7) overloadScore += 10;\n    if (metrics.formFieldCount > 7) overloadScore += 10;\n    if (metrics.callToActionCount > 2) overloadScore += 10;\n    if (metrics.cardChoiceCount > 9) overloadScore += 10;\n    if (metrics.tabCount > 6) overloadScore += 10;\n    overloadScore = Math.min(100, overloadScore);\n\n    return {\n      ...metrics,\n      totalDecisionPoints,\n      choiceOverloadScore: overloadScore,\n    };\n  }\n}\n```\n\n### Step 3: Build a Visual Hierarchy Analyzer\n\nVisual hierarchy determines the order in which users process page information. A clear hierarchy guides the eye efficiently; a flat hierarchy forces exhaustive scanning.\n\n```typescript\n\u002F\u002F helpers\u002Fhierarchy-analyzer.ts\nimport { Page } from '@playwright\u002Ftest';\n\nexport interface HierarchyMetrics {\n  headingLevels: Array\u003C{ level: number; count: number; text: string[] }>;\n  headingHierarchyValid: boolean;\n  fontSizeVariations: number;\n  whitespaceRatio: number;\n  primaryActionClear: boolean;\n  visualWeightDistribution: 'balanced' | 'top-heavy' | 'flat' | 'clear-hierarchy';\n  hierarchyScore: number;  \u002F\u002F 0-100, higher is better\n  issues: string[];\n}\n\nexport class HierarchyAnalyzer {\n  async analyze(page: Page): Promise\u003CHierarchyMetrics> {\n    const data = await page.evaluate(() => {\n      const issues: string[] = [];\n\n      \u002F\u002F Analyze heading hierarchy\n      const headings = document.querySelectorAll('h1, h2, h3, h4, h5, h6');\n      const levelMap = new Map\u003Cnumber, string[]>();\n      headings.forEach((h) => {\n        const level = parseInt(h.tagName.charAt(1));\n        if (!levelMap.has(level)) levelMap.set(level, []);\n        levelMap.get(level)?.push(h.textContent?.trim().substring(0, 50) || '');\n      });\n\n      const headingLevels = Array.from(levelMap.entries()).map(([level, texts]) => ({\n        level,\n        count: texts.length,\n        text: texts,\n      }));\n\n      \u002F\u002F Check for skipped heading levels\n      const sortedLevels = Array.from(levelMap.keys()).sort();\n      let hierarchyValid = true;\n      for (let i = 1; i \u003C sortedLevels.length; i++) {\n        if (sortedLevels[i] - sortedLevels[i - 1] > 1) {\n          hierarchyValid = false;\n          issues.push(`Heading hierarchy skips from h${sortedLevels[i - 1]} to h${sortedLevels[i]}`);\n        }\n      }\n\n      const h1Count = levelMap.get(1)?.length || 0;\n      if (h1Count === 0) {\n        issues.push('Page has no h1 heading');\n        hierarchyValid = false;\n      }\n      if (h1Count > 1) {\n        issues.push(`Page has ${h1Count} h1 headings (recommended: exactly 1)`);\n      }\n\n      \u002F\u002F Count distinct font sizes\n      const allElements = document.querySelectorAll('body *');\n      const fontSizes = new Set\u003Cstring>();\n      allElements.forEach((el) => {\n        const style = window.getComputedStyle(el);\n        if (style.display !== 'none' && el.textContent?.trim()) {\n          fontSizes.add(style.fontSize);\n        }\n      });\n      const fontSizeVariations = fontSizes.size;\n      if (fontSizeVariations > 8) {\n        issues.push(`${fontSizeVariations} distinct font sizes (recommended: 4-6)`);\n      }\n\n      \u002F\u002F Calculate whitespace ratio\n      const bodyRect = document.body.getBoundingClientRect();\n      const totalArea = bodyRect.width * Math.min(bodyRect.height, window.innerHeight);\n      let contentArea = 0;\n      const contentEls = document.querySelectorAll(\n        'p, h1, h2, h3, h4, h5, h6, img, button, input, select, textarea, table, ul, ol'\n      );\n      contentEls.forEach((el) => {\n        const rect = el.getBoundingClientRect();\n        if (rect.width > 0 && rect.height > 0 && rect.top \u003C window.innerHeight && rect.bottom > 0) {\n          contentArea += rect.width * rect.height;\n        }\n      });\n      const whitespaceRatio = totalArea > 0 ? 1 - contentArea \u002F totalArea : 0;\n      if (whitespaceRatio \u003C 0.2) {\n        issues.push(`Only ${(whitespaceRatio * 100).toFixed(0)}% whitespace (recommended: 30-50%)`);\n      }\n\n      \u002F\u002F Check primary CTA clarity\n      const primaryButtons = document.querySelectorAll(\n        'button[type=\"submit\"], .btn-primary, [data-testid*=\"primary\"]'\n      );\n      let primaryActionClear = false;\n      if (primaryButtons.length === 1) {\n        const style = window.getComputedStyle(primaryButtons[0]);\n        const bg = style.backgroundColor;\n        primaryActionClear =\n          bg !== 'rgba(0, 0, 0, 0)' && bg !== 'rgb(255, 255, 255)' && bg !== 'transparent';\n      }\n      if (primaryButtons.length > 1) {\n        issues.push(`${primaryButtons.length} primary CTAs compete for attention`);\n      }\n\n      return {\n        headingLevels,\n        headingHierarchyValid: hierarchyValid,\n        fontSizeVariations,\n        whitespaceRatio,\n        primaryActionClear,\n        issues,\n      };\n    });\n\n    let distribution: HierarchyMetrics['visualWeightDistribution'];\n    if (data.headingHierarchyValid && data.whitespaceRatio > 0.3 && data.fontSizeVariations \u003C= 6) {\n      distribution = 'clear-hierarchy';\n    } else if (data.fontSizeVariations \u003C= 3) {\n      distribution = 'flat';\n    } else if (data.whitespaceRatio \u003C 0.2) {\n      distribution = 'top-heavy';\n    } else {\n      distribution = 'balanced';\n    }\n\n    let score = 50;\n    if (data.headingHierarchyValid) score += 15;\n    if (data.primaryActionClear) score += 10;\n    if (data.whitespaceRatio >= 0.3 && data.whitespaceRatio \u003C= 0.5) score += 10;\n    if (data.fontSizeVariations >= 4 && data.fontSizeVariations \u003C= 6) score += 10;\n    if (data.fontSizeVariations > 8) score -= 10;\n    if (data.whitespaceRatio \u003C 0.2) score -= 15;\n    if (!data.headingHierarchyValid) score -= 10;\n    score = Math.max(0, Math.min(100, score));\n\n    return {\n      ...data,\n      visualWeightDistribution: distribution,\n      hierarchyScore: score,\n    };\n  }\n}\n```\n\n### Step 4: Build a Consistency Checker\n\nConsistency across pages reduces the cognitive cost of learning the interface.\n\n```typescript\n\u002F\u002F helpers\u002Fconsistency-checker.ts\nimport { Page } from '@playwright\u002Ftest';\n\nexport interface ConsistencyIssue {\n  category: 'naming' | 'layout' | 'interaction' | 'visual' | 'navigation';\n  description: string;\n  severity: 'high' | 'medium' | 'low';\n  pages: string[];\n  recommendation: string;\n}\n\nexport interface ConsistencyMetrics {\n  issues: ConsistencyIssue[];\n  consistencyScore: number;\n}\n\nexport class ConsistencyChecker {\n  private snapshots: Array\u003C{\n    url: string;\n    buttonLabels: string[];\n    navStructure: string[];\n    headingPattern: string[];\n    layoutPattern: string;\n  }> = [];\n\n  async captureSnapshot(page: Page): Promise\u003Cvoid> {\n    const snapshot = await page.evaluate(() => {\n      const buttons = document.querySelectorAll('button, [role=\"button\"]');\n      const buttonLabels = Array.from(buttons)\n        .map((b) => b.textContent?.trim())\n        .filter(Boolean) as string[];\n\n      const navLinks = document.querySelectorAll('nav a, [role=\"navigation\"] a');\n      const navStructure = Array.from(navLinks)\n        .map((a) => a.textContent?.trim())\n        .filter(Boolean) as string[];\n\n      const headings = document.querySelectorAll('h1, h2, h3');\n      const headingPattern = Array.from(headings).map(\n        (h) => `${h.tagName}:${h.textContent?.trim().substring(0, 30)}`\n      );\n\n      const mainContent = document.querySelector('main, [role=\"main\"]');\n      let layoutPattern = 'unknown';\n      if (mainContent) {\n        const style = window.getComputedStyle(mainContent);\n        if (style.display === 'grid') layoutPattern = 'grid';\n        else if (style.display === 'flex') layoutPattern = 'flex';\n        else layoutPattern = 'block';\n      }\n\n      return { buttonLabels, navStructure, headingPattern, layoutPattern };\n    });\n\n    this.snapshots.push({ url: page.url(), ...snapshot });\n  }\n\n  analyze(): ConsistencyMetrics {\n    const issues: ConsistencyIssue[] = [];\n\n    if (this.snapshots.length \u003C 2) {\n      return { issues, consistencyScore: 100 };\n    }\n\n    \u002F\u002F Check navigation consistency\n    const navStructures = this.snapshots.map((s) => JSON.stringify(s.navStructure));\n    if (new Set(navStructures).size > 1) {\n      issues.push({\n        category: 'navigation',\n        description: 'Navigation structure differs across pages',\n        severity: 'high',\n        pages: this.snapshots.map((s) => s.url),\n        recommendation: 'Use a consistent navigation component on all pages',\n      });\n    }\n\n    \u002F\u002F Check button label consistency for common actions\n    const allLabels = this.snapshots.flatMap((s) => s.buttonLabels);\n    const saveVariants = allLabels.filter((l) =>\n      \u002F^(save|submit|confirm|apply|done|ok|update)$\u002Fi.test(l)\n    );\n    const uniqueSaveLabels = new Set(saveVariants.map((l) => l.toLowerCase()));\n    if (uniqueSaveLabels.size > 2) {\n      issues.push({\n        category: 'naming',\n        description: `Multiple labels for save action: ${Array.from(uniqueSaveLabels).join(', ')}`,\n        severity: 'medium',\n        pages: this.snapshots.map((s) => s.url),\n        recommendation: 'Standardize on a single label for the primary save action',\n      });\n    }\n\n    const cancelVariants = allLabels.filter((l) =>\n      \u002F^(cancel|close|dismiss|back|discard)$\u002Fi.test(l)\n    );\n    const uniqueCancelLabels = new Set(cancelVariants.map((l) => l.toLowerCase()));\n    if (uniqueCancelLabels.size > 2) {\n      issues.push({\n        category: 'naming',\n        description: `Multiple labels for cancel action: ${Array.from(uniqueCancelLabels).join(', ')}`,\n        severity: 'medium',\n        pages: this.snapshots.map((s) => s.url),\n        recommendation: 'Standardize on a single label for the cancel action',\n      });\n    }\n\n    \u002F\u002F Check layout consistency\n    const layouts = this.snapshots.map((s) => s.layoutPattern);\n    if (new Set(layouts).size > 2) {\n      issues.push({\n        category: 'layout',\n        description: `${new Set(layouts).size} different layout patterns across pages`,\n        severity: 'medium',\n        pages: this.snapshots.map((s) => s.url),\n        recommendation: 'Use a consistent layout system for similar page types',\n      });\n    }\n\n    let score = 100;\n    for (const issue of issues) {\n      if (issue.severity === 'high') score -= 20;\n      else if (issue.severity === 'medium') score -= 10;\n      else score -= 5;\n    }\n\n    return { issues, consistencyScore: Math.max(0, score) };\n  }\n}\n```\n\n### Step 5: Build a Task Path Tracer\n\nMeasuring how many steps common tasks require reveals unnecessary workflow complexity.\n\n```typescript\n\u002F\u002F helpers\u002Ftask-path-tracer.ts\nimport { Page } from '@playwright\u002Ftest';\n\nexport interface TaskStep {\n  action: string;\n  url: string;\n  elementInteracted: string;\n  timestamp: number;\n  cognitiveEffort: 'low' | 'medium' | 'high';\n}\n\nexport interface TaskPath {\n  taskName: string;\n  steps: TaskStep[];\n  totalSteps: number;\n  totalTimeMs: number;\n  pagesVisited: number;\n  backtrackCount: number;\n  cognitiveScore: number;\n}\n\nexport class TaskPathTracer {\n  private steps: TaskStep[] = [];\n  private startTime: number = 0;\n  private visitedUrls: Set\u003Cstring> = new Set();\n  private urlSequence: string[] = [];\n\n  startTask(): void {\n    this.steps = [];\n    this.startTime = Date.now();\n    this.visitedUrls = new Set();\n    this.urlSequence = [];\n  }\n\n  recordStep(\n    action: string,\n    page: Page,\n    elementDescription: string,\n    effort: TaskStep['cognitiveEffort'] = 'low'\n  ): void {\n    const url = page.url();\n    this.visitedUrls.add(url);\n    this.urlSequence.push(url);\n\n    this.steps.push({\n      action,\n      url,\n      elementInteracted: elementDescription,\n      timestamp: Date.now(),\n      cognitiveEffort: effort,\n    });\n  }\n\n  completeTask(taskName: string): TaskPath {\n    const totalTimeMs = Date.now() - this.startTime;\n\n    let backtrackCount = 0;\n    const seen = new Set\u003Cstring>();\n    for (const url of this.urlSequence) {\n      if (seen.has(url)) backtrackCount++;\n      seen.add(url);\n    }\n\n    let cognitiveScore = 0;\n    cognitiveScore += this.steps.length * 5;\n    cognitiveScore += backtrackCount * 15;\n    cognitiveScore += (this.visitedUrls.size - 1) * 10;\n    for (const step of this.steps) {\n      if (step.cognitiveEffort === 'high') cognitiveScore += 10;\n      else if (step.cognitiveEffort === 'medium') cognitiveScore += 5;\n    }\n\n    return {\n      taskName,\n      steps: [...this.steps],\n      totalSteps: this.steps.length,\n      totalTimeMs,\n      pagesVisited: this.visitedUrls.size,\n      backtrackCount,\n      cognitiveScore: Math.min(100, cognitiveScore),\n    };\n  }\n}\n```\n\n### Step 6: Write Cognitive Load Tests\n\n```typescript\n\u002F\u002F tests\u002Fcognitive-load\u002Finformation-density.spec.ts\nimport { test, expect } from '@playwright\u002Ftest';\nimport { DensityCalculator } from '..\u002Fhelpers\u002Fdensity-calculator';\n\nconst pages = [\n  { name: 'Homepage', path: '\u002F' },\n  { name: 'Dashboard', path: '\u002Fdashboard' },\n  { name: 'Settings', path: '\u002Fsettings' },\n  { name: 'Product Listing', path: '\u002Fproducts' },\n];\n\ntest.describe('Information Density Analysis', () => {\n  const calculator = new DensityCalculator();\n\n  for (const pg of pages) {\n    test(`${pg.name} has acceptable information density`, async ({ page }) => {\n      await page.goto(pg.path);\n      await page.waitForLoadState('networkidle');\n\n      const metrics = await calculator.calculate(page);\n\n      expect(metrics.textDensity).toBeGreaterThan(50);\n      expect(metrics.textDensity).toBeLessThan(800);\n      expect(metrics.totalInteractiveElements).toBeLessThanOrEqual(30);\n\n      if (metrics.informationUnits > 0) {\n        expect(metrics.informationUnits).toBeLessThanOrEqual(8);\n      }\n\n      expect(metrics.densityScore).toBeLessThan(80);\n    });\n  }\n});\n```\n\n```typescript\n\u002F\u002F tests\u002Fcognitive-load\u002Fchoice-overload.spec.ts\nimport { test, expect } from '@playwright\u002Ftest';\nimport { ChoiceCounter } from '..\u002Fhelpers\u002Fchoice-counter';\n\ntest.describe('Choice Overload Analysis', () => {\n  const counter = new ChoiceCounter();\n\n  test('navigation has 7 or fewer top-level items', async ({ page }) => {\n    await page.goto('\u002F');\n    await page.waitForLoadState('networkidle');\n    const metrics = await counter.count(page);\n    expect(metrics.navigationItemCount).toBeLessThanOrEqual(7);\n  });\n\n  test('forms show 7 or fewer fields at once', async ({ page }) => {\n    await page.goto('\u002Fregister');\n    await page.waitForLoadState('networkidle');\n    const metrics = await counter.count(page);\n    expect(metrics.formFieldCount).toBeLessThanOrEqual(7);\n  });\n\n  test('no more than 2 competing CTAs per viewport', async ({ page }) => {\n    await page.goto('\u002F');\n    await page.waitForLoadState('networkidle');\n    const metrics = await counter.count(page);\n    expect(metrics.callToActionCount).toBeLessThanOrEqual(2);\n  });\n\n  test('total decision points stay under threshold', async ({ page }) => {\n    await page.goto('\u002Fdashboard');\n    await page.waitForLoadState('networkidle');\n    const metrics = await counter.count(page);\n    expect(metrics.totalDecisionPoints).toBeLessThanOrEqual(25);\n    expect(metrics.choiceOverloadScore).toBeLessThan(50);\n  });\n});\n```\n\n```typescript\n\u002F\u002F tests\u002Fcognitive-load\u002Fvisual-hierarchy.spec.ts\nimport { test, expect } from '@playwright\u002Ftest';\nimport { HierarchyAnalyzer } from '..\u002Fhelpers\u002Fhierarchy-analyzer';\n\ntest.describe('Visual Hierarchy Analysis', () => {\n  const analyzer = new HierarchyAnalyzer();\n\n  test('heading hierarchy does not skip levels', async ({ page }) => {\n    await page.goto('\u002F');\n    await page.waitForLoadState('networkidle');\n    const metrics = await analyzer.analyze(page);\n    expect(metrics.headingHierarchyValid).toBe(true);\n  });\n\n  test('whitespace ratio is between 20% and 70%', async ({ page }) => {\n    await page.goto('\u002F');\n    await page.waitForLoadState('networkidle');\n    const metrics = await analyzer.analyze(page);\n    expect(metrics.whitespaceRatio).toBeGreaterThan(0.2);\n    expect(metrics.whitespaceRatio).toBeLessThan(0.7);\n  });\n\n  test('font size variations stay reasonable', async ({ page }) => {\n    await page.goto('\u002F');\n    await page.waitForLoadState('networkidle');\n    const metrics = await analyzer.analyze(page);\n    expect(metrics.fontSizeVariations).toBeLessThanOrEqual(8);\n  });\n\n  test('hierarchy score meets minimum threshold', async ({ page }) => {\n    await page.goto('\u002F');\n    await page.waitForLoadState('networkidle');\n    const metrics = await analyzer.analyze(page);\n    expect(metrics.hierarchyScore).toBeGreaterThanOrEqual(50);\n  });\n});\n```\n\n```typescript\n\u002F\u002F tests\u002Fcognitive-load\u002Fconsistency-audit.spec.ts\nimport { test, expect } from '@playwright\u002Ftest';\nimport { ConsistencyChecker } from '..\u002Fhelpers\u002Fconsistency-checker';\n\ntest.describe('Cross-Page Consistency Audit', () => {\n  test('navigation and terminology are consistent across pages', async ({ page }) => {\n    const checker = new ConsistencyChecker();\n    const pagesToVisit = ['\u002F', '\u002Fdashboard', '\u002Fsettings', '\u002Fproducts', '\u002Fabout'];\n\n    for (const path of pagesToVisit) {\n      await page.goto(path);\n      await page.waitForLoadState('networkidle');\n      await checker.captureSnapshot(page);\n    }\n\n    const result = checker.analyze();\n\n    const highSeverity = result.issues.filter((i) => i.severity === 'high');\n    expect(highSeverity.length).toBe(0);\n    expect(result.consistencyScore).toBeGreaterThanOrEqual(70);\n  });\n});\n```\n\n```typescript\n\u002F\u002F tests\u002Fcognitive-load\u002Ftask-completion-paths.spec.ts\nimport { test, expect } from '@playwright\u002Ftest';\nimport { TaskPathTracer } from '..\u002Fhelpers\u002Ftask-path-tracer';\n\ntest.describe('Task Completion Path Complexity', () => {\n  test('user registration takes 5 or fewer steps', async ({ page }) => {\n    const tracer = new TaskPathTracer();\n    tracer.startTask();\n\n    await page.goto('\u002Fregister');\n    tracer.recordStep('Navigate to registration', page, 'URL', 'low');\n\n    await page.fill('[name=\"name\"]', 'Test User');\n    tracer.recordStep('Enter name', page, 'name input', 'low');\n\n    await page.fill('[name=\"email\"]', 'test@example.com');\n    tracer.recordStep('Enter email', page, 'email input', 'low');\n\n    await page.fill('[name=\"password\"]', 'SecurePass123!');\n    tracer.recordStep('Enter password', page, 'password input', 'medium');\n\n    await page.click('button[type=\"submit\"]');\n    tracer.recordStep('Submit form', page, 'submit button', 'low');\n\n    const result = tracer.completeTask('User Registration');\n    expect(result.totalSteps).toBeLessThanOrEqual(6);\n    expect(result.backtrackCount).toBe(0);\n    expect(result.pagesVisited).toBeLessThanOrEqual(2);\n  });\n\n  test('search task takes 3 or fewer steps', async ({ page }) => {\n    const tracer = new TaskPathTracer();\n    tracer.startTask();\n\n    await page.goto('\u002F');\n    tracer.recordStep('Start at homepage', page, 'homepage', 'low');\n\n    await page.fill('input[type=\"search\"], [data-testid=\"search-input\"]', 'test');\n    tracer.recordStep('Enter search query', page, 'search input', 'low');\n\n    await page.keyboard.press('Enter');\n    tracer.recordStep('Execute search', page, 'keyboard', 'low');\n\n    const result = tracer.completeTask('Search');\n    expect(result.totalSteps).toBeLessThanOrEqual(4);\n    expect(result.backtrackCount).toBe(0);\n  });\n});\n```\n\n## Configuration\n\n### Playwright Configuration\n\n```typescript\n\u002F\u002F playwright.config.ts\nimport { defineConfig } from '@playwright\u002Ftest';\n\nexport default defineConfig({\n  testDir: '.\u002Ftests\u002Fcognitive-load',\n  timeout: 30000,\n  retries: 0,\n  use: {\n    baseURL: process.env.BASE_URL || 'http:\u002F\u002Flocalhost:3000',\n    screenshot: 'on',\n    video: 'off',\n    trace: 'on-first-retry',\n  },\n  reporter: [\n    ['html', { open: 'never' }],\n    ['json', { outputFile: 'reports\u002Fcognitive-load-results.json' }],\n  ],\n  projects: [\n    {\n      name: 'cognitive-desktop',\n      use: { browserName: 'chromium', viewport: { width: 1440, height: 900 } },\n    },\n    {\n      name: 'cognitive-mobile',\n      use: {\n        browserName: 'chromium',\n        viewport: { width: 375, height: 812 },\n        isMobile: true,\n      },\n    },\n  ],\n});\n```\n\n### Cognitive Load Thresholds Configuration\n\n```json\n{\n  \"informationDensity\": {\n    \"maxWordsPerViewportK\": 600,\n    \"maxInteractiveElements\": 30,\n    \"maxInformationUnits\": 8,\n    \"maxDensityScore\": 75\n  },\n  \"choiceOverload\": {\n    \"maxNavigationItems\": 7,\n    \"maxFormFieldsVisible\": 7,\n    \"maxCTAs\": 2,\n    \"maxTabs\": 6,\n    \"maxCardChoices\": 9,\n    \"maxTotalDecisionPoints\": 25,\n    \"maxOverloadScore\": 50\n  },\n  \"visualHierarchy\": {\n    \"maxFontSizeVariations\": 6,\n    \"minWhitespaceRatio\": 0.3,\n    \"maxWhitespaceRatio\": 0.6,\n    \"minHierarchyScore\": 60\n  },\n  \"taskComplexity\": {\n    \"maxStepsForCommonTask\": 5,\n    \"maxPagesForCommonTask\": 3,\n    \"maxBacktracks\": 0,\n    \"maxCognitiveScore\": 40\n  }\n}\n```\n\n## Best Practices\n\n1. **Measure cognitive load on every critical page.** Homepage, dashboard, checkout, settings, and search results are high-traffic pages where cognitive load directly impacts conversion.\n\n2. **Test at mobile viewport sizes.** Mobile screens increase information density. A dashboard manageable at 1440px may be overwhelming at 375px.\n\n3. **Count decisions, not just elements.** A list of 20 read-only rows differs from 20 selectable options. Focus on elements requiring user decisions.\n\n4. **Audit consistency across at least 5 pages.** Single-page checks reveal nothing about cross-page coherence. Compare navigation, terminology, and layout patterns.\n\n5. **Measure task completion paths for the top 5 user tasks.** Registration, search, purchase, settings change, and content creation paths should all be under 5 steps.\n\n6. **Use progressive disclosure to reduce visible complexity.** Hide secondary information behind expandable sections, tabs, or drill-down patterns.\n\n7. **Apply Miller's Law to every grouping.** Navigation menus, form sections, card grids, and tab bars should contain 5-7 items maximum.\n\n8. **Apply Hick's Law to CTAs.** One primary CTA and at most one secondary per viewport. Multiple competing CTAs cause paralysis.\n\n9. **Validate heading hierarchy semantically.** Headings must follow logical order without skipping levels for both accessibility and scannability.\n\n10. **Maintain 30-50% whitespace.** Whitespace is a cognitive aid that separates information into digestible chunks. Below 30% feels cramped.\n\n11. **Standardize action labels across the application.** \"Save\" on one page and \"Submit\" on another for the same action forces reinterpretation.\n\n12. **Track cognitive load metrics over time.** As features accumulate, complexity creeps upward. Monitor per sprint to catch it early.\n\n## Anti-Patterns to Avoid\n\n1. **Showing everything at once.** Displaying all settings, all options, and all data on a single page forces users to process hundreds of items.\n\n2. **Too many navigation levels.** Navigation deeper than 3 levels forces users to track their position, consuming working memory.\n\n3. **Inconsistent terminology.** Using \"Save,\" \"Submit,\" \"Apply,\" \"Confirm,\" and \"Done\" interchangeably for the same action creates confusion.\n\n4. **Visual monotony.** When every element has the same size, color, and weight, there is no hierarchy to guide scanning.\n\n5. **Hidden primary actions.** When the most important action is buried below the fold or styled identically to secondary actions, users cannot find it.\n\n6. **Excessive form fields on one screen.** A 15-field registration form is intimidating. Break it into 3-4 steps of 3-5 fields.\n\n7. **No default selections.** Forcing every choice from scratch instead of providing smart defaults adds unnecessary cognitive work.\n\n8. **Ambiguous icons without labels.** Unlabeled icons require guessing. A gear icon could mean settings, configuration, tools, or preferences.\n\n9. **Identical visual weight for different importance levels.** When errors, info, and success messages look the same, users cannot quickly triage.\n\n10. **Context switching between pages for sub-tasks.** Navigating to a separate page for a sub-task during checkout disrupts the primary workflow.\n\n## Debugging Tips\n\n1. **Use the squint test.** Squint at the page until text is unreadable. The hierarchy should still be apparent through size, color, and spacing. If everything blurs uniformly, the hierarchy is flat.\n\n2. **Count decisions per viewport.** Scroll to any point and count every element requiring a user decision. More than 7 indicates overload.\n\n3. **Time yourself completing common tasks.** If you, an expert, take more than 30 seconds, a new user will struggle significantly more.\n\n4. **Screenshot at multiple breakpoints** (320px, 375px, 768px, 1024px, 1440px) and compare density. Mobile breakpoints often reveal hidden problems.\n\n5. **Map the information architecture.** Draw a tree of the page structure. Any branch deeper than 3 levels is a simplification candidate.\n\n6. **Read headings as a table of contents.** Extract all headings and read them as a list. If they do not tell a coherent story, the structure needs work.\n\n7. **Use a contrast checker** to verify the visual hierarchy uses sufficient differentiation. Prominent elements need high contrast; secondary ones need less.\n\n8. **Test with first-time users.** Cognitive load is highest for newcomers. Observe someone unfamiliar completing tasks. Note every hesitation, wrong click, and backtrack.\n\n9. **Track scroll depth and time-on-page.** Users scrolling past important content or spending disproportionate time indicates architecture problems.\n\n10. **Compare similar pages side by side.** Place settings next to profile, or search results next to category page. Inconsistencies become immediately visible.\n",{"name":5,"tags":24,"agents":31,"author":44,"domains":45,"license":15,"version":47,"languages":48,"frameworks":51,"description":7,"testingTypes":53},[25,26,27,28,29,30],"cognitive-load","ux","information-architecture","complexity","usability","heuristics",[32,33,34,35,36,37,38,39,40,41,42,43],"claude-code","cursor","github-copilot","windsurf","codex","aider","continue","cline","zed","bolt","gemini-cli","amp","Pramod",[46],"web","1.0.0",[49,50],"typescript","javascript",[52],"playwright",[54,55],"e2e","accessibility","main","eac438ea9216a7cb8a570cab803eb01eeafc6793","skills\u002Fqa\u002Fcognitive-load-analyzer","https:\u002F\u002Fgithub.com\u002FGrupoANDevelopment-m\u002Falberto-ai","https:\u002F\u002Fgithub.com\u002FGrupoANDevelopment-m","https:\u002F\u002Fid-preview--d5bef06d-6c9e-4563-a3d4-a855b9d61610.lovable.app\u002F","Eu sou Antonio B. B. Ndombe \r\nEu sou um Pesquisador e desenvolvedor de sistema autonomia cognitivos, fundador de sistemas ODCs ( organismos digital conscientes)","2026-11-04 06:53:39",{"source":8,"skillName":5,"commands":65,"prompt":75,"zipAvailable":76},[66,69,72],{"tool":67,"command":68},"npx","npx skills add GrupoANDevelopment-m\u002Falberto-ai --skill \"Cognitive Load Analyzer\"",{"tool":70,"command":71},"bunx","bunx skills add GrupoANDevelopment-m\u002Falberto-ai --skill \"Cognitive Load Analyzer\"",{"tool":73,"command":74},"pnpm","pnpm dlx skills add GrupoANDevelopment-m\u002Falberto-ai --skill \"Cognitive Load Analyzer\"","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FGrupoANDevelopment-m\u002Falberto-ai\u002Fblob\u002Fmain\u002Fskills\u002Fqa\u002Fcognitive-load-analyzer\u002FSKILL.md",true,[],[79,87,94,101,108,115],{"skillNo":80,"name":81,"nameZh":6,"description":82,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":83,"licenseFileUrl":6,"sourceHtmlUrl":84,"categories":85,"keywords":86,"publishedAt":19},"01M7DASC6FSCJP49JZBSK0NY1Z","nemoclaw-user-reference","Describes the NemoClaw integration layer and blueprint architecture and how they orchestrate compatible agent sandboxes. Use when looking up architecture, agent integration, plugin structure, or blueprint design. Trigger keywords - nemoclaw architecture, nemoclaw agent architecture, nemoclaw plugin blueprint structure, nemoclaw vs openshell, which cli, nemoclaw cli, openshell cli, sandbox commands, nemoclaw cli commands, nemoclaw command reference, nemoclaw network policy, sandbox egress control operator approval, nemoclaw troubleshooting, nemoclaw debug sandbox issues.","Apache-2.0","https:\u002F\u002Fgithub.com\u002FGrupoANDevelopment-m\u002Falberto-ai\u002Fblob\u002Fmain\u002Fupstream\u002Fnemoclaw\u002Fskills\u002Fnemoclaw-user-reference\u002FSKILL.md",[],[],{"skillNo":88,"name":89,"nameZh":6,"description":90,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":83,"licenseFileUrl":6,"sourceHtmlUrl":91,"categories":92,"keywords":93,"publishedAt":19},"01M7DAS5S79VK33XFGVAM2TFWF","nemoclaw-user-overview","Explains how OpenClaw, OpenShell, and NemoClaw form the ecosystem, NemoClaw's position in the stack, what NemoClaw adds beyond the community sandbox, and when to prefer NemoClaw versus integrating OpenShell and OpenClaw directly. Use when users ask about the relationship between OpenClaw, OpenShell, and NemoClaw, or when to use NemoClaw versus OpenShell. Trigger keywords - nemoclaw ecosystem, openclaw openshell, nemoclaw vs openshell, sandboxed openclaw, how nemoclaw works, nemoclaw sandbox lifecycle blueprint, nemoclaw overview, openclaw always-on assistants, nvidia openshell, nvidia nemotron, nemoclaw release notes, nemoclaw changelog.","https:\u002F\u002Fgithub.com\u002FGrupoANDevelopment-m\u002Falberto-ai\u002Fblob\u002Fmain\u002Fupstream\u002Fnemoclaw\u002Fskills\u002Fnemoclaw-user-overview\u002FSKILL.md",[],[],{"skillNo":95,"name":96,"nameZh":6,"description":97,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":83,"licenseFileUrl":6,"sourceHtmlUrl":98,"categories":99,"keywords":100,"publishedAt":19},"01M7DAS0PQEMET5MNGZ1ABSZVS","nemoclaw-user-monitor-sandbox","Inspects sandbox health, traces agent behavior, and diagnoses problems. Use when monitoring a running sandbox, debugging agent issues, or checking sandbox logs. Trigger keywords - monitor nemoclaw sandbox, debug nemoclaw agent issues.","https:\u002F\u002Fgithub.com\u002FGrupoANDevelopment-m\u002Falberto-ai\u002Fblob\u002Fmain\u002Fupstream\u002Fnemoclaw\u002Fskills\u002Fnemoclaw-user-monitor-sandbox\u002FSKILL.md",[],[],{"skillNo":102,"name":103,"nameZh":6,"description":104,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":83,"licenseFileUrl":6,"sourceHtmlUrl":105,"categories":106,"keywords":107,"publishedAt":19},"01M7DARQYGF7E9A69VH6S3CGN9","nemoclaw-user-manage-sandboxes","Explains operational tasks after the quickstart: listing sandboxes, status and health checks, logs, diagnostics, port forwards, multiple sandboxes, credential reset, rebuilds, network presets, upgrades, and uninstall. Trigger keywords - manage nemoclaw sandboxes, nemoclaw status, nemoclaw list, nemoclaw dashboard port, nemoclaw rebuild, nemoclaw upgrade sandboxes, nemoclaw uninstall, sandbox mutability, sandbox runtime configuration, sandbox rebuild, nemoclaw backup, nemoclaw restore, workspace backup, openshell sandbox download upload, nemoclaw messaging channels, nemoclaw telegram, nemoclaw discord, nemoclaw slack, nemoclaw wechat, nemoclaw whatsapp, openshell channel messaging, nemoclaw workspace files, soul.md, user.md, identity.md, agents.md, sandbox persistence.","https:\u002F\u002Fgithub.com\u002FGrupoANDevelopment-m\u002Falberto-ai\u002Fblob\u002Fmain\u002Fupstream\u002Fnemoclaw\u002Fskills\u002Fnemoclaw-user-manage-sandboxes\u002FSKILL.md",[],[],{"skillNo":109,"name":110,"nameZh":6,"description":111,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":83,"licenseFileUrl":6,"sourceHtmlUrl":112,"categories":113,"keywords":114,"publishedAt":19},"01M7DARH8BRTG51TRCAB7YWDJ4","nemoclaw-user-manage-policy","Adds, removes, or modifies allowed endpoints in the sandbox policy. Use when customizing network policy, changing egress rules, or configuring sandbox endpoint access. Trigger keywords - customize nemoclaw network policy, sandbox egress policy configuration, nemoclaw integration policy examples, post-install policy setup, openshell approval workflow, policy preset, nemoclaw approve network requests, sandbox egress approval tui.","https:\u002F\u002Fgithub.com\u002FGrupoANDevelopment-m\u002Falberto-ai\u002Fblob\u002Fmain\u002Fupstream\u002Fnemoclaw\u002Fskills\u002Fnemoclaw-user-manage-policy\u002FSKILL.md",[],[],{"skillNo":116,"name":117,"nameZh":6,"description":118,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":83,"licenseFileUrl":6,"sourceHtmlUrl":119,"categories":120,"keywords":121,"publishedAt":19},"01M7DARAT62M2VR37590VCZ5NS","nemoclaw-user-get-started","Installs NemoClaw, launches a sandbox, and runs the first agent prompt. Use when onboarding, installing, or launching a NemoClaw sandbox for the first time. Trigger keywords - nemoclaw quickstart, install nemoclaw openclaw sandbox, nemohermes quickstart, hermes agent nemoclaw, run hermes openshell sandbox, nemoclaw prerequisites, nemoclaw supported platforms, nemoclaw hardware software, nemoclaw windows wsl2 setup, nemoclaw install windows docker desktop.","https:\u002F\u002Fgithub.com\u002FGrupoANDevelopment-m\u002Falberto-ai\u002Fblob\u002Fmain\u002Fupstream\u002Fnemoclaw\u002Fskills\u002Fnemoclaw-user-get-started\u002FSKILL.md",[],[]]