/bug-handler:setup-reportingfrom Bug Handler
Use when adding the bug_handler package to a Flutter app for the first time, wiring BugReportClient/ClientConfig/BugReportBindings at bootstrap, choosing providers, sanitizers, Policy, or reporters, or when initialization questions come up (init order, runZonedGuarded, flush on startup, per-environment config).
Ships in Bug Handler. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Wire the error-reporting pipeline once, at bootstrap, matched to how this app
already boots. Audience: developers integrating bug_handler into an app.
pubspec.yaml / pubspec.lock: is bug_handler present, and which version
resolves? If it resolves to 0.0.1-dev.*, STOP - that is the legacy API; use
the migrate-legacy-api skill instead. If absent, add
bug_handler: ^1.0.0-dev.7 under dependencies and run flutter pub get.
This release requires Flutter 3.38.1 or later. Inspect the resolved version
before applying these bootstrap, privacy and queue behaviors to an older app.main.dart / bootstrap.dart: does the app already use runZonedGuarded,
set FlutterError.onError, PlatformDispatcher.instance.onError, DI
(get_it/riverpod container), or initialize Sentry/Crashlytics/Firebase? List
what exists - this decides the bootstrap style and prevents double wiring.BugReportBindings.runAppWithReporting(app: () => MyApp(), config: ...).
Call it before initializing Flutter so it can initialize the binding and run
the app in one guarded zone. If a binding already exists, call from the
zone that initialized it. That zone then owns uncaught async errors.
Framework and dispatcher handlers still capture errors with handled: false.
The current-isolate listener runs only on native platforms. Import
package:bug_handler/flutter/bindings.dart.BugReportClient.instance.initialize(config) inside the existing flow, add the
three handlers, and call unawaited(BugReportClient.instance.flush()) after
runApp to drain the offline outbox. Follow Pattern C in
../../references/production-patterns.md. Install one capture path per
error source so the same crash reaches your backend once.Start from Pattern D in ../../references/production-patterns.md. Decisions to
make with the user's context (defaults in parentheses match production usage):
environment: derive from the app's existing mode/flavor (mode.name).AppContextProvider() for app context. Add DeviceContextProvider()
for device details, which can include host names and machine or vendor IDs.
NetworkContextProvider() can collect SSID, BSSID and IP addresses on Wi-Fi.
Filter fields the receiver should omit. UIContextProvider needs a BuildContext and is
manual-report-only; skip at bootstrap.policy: Policy(minSeverity: Severity.warning) in production apps that want
warnings; the package default is Severity.error. Remember LOWER index = MORE
severe: warning is more permissive than error. Leave environments empty
unless the app must hard-mute some flavors.reporters: minimum viable is [if (kDebugMode) const ConsoleReporter()] plus
ONE real backend. If none exists yet, a log-only reporter that returns true
keeps the outbox from accumulating (Pattern B). Do NOT put ShareReporter() in
an automatic pipeline: its send() opens the platform share sheet and a
completed share counts as successful delivery. For Sentry/Crashlytics, use the
extend-pipeline skill (the shipped adapter files are empty placeholders).sanitizers: always include at least DefaultSanitizer(). For the full
privacy chain and ordering rules use the tune-privacy skill; a proven default
chain is in Pattern D.UserContextProvider at login via
addContextProvider, clear at logout - not in the static config.dart analyze the touched files - zero new issues.throw StateError('bug_handler smoke test') inside guard(..., source: 'Setup.smokeTest'))
and confirm the ConsoleReporter block prints with type, severity, and context
keys, then remove the test code.BugReportClient.instance.initialize and runAppWithReporting calls).flush().
Check the received payload and confirm the persisted entry was removed.
An enabled ConsoleReporter counts as successful delivery, so omit it
when exercising the failed-send path.capture throwing StateError: BugReportClient is not initialized: something
reports before bootstrap finishes. Either reorder, or use captureSafely
(no-op before init) for early paths.../../references/policy-and-delivery.md gate order (environment, severity,
handled, sampling, dedupe-by-type, rate limit) before touching reporter code.~/.pub-cache/hosted/pub.dev/bug_handler-<version>/lib/ for signatures."Add bug_handler to our app; we have get_it DI and Sentry already initialized in bootstrap.dart" -> inspect bootstrap order, keep Sentry init but strip its OnErrorIntegration (Pattern A), initialize the client after DI, hand-wire the three handlers + flush, config with Console (debug) + SentryReporter, DefaultSanitizer chain, Policy(minSeverity: warning), then run the smoke test and remove it.
What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
8 skills in this plugin
/audit-error-handlingUse when reviewing code in an app that depends on bug_handler - PR review, "check our error handling", pre-release audits, or "are we using bug_handler correctly". Finds violations of the guard contract: string errors in state, unreported catches, raw exceptions crossing repository boundaries, missing source labels, misused isReportable./diagnose-reportingUse when bug_handler reports are missing, duplicated, delayed, or unexpected - "nothing arrives in Sentry", "capture doesn't send", "errors only show sometimes", outbox files piling up in bug_report_outbox, StateError about initialization, or events arriving that should have been suppressed./extend-pipelineUse when connecting bug_handler to a delivery backend or enriching its reports - writing a custom Reporter (Sentry, Crashlytics, Slack, first-party HTTP endpoint), a custom ContextProvider (feature/session/cart context), or an EventTransform. Also use when someone tries to use the shipped Sentry/Crashlytics "adapters" (they are empty placeholder files)./guard-workflowUse when writing or refactoring feature code in an app that depends on bug_handler - repositories/services that can fail, cubits/blocs/notifiers/controllers that load data, error states, try/catch blocks, or "handle errors properly" requests. Also use when choosing which exception type to throw or how errors should reach the UI./migrate-dev6-to-dev7Use when upgrading bug_handler from 1.0.0-dev.6 to 1.0.0-dev.7. Covers file-based reporters, browser context injection and sharing tests, and Equatable 3 comparisons in exception metadata and custom props./migrate-legacy-apiUse when a project depends on bug_handler 0.0.1-dev.x or contains its legacy API - BugReporter, ErrorHandler, handleError, wrapper, ReportResult, ReportConfig, sentryDsn, ManualReporter, SentryReporter, ErrorDisplayWidget, or imports like package:bug_handler/core/error_handler.dart - and needs to move to the current 1.0.0-dev.x API.npx claudepluginhub omar-hanafy/bug_handler --plugin bug-handler