重要前提
安装AI Skills的关键前提是:必须科学上网,且开启TUN模式,这一点至关重要,直接决定安装能否顺利完成,在此郑重提醒三遍:科学上网,科学上网,科学上网。查看完整安装教程 →
using-sentry by andrelandgraf/fullstackrecipes
npx skills add https://github.com/andrelandgraf/fullstackrecipes --skill using-sentry通过 Sentry 捕获异常、添加上下文、创建性能追踪和使用结构化日志记录。
通过 Sentry 捕获异常、添加上下文、创建性能追踪和使用结构化日志记录。
参见:
using-sentry手动捕获已处理但仍需跟踪的错误:
import * as Sentry from "@sentry/nextjs";
try {
await riskyOperation();
} catch (err) {
Sentry.captureException(err);
// 优雅地处理错误...
}
为错误附加用户和自定义上下文:
import * as Sentry from "@sentry/nextjs";
// 设置用户上下文(在会话期间持续存在)
Sentry.setUser({
id: session.user.id,
email: session.user.email,
});
// 为异常添加自定义上下文
Sentry.captureException(err, {
tags: {
feature: "checkout",
plan: "pro",
},
extra: {
orderId: "order_123",
items: cart.items,
},
});
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
为有意义的操作创建追踪区间:
import * as Sentry from "@sentry/nextjs";
// 包装异步操作
const result = await Sentry.startSpan(
{
op: "http.client",
name: "GET /api/users",
},
async () => {
const response = await fetch("/api/users");
return response.json();
},
);
// 包装同步操作
Sentry.startSpan(
{
op: "ui.click",
name: "Submit Button Click",
},
(span) => {
span.setAttribute("form", "checkout");
processSubmit();
},
);
Sentry 提供结构化日志记录,这些日志会出现在日志标签页中:
import * as Sentry from "@sentry/nextjs";
const { logger } = Sentry;
logger.info("Payment processed", { orderId: "123", amount: 99.99 });
logger.warn("Rate limit approaching", { current: 90, max: 100 });
logger.error("Payment failed", { orderId: "123", reason: "declined" });
添加面包屑为错误提供上下文:
import * as Sentry from "@sentry/nextjs";
// 自动捕获:控制台日志、fetch 请求、UI 点击
// 为自定义事件手动添加面包屑:
Sentry.addBreadcrumb({
category: "auth",
message: "User signed in",
level: "info",
});
在用户登出时清除用户数据:
import * as Sentry from "@sentry/nextjs";
async function signOut() {
Sentry.setUser(null);
await authClient.signOut();
}
每周安装量
50
代码仓库
GitHub 星标数
8
首次出现
2026年1月20日
安全审计
安装于
opencode40
cursor38
claude-code37
codex37
gemini-cli37
antigravity30
Capture exceptions, add context, create performance spans, and use structured logging with Sentry.
Capture exceptions, add context, create performance spans, and use structured logging with Sentry.
See:
using-sentry in Fullstack RecipesManually capture errors that are handled but should be tracked:
import * as Sentry from "@sentry/nextjs";
try {
await riskyOperation();
} catch (err) {
Sentry.captureException(err);
// Handle the error gracefully...
}
Attach user and custom context to errors:
import * as Sentry from "@sentry/nextjs";
// Set user context (persists for session)
Sentry.setUser({
id: session.user.id,
email: session.user.email,
});
// Add custom context to exceptions
Sentry.captureException(err, {
tags: {
feature: "checkout",
plan: "pro",
},
extra: {
orderId: "order_123",
items: cart.items,
},
});
Create spans for meaningful operations:
import * as Sentry from "@sentry/nextjs";
// Wrap async operations
const result = await Sentry.startSpan(
{
op: "http.client",
name: "GET /api/users",
},
async () => {
const response = await fetch("/api/users");
return response.json();
},
);
// Wrap sync operations
Sentry.startSpan(
{
op: "ui.click",
name: "Submit Button Click",
},
(span) => {
span.setAttribute("form", "checkout");
processSubmit();
},
);
Sentry provides structured logging that appears in the Logs tab:
import * as Sentry from "@sentry/nextjs";
const { logger } = Sentry;
logger.info("Payment processed", { orderId: "123", amount: 99.99 });
logger.warn("Rate limit approaching", { current: 90, max: 100 });
logger.error("Payment failed", { orderId: "123", reason: "declined" });
Add breadcrumbs to provide context for errors:
import * as Sentry from "@sentry/nextjs";
// Automatically captured: console logs, fetch requests, UI clicks
// Manual breadcrumbs for custom events:
Sentry.addBreadcrumb({
category: "auth",
message: "User signed in",
level: "info",
});
Clear user data on sign out:
import * as Sentry from "@sentry/nextjs";
async function signOut() {
Sentry.setUser(null);
await authClient.signOut();
}
Weekly Installs
50
Repository
GitHub Stars
8
First Seen
Jan 20, 2026
Security Audits
Gen Agent Trust HubFailSocketPassSnykPass
Installed on
opencode40
cursor38
claude-code37
codex37
gemini-cli37
antigravity30
Dogfood - Vercel Labs 自动化 Web 应用探索与问题报告工具
20,800 周安装
双轴技能评审器:自动化技能质量评估工具,支持LLM与自动测试双维度评分
161 周安装
变体分析技能:基于CodeQL和Semgrep的自动化漏洞变体检测与安全研究工具
44 周安装
Google Maps API 技能 - 完整 REST API 客户端,支持地理编码、路线、地点等20+服务
164 周安装
结构变异分析工作流:基于ACMG标准的临床基因组学解读与致病性分类指南
161 周安装
Base链智能合约部署指南:安全配置、测试网ETH获取与合约验证
161 周安装
Skill Installer - 一键安装AI技能工具,支持GitHub公共/私有仓库
160 周安装