agentleFS
kienbui1995kienbui1995/magic-powers/skills/ai-product-design/SKILL.md

ai-product-design

Skill0 starsChanged 8 months agoMITView on GitHub

Use when productizing AI features for end users — UX patterns for AI, streaming, loading states, error handling, fallback design, reliability, and responsible AI disclosure.

  • Sends data out

2 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

9 rules. About 0 are common, 5 are distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈5

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Never claim AI is human when directly asked

    line 89
  2. Distinctive:

    Always for factual claims (dates, numbers, names)

    line 163
  3. Very specific:

    Always for medical/legal/financial content

    line 164
  4. Distinctive:

    Always when user can verify the underlying source

    line 166
  5. Distinctive:

    No fallback when AI fails (hard dependency = brittle feature)

    line 228
  6. Distinctive:

    No feedback mechanism (users can't signal quality)

    line 231
  7. Very specific:

    Use with ai-safety-guardrails for output safety before showing to user

    line 236
  8. Very specific:

    Use with llm-observability to monitor the metrics defined above

    line 237
  9. Very specific:

    Use prompt-engineering to improve acceptance rate and reduce regenerations

    line 238

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

AI Product Design

When to Use

  • Designing UX for a chat, copilot, or AI-assisted feature
  • Handling streaming responses, latency, and partial outputs
  • Designing fallbacks when AI fails or is unavailable
  • Writing AI disclosure and user trust patterns
  • Planning reliability targets for an AI feature

Core Jobs

1. AI UX Patterns

Pattern                  When to use
──────────────────────────────────────────────────────────
Progressive disclosure   Show AI suggestion; user confirms before applying
Streaming response       Show tokens as they arrive (< 2s to first token)
Skeleton loaders         For non-streaming (show structure while waiting)
Confidence indicators    Show when AI is uncertain (avoid false confidence)
Thumbs up/down           Inline feedback for quality signal + fine-tuning data
Edit in place            Let user correct AI output (reduces friction)
Regenerate               Always offer retry with optional guidance
Suggested follow-ups     Guide users toward productive next steps

2. Streaming Implementation

// Frontend streaming pattern (React)
const [output, setOutput] = useState('');
const [isStreaming, setIsStreaming] = useState(false);

async function callAI(prompt) {
  setIsStreaming(true);
  setOutput('');

  const response = await fetch('/api/ai', {
    method: 'POST',
    body: JSON.stringify({ prompt }),
  });

  const reader = response.body.getReader();
  const decoder = new TextDecoder();

  while (true) {
    const { done, value } = await reader.read();
    if (done) break;
    setOutput(prev => prev + decoder.decode(value));
  }
  setIsStreaming(false);
}

3. Error Handling & Fallbacks

AI Error Type          User-facing response
────────────────────────────────────────────────────────
Rate limit             "High demand right now. Try in 30 seconds." + auto-retry
Model timeout          Show partial response + "Continue?" option
Safety refusal         "I can't help with that. Try rephrasing or [alternative]."
Low confidence         Show output with disclaimer + "Verify this information"
Total AI failure       Graceful degradation to manual workflow

4. Reliability Design

  • SLA target for AI features: 200ms to first token (streaming) or 3s total
  • Circuit breaker: fall back to cached/manual if AI error rate > 5%
  • Caching: cache identical prompt+context combos (reduces cost + latency)
  • Timeout: set explicit timeouts (10-30s max); never block UI indefinitely
  • Queue: for batch operations, show progress not spinner

5. Responsible AI Disclosure

Required disclosures (per EU AI Act + emerging standards):

  • Label AI-generated content clearly ("Generated by AI")
  • Inform users when talking to AI vs human
  • Provide opt-out for AI features
  • Explain data usage for AI personalization
  • Never claim AI is human when directly asked

6. Metrics to Track for AI Features

User-facing:
  Task completion rate (with vs without AI)
  Time-to-complete (AI should save time)
  Acceptance rate (how often users keep AI output)
  Edit rate (how much users modify AI output)
  Opt-out rate (users who disable AI feature)

Quality:
  Thumbs up / down ratio
  Regeneration rate (proxy for quality)
  Error rate by type (timeout, refusal, safety)

Agent UX Patterns

Showing agent work to users requires different UX than single-call AI:

Displaying agent progress:

┌─────────────────────────────────────────┐
│ 🤖 Researching your question...         │
│                                         │
│ ✅ Searched documentation (0.8s)        │
│ ✅ Found 3 relevant sections (0.3s)     │
│ ⏳ Analyzing and synthesizing...        │
│                                         │
│ Step 3 of 4 — ~10s remaining           │
└─────────────────────────────────────────┘

Agent UX principles:

  • Show steps in real-time (users trust agents they can see working)
  • Reveal tools used: "I searched 3 sources" builds transparency
  • Show intermediate results progressively (don't wait until full completion)
  • Provide cancel option — users need control over long-running agents
  • On failure: explain what was tried before failing ("I searched docs, tried 2 approaches, couldn't find...")

Displaying tool use transparently:

Agent used: 🔍 web_search("Q3 revenue report 2024")
Agent used: 📄 read_file("annual_report.pdf")
Agent used: 🧮 calculate(formula="revenue * 0.15")

Collapsible by default — show on hover/expand for curious users.

Citation & Attribution

For RAG-generated content, attribution builds trust:

Answer: The product launch is scheduled for Q2 2025.

Sources used:
  [1] Product Roadmap 2025.pdf — p.3: "Q2 2025 launch target"
  [2] Engineering Timeline.xlsx — Sheet: Milestones

Implementation:

// Track citations during RAG generation
const response = await generateWithCitations(query, retrievedChunks);
// response: { answer: "...", citations: [{source, page, quote}] }

// Render with inline citation markers
renderWithCitations(response.answer, response.citations);
// → "The launch is scheduled for Q2 [1]" with expandable citation [1]

When to show citations:

  • Always for factual claims (dates, numbers, names)
  • Always for medical/legal/financial content
  • Optional for stylistic/creative responses
  • Always when user can verify the underlying source

Key Outputs

  • UX spec: streaming behavior, loading states, error messages, fallback flow
  • Reliability design: circuit breaker thresholds, timeout values, caching strategy
  • Disclosure copy: AI labels, opt-out mechanism, data usage statement
  • Metrics dashboard definition: acceptance rate, task completion, regeneration rate

Accessibility & Mobile

Accessibility for AI-specific UI elements:

// Streaming text — announce completion to screen readers
<div 
  role="log"               // live region for screen readers
  aria-live="polite"       // don't interrupt, announce when idle
  aria-label="AI response"
>
  {streamingText}
</div>

// Loading state — meaningful label, not just spinner
<div role="status" aria-label="AI is generating a response, please wait">
  <Spinner />
  <span className="sr-only">Generating response...</span>
</div>

// Confidence indicator — explain what percentage means
<span 
  title="AI confidence: 85% - This answer is likely accurate but verify for important decisions"
  aria-label="85% confidence"
>
  ●●●●○
</span>

Mobile patterns:

  • Streaming on mobile: throttle updates to 100ms (not every token) — reduces reflow
  • Loading states: skeleton screens better than spinners on small screens
  • Error messages: use native alert dialogs (not toasts) on mobile — more visible
  • Latency expectation: mobile users tolerate 5-8s more than desktop users (2-3s)
  • Offline handling: queue AI requests when offline, process when reconnected

Internationalization of AI responses:

// AI error messages need translation
const AI_ERROR_MESSAGES = {
  rate_limit: t('ai.error.rateLimitMessage'),        // localized
  timeout: t('ai.error.timeoutMessage'),
  safety_refusal: t('ai.error.safetyMessage'),
};

// RTL support for streaming text
<div dir="auto" lang={userLocale}>  {/* auto-detects RTL */}
  {streamingText}
</div>

Anti-Patterns

  • Blocking UI while waiting for AI response (always show progress)
  • No fallback when AI fails (hard dependency = brittle feature)
  • Hiding that content is AI-generated (trust violation)
  • Treating AI output as ground truth without user verification step
  • No feedback mechanism (users can't signal quality)
  • Same spinner for 200ms vs 30s operations (calibrate expectation)

Integration

  • Use with ai-safety-guardrails for output safety before showing to user
  • Use with llm-observability to monitor the metrics defined above
  • Use prompt-engineering to improve acceptance rate and reduce regenerations

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.