Skip to content
Development
Command

/error-trace

You are an error tracking and observability expert specializing in implementing comprehensive error monitoring solutions. Set up error tracking systems, configure alerts, implement structured logging, and ensure teams can quickly identify and resolve production issues.

From plugin
wshobson-agents
39k95 skills139 agents95 commands
Install
$ npx -y skills add wshobson/agents --agent claude-code

How it fires

How this command gets triggered: by you, by Claude, or both.

  • Fires itselfClaude auto-loads it when your prompt matches the work.
  • You can call itInvoke it directly when you want it.
  • Slash command/error-trace

Context preview

What this command does when you run it.

You are an error tracking and observability expert specializing in implementing comprehensive error monitoring solutions. Set up error tracking systems, configure alerts, implement structured logging, and ensure teams can quickly identify and resolve production issues.

Command definition

error-trace.md

Error Tracking and Monitoring

You are an error tracking and observability expert specializing in implementing comprehensive error monitoring solutions. Set up error tracking systems, configure alerts, implement structured logging, and ensure teams can quickly identify and resolve production issues.

Context

The user needs to implement or improve error tracking and monitoring. Focus on real-time error detection, meaningful alerts, error grouping, performance monitoring, and integration with popular error tracking services.

Requirements

$ARGUMENTS

Instructions

1. Error Tracking Analysis

Analyze current error handling and tracking:

**Error Analysis Script**

import os
import re
import ast
from pathlib import Path
from collections import defaultdict

class ErrorTrackingAnalyzer:
    def analyze_codebase(self, project_path):
        """
        Analyze error handling patterns in codebase
        """
        analysis = {
            'error_handling': self._analyze_error_handling(project_path),
            'logging_usage': self._analyze_logging(project_path),
            'monitoring_setup': self._check_monitoring_setup(project_path),
            'error_patterns': self._identify_error_patterns(project_path),
            'recommendations': []
        }

        self._generate_recommendations(analysis)
        return analysis

    def _analyze_error_handling(self, project_path):
        """Analyze error handling patterns"""
        patterns = {
            'try_catch_blocks': 0,
            'unhandled_promises': 0,
            'generic_catches': 0,
            'error_types': defaultdict(int),
            'error_reporting': []
        }

        for file_path in Path(project_path).rglob('*.{js,ts,py,java,go}'):
            content = file_path.read_text(errors='ignore')

            # JavaScript/TypeScript patterns
            if file_path.suffix in ['.js', '.ts']:
                patterns['try_catch_blocks'] += len(re.findall(r'try\s*{', content))
                patterns['generic_catches'] += len(re.findall(r'catch\s*\([^)]*\)\s*{\s*}', content))
                patterns['unhandled_promises'] += len(re.findall(r'\.then\([^)]+\)(?!\.catch)', content))

            # Python patterns
            elif file_path.suffix == '.py':
                try:
                    tree = ast.parse(content)
                    for node in ast.walk(tree):
                        if isinstance(node, ast.Try):
                            patterns['try_catch_blocks'] += 1
                            for handler in node.handlers:
                                if handler.type is None:
                                    patterns['generic_catches'] += 1
                except:
                    pass

        return patterns

    def _analyze_logging(self, project_path):
        """Analyze logging patterns"""
        logging_patterns = {
            'console_logs': 0,
            'structured_logging': False,
            'log_levels_used': set(),
            'logging_frameworks': []
        }

        # Check for logging frameworks
        package_files = ['package.json', 'requirements.txt', 'go.mod', 'pom.xml']
        for pkg_file in package_files:
            pkg_path = Path(project_path) / pkg_file
            if pkg_path.exists():
                content = pkg_path.read_text()
                if 'winston' in content or 'bunyan' in content:
                    logging_patterns['logging_frameworks'].append('winston/bunyan')
                if 'pino' in content:
                    logging_patterns['logging_frameworks'].append('pino')
                if 'logging' in content:
                    logging_patterns['logging_frameworks'].append('python-logging')
                if 'logrus' in content or 'zap' in content:
                    logging_patterns['logging_frameworks'].append('logrus/zap')

        return logging_patterns

2. Error Tracking Service Integration

Implement integrations with popular error tracking services:

**Sentry Integration**

// sentry-setup.js
import * as Sentry from "@sentry/node";
import { ProfilingIntegration } from "@sentry/profiling-node";

class SentryErrorTracker {
  constructor(config) {
    this.config = config;
    this.initialized = false;
  }

  initialize() {
    Sentry.init({
      dsn: this.config.dsn,
      environment: this.config.environment,
      release: this.config.release,

      // Performance Monitoring
      tracesSampleRate: this.config.tracesSampleRate || 0.1,
      profilesSampleRate: this.config.profilesSampleRate || 0.1,

      // Integrations
      integrations: [
        // HTTP integration
        new Sentry.Integrations.Http({ tracing: true }),

        // Express integration
        new Sentry.Integrations.Express({
          app: this.config.app,
          router: true,
          methods: ["GET", "POST", "PUT", "DELETE", "PATCH"],
        }),

        // Database integration
        new Sentry.Integrations.Postgres(),
        new Sentry.Integrations.Mysql(),
        new Sentry.Integrations.Mongo(),

        // Profiling
        new ProfilingIntegration(),

        // Custom integrations
        ...this.getCustomIntegrations(),
      ],

      // Filtering
      beforeSend: (event, hint) => {
        // Filter sensitive data
        if (event.request?.cookies) {
          delete event.request.cookies;
        }

        // Filter out specific errors
        if (this.shouldFilterError(event, hint)) {
          return null;
        }

        // Enhance error context
        return this.enhanceErrorEvent(event, hint);
      },

      // Breadcrumbs
      beforeBreadcrumb: (breadcrumb, hint) => {
        // Filter sensitive breadcrumbs
        if (breadcrumb.category === "console" && breadcrumb.level === "debug") {
          return null;
        }

        return breadcrumb;
      },

      // Options
      attachStacktrace: true,
      shutdownTimeout: 5000,
      maxBreadcrumbs: 100,
      debug: this.co
Read more
Ships withwshobson-agents

Production-ready agentic workflow building blocks: 94 plugins, 203 agents, 175 skills, 109 commands — built for Claude Code and consumed natively by OpenAI Codex CLI, Cursor, OpenCode, Gemini CLI, and GitHub Copilot from a single Markdown source.

Get the whole plugin, auto-invoked
Stats
38,612
Stars
7
Views
4,119
Forks
Active
Maintenance
Python
Language
MIT
License
3d ago
Last commit
1y ago
Created

Repo: wshobson/agents