ai-ux-patterns/SKILL.md
UX design patterns for AI-powered features — loading states, streaming display, confidence indicators, progressive disclosure, error recovery, human-in-the-loop controls, usage/budget display, and feedback collection. Invoke during UI design for...
npx skillsauth add peterbamuhigire/skills-web-dev ai-ux-patternsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
ai-ux-patterns or would be better handled by a more specific companion skill.SKILL.md first, then load only the referenced deep-dive files that are necessary for the task.AI features fail the user more often than traditional software. They are slow, sometimes wrong, and opaque. These patterns manage user expectations, build trust, and reduce frustration — without making the AI feel like a gimmick.
Core principle: AI should feel like a capable colleague, not a magic button.
AI responses take 2–8 seconds. Never show a blank screen.
Immediate (0ms): Show skeleton placeholder with "Analysing your data..."
Early (500ms): Animate a progress indicator specific to the task
Mid (2s): If streaming: show first tokens as they arrive
Complete: Replace skeleton with result; fade in smoothly
Android (Jetpack Compose):
when (uiState) {
is AIState.Idle -> AIPromptButton(onClick = { vm.generate() })
is AIState.Loading -> AISkeletonCard(label = "Analysing sales data...")
is AIState.Streaming -> AIStreamingText(text = uiState.partial)
is AIState.Success -> AIResultCard(result = uiState.result, onFeedback = vm::submitFeedback)
is AIState.Error -> AIErrorCard(message = uiState.message, onRetry = vm::retry)
is AIState.Gated -> AIUpgradePrompt(tier = uiState.requiredTier)
}
Web (PHP/Blade + Alpine.js):
<div x-data="aiFeature()" x-init="init()">
<template x-if="state === 'idle'">
<button @click="generate()" class="btn-ai">Generate Summary</button>
</template>
<template x-if="state === 'loading'">
<div class="ai-skeleton animate-pulse">Analysing your data...</div>
</template>
<template x-if="state === 'done'">
<div class="ai-result" x-text="result"></div>
</template>
<template x-if="state === 'gated'">
<div class="ai-upgrade-banner">Upgrade to AI Growth to use this feature.</div>
</template>
</div>
Stream responses token-by-token for chat and long-form output. Eliminates the "waiting for a response" problem.
Rules:
Key UX detail: Label the result clearly as AI-generated. Use a subtle AI badge (✦ or a model icon), never pretend the output is from a human.
Show confidence level when the AI makes a prediction or recommendation.
┌─────────────────────────────────────────┐
│ ✦ AI Risk Assessment │
│ Student: Aisha Nakato │
│ │
│ Risk Level: ████████░░ HIGH │
│ Confidence: ███████░░░ Medium │
│ │
│ Reason: Attendance below 60% in last │
│ 4 weeks; 3 missed assignments. │
│ │
│ [Review] [Dismiss] [Send Alert] │
└─────────────────────────────────────────┘
Confidence levels:
Do not display raw probability scores to end users. Map to High / Medium / Low.
Match control level to action severity.
| Action | Control Pattern | |--------|----------------| | View summary / report | Auto-display. No confirmation needed. | | Accept recommendation | "Accept" / "Dismiss" buttons. One click. | | Send alert to user | Confirmation dialog: "Send risk alert to Aisha's guardian?" | | Approve/reject financial action | Full review screen + typed confirmation ("Type CONFIRM to approve") | | Irreversible action | Disabled by AI — human must initiate separately. |
Anti-pattern: Never let AI take any action that cannot be undone without a confirmation step.
Design error states that feel helpful, not broken.
| Error | User-Facing Message | Action | |-------|--------------------|----| | Timeout | "Analysis is taking longer than expected." | Auto-retry once; then show retry button | | Invalid output | "We couldn't generate a result this time." | Retry button + "Report issue" link | | Budget exceeded | "Your AI usage limit for this month has been reached. Contact your administrator to increase your limit." | Link to admin panel | | Module not active | "This feature requires the AI add-on. Contact your system administrator." | No upgrade link (admin decides) | | API provider down | "AI analysis is temporarily unavailable. Your request has been queued." | Show queue confirmation |
Rules:
Tenants that pay for AI want visibility into what they are spending.
✦ AI Usage this month
████████░░ 82% of your allocation used
[18% remaining — resets in 11 days]
Show this in user settings or profile. Not on every screen.
Columns:
Show a tenant-level totals row. Include a trend chart (this month vs last month).
Columns:
Alert row: tenants at > 80% budget consumption.
AI improves with feedback. Collect it unobtrusively.
┌─────────────────────────────────────────┐
│ ✦ AI Sales Summary — Today │
│ Total sales UGX 2,450,000. Top item: │
│ Maize flour (340 units). 3 stockouts │
│ flagged for reorder. │
│ │
│ Was this useful? 👍 👎 │
└─────────────────────────────────────────┘
ai_feedback_log(response_id, user_id, rating, reason, created_at).AI features are invisible until users know they exist.
| Anti-Pattern | Problem | Fix | |-------------|---------|-----| | Blank white screen while AI loads | User thinks app crashed | Show skeleton + loading message immediately | | Raw JSON shown to user | Confusing; breaks trust | Always transform output before display | | "AI says to do X" with no explanation | No trust basis | Always show reason + data points used | | One-click irreversible AI actions | Catastrophic if wrong | Add confirmation gate | | AI badge on non-AI features | Misleading | Only badge genuine AI-generated content | | Hiding AI errors silently | User doesn't know result is missing | Always show a graceful error state | | Prompt text visible to users | Confusing | Keep prompts server-side only |
See also:
ai-feature-spec — Output schema that drives these UX statesai-architecture-patterns — Gate state that triggers upgrade promptai-metering-billing — Data behind the usage dashboardux-for-ai — Deeper AI trust and transparency principlesai-slop-prevention — Avoiding low-quality AI output in UIdata-ai
Use when adding AI-powered analytics to a SaaS platform — semantic search over business data, natural language queries, trend detection, anomaly alerts, and AI-generated insights for dashboards. Covers embeddings, NL2SQL, and per-tenant analytics...
data-ai
Design AI-powered analytics dashboards — what metrics to show, how to display AI predictions and confidence, drill-down patterns, KPI cards, trend visualisation, AI Insights panels, export design, and role-based dashboard variants. Invoke when...
development
Use when designing, building, reviewing, or upgrading production software systems that must be secure, performant, maintainable, scalable, and user-centered. Apply before writing specs, code, architecture, APIs, databases, mobile apps, SaaS platforms, or ERP systems.
development
Professional web app UI using commercial templates (Tabler/Bootstrap 5) with strong frontend design direction when needed. Use for CRUD interfaces, dashboards, admin panels with SweetAlert2, DataTables, Flatpickr. Clone seeder-page.php, use...