Token导航 LogoToken导航TokenDH.com
研究检索需要联网github未标认证来源可访问许可证需确认审计通过

component-analysis成分分析

Agent Skill

component-analysis 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

8,926

周安装

264

GitHub Stars

1

下载量

3,152
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:component-analysis(成分分析)
来源仓库:https://github.com/ankish8/storybook-npm
仓库路径:skills/component-analysis
安装命令:
npx skills add https://github.com/ankish8/storybook-npm --skill 'Component Analysis'
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/ankish8/storybook-npm --skill 'Component Analysis'

简介

用于查找、检索和筛选相关信息,适合根据关键词快速定位候选结果。

  • 可结合来源仓库、安装命令和原始 README 继续核验具体用法。
  • 使用时需要确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。
  • 安装前建议确认权限范围和维护状态,以及是否会触发文件读写操作。
  • 适用于 Codex、Claude、Cursor、Gemini CLI 中的信息检索任务。

SKILL.md

Component Analysis Skill

This skill provides intelligent codebase analysis for component creation. It prevents duplication, suggests architectural improvements, and identifies reusable subcomponents.

When to Activate

Activate this skill when:

  • Creating a new component
  • User describes a UI element they need
  • Analyzing a Figma design
  • Planning component architecture
  • Deciding between new component vs variant

Analysis Steps

1. Component Existence Check — Deep Discovery

Build a Component Capability Map by scanning the entire component library:

a. Fetch ALL components:

