Token导航 LogoToken导航

Agent Skill · 前端设计

tracekit-react-sdk(tracekit React SDK 前端)

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

tracekit-react-sdk 是前端设计类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为接触敏感数据;许可证信息还不明确,第三方扫描有提醒项,按安装量在前端设计类的 10,216 个 Skill 里排第 10,088。

总安装 186周安装 8GitHub Stars 1下载 65核验 2026-05-01

安装说明

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

安装方式

通过对话安装

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

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

命令行安装

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

skills.shnpx skills
npx skills add https://github.com/tracekit-dev/tracekit-for-ai --skill tracekit-react-sdk

这个 Skill 是做什么的

前端设计类 Skill 关注页面结构、视觉规范和组件写法,输出通常是可运行的界面代码。

用于辅助前端页面、组件和样式开发。适合生成或审查 React、Next.js 和 CSS 相关代码时使用。需要结合项目现有设计系统和路由方式,避免生成孤立片段。

安装命令:npx skills add https://github.com/tracekit-dev/tracekit-for-ai --skill tracekit-react-sdk 涉及页面改动时应配合本地预览和构建检查确认效果

来源仓库内路径:skills/tracekit-react-sdk

上手步骤

4 步
  1. 1

    确认自己的宿主工具

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

  2. 2

    拿到安装命令

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

  3. 3

    安装后重启宿主

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

  4. 4

    按最小权限试用

    它需要接触敏感数据,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

tracekit-react-sdk 怎么安装?

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

tracekit-react-sdk 支持哪些 AI 工具?

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

tracekit-react-sdk 需要什么权限?

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

tracekit-react-sdk 是免费的吗?

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

tracekit-react-sdk 用的人多吗?

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

tracekit-react-sdk 安全吗?

第三方扫描有提醒项,说明存在需要人工确认的行为。安装前请打开源码看清它读了什么、联网到哪里。

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

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。

先想清楚的地方

  • 需要接触敏感数据,装到常用环境前要先评估影响面。
  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方扫描存在提醒项或未通过项,需要人工逐条确认。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

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

不太适合

  • 环境里有大量密钥、凭证,不方便给第三方 Skill 读取的人。
  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

前端设计类 Skill 对比

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

前端设计 · Codex、Claude

8,823,360126,072只读MIT通过
vercel-composition-patterns

Vercel 组合模式 · Codex、Claude

3,858,81625,893需要联网MIT通过
vercel-react-native-skills

Vercel React native skills 前端 · Codex、Claude

2,468,66425,878只读MIT通过
adapt

adapt 搜索 · Codex、Claude

2,027,04023,125操作浏览器未明确通过
bolder

bolder 分析 · Codex、Claude

2,004,28823,130只读未明确通过
tracekit-react-sdk

tracekit React SDK 前端 · 本页

1861接触敏感数据未明确有提醒

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

SKILL.md 原文

TraceKit React SDK Setup

Auth Bootstrap

Do not tell the user to go sign up, log in separately, or manually create an API key before setup. First check for existing TraceKit auth. If ~/.tracekitconfig does not contain the production profile or TRACEKIT_API_KEY is missing, apply the tracekit-auth skill first. Use ./scripts/run-tracekit-auth.sh status to check, then guide the user through the TraceKit email verification flow with register and verify. That flow signs the user into an existing account for that email or creates the account automatically, then saves the returned credentials for the rest of the setup.

When To Use

Use this skill when the user asks to:

  • Add TraceKit to a React application
  • Add observability or APM to a React app
  • Instrument a React project with error tracking or distributed tracing
  • Configure TraceKit API keys in a React project
  • Set up error boundaries with automatic error reporting
  • Add performance monitoring to a React app
  • Debug production React apps with live breakpoints

Not React? If the user is using Vue, Angular, Next.js, Nuxt, or a plain JS/TS project without a framework, use the corresponding skill instead.

Non-Negotiable Rules

  1. Never hardcode API keys in code. Always use environment variables or build-time injection (e.g., import.meta.env.VITE_TRACEKIT_API_KEY).
  2. Always include a verification step confirming errors and traces appear in https://app.tracekit.dev/traces.
  3. Always init TraceKit before any other application code - the provider must wrap the entire app at the root level.

Detection

Before applying this skill, detect the project type:

  1. Check for package.json - confirms this is a JavaScript/TypeScript project.
  2. Check for react-dom in dependencies or devDependencies - confirms this is a React project.
  3. Check for Next.js: If next is in dependencies, use the tracekit-nextjs-sdk skill instead.
  4. Detect build tool for env var pattern:

