Token导航 LogoToken导航

Agent Skill · 前端设计

tracekit-nextjs-sdk(tracekit Next.js SDK 前端)

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

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

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

安装说明

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

安装方式

通过对话安装

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

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

命令行安装

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

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

这个 Skill 是做什么的

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

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

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

来源仓库内路径:skills/tracekit-nextjs-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-nextjs-sdk 怎么安装?

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

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

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

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

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

tracekit-nextjs-sdk 是免费的吗?

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

tracekit-nextjs-sdk 用的人多吗?

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

tracekit-nextjs-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-nextjs-sdk

tracekit Next.js SDK 前端 · 本页

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

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

SKILL.md 原文

TraceKit Next.js 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 Next.js application
  • Add observability, error tracking, or APM to a Next.js project
  • Instrument a Next.js app with distributed tracing
  • Set up error monitoring in a Next.js app (App Router or Pages Router)
  • Configure server-side and client-side error capture in Next.js
  • Debug production Next.js applications with live breakpoints

If the user has a vanilla JavaScript/TypeScript project without Next.js, use the tracekit-browser-sdk skill instead. If the user has a plain React SPA (no Next.js), use the tracekit-react-sdk skill instead.

Non-Negotiable Rules

  1. Never hardcode API keys in code. Use NEXT_PUBLIC_TRACEKIT_API_KEY for client-side and TRACEKIT_API_KEY for server-side via .env.local.
  2. Always include a verification step confirming errors appear in https://app.tracekit.dev.
  3. Always initialize TraceKit before app bootstrap -- use Next.js instrumentation files for both client and server init.

Detection

Before applying this skill, detect the project type:

  1. Check package.json for next in dependencies -- confirms this is a Next.js project.
  2. Detect router architecture by directory structure:

- app/ directory exists => App Router (Next.js 13+) - pages/ directory exists => Pages Router - Both may exist (hybrid) -- cover both patterns

  1. Only ask the user if neither app/ nor pages/ directory is found.

Step 1: Environment Setup

Set API keys in .env.local (Next.js convention -- never committed to git):

# .env.local
NEXT_PUBLIC_TRACEKIT_API_KEY=ctxio_your_api_key_here
TRACEKIT_API_KEY=ctxio_your_server_api_key_here
APP_VERSION=1.0.0
NEXT_PUBLIC_APP_VERSION=1.0.0
  • NEXT_PUBLIC_ prefix makes the variable available to client-side code (browser bundle).
  • Without the prefix, the variable is only available server-side.
  • Use the same key for both, or separate keys for client vs server if your security model requires it.

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_)

Step 2: Install SDK

npm install @tracekit/nextjs

Or with Yarn:

yarn add @tracekit/nextjs

This installs the TraceKit Next.js wrapper with multi-runtime support (client + server), error boundary components, navigation breadcrumbs, and source map upload tooling.

Step 3: Server-Side Init

Create instrumentation.ts at the project root. Next.js calls the register() function during server startup.

// instrumentation.ts
import { initServer, captureRequestError } from '@tracekit/nextjs';

export function register() {
  initServer({
    apiKey: process.env.TRACEKIT_API_KEY!,
    release: process.env.APP_VERSION,
    environment: process.env.NODE_ENV,
    apiEndpoint: 'https://app.tracekit.dev',
  });
}

// Capture server-side request errors (App Router + Pages Router)
export const onRequestError = captureRequestError;

captureRequestError matches the Next.js onRequestError signature. It receives error context including routerKind ("App Router" or "Pages Router"), routePath, and routeType ("page", "route", or "middleware"). Errors are sent to TraceKit via HTTP POST (fire-and-forget, never throws).

Step 4: Client-Side Init

Create instrumentation-client.ts at the project root. Next.js loads this file in the browser.

// instrumentation-client.ts
import { initClient, onRouterTransitionStart } from '@tracekit/nextjs';

initClient({
  apiKey: process.env.NEXT_PUBLIC_TRACEKIT_API_KEY!,
  release: process.env.NEXT_PUBLIC_APP_VERSION,
  environment: process.env.NODE_ENV,
  endpoint: 'https://app.tracekit.dev/v1/traces',
  tracePropagationTargets: [
    process.env.NEXT_PUBLIC_API_URL || 'https://api.example.com',
  ],
});

// Next.js 15.3+ navigation breadcrumbs
export { onRouterTransitionStart };

initClient() initializes the @tracekit/browser SDK for client-side error capture, breadcrumbs, and distributed tracing.

onRouterTransitionStart is a Next.js 15.3+ hook that captures client-side route transitions as breadcrumbs with from/to URLs and navigation type (push, replace, traverse).

Step 5: Error Boundary

App Router

Create app/global-error.tsx to capture errors in the root layout:

