agentleFS
AnjanJAnjanJ/rails_error_dashboard/.claude/skills/safety-check/SKILL.md

safety-check

Skill93 starsChanged 8 days agoMITView on GitHub

Audit staged changes against the 11 host app safety rules

1 other project uses a version of this.

Adopted by

Most recently taken up by

  • Other versions1 project uses a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 1

    1. AllanSantos-DV/skill-kit★ 0same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repository11 other files it gives its agents.

The file

We split this skill into the rules it gives an agent

3 rules. About 0 are common, 2 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Verification Before Done: Never report PASS without reading the actual code.

    line 69
  2. Distinctive:

    Autonomous Bug Fixing: If a safety violation is found (FAIL), fix it immediately rather than just reporting it.

    line 70
  3. Very specific:

    Self-Improvement Loop: If a safety violation was caused by a pattern not yet in the 11 rules, add it to tasks/lessons.md.

    line 71

≈ “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

/safety-check — Host App Safety Audit

Audit staged or recent changes against the 11 host app safety rules. This skill is also auto-invocable — Claude should run it automatically when making changes to the capture path.

Usage

  • /safety-check — audit staged changes (git diff --cached)
  • /safety-check HEAD~3 — audit last 3 commits
  • /safety-check <file> — audit a specific file

The 10 Safety Rules

Audit each changed file against these rules:

  1. Never raise in capture path — Look for raise statements in middleware, subscriber, or capture commands without surrounding rescue
  2. Never block request path — Look for HTTP calls, file I/O, or slow operations in synchronous capture code
  3. Budget every operation — Check timing: breadcrumb callback <10µs, health snapshot <1.5ms, storm check <15µs, capture <5ms before the response
  4. Clean up Thread.current — Any Thread.current[]= must have a matching ensure cleanup
  5. Always re-raise original exceptions — Middleware/subscriber must re-raise after capture (Sentry #1173)
  6. Feature-detect — Any call to Puma, Sidekiq, etc. must be guarded with defined?() or respond_to?()
  7. Make everything disableable — New request-path features need a config flag
  8. Never use ObjectSpace.each_object — Freezes all threads, grows heap
  9. Never use Signal.trap — Breaks Puma/Sidekiq signal handling
  10. Never store Binding objects — Prevents GC of entire call stack

Capture Path Files (Highest Scrutiny)

These files run on EVERY request or error — any bug here affects the host app:

  • lib/rails_error_dashboard/middleware/error_catcher.rb
  • lib/rails_error_dashboard/error_reporter.rb
  • lib/rails_error_dashboard/commands/log_error.rb
  • lib/rails_error_dashboard/commands/find_or_increment_error.rb
  • lib/rails_error_dashboard/commands/find_or_create_application.rb
  • lib/rails_error_dashboard/services/error_normalizer.rb
  • lib/rails_error_dashboard/services/breadcrumb_collector.rb
  • lib/rails_error_dashboard/services/system_health_snapshot.rb

Audit Process

  1. Get the diff:
    git diff --cached  # or git diff HEAD~N, or read the specified file
  2. Classify each changed file:
    • Capture path (listed above) — audit ALL 11 rules
    • Dashboard path (controllers, views, queries) — audit rules 1, 7, 8, 9
    • Background path (jobs, notifications) — audit rules 1, 5, 6
    • Other — audit rules 8, 9, 10
  3. Report findings in a table:

    FileRuleStatusDetails
    error_catcher.rb#1 No raisePASSAll paths wrapped in rescue
    error_catcher.rb#5 Re-raisePASSLine 42: raise error after capture
    breadcrumb_collector.rb#3 BudgetWARNNo timing measurement found
  4. Verdict: PASS (all clear), WARN (potential issues), or FAIL (definite violation)

Workflow Orchestration

  • Verification Before Done: Never report PASS without reading the actual code. Diff lines alone are insufficient — read the full file to understand rescue/ensure context.
  • Autonomous Bug Fixing: If a safety violation is found (FAIL), fix it immediately rather than just reporting it. Then re-run the check to verify the fix.
  • Self-Improvement Loop: If a safety violation was caused by a pattern not yet in the 11 rules, add it to tasks/lessons.md.

Auto-Invocation

Claude should automatically run this check when:

  • Editing any file in the capture path (listed above)
  • Adding new middleware or subscriber code
  • Modifying engine.rb initialization hooks
  • Adding Thread.current usage anywhere

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.