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

sentry-svelte-sdkSentry Svelte SDK 搜索

Agent Skill

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

总安装

423

周安装

18

GitHub Stars

19

下载量

148
CodexClaudeCursorGemini CLI

安装说明

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

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

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

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

命令行安装

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

skills.shnpx skills
npx skills add https://github.com/getsentry/agent-skills --skill sentry-svelte-sdk

简介

用于辅助前端页面、组件和样式开发,适合生成或审查 Svelte 相关代码。

  • 适用于组件结构整理、交互逻辑审查或性能优化建议。
  • 通过 GitHub 仓库安装,支持 Codex、Claude 等平台使用。
  • 使用时需结合项目构建方式和设计系统,避免生成孤立片段。
  • sentry-svelte-sdk 属于研究检索类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

Sentry Svelte SDK

Opinionated wizard that scans your project and guides you through complete Sentry setup for Svelte and SvelteKit.

Invoke This Skill When

  • User asks to "add Sentry to Svelte" or "set up Sentry" in a Svelte/SvelteKit app
  • User wants error monitoring, tracing, session replay, or logging in Svelte or SvelteKit
  • User mentions @sentry/svelte, @sentry/sveltekit, or Sentry SDK for Svelte
Note: SDK versions and APIs below reflect current Sentry docs at time of writing (@sentry/sveltekit ≥10.8.0, SvelteKit ≥2.31.0). Always verify against docs.sentry.io/platforms/javascript/guides/sveltekit/ before implementing.

Phase 1: Detect

Run these commands to understand the project before making any recommendations:

# Detect framework type
cat package.json | grep -E '"svelte"|"@sveltejs/kit"|"@sentry/svelte"|"@sentry/sveltekit"'

# Check for SvelteKit indicators
ls svelte.config.js svelte.config.ts vite.config.ts vite.config.js 2>/dev/null

# Check SvelteKit version (determines which setup pattern to use)
cat package.json | grep '"@sveltejs/kit"'

# Check if Sentry is already installed
cat package.json | grep '"@sentry/'

# Check existing hook files
ls src/hooks.client.ts src/hooks.client.js src/hooks.server.ts src/hooks.server.js \
   src/instrumentation.server.ts 2>/dev/null

# Detect logging libraries (Node side)
cat package.json | grep -E '"pino"|"winston"|"consola"'

# Detect if there's a backend (Go, Python, Ruby, etc.) in adjacent directories
ls ../backend ../server ../api 2>/dev/null
cat ../go.mod ../requirements.txt ../Gemfile 2>/dev/null | head -3

What to determine:

QuestionImpact
@sveltejs/kit in package.json?SvelteKit path vs. plain Svelte path
SvelteKit ≥2.31.0?Modern (instrumentation.server.ts) vs. legacy setup
@sentry/sveltekit already present?Skip install, go straight to feature config
vite.config.ts present?Source map upload via Vite plugin available
Backend directory found?Trigger Phase 4 cross-link suggestion

Phase 2: Recommend

Present a concrete recommendation based on what you found. Don't ask open-ended questions — lead with a proposal:

Recommended (core coverage):

  • Error Monitoring — always; auto-captures unhandled errors on client and server
  • Tracing — SvelteKit has both client-side navigation spans and server-side request spans; always recommend
  • Session Replay — recommended for user-facing SvelteKit apps (client-side only)

Optional (enhanced observability):

  • Logging — structured logs via Sentry.logger.*; recommend when app uses server-side logging or needs log-to-trace correlation

Recommendation logic:

FeatureRecommend when...
Error MonitoringAlways — non-negotiable baseline
TracingAlways for SvelteKit (client + server); for plain Svelte when calling APIs
Session ReplayUser-facing app, login flows, or checkout pages present
LoggingApp already uses server-side logging, or structured log search is needed

Propose: *"I recommend setting up Error Monitoring + Tracing + Session Replay. Want me to also add structured Logging?"*


Phase 3: Guide

Determine Setup Path

Your projectPackageSetup complexity
SvelteKit (≥2.31.0)@sentry/sveltekit5 files to create/modify
SvelteKit (<2.31.0)@sentry/sveltekit3 files (init in hooks.server.ts)
Plain Svelte (no @sveltejs/kit)@sentry/svelteSingle entry point

Path A: SvelteKit (Recommended — Modern, ≥2.31.0)

Option 1: Wizard (Recommended)

npx @sentry/wizard@latest -i sveltekit

The wizard walks you through login, org/project selection, and auth token setup interactively — no manual token creation needed. It then installs the SDK, creates all necessary files (client/server hooks, Vite plugin config), configures source map upload, and adds a /sentry-example-page for verification. Skip to Verification after running it.

Option 2: Manual Setup

Step 1 — Install

npm install @sentry/sveltekit --save

Step 2 — svelte.config.js — Enable instrumentation

import adapter from "@sveltejs/adapter-auto";

const config = {
  kit: {
    adapter: adapter(),
    experimental: {
      instrumentation: { server: true },
      tracing: { server: true },
    },
  },
};

export default config;

Step 3 — src/instrumentation.server.ts — Server-side init (runs once at startup)

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

Sentry.init({
  dsn: process.env.SENTRY_DSN,
  environment: process.env.SENTRY_ENVIRONMENT,
  release: process.env.SENTRY_RELEASE,

  sendDefaultPii: true,
  tracesSampleRate: 1.0,    // lower to 0.1–0.2 in production
  enableLogs: true,
});

Step 4 — src/hooks.client.ts — Client-side init

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

Sentry.init({
  dsn: import.meta.env.PUBLIC_SENTRY_DSN ?? import.meta.env.VITE_SENTRY_DSN,
  environment: import.meta.env.MODE,

  sendDefaultPii: true,
  tracesSampleRate: 1.0,

  integrations: [
    Sentry.replayIntegration({
      maskAllText: true,
      blockAllMedia: true,
    }),
  ],

  replaysSessionSampleRate: 0.1,
  replaysOnErrorSampleRate: 1.0,
  enableLogs: true,
});

export const handleError = Sentry.handleErrorWithSentry();

Step 5 — src/hooks.server.ts — Server hooks (no init here in modern setup)

import * as Sentry from "@sentry/sveltekit";
import { sequence } from "@sveltejs/kit/hooks";

export const handleError = Sentry.handleErrorWithSentry();

// sentryHandle() instruments incoming requests and creates root spans
export const handle = Sentry.sentryHandle();

// If you have other handle functions, compose with sequence():
// export const handle = sequence(Sentry.sentryHandle(), myAuthHandle);

Step 6 — vite.config.ts — Source maps (requires SENTRY_AUTH_TOKEN)

import { sveltekit } from "@sveltejs/kit/vite";
import { sentrySvelteKit } from "@sentry/sveltekit";
import { defineConfig } from "vite";

export default defineConfig({
  plugins: [
    // sentrySvelteKit MUST come before sveltekit()
    sentrySvelteKit({
      org: process.env.SENTRY_ORG,
      project: process.env.SENTRY_PROJECT,
      authToken: process.env.SENTRY_AUTH_TOKEN,
    }),
    sveltekit(),
  ],
});

Add to .env (never commit):

SENTRY_AUTH_TOKEN=sntrys_...
SENTRY_ORG=my-org-slug
SENTRY_PROJECT=my-project-slug

Path B: SvelteKit Legacy (<2.31.0 or @sentry/sveltekit <10.8.0)

Skip instrumentation.server.ts and svelte.config.js changes. Instead, put Sentry.init() directly in hooks.server.ts:

// src/hooks.server.ts (legacy — init goes here)
import * as Sentry from "@sentry/sveltekit";

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

export const handleError = Sentry.handleErrorWithSentry();
export const handle = Sentry.sentryHandle();

hooks.client.ts and vite.config.ts are identical to the modern path.


Path C: Plain Svelte (no SvelteKit)

Install:

npm install @sentry/svelte --save

Configure in entry point (src/main.ts or src/main.js) before mounting the app:

import * as Sentry from "@sentry/svelte";
import App from "./App.svelte";

Sentry.init({
  dsn: import.meta.env.VITE_SENTRY_DSN,
  environment: import.meta.env.MODE,

  sendDefaultPii: true,

  integrations: [
    Sentry.browserTracingIntegration(),
    Sentry.replayIntegration({
      maskAllText: true,
      blockAllMedia: true,
    }),
  ],

  tracesSampleRate: 1.0,
  tracePropagationTargets: ["localhost", /^https:\/\/yourapi\.io/],
  replaysSessionSampleRate: 0.1,
  replaysOnErrorSampleRate: 1.0,
  enableLogs: true,
});

const app = new App({ target: document.getElementById("app")! });
export default app;

Optional: Svelte component tracking (auto-injects tracking into all components):

// svelte.config.js
import { withSentryConfig } from "@sentry/svelte";

export default withSentryConfig(
  { compilerOptions: {} },
  { componentTracking: { trackComponents: true } }
);

For Each Agreed Feature

Walk through features one at a time. Load the reference file, follow its steps, then verify before moving on:

FeatureReferenceLoad when...
Error Monitoring${SKILL_ROOT}/references/error-monitoring.mdAlways (baseline)
Tracing${SKILL_ROOT}/references/tracing.mdAPI calls / distributed tracing needed
Session Replay${SKILL_ROOT}/references/session-replay.mdUser-facing app
Logging${SKILL_ROOT}/references/logging.mdStructured logs / log-to-trace correlation

For each feature: Read ${SKILL_ROOT}/references/<feature>.md, follow steps exactly, verify it works.


SvelteKit File Summary

