From 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.
How this skill is triggered — by the user, by Claude, or both
Slash command
/bug-handler:migrate-legacy-apiThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Supported path: any 0.0.1-dev.1..4 project -> 1.0.0-dev.5 or later (recommend
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"
pubspec.yaml: bug_handler: ^1.0.0-dev.6 (or current latest). 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.
npx claudepluginhub omar-hanafy/bug_handler --plugin bug-handlerGuides completion of development work by verifying tests, detecting environment, and presenting structured options for merge, PR, or cleanup.
Guides creation and editing of skills using test-driven development with pressure scenarios and subagents to verify agent compliance.
Dispatches multiple subagents concurrently for independent tasks without shared state. Use when facing 2+ unrelated failures or subsystems that can be investigated in parallel.