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

react-component-documentationReact component 文档

Agent Skill

用于辅助前端页面、组件、样式和交互逻辑的开发与维护。它适合让 Agent 生成或审查 React、Next.js、Vue、Tailwind、CSS 等相关代码,整理组件结构,或定位布局和性能问题。使用时需要结合项目现有设计系统、路由和构建方式,避免只生成孤立片段;涉及页面改动时,应配合本地预览和构建检查确认视觉效果。

总安装

264

周安装

11

GitHub Stars

43,662

下载量

88
CodexClaudeCursorGemini CLI

安装说明

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

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

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

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

命令行安装

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

skills.shnpx skills
npx skills add https://github.com/getsentry/sentry --skill react-component-documentation

简介

协助生成和维护 React 组件文档。

  • 支持 Props 说明与使用示例输出。
  • 适用于 Storybook 或内部文档系统。
  • 需确保 API 描述与实际实现一致。
  • 建议定期同步更新文档内容。react-component-documentation 属于研究检索类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

Component Documentation (MDX Stories)

Create a .mdx file for a Sentry component following the conventions in static/app/components/core/.

Step 0: Gather Editorial Content

Before writing, collect the information that makes documentation useful beyond mechanical structure. Ask the user these questions — or, if they aren't available, search existing usages in the codebase (Grep for the component name across static/app/views/) to infer answers.

QuestionWhere it surfaces in the docs
When should a developer reach for this component?Introduction or a ## When to use section
When should they NOT use it — and what should they use instead?> [!WARNING] callout or ## See Also with guidance
What does each variant/priority mean semantically?Description in each variant's section (e.g., "danger = destructive and irreversible")
What do developers commonly get wrong?> [!WARNING] callouts, icon-only accessibility notes, required prop reminders
Does this component require a specific parent, peer, or provider to work correctly?Noted in the introduction or a > [!NOTE] callout
Are there related components that overlap in purpose?## See Also with one-line guidance on when to prefer each
Which props and variants are worth documenting with a demo?See prop triage below

You don't need answers to all questions for every component. Skip ones that don't apply. The goal is to not write docs that only describe *how* to use the API — write docs that tell developers *when and why*.

Prop triage

Not every prop needs a demo section. Ask the user: "Which props should I document, and are there any variants or values with specific intended uses?"

If the user isn't available, read the component's TypeScript props and classify each:

TierDocument howExamples
Core — defines the component's primary behavior or appearanceFull ## section with live demo and semantic description of each valuepriority, variant, size
Modifier — adjusts a single aspect; values are self-explanatoryBrief mention with a demo, or a single combined demo with other modifiersdisabled, busy, icon, showIcon
Structural — controls layout or compositionDemo showing the before/after or compound usagesystem, expand, trailingItems
Internal / pass-through — not user-facingSkip entirelyclassName, style, ref, data-test-id

For enum props specifically, always ask: "Does each value have a distinct intended meaning, or are they purely visual?" If distinct (e.g., danger means destructive, not just red), document the semantics — not just the visual difference.

Step 1: Locate the Component

Find the component source file:

static/app/components/core/<category>/<component>/index.tsx
static/app/components/core/<category>/<component>/<component>.tsx

Read the component file to understand:

  • Props and their types
  • Exported named variants and sub-components (e.g., Component.SubComponent, export {TabList, TabPanels})
  • Available values for enum/union props
  • Default prop values

The MDX file goes next to the component: <component-dir>/<component>.mdx.

If the file already exists, read it first and update rather than overwrite.

Determining the import path:

  • Components in static/app/components/core/ are published as @sentry/scraps/<name>
  • All other components use the sentry-internal path: sentry/components/<path>

To confirm the exact @sentry/scraps package name and type-loader path, check an existing import in the component directory or a neighboring .mdx file — the type-loader path can be @sentry/scraps/<name> or @sentry/scraps/<name>/<name> depending on the package structure.

Step 2: Determine Frontmatter

