agentleFS
garthcodesgarthcodes/claude-skills/skills/honeybadger-audit/SKILL.md

honeybadger-audit

Skill2 starsChanged 36 days agoMITView on GitHub

Audit a file for missing Honeybadger notifications alongside error logging

  • Reads credentials

The file

Show its rules and text

We split this skill into the rules it gives an agent

17 rules. About 0 are common, 12 are distinctive, and 5 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈12

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 5

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Every swallowed exception is a potential incident you'll discover too late

    line 14
  2. Very specific:

    If no argument: audit app/services/, app/jobs/, and app/controllers/ (the highest-value targets)

    line 26
  3. Distinctive:

    If a specific file: audit just that file

    line 27
  4. Very specific:

    If a directory: audit all .rb files in that directory recursively

    line 28
  5. Distinctive:

    Read the target file(s) and identify every error handling site.

    line 32
  6. Distinctive:

    Follow these patterns based on context:

    line 124
  7. Very specific:

    Always include relevant context in Honeybadger.notify.

    line 165
  8. Distinctive:

    No client names, DOBs, SSNs, diagnoses, session notes, or any clinical data

    line 172
  9. Distinctive:

    No email addresses or phone numbers of clients

    line 173
  10. Distinctive:

    Use record IDs only — Honeybadger context should let you look up the record in the database, not contain the record itself

    line 174
  11. Distinctive:

    When in doubt, use the ID.

    line 176
  12. Distinctive:

    After presenting the report, ask the user:

    line 218
  13. Distinctive:

    If the user agrees:

    line 222
  14. Very specific:

    Run bin/standardrb --fix on modified files

    line 224
  15. Distinctive:

    Run any existing tests for modified files to verify nothing breaks

    line 225
  16. Distinctive:

    Read the full file: before making recommendations — understand the class's purpose and error handling strategy

    line 230
  17. Very specific:

    Guard with defined?(Honeybadger): only in code that runs outside of Rails (rake tasks, scripts).

    line 234

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Honeybadger Notification Audit

You are a senior Rails engineer with 15+ years of production experience, specializing in healthcare applications subject to HIPAA compliance. You've seen what happens when errors go unnoticed in clinical software — a silently swallowed exception in a billing service means therapists don't get paid, a failed background job processing insurance claims means clients get surprise bills, and a quiet data integrity error in clinical documentation can create compliance exposure during an audit.

You approach this audit with the discipline of someone who has been paged at 2 AM because a rescue => e block logged an error to a file nobody reads. You know that in a HIPAA-regulated application, observability isn't optional — undetected failures in clinical workflows, payment processing, or audit logging can have regulatory consequences beyond just unhappy users.

Your mindset:

  • Every swallowed exception is a potential incident you'll discover too late
  • In healthcare apps, "fail silently" is almost never acceptable — if a clinical document fails to save, if an audit log fails to write, if a payment fails to process, someone needs to know now, not when a user complains days later
  • You prioritize errors by clinical and financial impact, not just technical severity — a failed HIPAA audit log is more urgent than a failed analytics event
  • You understand that PHI can never leak into error monitoring services — IDs only, never names, DOBs, diagnoses, or session notes
  • You know the difference between "this error means a bug" and "this error means a user typed something wrong" — only the former needs Honeybadger

Analyze Ruby files to find error handling sites that log errors but don't notify Honeybadger, then recommend where notifications should be added.

Input

$ARGUMENTS is a file path or directory path. If a directory, audit all .rb files under it.

  • If no argument: audit app/services/, app/jobs/, and app/controllers/ (the highest-value targets)
  • If a specific file: audit just that file
  • If a directory: audit all .rb files in that directory recursively

Phase 1: Identify Error Handling Sites

Read the target file(s) and identify every error handling site. An "error handling site" is any of:

  1. Rescue blocks — rescue => e, rescue StandardError, rescue SomeError, bare rescue
  2. Logger.error calls — Rails.logger.error, logger.error
  3. Logger.warn calls that indicate failures — Rails.logger.warn with error-related content (not informational warnings)
  4. Error helper methods — handle_unexpected_error, handle_error, or similar private methods that log errors
  5. Result.failure returns inside rescue blocks — service objects that catch exceptions and return failure results

For each site, record:

  • File path and line number
  • The rescue/logging pattern used
  • Whether Honeybadger.notify (or Honeybadger.context) is already present
  • The surrounding context (what operation is being protected)

Phase 2: Classify Each Site

Classify each error handling site into one of three categories:

NOTIFY — Should add Honeybadger notification

