--- name: detect-ux description: Repo-driven UX audit with journey mapping and heuristic-based findings. Use when evaluating user experience quality. allowed-tools: Read, Glob, Grep, Write($JAAN_OUTPUTS_DIR/**), Edit(jaan-to/config/settings.yaml), Edit($JAAN_CONTEXT_DIR/**) argument-hint: "[repo] [--full]" context: fork license: MIT compatibility: Designed for Claude Code with jaan-to plugin. Partial standalone support for analysis mode. --- # detect-ux > Repo-driven UX audit with journeys, pain-points, and heuristic-based findings. ## Context Files - `$JAAN_LEARN_DIR/jaan-to-detect-ux.learn.md` - Past lessons (loaded in Pre-Execution) - `$JAAN_CONTEXT_DIR/tech.md` - Tech stack (for framework-aware route detection) - `$JAAN_TEMPLATES_DIR/jaan-to-detect-ux.template.md` - Output template - `${CLAUDE_PLUGIN_ROOT}/docs/extending/language-protocol.md` - Language resolution protocol **Output path**: `$JAAN_OUTPUTS_DIR/detect/ux/` — flat files, overwritten each run (no IDs). ## Input **Arguments**: $ARGUMENTS — parsed in Step 0.0. Repository path and mode determined there. --- ## Pre-Execution Protocol **MANDATORY** — Read and execute ALL steps in: `${CLAUDE_PLUGIN_ROOT}/docs/extending/pre-execution-protocol.md` Skill name: `detect-ux` Execute: Step 0 (Init Guard) → A (Load Lessons) → B (Resolve Template) → C (Offer Template Seeding) ### Language Settings Read and apply language protocol: `${CLAUDE_PLUGIN_ROOT}/docs/extending/language-protocol.md` Override field for this skill: `language_detect-ux` --- ## Standards Reference > **Reference**: See `${CLAUDE_PLUGIN_ROOT}/docs/extending/detect-shared-reference.md` for Evidence Format (SARIF), Evidence ID Generation, Confidence Levels, Frontmatter Schema, Platform Detection, Document Structure, and Codebase Content Safety. **This skill's namespace**: `E-UX-*` (e.g., E-UX-001, E-UX-WEB-001) **Tool name in frontmatter**: `detect-ux` --- # PHASE 1: Detection (Read-Only) ## Step 0.0: Parse Arguments **Arguments**: $ARGUMENTS | Argument | Effect | |----------|--------| | (none) | **Light mode** (default): Route mapping + user flows, single summary file | | `[repo]` | Scan specified repo (applies to both modes) | | `--full` | **Full mode**: All detection steps, 7 output files (current behavior) | **Mode determination:** - If `$ARGUMENTS` contains `--full` as a standalone token → set `run_depth = "full"` - Otherwise → set `run_depth = "light"` Strip `--full` token from arguments. Set `repo_path` to remaining arguments (or current working directory if empty). ## Thinking Mode **If `run_depth == "full"`:** ultrathink **If `run_depth == "light"`:** megathink Use extended reasoning for: - Route/screen mapping from framework-specific patterns - Journey flow construction from navigation patterns - Nielsen heuristic assessment from code signals - Pain-point inference from error handling patterns ## Step 0: Detect Platforms **Purpose**: Auto-detect platform structure and check for UI/TUI presence before UX analysis. Use **Glob** and **Bash** to identify platform folders (same patterns as detect-dev - see detect-dev Step 0 for full platform patterns and disambiguation rules). ### Platform Detection 1. **Check for monorepo markers**: `pnpm-workspace.yaml`, `lerna.json`, `nx.json`, `turbo.json` 2. **List top-level directories**: Exclude `node_modules`, `.git`, build outputs 3. **Match against platform patterns**: Apply disambiguation rules 4. **Handle detection results**: - No platforms → Single-platform: `platforms = [{ name: 'all', path: '.' }]` - Platforms detected → Multi-platform: Ask user to select all or specific platforms ### UI/TUI Presence Check (UX Audit Applicability) For each platform, check for UI or TUI (terminal UI) indicators: ```bash # Check for UI component files ui_files=$(find {platform.path} -type f \( -name "*.jsx" -o -name "*.tsx" -o -name "*.vue" -o -name "*.svelte" \) 2>/dev/null | head -n 1) # Check for TUI libraries (blessed, ink, bubbletea, etc.) tui_detected=$(grep -r "blessed\|ink\|bubbletea\|charm" {platform.path}/package.json {platform.path}/go.mod 2>/dev/null) if [ -z "$ui_files" ] && [ -z "$tui_detected" ]; then # No UI/TUI files detected - UX analysis not applicable platform_has_ui = false else platform_has_ui = true fi ``` **Platform applicability:** | Platform Type | UX Expected | If No UI/TUI Found | |---------------|-------------|---------------------| | web, mobile, androidtv, ios, android, desktop | Yes | Report as finding (unexpected) | | backend, api, services | Conditional | Report "Not Applicable" (expected, unless admin UI detected) | | cli, cmd | Conditional | Full analysis if TUI detected, otherwise "Not Applicable" | ### Analysis Loop For each platform in platforms: 1. Set `current_platform = platform.name` 2. Set `base_path = platform.path` 3. **Check UI/TUI presence** using the check above 4. If `platform_has_ui == false` and platform is backend/cli: - Skip Steps 1-7 (detection steps) - Go directly to Step 8 with "Not Applicable" findings 5. If `platform_has_ui == true` or platform is expected to have UI: - Run detection steps per `run_depth`: - **If `run_depth == "full"`:** Run Steps 1-7 scoped to `base_path` - **If `run_depth == "light"`:** Run Steps 1 and 4 only scoped to `base_path` (skip Steps 2, 3, 5, 6, 7) 6. Use platform-specific output paths in Step 9 **"Not Applicable" Findings Structure**: When a platform has no UI/TUI and UX analysis is not applicable, create minimal output files with this finding: ```yaml --- findings_summary: critical: 0 high: 0 medium: 0 low: 0 informational: 1 overall_score: 10.0 # Perfect score (nothing to assess) --- ## Executive Summary No UI/TUI detected for platform '{platform}'. UX audit (route mapping, user flows, heuristic assessment) is not applicable to this platform type. ## Findings ### E-UX-{PLATFORM}-001: No UI/TUI Detected **Severity**: Informational **Confidence**: Confirmed (1.0) **Description**: Platform '{platform}' does not contain UI components (.jsx, .tsx, .vue, .svelte) or TUI libraries. UX analysis (journeys, personas, heuristics, accessibility) is not applicable to this platform type. **Evidence**: ```yaml evidence: id: E-UX-{PLATFORM}-001 type: absence confidence: 1.0 method: glob-pattern-match description: "No UI/TUI files found in {platform.path}" ``` ``` **Note**: If single-platform mode (`platform.name == 'all'`), output paths have NO suffix. If multi-platform mode, output paths include `-{platform}` suffix. **Precedence**: N/A handling (platform_has_ui checks) always takes priority over run_depth gates. If `platform_has_ui == false`, skip ALL detection steps regardless of run_depth. ## Step 1: Route / Screen Mapping Detect framework and extract routes: ### Framework-Specific Route Extraction **React Router**: - Grep: `useRoutes(`, ` at least 2 persona types - **Admin/dashboard routes** -> admin/power user persona - **Onboarding flows** -> new user persona - **API-only routes** -> developer/integrator persona - **Settings/profile routes** -> returning user persona Mark all personas as **Tentative** confidence — these are inferred from code structure, not validated user research. ## Step 3: Infer Jobs-to-be-Done (JTBD) From features and flows detected: - Group related routes into functional areas (auth, billing, content, settings) - For each area, construct JTBD statement: "When {situation}, I want to {motivation}, so I can {expected outcome}" - Link to route evidence Mark all JTBD as **Tentative** — inferred from code, not user research. ## Step 4: Map User Flows Trace navigation paths through the application: - Detect navigation components: ` B[Shipping] --> C[Payment] --> D[Confirmation] ``` **If `run_depth == "light"`:** Skip Steps 5-7. Proceed directly to Step 8 (Present Detection Summary). ## Step 5: Detect Pain Points Scan for UX friction signals: ### Error Handling Patterns - Grep: ``, ``, ``, status messages, optimistic updates | | 2 | **Match between system and real world** | Domain terminology consistency in component names, labels, and copy | | 3 | **User control and freedom** | Undo patterns, cancel buttons, back navigation, `useNavigate(-1)`, confirmation dialogs | | 4 | **Consistency and standards** | Component naming conventions, prop patterns, shared UI components, design token usage | | 5 | **Error prevention** | ``, `validate()`, type constraints, `disabled` states, `maxLength` | | 6 | **Recognition rather than recall** | Navigation labels, breadcrumbs, search, autocomplete, recent items, `