---
title: <ComponentName>
description: <One sentence describing what it is and its primary purpose.>
category: <category> # See category table below; omit for principle docs
source: '@sentry/scraps/<component>' # or 'sentry/<path>' for product components
resources:
  figma: <figma-url> # Include if known
  js: https://github.com/getsentry/sentry/blob/master/static/app/components/core/<path>
  a11y: # Include for interactive components
    WCAG 1.4.3: https://www.w3.org/TR/WCAG22/#contrast-minimum
    WAI-ARIA <Pattern> Practices: https://www.w3.org/WAI/ARIA/apg/patterns/<pattern>/
---

Category values:

CategoryComponents
buttonsButton, ButtonBar, LinkButton
formsInput, Select, Checkbox, Radio, Slider, Switch
navigationTabs, SegmentedControl, Disclosure
statusAlert, Badge, Tag, Toast
layoutFlex, Grid, Stack, Container, Surface
typographyText, Heading, Prose
patternsdesign patterns, principles

For principle/pattern docs (no interactive component), use layout: document instead of category, and replace a11y: with reference: under resources.

Step 3: Write Imports

Follow this import order exactly:

// 1. External packages (react, etc.) — only if needed for examples
import {useState} from 'react';
// 5. Type-loader for auto-generated API docs (@sentry/scraps components only)
import documentation from '!!type-loader!@sentry/scraps/<component>';

// 3. @sentry/scraps component(s)
import {ComponentName} from '@sentry/scraps/<component>';

// 2. Sentry internals used in examples (icons, utils)
import {IconAdd, IconEdit} from 'sentry/icons';
// 4. Stories namespace (always last before type-loader)
import * as Storybook from 'sentry/stories';

export {documentation};

Omit any group that isn't needed. For product components (not in @sentry/scraps), omit the type-loader lines and document props manually in a table (see Step 5).

Complex export: If the component exports need filtering (e.g., to hide internal exports), use the explicit form instead of export {documentation}:

import RawDocumentation from '!!type-loader!@sentry/scraps/<component>';

export const documentation = {
  exports: RawDocumentation.exports,
  props: {
    ...RawDocumentation?.props,
    // Remove internal props if needed
  },
};

Step 4: Write Content

Section structure

Organize content by feature or user-facing variant, not by prop name:

  1. Introduction — 1-2 sentences, then a minimal usage code block (no demo wrapper)
  2. When to use *(if the component has meaningful alternatives or misuse risk)* — prose guidance, optionally a do/don't <Storybook.SideBySide>
  3. Feature sections — one ## per major feature: ## Sizes, ## Priorities, ## States, ## Composition
  4. Accessibility — WCAG claims and developer responsibilities
  5. See Also — links to related components with one-line guidance (optional)

Prefer titles like ## Sizes, ## Variants, ## States over ## The size prop.

When to use / See Also patterns:

## When to use

Use `<Alert>` for inline feedback within a page. For application-level banners that span the full viewport, use the `system` prop or reach for `<Toast>` if the message is transient.

> [!WARNING]
> Do not use `<Alert variant="danger">` for confirmation dialogs. Use a modal instead.
## See Also

- [LinkButton](/stories/core/linkbutton/) — use when the action navigates to a new URL
- [Link](/stories/core/link/) — use for inline text navigation, not standalone CTAs

Introduction pattern

To create a basic <component>, wrap content in `<ComponentName>`.

<ComponentName prop="value">Content</ComponentName>

### Sub-components

When a component exposes sub-components, show the full compound usage early:

<Tabs> is a compound component. Use <TabList> and <TabPanels> together:

<Tabs>
  <TabList>
    <TabList.Item key="tab1">Tab 1</TabList.Item>
  </TabList>
  <TabPanels>
    <TabPanels.Item key="tab1">Content 1</TabPanels.Item>
  </TabPanels>
</Tabs>
### Demo pattern

Every feature section must have a `<Storybook.Demo>` followed **immediately** by the matching code block:

Sizes

<brief description>

<Storybook.Demo> <Component size="sm">Small</Component> <Component size="md">Medium</Component> <Component size="lg">Large</Component> </Storybook.Demo>

