Token导航 LogoToken导航

Agent Skill · 研究检索

component-preview(组件预览)

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

component-preview 是研究检索类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为操作浏览器;许可证信息还不明确,第三方扫描已通过,按安装量在研究检索类的 73,675 个 Skill 里排第 42,153。

总安装 1,102周安装 45GitHub Stars 7,136下载 353核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

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

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

命令行安装

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

skills.shnpx skills
npx skills add https://github.com/civitai/civitai --skill component-preview

这个 Skill 是做什么的

研究检索类 Skill 主要解决「找资料、核对事实、把来源整理清楚」的问题,通常会让助手先检索再总结。

用于在隔离环境中预览 React 组件,支持 Mantine v7 + Tailwind 样式。基于 Ladle(轻量 Storybook 替代方案),无需启动 dev server。适用于修改 UI 后快速查看效果、调试视觉问题或迭代组件。

需确保项目已配置 .ladle/components.tsx 和 .ladle/config.mjs。自动集成 MantineProvider 与主题,简化预览流程。

来源仓库内路径:skills/component-preview

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/civitai/civitai --skill component-preview;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要操作浏览器,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

component-preview 怎么安装?

在终端执行 npx skills add https://github.com/civitai/civitai --skill component-preview。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

component-preview 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

component-preview 需要什么权限?

权限级别是操作浏览器。该 Skill 可能涉及浏览器控制能力,使用时可能读取或操作网页内容,需要在受控环境中确认权限边界。

component-preview 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

component-preview 用的人多吗?

公开数据是累计安装 1,102 次,近一周安装 45 次,下载 353 次,GitHub 7,136 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

component-preview 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 第三方扫描已通过,常见的高风险行为没有命中。
  • 来源仓库有 7,136 星,维护活跃度相对可查。

先想清楚的地方

  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理研究检索类任务、又不想每次都手写提示词的人。

不太适合

  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

研究检索类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
find-skills

寻找技能 · Codex、Claude

31,199,81316,486操作浏览器MIT有提醒
self-improving-agent

自我改进 Agent · OpenClaw

16,464,0023,396接触敏感数据MIT-0通过
soultrace

灵魂追踪 · Codex、Claude

7,588,94412需要联网未明确有提醒
self-improving

自我完善 · OpenClaw

6,829,2841,046需要联网MIT-0通过
microsoft-foundry

微软代工厂 · Codex、Claude

6,614,144764调用外部服务未明确有提醒
component-preview

组件预览 · 本页

1,1027,136操作浏览器未明确通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

Component Preview

Preview React components in isolation using Ladle (lightweight Storybook alternative) with real Mantine v7 + Tailwind styling. No dev server needed.

When to Use

  • After modifying a UI component — proactively offer to preview it
  • When the user asks "show me what it looks like" or "generate a preview"
  • When debugging visual issues — create a story to reproduce and iterate
  • When reviewing component changes before committing

Prerequisites

Ladle is configured in the project root:

  • .ladle/components.tsx — Global provider with MantineProvider + theme
  • .ladle/config.mjs — Story discovery config
  • .ladle/vite.config.ts — Vite config with ~/ path alias + PostCSS

If these don't exist in the current worktree, copy them from main or create them. See Setup Reference below.

Workflow

1. Create/Update the Story

Create a .stories.tsx file near the component being previewed:

src/components/MyComponent/MyComponent.stories.tsx
src/pages/challenges/EligibleModels.stories.tsx

Story structure:

import { /* Mantine components */ } from '@mantine/core';
// Import the component or recreate the relevant JSX

// Mock data that represents realistic API responses
const mockData = [ ... ];

// Render the component with different states
function Preview({ data }) {
  return (
    <div style={{ width: 320 }}> {/* Constrain to realistic width */}
      <MyComponent data={data} />
    </div>
  );
}

/** Default state */
export const Default = () => <Preview data={mockData} />;

/** Empty state */
export const Empty = () => <Preview data={[]} />;

/** Loading or edge case states */
export const LongList = () => <Preview data={longMockData} />;

Important patterns:

  • Set a realistic width on the wrapper (e.g., 320px for sidebar, 600px for main content)
  • Copy the exact Mantine component props and Tailwind classes from the real component
  • Copy any inline styles props from the parent context (e.g., Accordion styles)
  • Use useComputedColorScheme and useMantineTheme if the component uses them
  • Create 2-4 variants showing different states (default, empty, single item, overflow)

2. Start Ladle

# Check if Ladle is already running
curl -s -o /dev/null -w "%{http_code}" http://localhost:61111/

# If not running, start it (from project root or worktree root)
cd <worktree-path>
npx ladle serve --port 61111 &
# Wait for it to be ready (~3-5 seconds)

Ladle auto-discovers stories matching src/**/*.stories.tsx.

3. Capture Screenshots

Use the browser-automation skill to capture cropped, padded screenshots:

# Create a browser session
node ~/.claude/skills/browser-automation/cli.mjs session http://localhost:61111 --name ladle

