본문으로 건너뛰기
Skillpedia
배포 및 클라우드 (DevOps)10k · #12032

error-tracking

하는 일

이 스킬은 Sentry라는 온라인 오류 추적 서비스를 코드에 설정해서, 오류가 검토를 위해 Sentry로 전송되도록 합니다. 웹 서비스를 운영하며 실패와 느린 호출을 보고 싶은 개발자를 위한 스킬입니다.

사용하는 경우

  • ✓서비스에 오류 처리를 추가하거나 새 컨트롤러를 만들 때.
  • ✓보고가 필요한 예약 작업을 설정할 때.
  • ✓느린 데이터베이스 호출을 추적하거나 성능 구간을 추가하고 싶은 경우.

스킬 링크

https://github.com/diet103/claude-code-infrastructure-showcase/blob/main/.agents/skills/error-tracking/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/diet103/claude-code-infrastructure-showcase/blob/main/.agents/skills/error-tracking/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“새 컨트롤러에 Sentry 오류 추적을 추가해서, 모든 오류가 Sentry로 전송되도록 해 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

이 스킬은 오류와 성능 데이터를 Sentry로 보내는 표준 패턴을 보여 줍니다. 오류를 단순히 기록하지 말고 보고하도록 AI에게 상기시키며, 컨트롤러, 라우트, 백그라운드 작업을 다룹니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

Sentry Integration Skill

Purpose

This skill enforces comprehensive Sentry error tracking and performance monitoring across all 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

Example: API Service ✅ Complete

  • Sentry v8 fully integrated
  • All workflow errors tracked
  • Background job processors instrumented
  • Test endpoints available

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

Example of a domain-specific Sentry helper from the original production project. If you build a helper like this for your domain, the call site looks like:

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

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

Without a helper, plain Sentry works everywhere:

Sentry.captureException(error, {
    tags: { operation: 'stepCompletion' },
    extra: { workflowCode: 'INVOICE_APPROVAL', instanceId: 123, userId: 'user-123' }
});

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

Example from the original production project - a small helper that wraps DB calls in Sentry spans. Adapt to your codebase:

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

const result = await DatabasePerformanceMonitor.withPerformanceTracking(
    'findMany',
    'UserProfile',
    async () => {
        return await PrismaService.main.userProfile.findMany({
            take: 5,
        });
    }
);

The universally-available equivalent is a direct Sentry span:

const result = await Sentry.startSpan({
    name: 'db.userProfile.findMany',
    op: 'db.query',
    attributes: { 'db.model': 'UserProfile', 'db.operation': 'findMany' }
}, async () => {
    return await prisma.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

자주 묻는 질문

Sentry는 무엇인가요?

Sentry는 소프트웨어의 오류를 수집해 개발자에게 보여 주는 온라인 서비스입니다.

오류를 콘솔에만 기록하나요?

아니요. 이 스킬은 오류를 콘솔에만 쓰지 말고 Sentry로 보내야 한다고 설명합니다.

백그라운드 작업도 다루나요?

네. 예약 작업과 백그라운드 처리기에 대한 안내도 포함되어 있습니다.

상세 정보

작성자의 원본 설명

Add Sentry v8 error tracking and performance monitoring to your services. Use this skill when adding error handling, creating new controllers, instrumenting cron jobs, or tracking database performance. ALL ERRORS MUST BE CAPTURED TO SENTRY - no exceptions.

repo: diet103/claude-code-infrastructure-showcase

인기도

GitHub 스타
10k
순위
#12032
라이선스
MIT
업데이트
2026. 7. 13.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

비슷한 스킬