Token导航 LogoToken导航TokenDH.com
研究检索需要联网github未标认证来源可访问clear审计通过

error-tracking错误跟踪

Agent Skill

error-tracking 用于记录任务执行中的错误、用户纠正、经验和能力缺口,适合在 Codex、Claude、Cursor、Gemini CLI 中希望让 Agent 持续沉淀问题、修正和最佳实践时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

903

周安装

38

GitHub Stars

9,514

下载量

316
CodexClaudeCursorGemini CLI

安装说明

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

GitHub

来源数

3

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

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

请帮我安装这个 Agent Skill:error-tracking(错误跟踪)
来源仓库:https://github.com/diet103/claude-code-infrastructure-showcase
仓库路径:skills/error-tracking
安装命令:
npx skills add https://github.com/diet103/claude-code-infrastructure-showcase --skill error-tracking
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/diet103/claude-code-infrastructure-showcase --skill error-tracking

简介

error-tracking 用于在项目服务中强制实施全面的 Sentry 错误跟踪和性能监控,遵循 Sentry v8 模式。

  • 适用于添加错误处理、创建新控制器或路由、监控数据库性能以及处理工作流错误的场景。
  • 通过自然语言指令运行完整安全审计或增量扫描,无需安装额外工具或修改 CI 流程。
  • 使用前需确认环境变量配置和权限范围,避免仅依赖 console.error 进行错误记录。
  • 适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

SKILL.md

your project Sentry Integration Skill

Purpose

This skill enforces comprehensive Sentry error tracking and performance monitoring across all your project services following Sentry v8 patterns.

When to Use This Skill

  • Adding error handling to any code
  • Creating new controllers or routes
  • Instrumenting cron jobs
  • Tracking database performance
  • Adding performance spans
  • Handling workflow errors

🚨 CRITICAL RULE

ALL ERRORS MUST BE CAPTURED TO SENTRY - No exceptions. Never use console.error alone.

Current Status

Form Service ✅ Complete

  • Sentry v8 fully integrated
  • All workflow errors tracked
  • SystemActionQueueProcessor instrumented
  • Test endpoints available

Email Service 🟡 In Progress

  • Phase 1-2 complete (6/22 tasks)
  • 189 ErrorLogger.log() calls remaining

Sentry Integration Patterns

1. Controller Error Handling

// ✅ CORRECT - Use BaseController
import { BaseController } from '../controllers/BaseController';

export class MyController extends BaseController {
    async myMethod() {
        try {
            // ... your code
        } catch (error) {
            this.handleError(error, 'myMethod'); // Automatically sends to Sentry
        }
    }
}

2. Route Error Handling (Without BaseController)

import * as Sentry from '@sentry/node';

router.get('/route', async (req, res) => {
    try {
        // ... your code
    } catch (error) {
        Sentry.captureException(error, {
            tags: { route: '/route', method: 'GET' },
            extra: { userId: req.user?.id }
        });
        res.status(500).json({ error: 'Internal server error' });
    }
});

3. Workflow Error Handling

import { WorkflowSentryHelper } from '../workflow/utils/sentryHelper';

// ✅ CORRECT - Use WorkflowSentryHelper
WorkflowSentryHelper.captureWorkflowError(error, {
    workflowCode: 'DHS_CLOSEOUT',
    instanceId: 123,
    stepId: 456,
    userId: 'user-123',
    operation: 'stepCompletion',
    metadata: { additionalInfo: 'value' }
});

4. Cron Jobs (MANDATORY Pattern)

#!/usr/bin/env node
// FIRST LINE after shebang - CRITICAL!
import '../instrument';
import * as Sentry from '@sentry/node';

async function main() {
    return await Sentry.startSpan({
        name: 'cron.job-name',
        op: 'cron',
        attributes: {
            'cron.job': 'job-name',
            'cron.startTime': new Date().toISOString(),
        }
    }, async () => {
        try {
            // Your cron job logic
        } catch (error) {
            Sentry.captureException(error, {
                tags: {
                    'cron.job': 'job-name',
                    'error.type': 'execution_error'
                }
            });
            console.error('[Job] Error:', error);
            process.exit(1);
        }
    });
}

main()
    .then(() => {
        console.log('[Job] Completed successfully');
        process.exit(0);
    })
    .catch((error) => {
        console.error('[Job] Fatal error:', error);
        process.exit(1);
    });

5. Database Performance Monitoring

import { DatabasePerformanceMonitor } from '../utils/databasePerformance';

// ✅ CORRECT - Wrap database operations
const result = await DatabasePerformanceMonitor.withPerformanceTracking(
    'findMany',
    'UserProfile',
    async () => {
        return await PrismaService.main.userProfile.findMany({
            take: 5,
        });
    }
);

6. Async Operations with Spans

import * as Sentry from '@sentry/node';

const result = await Sentry.startSpan({
    name: 'operation.name',
    op: 'operation.type',
    attributes: {
        'custom.attribute': 'value'
    }
}, async () => {
    // Your async operation
    return await someAsyncOperation();
});

Error Levels

Use appropriate severity levels:

  • fatal: System is unusable (database down, critical service failure)
  • error: Operation failed, needs immediate attention
  • warning: Recoverable issues, degraded performance
  • info: Informational messages, successful operations
  • debug: Detailed debugging information (dev only)

Required Context

import * as Sentry from '@sentry/node';

Sentry.withScope((scope) => {
    // ALWAYS include these if available
    scope.setUser({ id: userId });
    scope.setTag('service', 'form'); // or 'email', 'users', etc.
    scope.setTag('environment', process.env.NODE_ENV);

    // Add operation-specific context
    scope.setContext('operation', {
        type: 'workflow.start',
        workflowCode: 'DHS_CLOSEOUT',
        entityId: 123
    });

    Sentry.captureException(error);
});

Service-Specific Integration

Form Service

Location: ./blog-api/src/instrument.ts

import * as Sentry from '@sentry/node';
import { nodeProfilingIntegration } from '@sentry/profiling-node';

Sentry.init({
    dsn: process.env.SENTRY_DSN,
    environment: process.env.NODE_ENV || 'development',
    integrations: [
        nodeProfilingIntegration(),
    ],
    tracesSampleRate: 0.1,
    profilesSampleRate: 0.1,
});

Key Helpers:

  • WorkflowSentryHelper - Workflow-specific errors
  • DatabasePerformanceMonitor - DB query tracking
  • BaseController - Controller error handling

Email Service

Location: ./notifications/src/instrument.ts

import * as Sentry from '@sentry/node';
import { nodeProfilingIntegration } from '@sentry/profiling-node';

Sentry.init({
    dsn: process.env.SENTRY_DSN,
    environment: process.env.NODE_ENV || 'development',
    integrations: [
        nodeProfilingIntegration(),
    ],
    tracesSampleRate: 0.1,
    profilesSampleRate: 0.1,
});

Key Helpers:

  • EmailSentryHelper - Email-specific errors
  • BaseController - Controller error handling

Configuration (config.ini)

[sentry]
dsn = your-sentry-dsn
environment = development
tracesSampleRate = 0.1
profilesSampleRate = 0.1

[databaseMonitoring]
enableDbTracing = true
slowQueryThreshold = 100
logDbQueries = false
dbErrorCapture = true
enableN1Detection = true

Testing Sentry Integration

Form Service Test Endpoints

# Test basic error capture
curl http://localhost:3002/blog-api/api/sentry/test-error

# Test workflow error
curl http://localhost:3002/blog-api/api/sentry/test-workflow-error

# Test database performance
curl http://localhost:3002/blog-api/api/sentry/test-database-performance

# Test error boundary
curl http://localhost:3002/blog-api/api/sentry/test-error-boundary

Email Service Test Endpoints

# Test basic error capture
curl http://localhost:3003/notifications/api/sentry/test-error

# Test email-specific error
curl http://localhost:3003/notifications/api/sentry/test-email-error

# Test performance tracking
curl http://localhost:3003/notifications/api/sentry/test-performance

Performance Monitoring

Requirements

  1. All API endpoints must have transaction tracking
  2. Database queries > 100ms are automatically flagged
  3. N+1 queries are detected and reported
  4. Cron jobs must track execution time

Transaction Tracking

import * as Sentry from '@sentry/node';

// Automatic transaction tracking for Express routes
app.use(Sentry.Handlers.requestHandler());
app.use(Sentry.Handlers.tracingHandler());

// Manual transaction for custom operations
const transaction = Sentry.startTransaction({
    op: 'operation.type',
    name: 'Operation Name',
});

try {
    // Your operation
} finally {
    transaction.finish();
}

Common Mistakes to Avoid

NEVER use console.error without Sentry ❌ NEVER swallow errors silently ❌ NEVER expose sensitive data in error context ❌ NEVER use generic error messages without context ❌ NEVER skip error handling in async operations ❌ NEVER forget to import instrument.ts as first line in cron jobs

Implementation Checklist

When adding Sentry to new code:

  • Imported Sentry or appropriate helper
  • All try/catch blocks capture to Sentry
  • Added meaningful context to errors
  • Used appropriate error level
  • No sensitive data in error messages
  • Added performance tracking for slow operations
  • Tested error handling paths
  • For cron jobs: instrument.ts imported first

Key Files

Form Service

  • /blog-api/src/instrument.ts - Sentry initialization
  • /blog-api/src/workflow/utils/sentryHelper.ts - Workflow errors
  • /blog-api/src/utils/databasePerformance.ts - DB monitoring
  • /blog-api/src/controllers/BaseController.ts - Controller base

Email Service

  • /notifications/src/instrument.ts - Sentry initialization
  • /notifications/src/utils/EmailSentryHelper.ts - Email errors
  • /notifications/src/controllers/BaseController.ts - Controller base

Configuration

  • /blog-api/config.ini - Form service config
  • /notifications/config.ini - Email service config
  • /sentry.ini - Shared Sentry config

Documentation

  • Full implementation: /dev/active/email-sentry-integration/
  • Form service docs: /blog-api/docs/sentry-integration.md
  • Email service docs: /notifications/docs/sentry-integration.md

Related Skills

  • Use database-verification before database operations
  • Use workflow-builder for workflow error context
  • Use database-scripts for database error handling

适合场景

01

用户想查找某类 Agent Skill 时

02

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

03

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

04

需要参考平台分布和安装热度时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

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

能力 4

补充不同宿主或平台的使用分布数据

能力 5

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

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

平台分布

Claude Code

31.03%
按下载量换算98

Gemini CLI

23.68%
按下载量换算75

Antigravity

16.99%
按下载量换算54

OpenCode

12.94%
按下载量换算41

windsurf

7.31%
按下载量换算23

Codex

3.42%
按下载量换算11

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。

来源信息

继续浏览同类 Skills