Claude-skill-registry error-monitoring-specialist
Expert in error handling, Error Boundaries, Sentry integration, logging strategies, error recovery, user-friendly error UI, and debugging tools
install
source · Clone the upstream repo
git clone https://github.com/majiayu000/claude-skill-registry
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/majiayu000/claude-skill-registry "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/data/error-monitoring-specialist" ~/.claude/skills/majiayu000-claude-skill-registry-error-monitoring-specialist && rm -rf "$T"
manifest:
skills/data/error-monitoring-specialist/SKILL.mdsource content
Error Monitoring Specialist
Expert skill for comprehensive error handling and monitoring. Specializes in Error Boundaries, Sentry, logging, error recovery, and user-friendly error experiences.
Core Capabilities
1. Error Boundaries
- Class Components: componentDidCatch
- React Error Boundaries: Catch rendering errors
- Fallback UI: User-friendly error pages
- Error Recovery: Reset component state
- Nested Boundaries: Granular error handling
2. Error Tracking
- Sentry: Industry-standard error tracking
- LogRocket: Session replay
- Bugsnag: Error monitoring
- Custom Logging: Application-specific logs
- Source Maps: Map errors to source code
3. Error Types
- Runtime Errors: JavaScript errors
- Network Errors: Failed API calls
- Validation Errors: Form validation
- 404 Errors: Not found pages
- Permission Errors: Unauthorized access
- Async Errors: Promise rejections
4. User Experience
- Friendly Messages: Non-technical language
- Retry Mechanisms: Allow users to retry
- Contact Support: Easy reporting
- Fallback Content: Graceful degradation
- Error Analytics: Track common errors
Error Boundary
// ErrorBoundary.tsx import { Component, ReactNode, ErrorInfo } from 'react' import * as Sentry from '@sentry/react' interface Props { children: ReactNode fallback?: ReactNode } interface State { hasError: boolean error: Error | null } export class ErrorBoundary extends Component<Props, State> { constructor(props: Props) { super(props) this.state = { hasError: false, error: null } } static getDerivedStateFromError(error: Error): State { return { hasError: true, error } } componentDidCatch(error: Error, errorInfo: ErrorInfo) { console.error('Error caught by boundary:', error, errorInfo) Sentry.captureException(error, { contexts: { react: { componentStack: errorInfo.componentStack } } }) } render() { if (this.state.hasError) { return this.props.fallback || ( <div className="error-fallback"> <h1>Something went wrong</h1> <p>We've been notified and are working on a fix.</p> <button onClick={() => this.setState({ hasError: false, error: null })}> Try again </button> </div> ) } return this.props.children } }
Sentry Setup
// sentry.ts import * as Sentry from '@sentry/react' import { BrowserTracing } from '@sentry/tracing' Sentry.init({ dsn: process.env.REACT_APP_SENTRY_DSN, integrations: [new BrowserTracing()], tracesSampleRate: 1.0, environment: process.env.NODE_ENV, beforeSend(event, hint) { if (event.exception) { console.error(hint.originalException || hint.syntheticException) } return event }, }) // Usage try { throw new Error('Test error') } catch (error) { Sentry.captureException(error) }
Async Error Handling
// hooks/useAsyncError.ts import { useState } from 'react' export function useAsyncError() { const [, setError] = useState() return (error: Error) => { setError(() => { throw error }) } } // Usage function AsyncComponent() { const throwError = useAsyncError() useEffect(() => { fetchData().catch(throwError) }, []) }
API Error Handling
// api/errorHandler.ts export class APIError extends Error { constructor(public status: number, message: string) { super(message) this.name = 'APIError' } } export async function handleAPIError(response: Response) { if (!response.ok) { const error = await response.json() throw new APIError(response.status, error.message) } return response } // Usage fetch('/api/data') .then(handleAPIError) .then(response => response.json()) .catch(error => { if (error instanceof APIError) { if (error.status === 401) { // Redirect to login } } Sentry.captureException(error) })
Best Practices
- Use Error Boundaries at route level
- Log errors to monitoring service
- Show user-friendly error messages
- Provide retry mechanisms
- Track error frequency
- Monitor error trends
- Test error scenarios
- Document common errors
When to Use This Skill
Use when you need to:
- Set up error monitoring
- Create Error Boundaries
- Integrate Sentry or LogRocket
- Handle API errors gracefully
- Build error recovery mechanisms
- Improve error UX
- Debug production errors
Output Format
Provide:
- Error Boundaries: Component-level error handling
- Monitoring Setup: Sentry/LogRocket configuration
- Error UI: User-friendly error pages
- Logging Strategy: What and how to log
- Recovery Mechanisms: How users can recover
- Testing: Error scenario tests