FilePurposeModernLegacy
src/instrumentation.server.tsServer Sentry.init() — runs once at startup✅ Required
src/hooks.client.tsClient Sentry.init() + handleError✅ Required✅ Required
src/hooks.server.tshandleError + sentryHandle() (no init)✅ Required✅ Init goes here
svelte.config.jsEnable experimental.instrumentation.server✅ Required
vite.config.tssentrySvelteKit() plugin for source maps✅ Recommended✅ Recommended
.envSENTRY_AUTH_TOKEN, SENTRY_ORG, SENTRY_PROJECT✅ For source maps✅ For source maps

Configuration Reference

Key Sentry.init() Options

OptionTypeDefaultNotes
dsnstringRequired. Use env var; SDK is disabled when empty
environmentstring"production"e.g., "staging", "development"
releasestringe.g., "my-app@1.2.3" or git SHA
sendDefaultPiibooleanfalseIncludes IP addresses and request headers
tracesSampleRatenumber0–1; use 1.0 in dev, 0.1–0.2 in prod
tracesSamplerfunctionPer-transaction sampling; overrides tracesSampleRate
tracePropagationTargets`(string\RegExp)[]`URLs that receive distributed tracing headers
replaysSessionSampleRatenumberFraction of all sessions recorded (client only)
replaysOnErrorSampleRatenumberFraction of error sessions recorded (client only)
enableLogsbooleanfalseEnable Sentry.logger.* API
beforeSendLogfunctionFilter/modify logs before send
debugbooleanfalseVerbose SDK output to console

Server-Only Options (instrumentation.server.ts / hooks.server.ts)

OptionTypeNotes
serverNamestringHostname tag on server events
includeLocalVariablesbooleanAttach local vars to stack frames
shutdownTimeoutnumberms to flush events before process exit (default: 2000)

Adapter Compatibility

AdapterSupport
@sveltejs/adapter-auto / adapter-vercel (Node)✅ Full
@sveltejs/adapter-node✅ Full
@sveltejs/adapter-cloudflare⚠️ Partial — requires extra setup
Vercel Edge Runtime❌ Not supported

Verification

After setup, trigger test events to confirm Sentry is receiving data:

<!-- src/routes/sentry-test/+page.svelte -->
<script>
  import * as Sentry from "@sentry/sveltekit";
</script>

<button onclick={() => { throw new Error("Sentry client test"); }}>
  Test Client Error
</button>

<button onclick={() => Sentry.captureMessage("Sentry test message", "info")}>
  Test Message
</button>
// src/routes/sentry-test/+server.ts
export const GET = () => {
  throw new Error("Sentry server test");
};

Check the Sentry dashboard:

  • Issues → both errors should appear within seconds
  • Traces → look for route-based transactions
  • Replays → session recording visible after page interaction
  • Logs → structured log entries (if logging enabled)

If nothing appears, set debug: true in Sentry.init() and check the browser/server console for SDK output.


Phase 4: Cross-Link

After completing Svelte/SvelteKit setup, check for a companion backend missing Sentry coverage:

# Look for backend in adjacent directories
ls ../backend ../server ../api ../go ../python 2>/dev/null
cat ../go.mod 2>/dev/null | head -3
cat ../requirements.txt ../pyproject.toml 2>/dev/null | head -3
cat ../Gemfile 2>/dev/null | head -3

If a backend exists without Sentry configured, suggest the matching skill:

Backend detectedSuggest skill
Go (go.mod)sentry-go-sdk
Python (requirements.txt, pyproject.toml)sentry-python-sdk
Ruby (Gemfile)sentry-ruby-sdk
Node.js (Express, Fastify, etc.)Use @sentry/node — see docs.sentry.io/platforms/javascript/guides/express/

Troubleshooting

IssueSolution
Events not appearingSet debug: true, check DSN, open browser console for SDK errors
Source maps not workingRun npm run build (not dev), verify SENTRY_AUTH_TOKEN is set
Server errors not capturedEnsure handleErrorWithSentry() is exported from hooks.server.ts
Client errors not capturedEnsure handleErrorWithSentry() is exported from hooks.client.ts
Session replay not recordingConfirm replayIntegration() is in client init only (never server)
sentryHandle() + other handles not composingWrap with sequence(Sentry.sentryHandle(), myHandle)
Ad-blocker blocking eventsSet tunnel: "/sentry-tunnel" and add a server-side relay endpoint
SvelteKit instrumentation not activatingConfirm experimental.instrumentation.server: true in svelte.config.js
Cloudflare adapter issuesConsult docs.sentry.io/platforms/javascript/guides/sveltekit/ for adapter-specific notes
wrapLoadWithSentry / wrapServerLoadWithSentry errorsThese are legacy wrappers — remove them; sentryHandle() instruments load functions automatically in ≥10.8.0

适合场景

01

用户想查找某类 Agent Skill 时

02

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

03

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

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

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

能力 4

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

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

平台分布

Codex

35.98%
按下载量换算53

Claude

29.71%
按下载量换算44

Cursor

18.42%
按下载量换算27

Gemini CLI

9.46%
按下载量换算14

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

敏感数据

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

安装前确认

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

来源信息

继续浏览同类 Skills