Token导航 LogoToken导航TokenDH.com
研究检索敏感数据github未标认证来源可访问clear审计未展示

sentry-react-setupSentry React 设置

Agent Skill

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

总安装

857

周安装

35

GitHub Stars

公开资料未说明

下载量

274
CodexClaudeCursorGemini CLI

安装说明

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

GitHub

来源数

2

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

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

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

命令行安装

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

AgentSkills.tonpx skills
npx skills add getsentry/agent-skills --skill "sentry-react-setup"

简介

协助React、Next.js、Vue等前端框架的组件开发与样式调试。

  • 适合让Agent生成UI片段、审查布局问题或整合Tailwind设计系统。
  • 结合项目路由结构输出完整页面代码,而非孤立组件示例。
  • 涉及CSS改动时应配合本地构建命令验证视觉效果。
  • 注意:第三方库版本冲突可能导致运行时错误,修改前建议锁定依赖版本。

SKILL.md

Sentry React Setup

Install and configure Sentry in React projects.

Invoke This Skill When

  • User asks to "add Sentry to React" or "install Sentry" in a React app
  • User wants error monitoring, logging, or tracing in React
  • User mentions "@sentry/react" or React error boundaries

Important: The configuration options and code samples below are examples. Always verify against docs.sentry.io before implementing, as APIs and defaults may have changed.

Install

npm install @sentry/react --save

Configure

Create instrument.js in your project root (must be imported first in your app):

import * as Sentry from "@sentry/react";

Sentry.init({
  dsn: "YOUR_SENTRY_DSN",
  sendDefaultPii: true,

  // Tracing + Session Replay
  integrations: [
    Sentry.browserTracingIntegration(),
    Sentry.replayIntegration(),
  ],
  tracesSampleRate: 1.0,
  tracePropagationTargets: [/^\//, /^https:\/\/yourserver\.io\/api/],
  replaysSessionSampleRate: 0.1,
  replaysOnErrorSampleRate: 1.0,

  // Logs
  enableLogs: true,
});

Import First in Entry Point

// src/index.js or src/main.jsx
import "./instrument";  // Must be first!
import App from "./App";
import { createRoot } from "react-dom/client";

const root = createRoot(document.getElementById("app"));
root.render(<App />);

Error Handling

React 19+

Use error hooks with createRoot:

import { createRoot } from "react-dom/client";
import * as Sentry from "@sentry/react";

const root = createRoot(document.getElementById("app"), {
  onUncaughtError: Sentry.reactErrorHandler(),
  onCaughtError: Sentry.reactErrorHandler(),
  onRecoverableError: Sentry.reactErrorHandler(),
});

React <19

Use ErrorBoundary component:

import * as Sentry from "@sentry/react";

<Sentry.ErrorBoundary fallback={<p>An error occurred</p>}>
  <MyComponent />
</Sentry.ErrorBoundary>

Router Integration

RouterIntegration
React Router v7Sentry.reactRouterV7BrowserTracingIntegration
React Router v6Sentry.reactRouterV6BrowserTracingIntegration
React Router v4/v5Sentry.reactRouterV5BrowserTracingIntegration (shared for both)
TanStack RouterSee TanStack Router docs

Redux Integration (Optional)

import * as Sentry from "@sentry/react";
import { configureStore } from "@reduxjs/toolkit";

const store = configureStore({
  reducer,
  enhancers: (getDefaultEnhancers) =>
    getDefaultEnhancers().concat(Sentry.createReduxEnhancer()),
});

Source Maps

Upload source maps for readable stack traces:

npx @sentry/wizard@latest -i sourcemaps

Environment Variables

SENTRY_DSN=https://xxx@o123.ingest.sentry.io/456
SENTRY_AUTH_TOKEN=sntrys_xxx  # Used by sentry-cli / source maps, not the SDK
SENTRY_ORG=my-org              # Used by sentry-cli, not the SDK
SENTRY_PROJECT=my-project      # Used by sentry-cli, not the SDK

Note: The SDK reads SENTRY_DSN automatically. If using Create React App, prefix with REACT_APP_; for Vite, use VITE_. SENTRY_AUTH_TOKEN/ORG/PROJECT are used by sentry-cli for source map uploads, not by the browser SDK.

Verification

Add test button to trigger error:

<button onClick={() => { throw new Error("Sentry Test Error"); }}>
  Test Sentry
</button>

Troubleshooting

IssueSolution
Errors not capturedEnsure instrument.js is imported first
Source maps not workingRun sourcemaps wizard, verify auth token
React Router spans missingAdd correct router integration for your version

适合场景

01

用户想查找某类 Agent Skill 时

02

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

03

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

04

需要参考平台分布和安装热度时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

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

能力 4

补充不同宿主或平台的使用分布数据

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

平台分布

Claude Code

28.56%
按下载量换算78

Cursor

23.92%
按下载量换算66

OpenCode

16.91%
按下载量换算46

Codex

12.64%
按下载量换算35

Antigravity

6.64%
按下载量换算18

Gemini CLI

3.51%
按下载量换算10

安全审计

暂无安全审计结果可展示。

权限和风险

敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

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

来源信息

继续浏览同类 Skills