<Component size="sm">Small</Component>
<Component size="md">Medium</Component>
<Component size="lg">Large</Component>
**Demo layout helpers:**

| Component | Use when |
|-----------|----------|
| `<Storybook.Demo>` | Default; horizontally arranges examples |
| `<Storybook.Grid>` | Grid layout for many variants |
| `<Storybook.SideBySide>` | Two-column comparisons (do/don't) |
| `<Storybook.TokenReference>` | Displaying design tokens (spacing, color, etc.) |
| `<Storybook.ColorReference>` | Displaying color tokens specifically |

### Accessibility section

Accessibility

This component meets WCAG 2.2 AA standards:

  • Color contrast: Meets 4.5:1 ratio (WCAG 1.4.3)
  • Keyboard navigation: <what interactions are supported>
  • Screen reader support: <ARIA role and labeling behavior>

Developer responsibilities

  • Always provide <required accessible prop> (e.g., aria-label or visible label text)
  • <other requirement>

### Callout syntax
[!TIP] Use the <prop> prop when you need <use case>.
[!WARNING] Avoid <pattern> because <reason>.
[!NOTE] <Additional context.>

## Step 5: Props Table (product components only)

For components not in `@sentry/scraps`, list props manually instead of using the type-loader:

Props

PropTypeDefaultDescription
variant`'info' \'warning' \'danger'`'info'Controls the visual style
size`'sm' \'md' \'lg'`'md'Controls the size

## Complete Example

title: Alert description: Alerts provide contextual feedback messages with different severity levels. category: status source: '@sentry/scraps/alert' resources: js: https://github.com/getsentry/sentry/blob/master/static/app/components/core/alert/index.tsx a11y: WCAG 1.4.3: https://www.w3.org/TR/WCAG22/#contrast-minimum WCAG 2.1.1: https://www.w3.org/TR/WCAG22/#keyboard WAI-ARIA Alert Pattern: https://www.w3.org/WAI/ARIA/apg/patterns/alert/


import {Alert} from '@sentry/scraps/alert';

import * as Storybook from 'sentry/stories';

import documentation from '!!type-loader!@sentry/scraps/alert';

export {documentation};

To create a basic alert, wrap a message in <Alert> and specify the appropriate type.

<Alert variant="info">This is an informational message</Alert>

## Types

Alerts come in five types: `muted`, `info`, `warning`, `success`, and `danger`.

<Storybook.Demo> <Alert.Container> Muted Info Warning Success Danger </Alert.Container> </Storybook.Demo>

<Alert.Container> <Alert variant="muted">Muted</Alert> <Alert variant="info">Info</Alert> <Alert variant="warning">Warning</Alert> <Alert variant="success">Success</Alert> <Alert variant="danger">Danger</Alert> </Alert.Container>


## Accessibility

This component meets [WCAG 2.2 AA](https://www.w3.org/TR/WCAG22/) standards:

- **Color contrast**: All variants meet 4.5:1 ratio (WCAG 1.4.3)
- **Keyboard accessible**: Fully operable via keyboard (WCAG 2.1.1)

## Checklist

Before completing, verify:

- MDX file is colocated next to the component source file (named `<component>.mdx`)
- Frontmatter has `title`, `description`, and `source`
- Imports follow the correct order (external → icons/utils → @sentry/scraps → Storybook → type-loader)
- Type-loader import is included for `@sentry/scraps` components
- Every `<Storybook.Demo>` is immediately followed by a matching code block
- Sections are organized by feature/variant, not by prop name
- Sub-components are documented with compound usage examples
- Accessibility section covers WCAG compliance and developer responsibilities
- No raw `<img>` tags (use `<Image>`), no inline SVGs, no styled components

适合场景

01

用户想查找某类 Agent Skill 时

02

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

03

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

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

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

能力 4

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

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

平台分布

Codex

33.22%
按下载量换算29

Claude

31.43%
按下载量换算28

Cursor

19.24%
按下载量换算17

Gemini CLI

9.53%
按下载量换算8

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

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

安装前确认

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

来源信息

继续浏览同类 Skills