- CRA (react-scripts in dependencies) => REACT_APP_TRACEKIT_API_KEY via process.env - Vite (vite in devDependencies) => VITE_TRACEKIT_API_KEY via import.meta.env

  1. Check for TypeScript: tsconfig.json presence means use .tsx snippets.
  2. Only ask the user if react-dom is not found but React-like code exists.

Step 1: Environment Setup

Set the TRACEKIT_API_KEY environment variable. This is the only required secret.

Add to your .env file:

Vite projects:

VITE_TRACEKIT_API_KEY=ctxio_your_api_key_here

Create React App projects:

REACT_APP_TRACEKIT_API_KEY=ctxio_your_api_key_here

Where to get your API key:

  1. Log in to TraceKit
  2. Go to API Keys page
  3. Generate a new key (starts with ctxio_)

Do not commit real API keys. Use .env files, deployment secret managers, or CI variables.

Step 2: Install SDK

npm install @tracekit/react

Or with Yarn:

yarn add @tracekit/react

This installs the TraceKit React SDK which wraps @tracekit/browser with React-specific integrations: error boundaries, provider pattern, performance hooks, and router breadcrumbs. You only need this one package.

Step 3: Initialize TraceKit Provider

Wrap your app root in <TraceKitProvider>. This initializes the SDK and provides context to all child components.

Vite + React

// src/main.tsx
import React from 'react';
import ReactDOM from 'react-dom/client';
import { TraceKitProvider } from '@tracekit/react';
import App from './App';

ReactDOM.createRoot(document.getElementById('root')!).render(
  <React.StrictMode>
    <TraceKitProvider
      config={{
        apiKey: import.meta.env.VITE_TRACEKIT_API_KEY,
        serviceName: 'my-react-app',
        endpoint: 'https://app.tracekit.dev/v1/traces',
        release: import.meta.env.VITE_APP_VERSION || '0.0.0',
        environment: import.meta.env.MODE,
      }}
    >
      <App />
    </TraceKitProvider>
  </React.StrictMode>
);

Create React App

// src/index.tsx
import React from 'react';
import ReactDOM from 'react-dom/client';
import { TraceKitProvider } from '@tracekit/react';
import App from './App';

ReactDOM.createRoot(document.getElementById('root')!).render(
  <React.StrictMode>
    <TraceKitProvider
      config={{
        apiKey: process.env.REACT_APP_TRACEKIT_API_KEY!,
        serviceName: 'my-react-app',
        endpoint: 'https://app.tracekit.dev/v1/traces',
        release: process.env.REACT_APP_VERSION || '0.0.0',
        environment: process.env.NODE_ENV,
      }}
    >
      <App />
    </TraceKitProvider>
  </React.StrictMode>
);

Key points:

  • TraceKitProvider must be the outermost wrapper (before Router, Redux, etc.)
  • The provider calls init() internally - do not call init() separately
  • serviceName should match your app's logical name (e.g., "dashboard", "checkout")

Step 4: Error Boundary

Wrap component trees with <TraceKitErrorBoundary> to capture React render errors. The error boundary automatically calls captureException with component stack traces.

import { TraceKitErrorBoundary } from '@tracekit/react';

function ErrorFallback({ error, resetError }: { error: Error; resetError: () => void }) {
  return (
    <div role="alert" style={{ padding: '2rem', textAlign: 'center' }}>
      <h2>Something went wrong</h2>
      <p style={{ color: '#666' }}>{error.message}</p>
      <button
        onClick={resetError}
        style={{ marginTop: '1rem', padding: '0.5rem 1rem', cursor: 'pointer' }}
      >
        Try again
      </button>
    </div>
  );
}

// Wrap your app or specific route sections
function App() {
  return (
    <TraceKitErrorBoundary fallback={(error, _componentStack, resetError) => (
      <ErrorFallback error={error} resetError={resetError} />
    )}>
      <Dashboard />
    </TraceKitErrorBoundary>
  );
}

Nesting error boundaries - wrap different sections for granular recovery:

function App() {
  return (
    <div>
      <Header /> {/* Errors here bubble up to root */}
      <TraceKitErrorBoundary fallback={<p>Dashboard failed to load</p>}>
        <Dashboard />
      </TraceKitErrorBoundary>
      <TraceKitErrorBoundary fallback={<p>Sidebar failed to load</p>}>
        <Sidebar />
      </TraceKitErrorBoundary>
    </div>
  );
}

Important: React error boundaries only catch errors during rendering, lifecycle methods, and constructors. They do NOT catch errors in event handlers, async code, or setTimeout. Use captureException for those:

import { captureException } from '@tracekit/react';

function SubmitButton() {
  const handleClick = async () => {
    try {
      await submitForm();
    } catch (err) {
      captureException(err as Error, { component: 'SubmitButton' });
    }
  };
  return <button onClick={handleClick}>Submit</button>;
}

Step 5: Custom Performance Spans

Use the useTraceKitSpan hook to measure component-level operations:

import { useTraceKitSpan } from '@tracekit/react';

function Dashboard() {
  const { startSpan } = useTraceKitSpan();

  useEffect(() => {
    const span = startSpan('load-dashboard-data');
    fetchDashboardData()
      .then((data) => {
        setData(data);
        span.end();
      })
      .catch((err) => {
        captureException(err as Error);
        span.end();
      });
  }, []);

  return <div>{/* dashboard content */}</div>;
}

Measuring route transitions:

import { useTraceKitSpan } from '@tracekit/react';
import { useLocation } from 'react-router-dom';

function RouteTracker() {
  const location = useLocation();
  const { startSpan } = useTraceKitSpan();

  useEffect(() => {
    const span = startSpan('route-transition', {
      'route.path': location.pathname,
    });
    // End span after page renders
    requestAnimationFrame(() => span.end());
  }, [location.pathname]);

  return null;
}

Step 6: Distributed Tracing

Configure tracePropagationTargets in the provider config to attach trace headers to outbound fetch/XHR requests. This connects frontend spans to backend traces.

<TraceKitProvider
  config={{
    apiKey: import.meta.env.VITE_TRACEKIT_API_KEY,
    serviceName: 'my-react-app',
    endpoint: 'https://app.tracekit.dev/v1/traces',
    tracePropagationTargets: [
      'https://api.myapp.com',
      'https://auth.myapp.com',
      /^https:\/\/.*\.myapp\.com/,
    ],
  }}
>
  <App />
</TraceKitProvider>

How it works:

  1. Fetch/XHR requests to matching URLs receive a traceparent header
  2. Your backend SDK reads this header and links the backend span to the frontend trace
  3. The full request lifecycle appears as a single trace in the TraceKit dashboard

Important: Your backend CORS configuration must accept the traceparent and tracestate headers.

Step 7: Session Replay (Optional)

Enable session replay via the provider config to record user sessions for visual debugging:

import { replayIntegration } from '@tracekit/replay';

const replay = replayIntegration({
  sessionSampleRate: 0.1,
  errorSampleRate: 1.0,
  maskAllText: true,
  blockAllMedia: true,
});

<TraceKitProvider
  config={{
    apiKey: import.meta.env.VITE_TRACEKIT_API_KEY,
    serviceName: 'my-react-app',
    endpoint: 'https://app.tracekit.dev/v1/traces',
    addons: [replay],
  }}
>
  <App />
</TraceKitProvider>

Step 8: Source Maps (Optional)

Upload source maps so stack traces show original file names and line numbers.

Add to your .env:

TRACEKIT_AUTH_TOKEN=your_auth_token_here

After building:

tracekit sourcemaps upload --release=1.0.0 ./build

Build integration - add to package.json:

{
  "scripts": {
    "build": "vite build",
    "postbuild": "tracekit sourcemaps upload --release=$npm_package_version ./dist"
  }
}

Ensure the release value matches the release option in your provider config.

Step 9: Verification

After integrating, verify errors and traces are flowing:

  1. Start your application with the API key env var set.
  2. Trigger a test error - add this temporarily inside a component: import {captureException} from '@tracekit/react'; function TestError() {useEffect(() => {captureException(new Error('TraceKit React test error'));}, []); return null;}
  3. Open https://app.tracekit.dev/traces.
  4. Confirm the test error and your service name appear within 30-60 seconds.
  5. Remove the test component once verified.

To test the ErrorBoundary:

function BuggyComponent() {
  throw new Error('ErrorBoundary test');
  return null;
}

// Wrap with TraceKitErrorBoundary and render  - should show fallback UI
// and report error to dashboard

Complete Working Example

Full App.tsx with TraceKitProvider, ErrorBoundary, router wrapping, and all features:

// src/App.tsx
import React, { useEffect, useState } from 'react';
import { BrowserRouter, Routes, Route, Link } from 'react-router-dom';
import {
  TraceKitProvider,
  TraceKitErrorBoundary,
  useTraceKitSpan,
  captureException,
  setUser,
  setTag,
} from '@tracekit/react';
import { replayIntegration } from '@tracekit/replay';

// --- Session Replay ---
const replay = replayIntegration({
  sessionSampleRate: 0.1,
  errorSampleRate: 1.0,
  maskAllText: true,
  blockAllMedia: true,
});

