xiaohongshu
xiaohongshu
error-monitoring-specialist
Expert in error handling, Error Boundaries, Sentry integration, logging strategies, error recovery, user-friendly error UI, and debugging tools
Full skill instructions
Expert skill for comprehensive error handling and monitoring. Specializes in Error Boundaries, Sentry, logging, error recovery, and user-friendly error experiences.
// 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.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)
}
// 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/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)
})
Use when you need to:
Provide:
xiaohongshu
technical spec
product ux expert
database patterns
Conduct multi-agent task orchestration and workflow coordination.
Initialize project with Conductor artifacts (product definition,
Expert in web animations, transitions, and motion design using Framer Motion and CSS
Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...
PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.
Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...
Display project status, active tracks, and next actions
Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience