/bug-handler:migrate-legacy-apifrom Bug Handler
Use 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.
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.
Supported path: any 0.0.1-dev.1..4 project -> 1.0.0-dev.5 or later (recommend
latest). The lines are source-incompatible; this is a mechanical-plus-judgment
migration, not a version bump. Complete symbol table, behavior changes, and
detection patterns: ../../references/legacy-api-mapping.md (read it fully
before editing). Worked before/after example:
../../fixtures/migration/ (legacy_before/ vs current_after/).
pubspec.lock resolves
bug_handler to 0.0.1-dev.*, or legacy symbols/imports from the mapping's
detection list appear in lib/. If already on 1.0.0-dev.x with no legacy
symbols, STOP and say so - nothing to migrate.grep -rn -E "BugReporter|ErrorHandler|handleError\(|wrapper\(|ReportResult|ReportConfig|ManualReporter|SentryReporter|ErrorDisplayWidget|reportException\(|manualReport:|shouldAutoReport|shouldReportToSentry" lib/ --include='*.dart'
grep -rn "package:bug_handler/" lib/ --include='*.dart' | grep -vE "bug_handler/bug_handler.dart"
bug_handler: ^1.0.0-dev.7 in pubspec.yaml. If the app
used Sentry through the legacy package (sentryDsn set, Sentry types without
a direct dep), add sentry_flutter explicitly now - legacy re-exported it;
current does not. flutter pub get.core/core.dart,
exceptions/exceptions.dart, config/config.dart, context/context.dart,
reporters/reporters.dart, core/error_handler.dart,
core/bug_reporter.dart) with package:bug_handler/bug_handler.dart; add
flutter/error_boundary.dart where ErrorDisplayWidget was used,
helpers.dart where HttpStatusCodeInfo is constructed.BugReporter.initialize(start, config: ReportConfig(...)) becomes
BugReportBindings.runAppWithReporting(app:, config: ClientConfig(...)) (or
manual wiring, Pattern C in ../../references/production-patterns.md).
Config field moves per the mapping table: enum environment -> String;
minSeverity -> Policy; sentryDsn/enableSentry -> app-owned SentryFlutter.init
SentryReporter (Pattern A). onPreSendReport/onPreShareReport
need a HUMAN DECISION - see judgment cases below.wrapper(action, source:, onSuccess:, onError:, shouldReport:) ->
guard(action, source:, onSuccess:, onError:);handleError(e, s, source:, ...) -> captureSafely(normalizeError(e, s, source: source));ReportResult consumption -> Result: didThrow -> isErr; .data ->
unwrapOr/pattern-match; didReport -> DELETE the branch (delivery
outcome is intentionally not exposed; code must not depend on it);reportException(e) -> captureSafely(e); manualReport: -> manual:;ManualReporter -> ShareReporter; ErrorDisplayWidget(config:) ->
ErrorBoundary(fallbackBuilder:);parser(...) - unchanged, leave as is.const from constructors/call sites of
BaseException subclasses (current base is non-const). ErrorSeverity still
compiles via typedef; optionally rename to Severity. Replace uses of the
removed severity.shouldAutoReport / shouldReportToSentry getters with
Policy config or reporter-side checks.dart format . then dart analyze - iterate until zero
errors. Then re-run the step-0 greps: expected result is zero legacy symbols.shouldReport: per-call callbacks and onPreSendReport cancel hooks: current
API has no cancelable pre-send. Options: encode blanket rules in Policy,
move filtering into the custom Reporter (skip -> return true), or drop the
behavior. Present the options with the original callback's logic quoted.isReportable reliance: legacy ENFORCED it; current ignores it. Grep
isReportable - if the app sets it false anywhere expecting suppression,
decide per type: keep minSeverity: error (suppresses the warning/info
defaults), or add reporter-side skip logic. This is the migration's main
silent behavior change.didReport): any real logic hanging off it must
be redesigned - flag each site.Policy(rateLimit:, dedupe:) deliberately.dart analyze clean; app builds for its primary platform.guard) reaches the configured reporter, then remove the probe.ErrorSeverity usages
are legal (typedef) - do not chase them unless the user wants the rename.bug_reporting_system package name): the mapping still
mostly applies (same legacy shape), but say explicitly that this exact
source version is not a published supported path and proceed only with the
user's consent, mapping symbol-by-symbol.BugReporter and BugReportClient wired.git checkout the migration branch away, restore pubspec.lock via
flutter pub get. No on-disk state migrates (legacy had no outbox), so
rollback is source-only.App on 0.0.1-dev.4 with wrapper() in 40 call sites, Sentry via sentryDsn ->
inventory greps; pubspec bump + explicit sentry_flutter; bootstrap rewritten to
runAppWithReporting + SentryReporter (Pattern A); 40 wrapper sites -> guard with
kept source labels; two didReport branches flagged to the user (dropped after
confirmation); analyze clean; smoke event visible in Sentry exactly once.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub omar-hanafy/bug_handler --plugin bug-handler8 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./Other plugins' skills for the same job