areas/software/frontend/skills/error-handling/SKILL.md
# Skill: Frontend Error Handling ## When to load When adding error boundaries, handling async errors, or building error UI states. ## Error Boundary ```tsx class ErrorBoundary extends React.Component< { fallback: React.ComponentType<{ error: Error; reset: () => void }> }, { error: Error | null } > { state = { error: null }; static getDerivedStateFromError(error: Error) { return { error }; } componentDidCatch(error: Error, info: React.ErrorInfo) { logger.error('UI Error'
npx skillsauth add sawrus/agent-guides areas/software/frontend/skills/error-handlingInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
When adding error boundaries, handling async errors, or building error UI states.
class ErrorBoundary extends React.Component<
{ fallback: React.ComponentType<{ error: Error; reset: () => void }> },
{ error: Error | null }
> {
state = { error: null };
static getDerivedStateFromError(error: Error) {
return { error };
}
componentDidCatch(error: Error, info: React.ErrorInfo) {
logger.error('UI Error', { error: error.message, componentStack: info.componentStack });
}
render() {
if (this.state.error) {
const Fallback = this.props.fallback;
return <Fallback error={this.state.error} reset={() => this.setState({ error: null })} />;
}
return this.props.children;
}
}
// Usage:
<ErrorBoundary fallback={RouteErrorFallback}>
<UserDashboard />
</ErrorBoundary>
export class ApiError extends Error {
constructor(public status: number, public body: unknown) {
super(`API Error ${status}`);
}
}
// In components:
if (error instanceof ApiError) {
if (error.status === 401) return <LoginRedirect />;
if (error.status === 403) return <ForbiddenMessage />;
if (error.status === 404) return <NotFound />;
}
return <GenericError message={error.message} />;
testing
QA Expert for writing E2E tests, test scenarios, test plans, and ensuring test coverage quality.
development
Expert UI/UX design intelligence for creating distinctive, high-craft, and mobile-first interfaces. Focuses on premium aesthetics, touch-first ergonomics, and Flutter performance.
development
Code Review Expert for static analysis, security auditing, architecture review, and ensuring code quality standards.
development
Babysit a GitHub pull request after creation by continuously polling review comments, CI checks/workflow runs, and mergeability state until the PR is merged/closed or user help is required. Diagnose failures, retry likely flaky failures up to 3 times, auto-fix/push branch-related issues when appropriate, and keep watching open PRs so fresh review feedback is surfaced promptly. Use when the user asks Codex to monitor a PR, watch CI, handle review comments, or keep an eye on failures and feedback on an open PR.