# Capture all story variants in dark and light themes
node ~/.claude/skills/browser-automation/cli.mjs run "
  const stories = [
    { name: 'default', path: 'my-component--default' },
    { name: 'empty', path: 'my-component--empty' },
  ];
  const themes = ['dark', 'light'];
  const dir = '<session-screenshots-dir>';

  for (const theme of themes) {
    for (const story of stories) {
      await page.goto('http://localhost:61111/?story=' + story.path + '&theme=' + theme + '&mode=preview');
      await page.waitForTimeout(800);
      const wrapper = page.locator('.ladle-story-wrapper');
      await wrapper.screenshot({ path: dir + '/crop-' + theme + '-' + story.name + '.png' });
    }
  }
" --label "Component preview screenshots" -s ladle

Story path format: The story path is derived from the file name and export name:

  • File: EligibleModels.stories.tsx, Export: Default -> path: eligible-models--default
  • File: ModelCard.stories.tsx, Export: WithBadge -> path: model-card--with-badge

Pattern: kebab-case filename + -- + kebab-case export name.

4. Present to User

  1. Show screenshots inline using the Read tool on the PNG files
  2. Open for the user if they want to see them in their image viewer: start "" "<path-to-screenshot>"
  3. Ask for feedback — "Does this look right? Want me to adjust anything?"
  4. Iterate — if they want changes, modify the component, re-capture, re-present

Handling Complex Components

Some components depend heavily on app context. When this happens:

Easy (just do it)

  • Presentational components (badges, cards, lists, accordions)
  • Components that only use Mantine + Tailwind
  • Components with simple props

Medium (mock the data)

  • Components that use tRPC data — extract the type and create mock objects
  • Components with images — use placeholder divs or null image fallbacks
  • Components with links — use <div> or <a href="#"> instead of Next.js <Link>

Hard (raise to user)

  • Components deeply coupled to multiple providers (auth, router, tRPC context)
  • Components using complex hooks that call APIs
  • Components with heavy CSS module dependencies

When encountering hard cases, tell the user:

"This component depends on [auth/router/tRPC context]. I can either: 1. Mock out the dependencies (more setup, more accurate) 2. Extract just the visual parts into the story (faster, close enough) 3. Skip the preview and we can check it on the dev server instead What would you prefer?"

Setup Reference

If Ladle isn't configured in the worktree, create these files:

.ladle/components.tsx

import { MantineProvider, createTheme, Modal } from '@mantine/core';
import type { GlobalProvider } from '@ladle/react';

import '@mantine/core/styles.layer.css';
import '../src/styles/globals.css';

// Theme subset from src/providers/ThemeProvider.tsx
const theme = createTheme({
  components: {
    Badge: {
      styles: { leftSection: { lineHeight: 1 } },
      defaultProps: { radius: 'sm', variant: 'light' },
    },
    ActionIcon: {
      defaultProps: { color: 'gray', variant: 'subtle' },
    },
    Tooltip: {
      defaultProps: { withArrow: true },
    },
  },
  colors: {
    dark: ['#C1C2C5','#A6A7AB','#8c8fa3','#5C5F66','#373A40','#2C2E33','#25262B','#1A1B1E','#141517','#101113'],
    blue: ['#E7F5FF','#D0EBFF','#A5D8FF','#74C0FC','#4DABF7','#339AF0','#228BE6','#1C7ED6','#1971C2','#1864AB'],
  },
  white: '#fefefe',
  black: '#222',
});

export const Provider: GlobalProvider = ({ children, globalState }) => (
  <MantineProvider
    theme={theme}
    defaultColorScheme={globalState.theme === 'dark' ? 'dark' : 'light'}
    forceColorScheme={globalState.theme === 'dark' ? 'dark' : 'light'}
  >
    <div className="ladle-story-wrapper" style={{ padding: 24, width: 'fit-content' }}>
      {children}
    </div>
  </MantineProvider>
);

.ladle/config.mjs

/** @type {import('@ladle/react').UserConfig} */
export default {
  stories: 'src/**/*.stories.tsx',
  defaultStory: '',
  viteConfig: '.ladle/vite.config.ts',
};

.ladle/vite.config.ts

import { defineConfig } from 'vite';
import path from 'path';

export default defineConfig({
  resolve: {
    alias: { '~': path.resolve(__dirname, '../src') },
  },
  css: {
    postcss: path.resolve(__dirname, '..'),
  },
});

Ensure Ladle is installed

pnpm add -D @ladle/react

Tips

  • Dark theme first — Civitai defaults to dark mode, so capture dark first
  • Constrain width — always set a width matching the real context (sidebar = ~320px, main content = ~600px, full page = ~1200px)
  • Copy parent styles — if the component lives inside an Accordion, Card, or other container, replicate those parent styles in the story
  • Keep stories temporary — stories for one-off reviews can be deleted after; stories for reusable components can stay
  • Ladle port — always use 61111 to avoid conflicts with dev server (3000) and other services

平台分布

Codex

33.63%
按下载量换算119

Claude

31.88%
按下载量换算113

Cursor

20.48%
按下载量换算72

Gemini CLI

9.04%
按下载量换算32

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

操作浏览器

该 Skill 可能涉及浏览器控制能力,使用时可能读取或操作网页内容,需要在受控环境中确认权限边界。

安装前确认

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

继续浏览同类 Skills