Glob: src/components/ui/*.tsx (exclude __tests__/*, *.stories.tsx)
Glob: src/components/custom/*/*.tsx (exclude __tests__/*, *.stories.tsx)

b. Extract metadata per component using Grep:

  • export interface.*Props → props interfaces
  • variants: blocks → CVA variants and their names
  • export { or export const → public exports

c. Build and present a Capability Map:

| Component   | Location | Variants              | Key Props                |
|-------------|----------|-----------------------|--------------------------|
| Button      | ui/      | 7 variants, 4 sizes   | onClick, loading, leftIcon |
| Badge       | ui/      | 5 variants            | —                        |
| TextField   | ui/      | —                     | label, error, helperText |
| WalletTopup | custom/  | —                     | amounts, onPay, currency |

d. Match against new component:

  • Exact match: button.tsx exists → Component exists
  • Similar name: Looking for icon-button → Found button → Suggest variant
  • Functionality match: Looking for data-table → Found table → Suggest enhancement
  • Semantic similarity: Compare name AND description against capability map to catch non-obvious overlaps

2. Variant vs New Component Decision

Use this decision tree informed by the Capability Map:

Create a VARIANT when:

  • Component differs only in visual style (colors, sizes)
  • Component shares same structure and behavior
  • Component uses same props interface
  • The Capability Map shows an existing component with matching variants/props
  • Example: button with variant="icon" instead of new icon-button

Create a COMPOSITION when:

  • New component combines multiple existing components
  • The Capability Map shows several components that together form the new one
  • Example: user-settings-form composes form-modal + text-field + select-field + switch

Create a NEW COMPONENT when:

  • Component has different structure or behavior
  • Component needs different props interface
  • Component serves different purpose
  • No existing component in the Capability Map covers its functionality
  • Example: avatar is different from badge despite both being circular

Recommendation pattern:

Found existing component: `button` at src/components/ui/button.tsx

Capability Map excerpt:
| Component | Variants | Key Props |
|-----------|----------|-----------|
| Button | default, primary, secondary, destructive, outline, ghost, link | onClick, disabled, loading, leftIcon |

Analysis:
- Your "icon-button" differs only in having no text and centered icon
- It shares the same purpose (clickable action)
- It can use the same props (onClick, disabled, etc.)

Recommendation: Add a variant to `button` instead:

variant: {
  default: "...",
  primary: "...",
  icon: "h-10 w-10 p-0 justify-center items-center",  // NEW
}

This maintains consistency and reduces code duplication.

3. Subcomponent Identification

Analyze the component requirements and identify which existing components can be reused:

Form Components:

Requirement: "A form with name and email inputs"

Identified subcomponents:
✓ text-field (for name input with label)
✓ text-field (for email input with validation)
✓ button (for submit action)
✓ form-modal (if in a dialog)
✓ alert (for error messages)

Architecture:
- Composite component using existing primitives
- No need to create custom input components

Data Display Components:

Requirement: "A user profile card"

Identified subcomponents:
✓ typography (for name, role, description)
✓ badge (for status indicator)
✓ button (for action buttons)
✓ avatar (if available, else suggest creating)

Architecture:
- Container component with composition
- Uses existing UI primitives

Overlay Components:

Requirement: "A confirmation dialog with form"

Identified subcomponents:
✓ form-modal (provides dialog + form layout)
✓ text-field (for input fields)
✓ button (already included in form-modal)

Architecture:
- Use form-modal as base
- Add custom content inside

4. Component Category Detection

Determine the appropriate category for components.yaml:

CategoryWhen to UseExamples
coreEssential UI primitivesbutton, badge, typography
formForm inputs and controlsinput, select, checkbox, switch, text-field
dataData display componentstable, list, data-grid
overlayPopups, modals, menusdialog, dropdown-menu, tooltip, form-modal
feedbackStatus and notificationstag, alert, toast
layoutLayout and structureaccordion, page-header, tabs
customMulti-file complex componentsevent-selector, key-value-input

5. Dependency Analysis

Identify all dependencies for the component:

External dependencies:

dependencies:
  - "class-variance-authority"  # If using CVA
  - "clsx"  # If using cn()
  - "tailwind-merge"  # If using cn()
  - "lucide-react"  # If using icons
  - "@radix-ui/react-dialog@^1.1.15"  # If using Dialog
  - "@radix-ui/react-select@^2.2.6"  # If using Select

Internal dependencies (other components):

internalDependencies:
  - button  # If using Button component
  - input  # If using Input component
  - dialog  # If using Dialog component

6. Multi-File Structure Detection

Determine if component needs multiple files:

Single file components:

  • Simple primitives (Button, Badge, Input)
  • No internal state management
  • No complex sub-structures

Multi-file components:

  • Complex components with subcomponents (EventSelector, KeyValueInput)
  • Shared types across files
  • Multiple related components that work together

Multi-file structure:

src/components/custom/component-name/
├── component-name.tsx          # Main component (exported)
├── component-subpart.tsx       # Internal subcomponent
├── types.ts                    # Shared types
├── utils.ts                    # Helper functions
└── index.ts                    # Public exports

Analysis Output Format

Provide analysis in this structured format:

# Component Analysis: [ComponentName]

## Existence Check
- ❌ Component does not exist
- ✅ Similar component found: `button` at src/components/ui/button.tsx

## Recommendation
[CREATE VARIANT / CREATE NEW COMPONENT]

**Reasoning:**
[Explanation of decision]

## Identified Subcomponents

| Component | Location | Usage |
|-----------|----------|-------|
| text-field | src/components/ui/text-field.tsx | For labeled input fields |
| button | src/components/ui/button.tsx | For submit action |
| alert | src/components/ui/alert.tsx | For validation errors |

## Component Details

**Type:** [UI / Custom]
**Category:** [core / form / data / overlay / feedback / layout]
**Structure:** [Single file / Multi-file]

**Dependencies:**
- External: class-variance-authority, clsx, tailwind-merge
- Internal: button, text-field, alert

## Suggested Architecture

// Main component using identified subcomponents import { Button } from "./button" import { TextField } from "./text-field" import { Alert } from "./alert"

const Component = () => { return ( <div> <TextField label="Name" /> <TextField label="Email" type="email" /> {error && <Alert variant="destructive">{error}</Alert>} <Button type="submit">Submit</Button> </div> ) }


## Next Steps

1. Confirm architecture with user
2. Gather design context (Figma or manual)
3. Map colors to CSS variables
4. Generate component files
5. Create tests and stories

Examples

Example 1: Suggest Variant

Input: User wants to create "outlined-button"

Analysis:

# Component Analysis: OutlinedButton

## Existence Check
✅ Found: `button` at src/components/ui/button.tsx

## Recommendation
CREATE VARIANT

**Reasoning:**
The existing `button` component already has an `outline` variant:

variant: { default: "bg-primary text-primary-foreground", outline: "border border-input bg-background", // Already exists! // ... }


**Action:** Use existing `<Button variant="outline">` instead of creating new component.

Example 2: Create New Component

Input: User wants to create "avatar" component

Analysis:

# Component Analysis: Avatar

## Existence Check
❌ Component does not exist
✅ Similar: `badge` (circular shape) at src/components/ui/badge.tsx

## Recommendation
CREATE NEW COMPONENT

**Reasoning:**
While `badge` is circular, `avatar` serves a different purpose:
- Avatar displays user images with fallback
- Badge shows status indicators
- Different props (src, alt, fallback vs children)
- Different behavior (image loading vs static content)

## Identified Subcomponents
None - This is a primitive component

## Component Details
**Type:** UI
**Category:** core
**Structure:** Single file

**Dependencies:**
- External: class-variance-authority, clsx, tailwind-merge
- Internal: None

## Suggested Architecture

const avatarVariants = cva( "relative flex shrink-0 overflow-hidden rounded-full", { variants: { size: { xs: "h-6 w-6", sm: "h-8 w-8", md: "h-10 w-10", lg: "h-12 w-12", xl: "h-16 w-16", }, }, defaultVariants: { size: "md" }, } )

interface AvatarProps { src?: string alt?: string fallback?: string size?: "xs" | "sm" | "md" | "lg" | "xl" }

Example 3: Identify Subcomponents

Input: User wants to create "user-settings-form"

Analysis:

# Component Analysis: UserSettingsForm

## Existence Check
❌ Component does not exist

## Recommendation
CREATE NEW COMPONENT (Custom)

**Reasoning:**
This is an application-specific form, not a reusable primitive.
Should be created in `src/components/custom/`.

## Identified Subcomponents

| Component | Location | Usage |
|-----------|----------|-------|
| form-modal | src/components/ui/form-modal.tsx | Modal wrapper with save/cancel |
| text-field | src/components/ui/text-field.tsx | Name, email, phone inputs |
| select-field | src/components/ui/select-field.tsx | Timezone, language selects |
| switch | src/components/ui/switch.tsx | Notification toggles |
| button | src/components/ui/button.tsx | Included in form-modal |
| alert | src/components/ui/alert.tsx | Error/success messages |

## Component Details
**Type:** Custom
**Category:** custom
**Structure:** Single file (uses composition)

**Dependencies:**
- External: clsx, tailwind-merge
- Internal: form-modal, text-field, select-field, switch, alert

## Suggested Architecture

import { FormModal } from "@/components/ui/form-modal" import { TextField } from "@/components/ui/text-field" import { SelectField } from "@/components/ui/select-field" import { Switch } from "@/components/ui/switch" import { Alert } from "@/components/ui/alert"

const UserSettingsForm = ({ open, onOpenChange }) => { return ( <FormModal open={open} onOpenChange={onOpenChange} title="User Settings" onSave={handleSave} > <TextField label="Name" /> <TextField label="Email" type="email" /> <SelectField label="Timezone" options={timezones} /> <Switch label="Email notifications" /> {error && <Alert variant="destructive">{error}</Alert>} </FormModal> ) }

Best Practices

  1. Always search before suggesting creation - Avoid duplication
  2. Prefer variants over new components - Maintain consistency
  3. Identify ALL reusable subcomponents - Don't reinvent the wheel
  4. Consider component category - Organize properly
  5. Analyze dependencies - Keep dependency tree clean
  6. Suggest multi-file structure when needed - For complex components

Error Handling

  • No similar component found → Safe to create new component
  • Multiple similar components → Present options to user
  • Unclear if variant or new → Ask user for clarification
  • Missing dependency → Note in analysis and suggest adding

This skill ensures component library consistency, prevents duplication, and promotes proper architecture patterns.

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

35.21%
按下载量换算1,110

Claude

29.43%
按下载量换算928

Cursor

17.36%
按下载量换算547

Gemini CLI

9%
按下载量换算284

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills