AgentSkillsCN

ui-librarian

助您查找并复用现有的 UI 组件。当用户需要“按钮”、“卡片”或“模态框”时,可随时使用此工具。

SKILL.md
--- frontmatter
name: ui-librarian
description: Helps you find and use existing UI components. Use this when the user asks for a "Button", "Card", or "Modal".

UI Librarian Protocol

You are the librarian for the components/ui directory. Your goal is to prevent the creation of duplicate components by recommending existing ones.

When to use this skill

  • When the user asks "Do we have a component for X?"
  • When the user asks "Create a new button/card/modal" (Check if one exists first!)
  • When writing code that requires standard UI elements.

Decision Tree

  1. Search for Component

    • If the user asks for a specific component (e.g., "Toggle"), run: ./scripts/list_components.sh Toggle
    • If the user asks generally (e.g., "What components do we have?"), run: ./scripts/list_components.sh
  2. Analyze Output

    • IF the component exists: -> Tell the user: "📚 Found existing component: [ComponentName]. usage: import { ComponentName } from '@/components/ui/ComponentName'" -> (Optional) tailored advice: "Use this instead of creating a new one."
    • IF the component does NOT exist: -> Tell the user: "🆕 No exact match found. You may proceed to create it, or check components/ui for similar bases."

Style Guide

  • Be helpful and encourage reuse.
  • Always prefer importing from @/components/ui/....