# Error Tracking

Add Sentry v8 error tracking and performance monitoring to your services.

- Repository: https://github.com/diet103/claude-code-infrastructure-showcase (10043 stars)
- Category: Data and ML
- License: MIT
- Last updated: 2026-07-13
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add diet103/claude-code-infrastructure-showcase --skill error-tracking -g -a claude-code -y`
Codex: `npx skills add diet103/claude-code-infrastructure-showcase --skill error-tracking -g -a codex -y`
Cursor: `npx skills add diet103/claude-code-infrastructure-showcase --skill error-tracking -g -a cursor -y`
Gemini CLI: `npx skills add diet103/claude-code-infrastructure-showcase --skill error-tracking -g -a gemini-cli -y`

## Description

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.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# 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

```typescript
// ✅ 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)

```typescript
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:

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

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