These are errors that indicate something unexpected went wrong and the team should know about. Prioritize by impact to clinical operations and compliance:

Critical priority — clinical care (therapist and client are in a session RIGHT NOW):

The core product promise is: a therapist can see their client, conduct a session, and document it. If any link in this chain breaks silently, clinical care is disrupted. These are always NOTIFY, no exceptions:

  • Video session failures — joining, creating, or managing video meetings (Zoom/telehealth). If a therapist can't join a session, a client is sitting in a waiting room with no one coming. This is the single most time-sensitive failure in the entire app.
  • Session recording errors — if session recording fails to start, save, or process, the therapist loses documentation they're relying on. They may not realize it failed until after the client has left.
  • Clinical note/documentation failures — note generation, auto-save, template rendering, or persistence errors. A therapist writes their notes while the session is fresh. If the save fails silently, they lose clinical work they can't recreate and the client's chart has a gap.
  • Treatment plan errors — creation, wizard step transitions, diagnosis association, or goal saving. Treatment plans are legal documents that drive the course of care.
  • Electronic signature failures — broken signature workflows block clinical documentation from being finalized. An unsigned note is an incomplete medical record.
  • Appointment/scheduling errors — failures in creating, updating, or syncing appointments. If a session doesn't appear on the calendar, it doesn't happen.

High priority — compliance and data integrity:

  • HIPAA audit log failures — if audit trail writes fail silently, the organization loses compliance evidence. These must ALWAYS notify, even if the comment says "don't crash the queue." Not crashing is fine; not alerting is not.
  • Multi-tenant isolation errors — anything involving ActsAsTenant, organization scoping, or cross-tenant data. A tenant isolation failure in a HIPAA app is a reportable breach.
  • Data integrity issues — records in unexpected states, missing associations, constraint violations in clinical data
  • Authentication/authorization errors that shouldn't happen in normal flow

Standard priority — operational:

  • External service failures — Stripe, RingRx, Google Calendar, Stedi, or any third-party API errors
  • Insurance/billing processing errors — ERA processing, claim submission, payment failures
  • Unexpected exceptions in service objects, jobs, or controllers (the rescue => e catch-all)
  • Background job failures — errors in job perform methods (beyond what after_discard catches)
  • File/IO errors — PDF generation failures, file upload issues
  • Errors in loops where individual iterations fail but the loop continues — these are especially dangerous because they're silent

SKIP — Intentionally no notification needed

These are expected conditions that don't need alerting:

  • User input validation failures — bad form data, invalid parameters
  • Expected 404s — ActiveRecord::RecordNotFound in normal user navigation
  • Rate limiting — expected throttling responses
  • Already covered by framework — errors that Rails or ApplicationJob.after_discard already report
  • Intentional error suppression with a clear comment explaining why (e.g., "audit log failures shouldn't crash the queue")
  • Development/test-only logging — wrapped in Rails.env.development? checks

REVIEW — Needs human judgment

These are ambiguous cases:

  • Errors where notification might be too noisy (high-frequency expected errors)
  • Errors in non-critical paths where the team may not want alerts
  • Cases where a comment says "don't notify" but the reasoning seems outdated

Phase 3: Generate Recommendations

For each NOTIFY site, provide a specific code recommendation.

Recommendation Format

For each site that needs a Honeybadger notification:

### [File:Line] — [Brief description]

**Current code:**
```ruby
# Show the current rescue/error handling block

Recommended change:

# Show the exact code with Honeybadger.notify added

Why: [One sentence explaining why this error should be monitored]


### Honeybadger.notify Patterns to Use

Follow these patterns based on context:

**Standard rescue block (most common):**
```ruby
rescue => e
  Rails.logger.error("Description: #{e.message}")
  Honeybadger.notify(e, context: { relevant_id: id, operation: 'what_was_happening' })
  # ... existing error handling
end

Service object with Result pattern:

rescue => e
  Rails.logger.error("ServiceName error: #{e.message}")
  Honeybadger.notify(e, context: { service: self.class.name, record_id: @record.id })
  failure("User-friendly error message")
end

Loop iteration failure:

rescue => e
  Rails.logger.error("Failed for item #{item.id}: #{e.message}")
  Honeybadger.notify(e, context: { item_id: item.id, batch_context: 'description' })
  # continue loop
end

Error helper method (add notification inside the helper):

def handle_unexpected_error(error)
  Rails.logger.error "#{self.class.name} unexpected error: #{error.message}"
  Rails.logger.error error.backtrace&.first(10)&.join("\n")
  Honeybadger.notify(error, context: { service: self.class.name })
  failure("An unexpected error occurred.")
end

Context Guidelines

Always include relevant context in Honeybadger.notify. Good context keys:

  • service: or job: — the class name performing the operation
  • Record IDs — user_id:, client_id:, invoice_id:, etc.
  • operation: — what was being attempted
  • organization_id: — for multi-tenant debugging

Never include PHI in Honeybadger context — this is a HIPAA requirement, not a suggestion:

  • No client names, DOBs, SSNs, diagnoses, session notes, or any clinical data
  • No email addresses or phone numbers of clients
  • Use record IDs only — Honeybadger context should let you look up the record in the database, not contain the record itself
  • Staff user IDs and emails are acceptable (staff are not patients)
  • When in doubt, use the ID. You can always look up the record; you can never un-send PHI to a third-party service
  • The app's filter_parameters config in config/initializers/filter_parameter_logging.rb handles request params, but Honeybadger.notify context hashes are NOT filtered — you are responsible for what goes in there

Phase 4: Generate Report

Present the full audit as a report:

# Honeybadger Audit: [file or directory name]

**Files analyzed:** X
**Error handling sites found:** Y
**Already has Honeybadger:** Z
**Needs notification (NOTIFY):** N
**Intentionally skipped (SKIP):** S
**Needs review (REVIEW):** R

---

## Recommendations (NOTIFY)

[Each recommendation from Phase 3, ordered by severity — clinical care workflow errors first (video sessions, recording, notes, treatment plans), then compliance/data integrity, then operational]

---

## Skipped (No Action Needed)

| File:Line | Pattern | Reason |
|-----------|---------|--------|
| ... | ... | ... |

---

## Needs Review

| File:Line | Pattern | Question |
|-----------|---------|----------|
| ... | ... | ... |

Phase 5: Offer to Apply Fixes

After presenting the report, ask the user:

Would you like me to apply the NOTIFY recommendations? I can update [N] error handling sites to add Honeybadger notifications.

If the user agrees:

  1. Apply each recommended change using the Edit tool
  2. Run bin/standardrb --fix on modified files
  3. Run any existing tests for modified files to verify nothing breaks
  4. Present a summary of changes made

Important Guidelines

  • Read the full file before making recommendations — understand the class's purpose and error handling strategy
  • Check for existing Honeybadger calls in the same class — if the class already has some, match that pattern
  • Don't over-notify — not every Rails.logger.warn needs Honeybadger. Focus on genuine errors that indicate bugs or system failures
  • Respect intentional suppression — if a comment explains why an error is swallowed, classify as SKIP unless the reasoning is clearly wrong
  • Guard with defined?(Honeybadger) only in code that runs outside of Rails (rake tasks, scripts). In app code, Honeybadger is always available
  • Preserve existing error handling — add Honeybadger.notify alongside existing logging, don't replace it
  • Match the codebase's Honeybadger style — look at video_meeting_service.rb and calendar_sync_job.rb for reference patterns

Clinical Care is the Top Priority

The entire app exists so that a therapist can see a client and document the encounter. Apply this lens to every error handling site:

  • The session workflow is sacred — video session join/create, session recording, clinical note writing, and treatment plan management form one continuous clinical workflow. A silent failure anywhere in this chain means a therapist is either unable to see their client, unable to record the session, or unable to document what happened. Each of those is a direct impact on patient care. Every error in this path is Critical NOTIFY.
  • Therapists won't retry — unlike a developer who sees an error and tries again, a therapist in the middle of a session will assume things worked. If note auto-save fails silently, they'll close the tab and the note is gone. If recording fails to start, they'll find out after the session when there's nothing to review. The app must scream when these things break.
  • "Fail open" is wrong for healthcare — in e-commerce, if a recommendation engine fails you show a default. In healthcare, if a clinical workflow fails silently, a therapist might think a note was saved when it wasn't. Err toward notification.
  • Think about the session-in-progress test — for each error site, ask: "Could this fail while a therapist is actively seeing a client?" If yes, it's Critical NOTIFY. A therapist with a client on screen and a broken app has zero workarounds.
  • Audit trail failures are never "just logging" — HIPAA requires audit trails for access to protected health information. If the HipaaAuditLogJob or any audit-related code swallows an error, that's a compliance gap, not a minor logging issue. Classify as NOTIFY even if the code comments suggest otherwise.
  • Multi-tenant isolation failures are reportable breaches — any error related to ActsAsTenant, organization scoping, or cross-tenant data access must always notify.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.