// app/global-error.tsx
export { GlobalError as default } from '@tracekit/nextjs';

Or customize the error UI:

// app/global-error.tsx
'use client';

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

export default function GlobalError({
  error,
  reset,
}: {
  error: Error & { digest?: string };
  reset: () => void;
}) {
  useEffect(() => {
    captureException(error);
  }, [error]);

  return (
    <html>
      <body>
        <h2>Something went wrong!</h2>
        <button onClick={reset}>Try again</button>
      </body>
    </html>
  );
}

For per-route error boundaries, create error.tsx files in route directories:

// app/dashboard/error.tsx
'use client';

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

export default function DashboardError({
  error,
  reset,
}: {
  error: Error & { digest?: string };
  reset: () => void;
}) {
  useEffect(() => {
    captureException(error);
  }, [error]);

  return (
    <div>
      <h2>Dashboard error</h2>
      <button onClick={reset}>Retry</button>
    </div>
  );
}

Pages Router

Wrap your custom error page with withTraceKitErrorPage:

// pages/_error.tsx
import { withTraceKitErrorPage } from '@tracekit/nextjs';

function CustomErrorPage({ statusCode }: { statusCode?: number }) {
  return (
    <div>
      <h1>{statusCode ? statusCode + ' - Server Error' : 'Client Error'}</h1>
      <p>An unexpected error occurred.</p>
    </div>
  );
}

CustomErrorPage.getInitialProps = ({ res, err }: any) => {
  const statusCode = res ? res.statusCode : err ? err.statusCode : 404;
  return { statusCode, err };
};

export default withTraceKitErrorPage(CustomErrorPage);

Step 6: Custom Error Capture and Performance Spans

Client-side (client components, event handlers):

import { captureException, setUser } from '@tracekit/nextjs';

// Capture errors manually
try {
  await riskyOperation();
} catch (err) {
  captureException(err as Error, { context: 'checkout' });
}

// Set user context after authentication
setUser({ id: user.id, email: user.email });

Server-side (API routes, server components) -- use captureRequestError for automatic capture, or import from Node SDK for manual spans in API routes:

// app/api/orders/route.ts
import { NextResponse } from 'next/server';

export async function POST(request: Request) {
  try {
    const body = await request.json();
    const order = await processOrder(body);
    return NextResponse.json(order);
  } catch (err) {
    // Server errors are automatically captured via captureRequestError
    return NextResponse.json({ error: 'Failed' }, { status: 500 });
  }
}

Re-exported functions available from @tracekit/nextjs (client-side only):

import {
  captureException,
  captureMessage,
  setUser,
  setTag,
  setExtra,
  addBreadcrumb,
  getClient,
} from '@tracekit/nextjs';

These re-exports are client-side functions from @tracekit/browser. Do not use them in server-side code (API routes, server components). For server-side error capture, use captureRequestError.

Step 7: Distributed Tracing

Client-side distributed tracing is configured via tracePropagationTargets in the initClient() call (Step 4). The SDK automatically adds trace headers (tracekit-trace-id, baggage) to outgoing fetch requests matching the targets.

// instrumentation-client.ts
initClient({
  apiKey: process.env.NEXT_PUBLIC_TRACEKIT_API_KEY!,
  endpoint: 'https://app.tracekit.dev/v1/traces',
  tracePropagationTargets: [
    'https://api.example.com',
    /^\/api\//,  // Same-origin API routes
  ],
});

Server-side API routes are automatically traced via captureRequestError with route context (routerKind, routePath, routeType).

Step 8: Session Replay (Optional)

Enable session replay in the client-side init (browser only):

// instrumentation-client.ts
initClient({
  apiKey: process.env.NEXT_PUBLIC_TRACEKIT_API_KEY!,
  endpoint: 'https://app.tracekit.dev/v1/traces',
  replay: {
    enabled: true,
    sampleRate: 0.1,
    errorSampleRate: 1.0,
    maskAllText: true,
    blockAllMedia: false,
  },
});

Session replay captures DOM mutations, network requests, and console logs in the browser. It does not affect server-side rendering.

Step 9: Source Maps (Optional)

Add the TraceKit webpack plugin to next.config.js for automatic source map upload during builds:

// next.config.js
const { withTraceKit } = require('@tracekit/nextjs/webpack-plugin');

/** @type {import('next').NextConfig} */
const nextConfig = {
  // Your existing config
};

module.exports = withTraceKit(nextConfig, {
  apiKey: process.env.TRACEKIT_API_KEY,
  release: process.env.APP_VERSION || '1.0.0',
  // Source maps are uploaded during build, not at runtime
});

Or upload manually after building:

tracekit sourcemaps upload \
  --api-key $TRACEKIT_API_KEY \
  --release 1.0.0 \
  --dist .next/static

Step 10: Verification

After integrating, verify both client-side and server-side errors are captured:

  1. Client-side: Add a button that throws an error in a client component: 'use client'; export default function TestPage() {return <button onClick={() => {throw new Error('TraceKit Next.js client test');}}>Test Error</button>;}
  2. Server-side: Create an API route that throws: // app/api/test-error/route.ts export async function GET() {throw new Error('TraceKit Next.js server test');}
  3. Open https://app.tracekit.dev.
  4. Confirm both errors appear within 30-60 seconds -- client errors show browser context, server errors show route context.

Complete Working Example (App Router)

All files needed for a full Next.js App Router setup:

# .env.local
NEXT_PUBLIC_TRACEKIT_API_KEY=ctxio_your_api_key_here
TRACEKIT_API_KEY=ctxio_your_server_api_key_here
APP_VERSION=1.0.0
NEXT_PUBLIC_APP_VERSION=1.0.0
// instrumentation-client.ts
import { initClient, onRouterTransitionStart } from '@tracekit/nextjs';

initClient({
  apiKey: process.env.NEXT_PUBLIC_TRACEKIT_API_KEY!,
  release: process.env.NEXT_PUBLIC_APP_VERSION,
  environment: process.env.NODE_ENV,
  endpoint: 'https://app.tracekit.dev/v1/traces',
  tracePropagationTargets: [
    process.env.NEXT_PUBLIC_API_URL || 'https://api.example.com',
  ],
  replay: {
    enabled: true,
    sampleRate: 0.1,
    errorSampleRate: 1.0,
  },
});

export { onRouterTransitionStart };
// instrumentation.ts
import { initServer, captureRequestError } from '@tracekit/nextjs';

export function register() {
  initServer({
    apiKey: process.env.TRACEKIT_API_KEY!,
    release: process.env.APP_VERSION,
    environment: process.env.NODE_ENV,
  });
}

export const onRequestError = captureRequestError;
// app/global-error.tsx
export { GlobalError as default } from '@tracekit/nextjs';
// app/layout.tsx
export default function RootLayout({
  children,
}: {
  children: React.ReactNode;
}) {
  return (
    <html lang="en">
      <body>{children}</body>
    </html>
  );
}

Troubleshooting

Server errors not appearing

  • Check instrumentation.ts: Ensure register() calls initServer() and onRequestError is exported at the top level.
  • Check TRACEKIT_API_KEY is set in .env.local (without NEXT_PUBLIC_ prefix for server-side).
  • Check outbound access: Server must reach https://app.tracekit.dev. Test with: curl -X POST https://app.tracekit.dev/v1/traces (expect 401).

Client errors not appearing

  • Check instrumentation-client.ts: Ensure initClient() is called with NEXT_PUBLIC_TRACEKIT_API_KEY.
  • Check browser console for initialization errors or network failures to the TraceKit endpoint.

Server vs client init confusion

  • Server: instrumentation.ts with initServer() -- runs in Node.js/Edge runtime
  • Client: instrumentation-client.ts with initClient() -- runs in the browser
  • Do not import server functions in client code or vice versa.

Edge runtime compatibility

  • captureRequestError uses fetch() internally, which is available in both Node.js and Edge runtimes.
  • initServer() stores config in a module-scoped variable -- safe for both runtimes.

Hydration errors

  • TraceKit captures React recoverable hydration errors automatically via onRecoverableError in the client-side init.
  • These appear as "handled" errors with mechanism react.onRecoverableError.

Navigation breadcrumbs not appearing

  • onRouterTransitionStart requires Next.js 15.3+. On older versions, breadcrumbs are captured via the base @tracekit/browser navigation integration.
  • Ensure onRouterTransitionStart is re-exported from instrumentation-client.ts.

Next Steps

Once your Next.js app is traced, consider:

  • Browser SDK -- For non-Next.js pages, use the tracekit-browser-sdk skill
  • React SDK -- For plain React SPAs, use the tracekit-react-sdk skill
  • Session Replay -- Record and replay user sessions with linked traces
  • Source Maps -- Upload source maps for readable production stack traces
  • Backend SDKs -- Connect frontend traces to backend services for full distributed tracing

References

  • Next.js SDK docs: https://app.tracekit.dev/docs/frontend/frameworks/nextjs
  • Browser SDK docs: https://app.tracekit.dev/docs/frontend/browser-sdk
  • TraceKit docs root: https://app.tracekit.dev/docs
  • Dashboard: https://app.tracekit.dev

平台分布

Codex

36.95%
按下载量换算23

Claude

30.78%
按下载量换算19

Cursor

20.41%
按下载量换算13

Gemini CLI

9.79%
按下载量换算6

安全审计

Gen Agent Trust Hub

通过

Socket

可疑

Snyk

通过

权限和风险

接触敏感数据

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

安装前确认

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

继续浏览同类 Skills