Communitygithub.com

ComeOnOliver/skillshub

集成 Sentry、Rollbar 等错误追踪服务,提供错误边界、上下文和面包屑功能,用于生产环境的调试和监控。

skillshub 是什么?

该技能为 AI 代理提供全面的错误追踪集成能力。它支持多种流行平台(如 Sentry、Rollbar、Bugsnag、Airbrake 和 LogRocket)以及多种框架(包括 React、Vue、Angular、Express、Django、Rails 等)。技能涵盖从安装配置、添加错误边界、上下文和面包屑,到手动捕获异常、过滤敏感数据、设置源映射和性能监控等全流程。它通过 SKILL.md 文档提供结构化步骤和代码示例,帮助开发者快速在生产环境中部署可靠且可观察的错误跟踪系统。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/ComeOnOliver/skillshub/tree/HEAD/skills/aiskillstore/marketplace/crazydubya/error-tracking-integrator

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

错误追踪集成器

将错误追踪服务集成到应用程序中,以便更好地进行生产环境调试和监控。

使用时机

  • 用户要求进行错误监控或追踪
  • 设置生产环境错误日志
  • 用户提到“Sentry”、“错误追踪”、“崩溃报告”或“生产环境调试”\n

操作指南

1. 检测框架

识别应用框架:

  • React、Vue、Angular(前端)
  • Express、Fastify(Node.js 后端)
  • Django、Flask(Python)
  • Rails(Ruby)

2. 选择错误追踪服务

热门服务:

  • Sentry:最流行、功能全面
  • Rollbar:适用于后端
  • Bugsnag:跨平台
  • Airbrake:侧重于 Ruby
  • LogRocket:会话回放 + 错误

3. 安装与配置

Sentry(React 示例):

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

Sentry.init({
  dsn: process.env.REACT_APP_SENTRY_DSN,
  environment: process.env.NODE_ENV,
  tracesSampleRate: 1.0,
  integrations: [
    new Sentry.BrowserTracing(),
    new Sentry.Replay()
  ],
});

Sentry(Node.js/Express):

const Sentry = require("@sentry/node");

Sentry.init({
  dsn: process.env.SENTRY_DSN,
  environment: process.env.NODE_ENV,
  tracesSampleRate: 1.0,
});

// 请求处理中间件(放置于第一个中间件)
app.use(Sentry.Handlers.requestHandler());

// 错误处理中间件(放在所有路由之后,错误中间件之前)
app.use(Sentry.Handlers.errorHandler());

4. 添加错误边界(React)

import { ErrorBoundary } from '@sentry/react';

function App() {
  return (
    <ErrorBoundary fallback={<ErrorFallback />}>
      <YourApp />
    </ErrorBoundary>
  );
}

5. 添加上下文

用户上下文:

Sentry.setUser({
  id: user.id,
  email: user.email,
  username: user.username
});

标签:

Sentry.setTag("page_locale", "en-US");
Sentry.setTag("feature_flag", "new_ui");

上下文:

Sentry.setContext("order", {
  id: order.id,
  total: order.total,
  items: order.items.length
});

6. 面包屑

追踪导致错误的用户操作:

Sentry.addBreadcrumb({
  category: "auth",
  message: "用户已登录",
  level: "info"
});

Sentry.addBreadcrumb({
  category: "ui",
  message: "按钮已点击",
  data: { buttonId: "submit-form" }
});

7. 手动捕获错误

try {
  riskyOperation();
} catch (error) {
  Sentry.captureException(error, {
    tags: { section: "payment" },
    level: "error",
    extra: { orderId: order.id }
  });
}

8. 过滤敏感数据

擦除 PII(个人身份信息):

Sentry.init({
  beforeSend(event, hint) {
    // 不发送包含敏感数据的内容
    if (event.request?.data?.password) {
      delete event.request.data.password;
    }
    return event;
  },
  ignoreErrors: [
    // 忽略浏览器扩展错误
    /extensions\//i,
    /^Non-Error promise rejection/,
  ]
});

9. 源映射(生产环境)

启用源映射以获取可读的堆栈跟踪:

Webpack:

// webpack.config.js
module.exports = {
  devtool: 'source-map',
  plugins: [
    new SentryWebpackPlugin({
      org: "your-org",
      project: "your-project",
      authToken: process.env.SENTRY_AUTH_TOKEN,
      include: "./dist",
    }),
  ],
};

10. 告警配置

为以下内容设置告警:

  • 新问题
  • 问题回归(已解决的问题再次出现)
  • 错误率飙升
  • 关键错误(支付、认证失败等)

11. 性能监控

添加事务追踪:

const transaction = Sentry.startTransaction({
  name: "processOrder",
  op: "task"
});

try {
  await processOrder();
} finally {
  transaction.finish();
}

12. 最佳实践

  • 环境分离:为开发/预发布/生产环境使用不同的项目
  • 版本追踪:使用发布版本标记错误
  • 采样率:错误100%上报,性能降低采样
  • 团队通知:集成 Slack/邮件通知
  • 问题分配:自动分配给代码负责人
  • 错误分组:使用自定义指纹实现更好的分组
  • 不要记录敏感数据:PII、密码、令牌

支持文件

  • templates/sentry-react.js:React 集成模板
  • templates/sentry-node.js:Node.js 集成模板
  • templates/sentry-python.py:Python 集成模板

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

ComeOnOliver/skillshub

Create stunning, animation-rich HTML presentations from scratch or by converting PowerPoint files. Use when the user wants to build a presentation, convert a PPT/PPTX to web, or create slides for a talk/pitch. Helps non-designers discover their aesthetic through visual exploration rather than abstract choices.

ComeOnOliver/skillshub

Next.js 16+ 和 Turbopack — 增量打包、文件系统缓存、开发速度,以及何时使用 Turbopack 与 webpack。

ComeOnOliver/skillshub

SwiftUI architecture patterns, state management with @Observable, view composition, navigation, performance optimization, and modern iOS/macOS UI best practices.

ComeOnOliver/skillshub

See, Understand, Act on video and audio. See- ingest from local files, URLs, RTSP/live feeds, or live record desktop; return realtime context and playable stream links. Understand- extract frames, build visual/semantic/temporal indexes, and search moments with timestamps and auto-clips. Act- transcode and normalize (codec, fps, resolution, aspect ratio), perform timeline edits (subtitles, text/image overlays, branding, audio overlays, dubbing, translation), generate media assets (image, audio, video), and create real time alerts for events from live streams or desktop capture.

ComeOnOliver/skillshub

AI-assisted video editing workflows for cutting, structuring, and augmenting real footage. Covers the full pipeline from raw capture through FFmpeg, Remotion, ElevenLabs, fal.ai, and final polish in Descript or CapCut. Use when the user wants to edit video, cut footage, create vlogs, or build video content.

ComeOnOliver/skillshub

Next.js 15 애플리케이션을 위한 프론트엔드 개발 가이드라인. React 19, TypeScript, Shadcn/ui, Tailwind CSS를 사용한 모던 패턴. Server Components, Client Components, App Router, 파일 구조, Shadcn/ui 컴포넌트, 성능 최적화, TypeScript 모범 사례 포함. 컴포넌트, 페이지, 기능 생성, 데이터 페칭, 스타일링, 라우팅, 프론트엔드 코드 작업 시 사용.

ComeOnOliver/skillshub

Provides Tamagui patterns for config v4, compiler optimization, styled context, and cross-platform styling. Must use when working with Tamagui projects (tamagui.config.ts, @tamagui imports).

ComeOnOliver/skillshub

Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.

ComeOnOliver/skillshub

Create high-converting, visually distinctive landing pages. Use when building marketing pages, product launches, SaaS homepages, or any single-page conversion-focused website. Guides section-by-section composition with anti-AI-slop principles.

ComeOnOliver/skillshub

Auto-loaded context for Portfolio Buddy 2 development. Use for ANY task involving: React 19 development, TypeScript, portfolio analysis features, metrics calculations, trading strategy comparison, or working with the Portfolio Buddy 2 codebase. Contains tech stack, known issues, and architectural constraints.

ComeOnOliver/skillshub

Next.js development tooling via MCP. Inspect routes, components, build info, and debug Next.js apps. Use when working on Next.js applications, debugging routing, or inspecting app structure. NOT for general React or non-Next.js projects.

ComeOnOliver/skillshub

Implement UI using Shadcn MCP (atoms/theme) and 21st.dev MCP (complex sections). Use when adding buttons, layouts, or generating landing pages.

ComeOnOliver/skillshub

A conceptual skill for building an API client in Next.js that handles JWT tokens

ComeOnOliver/skillshub

Best practices and patterns for Next.js App Router, Server Actions, and Routing in this project.

ComeOnOliver/skillshub

The Design System, Theme, and UX rules for the Physical AI Hub.

ComeOnOliver/skillshub

Comprehensive frontend development skill for building modern, performant web applications using ReactJS, NextJS, TypeScript, Tailwind CSS. Includes component scaffolding, performance optimization, bundle analysis, and UI best practices. Use when developing frontend features, optimizing performance, implementing UI/UX designs, managing state, or reviewing frontend code.

ComeOnOliver/skillshub

This document captures learnings from fixing keyboard navigation issues when floating components (Select, DropdownMenu, Popover) have CSS open/close animations.

ComeOnOliver/skillshub

Build Next.js 16 applications with correct patterns and distinctive design. Use when creating pages, layouts, dynamic routes, upgrading from Next.js 15, or implementing proxy.ts. Covers breaking changes (async params/searchParams, Turbopack, cacheComponents) and frontend aesthetics. NOT when building non-React or backend-only applications.

ComeOnOliver/skillshub

Comprehensive Framer Motion animation library for React. Covers motion components, variants, gestures, page transitions, and scroll animations. Use when adding animations to React/Next.js applications.

ComeOnOliver/skillshub

Build interfaces that resonate, not just render. This skill enforces bold, intentional

相关技能