/bug-handler:extend-pipelinefrom Bug Handler
Use 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).
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.
Three extension points: Reporter (delivery), ContextProvider (enrichment),
EventTransform (reshaping). The shipped
reporters/adapters/{sentry,crashlytics}.dart files are EMPTY placeholders -
never import them; write the reporter in the app.
true to acknowledge the event. Return false to request a retry.
The client enqueues a failed send when every configured reporter fails.isReportable policy,
noise suppression), return TRUE. Returning false for skips makes the outbox
grow forever with events you will never send.false on a delivery error. CompositeReporter also treats a
thrown error as a failure and continues to the remaining reporters.event.toMap(). It is the sanitized payload embedded
by the client. Building output from event.context/event.exception fields
directly bypasses every sanitizer - a privacy bug.event.exception is a SerializedException, not the
original subtype. Type checks like event.exception is ValidationException
silently stop matching for replayed events; prefer payload fields
when filtering must survive replay. Check that the exception is a map before
reading its type or message. A filter or size budget may have removed or
replaced the whole field.ReportAttachment.fromEvent(event).bytes with the
attachment's name and mimeType. Use the protected generateFile only in
native implementations whose consumer requires a filesystem path.Full working SentryReporter (transport-only Sentry, skip semantics, level
mapping) and LoggerReporter templates: Patterns A and B in
../../references/production-patterns.md. For Sentry, also apply the bootstrap
side of Pattern A (strip OnErrorIntegration so Sentry does not double-capture
what bug_handler already owns).
class CartContextProvider extends ContextProvider with CachedContextProvider {
CartContextProvider(this.cart);
final CartService cart;
@override
String get name => 'cart'; // key in event context
@override
Duration get cacheDuration => const Duration(seconds: 30);
@override
Future<Map<String, dynamic>> collect() async => {
'items': cart.items.length,
'total': cart.total,
};
}
Rules:
CachedContextProvider, override collect(), NOT getData() (the mixin
owns getData: TTL cache + in-flight dedupe + never-throw).getData() must never throw - return {} on failure..name, DateTime via toIso8601String().manualReportOnly => true for heavy or sensitive data (collected only when
manual: true, i.e. user-initiated reports).validateData; that is fine.baseProviders/additionalProviders, or runtime via
BugReportClient.instance.addContextProvider(...) (dedupes by equality;
lifecycle-bound data like the current user belongs at runtime with
clearContextProviders() on logout).tune-privacy skill if you add any.ReportEvent Function(ReportEvent), applied in order BEFORE sanitization.
Use for tagging/normalizing (e.g., copy metadata['source'] into a context
tag, rewrite devMessages for grouping). Transforms cannot cancel delivery -
that is Policy/Reporter territory. Keep them pure; return e.copyWith(...).
dart analyze + dart format on new files.ReportEvent (or SerializedException-based one via
ReportEvent.fromMap) and assert send() returns true/false per your matrix,
and that skipped events return true.setup-reporting skill; confirm the backend received the sanitized payload
(spot-check that a known-sensitive field arrives masked)."Send our bug_handler reports to Crashlytics" -> new CrashlyticsReporter extends Reporter in the app's reporting module: send maps
the retained message, stack and diagnostic fields in event.toMap() into
the Crashlytics call. Test with a payload whose message is redacted and a
second payload whose exception field was removed. Confirm that both preserve
the configured privacy rules at the reporter.
What SKILL.md sets; muted values are Claude Code's defaults
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./Other plugins' skills for the same job
npx claudepluginhub omar-hanafy/bug_handler --plugin bug-handler