// --- Error Fallback ---
function ErrorFallback({ error, resetError }: { error: Error; resetError: () => void }) {
  return (
    <div role="alert" style={{ padding: '2rem', textAlign: 'center' }}>
      <h2>Something went wrong</h2>
      <p style={{ color: '#666' }}>{error.message}</p>
      <button onClick={resetError} style={{ marginTop: '1rem', padding: '0.5rem 1rem' }}>
        Try again
      </button>
    </div>
  );
}

// --- Dashboard with performance span ---
function Dashboard() {
  const [data, setData] = useState(null);
  const { startSpan } = useTraceKitSpan();

  useEffect(() => {
    const span = startSpan('load-dashboard');
    fetch('/api/dashboard')
      .then((r) => r.json())
      .then((d) => { setData(d); span.end(); })
      .catch((err) => { captureException(err as Error); span.end(); });
  }, []);

  return <div>{data ? JSON.stringify(data) : 'Loading...'}</div>;
}

// --- App Root ---
export default function App() {
  useEffect(() => {
    // Set user context after auth
    setUser({ id: 'user-123', email: 'alice@example.com' });
    setTag('plan', 'pro');
  }, []);

  return (
    <TraceKitProvider
      config={{
        apiKey: import.meta.env.VITE_TRACEKIT_API_KEY,
        serviceName: 'my-react-app',
        release: import.meta.env.VITE_APP_VERSION || '0.0.0',
        environment: import.meta.env.MODE,
        endpoint: 'https://app.tracekit.dev/v1/traces',
        tracePropagationTargets: [
          'https://api.myapp.com',
          /^https:\/\/.*\.myapp\.com/,
        ],
        addons: [replay],
      }}
    >
      <BrowserRouter>
        <nav>
          <Link to="/">Home</Link> | <Link to="/dashboard">Dashboard</Link>
        </nav>
        <TraceKitErrorBoundary
          fallback={(error, _stack, resetError) => (
            <ErrorFallback error={error} resetError={resetError} />
          )}
        >
          <Routes>
            <Route path="/" element={<h1>Home</h1>} />
            <Route path="/dashboard" element={<Dashboard />} />
          </Routes>
        </TraceKitErrorBoundary>
      </BrowserRouter>
    </TraceKitProvider>
  );
}

Troubleshooting

ErrorBoundary not catching errors

  • Event handlers: Error boundaries only catch errors during rendering. Errors in onClick, onChange, etc. must use try/catch with captureException.
  • Async code: Errors in async functions, setTimeout, or Promises are not caught by error boundaries. Use captureException in catch blocks.
  • Server components: Error boundaries do not work in React Server Components. Use error.tsx files in Next.js App Router instead.

Traces not connecting to backend

  • Check tracePropagationTargets: URLs must match your API endpoints. Verify traceparent headers appear in the browser Network tab.
  • Check CORS: Your backend must accept traceparent and tracestate in Access-Control-Allow-Headers.
  • Check backend SDK: The backend must be instrumented with a TraceKit SDK that reads traceparent.

HMR double-init in development

  • React Strict Mode: In development, Strict Mode double-renders components. The TraceKitProvider handles this gracefully by checking for existing initialization.
  • Vite HMR: If you see duplicate init warnings during hot reload, this is normal in development and does not affect production.

Source maps not resolving

  • Check release version: The release in provider config must match the --release flag during upload.
  • CRA output: Upload from ./build, not ./dist.
  • Vite output: Upload from ./dist.

Next Steps

Once your React app is traced, consider:

  • Session Replay - Visual debugging with full session recordings (see tracekit-session-replay skill)
  • Source Maps - Readable stack traces with original source code (see tracekit-source-maps skill)
  • Backend Tracing - Add @tracekit/node-apm or another backend SDK for end-to-end distributed traces (see tracekit-node-sdk, tracekit-go-sdk, and other backend skills)
  • Browser SDK - For advanced browser-level configuration, see the tracekit-browser-sdk skill

References

  • React SDK docs: https://app.tracekit.dev/docs/frontend/frameworks/react
  • TraceKit docs root: https://app.tracekit.dev/docs
  • Dashboard: https://app.tracekit.dev
  • Quick start: https://app.tracekit.dev/docs/quickstart

平台分布

Codex

36.98%
按下载量换算24

Claude

29.86%
按下载量换算19

Cursor

16.47%
按下载量换算11

Gemini CLI

8.83%
按下载量换算6

安全审计

Gen Agent Trust Hub

通过

Socket

可疑

Snyk

通过

权限和风险

接触敏感数据

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

安装前确认

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

继续浏览同类 Skills