rails_error_dashboard
CLAUDE.md93 starsChanged 8 days agoMITView on GitHub
rails_error_dashboard is a self-hosted error tracking gem for Rails. It's a Rails Engine using CQRS architecture (Commands/Queries/Services). It runs inside the host app's process — no external services. More context lives in the repo: PROJECT_MAP.md (verified index of where things live, refreshed at 0.16.1), .claude/skills/ (e.g. host-app-safety, release, chaos), .shipkit/specs/ (feature specs) and .shipkit/decisions/ (decision records). Chaos tests create real Rails apps in /tmp, install the gem, and run in production mode. They test: - Phase A: data integrity -…
In this repository11 other files it gives its agents.
- add-breadcrumb-pageSkill
- chaosSkill
- cqrs-patternsSkill
- demo-updateSkill
- host-app-safetySkill
- new-featureSkill
- release-rulesSkill
- releaseSkill
- roadmap-statusSkill
- safety-checkSkill
- testSkill
The file
Show its rules and text
We split this CLAUDE.md into the rules it gives an agent
20 rules. About 0 are common, 12 are distinctive, and 8 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.
8
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Very specific: line 14
All CSS is inline in the layout <style> block, all JS is inline in <script> blocks
- Distinctive: line 73
No emojis in code unless user asks
- Very specific: line 74
Commit messages: conventional commits style (feat/fix/chore/etc.)
- Distinctive: line 82
If something goes sideways, STOP and re-plan immediately — don't keep pushing
- Distinctive: line 83
Use plan mode for verification steps, not just building
- Distinctive: line 84
Write detailed specs upfront to reduce ambiguity
- Distinctive: line 87
Use subagents liberally to keep main context window clean
- Very specific: line 93
After ANY correction from the user: update tasks/lessons.md with the pattern
- Distinctive: line 94
Write rules for yourself that prevent the same mistake
- Distinctive: line 99
Never mark a task complete without proving it works
- Distinctive: line 101
Ask yourself: "Would a staff engineer approve this?"
- Distinctive: line 102
Run tests, check logs, demonstrate correctness
- Distinctive: line 106
If a fix feels hacky: "Knowing everything I know now, implement the elegant solution"
- Distinctive: line 111
When given a bug report: just fix it.
- Very specific: line 117
Plan First: Write plan to tasks/todo.md with checkable items
- Distinctive: line 118
Verify Plan: Check in before starting implementation
- Very specific: line 121
Document Results: Add review section to tasks/todo.md
- Very specific: line 122
Capture Lessons: Update tasks/lessons.md after corrections
- Very specific: line 131
Thor colors: Only :black, :red, :green, :yellow, :blue, :magenta, :cyan, :white, :bold — no :gray or :light_*
- Very specific: line 133
Puma in test scripts: Always lsof -ti :$port | xargs kill -9 before starting.
≈ “Common” is an estimate: at least 1 in 5 of the 26,980 CLAUDE.md 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.
Files
CLAUDE.md — Project Instructions for Claude Code
What This Is
rails_error_dashboard is a self-hosted error tracking gem for Rails. It's a Rails Engine using CQRS architecture (Commands/Queries/Services). It runs inside the host app's process — no external services.
More context lives in the repo:
PROJECT_MAP.md(verified index of where things live, refreshed at 0.16.1),.claude/skills/(e.g.host-app-safety,release,chaos),.shipkit/specs/(feature specs) and.shipkit/decisions/(decision records).
Architecture Rules
- HOST APP SAFETY FIRST — Never raise in capture path, never block requests, budget every operation, clean up Thread.current, always re-raise original exceptions
- CQRS — Commands for writes (
lib/rails_error_dashboard/commands/), Queries for reads (lib/rails_error_dashboard/queries/), Services for algorithms (lib/rails_error_dashboard/services/) - NEVER depend on Rails asset pipeline — no Sprockets, no Propshaft, no
app/assets/, nopublic/directory serving - All CSS is inline in the layout
<style>block, all JS is inline in<script>blocks - External dependencies load via CDN only. From jsDelivr: scripts Chart.js, chartjs-adapter-date-fns, Chartkick, highlight.js, highlightjs-line-numbers, the Bootstrap JS bundle and Stimulus (plus the turbo-rails live-updates client on the error list when live updates are on); stylesheets Bootstrap Icons and Catppuccin Mocha for highlight.js. Plus Google Fonts CSS. Bootstrap CSS was removed in v0.6.0 in favor of a custom design token system. Every CDN tag must be an npm package file at an exact version, pinned with
integrity+crossorigin="anonymous", with a vendored copy inspec/support/vendor/(Google Fonts excepted);spec/requests/cdn_integrity_spec.rbenforces it - Layout must be fully self-contained — works with any proxy (Thruster, Nginx, etc.)
Testing
RSpec (unit/integration)
bundle exec rspec # full suite (5,966 examples at 0.16.1)
bundle exec rspec spec/path/to/file_spec.rb # one file (a file or directory argument narrows the run)
bundle exec rspec spec/system/ # system tests (Capybara + Cuprite)
HEADLESS=false bundle exec rspec spec/system/ # visible browserPre-Release Chaos Tests (integration, production mode)
bin/pre-release-test all # all 5 apps incl. an API-only host (~5 min, ~1,640 assertions)
bin/pre-release-test full_sync # sync + shared DB
bin/pre-release-test full_async # async (Sidekiq inline) + shared DB
bin/pre-release-test full_http # HTTP middleware capture + dashboard
bin/pre-release-test full_separate_db # separate DB
bin/pre-release-test full_api # API-only host (rails new --api)Chaos tests create real Rails apps in /tmp, install the gem, and run in production mode. They test:
- Phase A: data integrity
- Phase B: edge cases
- Phase C: query layer
- Phase D: dashboard HTTP endpoints
- Phase E: subscriber capture via
Rails.error.report() - Phase F: real HTTP middleware error capture (starts Puma, hits endpoints)
Lefthook Pre-Commit
Runs automatically on git commit:
- Stage 1 (one at a time;
piped: true): RuboCop, changed specs, bundle-audit, debugger check, i18n-check (locale files), whitespace - Stage 2 (sequential): chaos tests (
bin/pre-release-test all)
Skip chaos tests: LEFTHOOK_EXCLUDE=chaos-tests git commit -m "msg"
Skip all hooks: LEFTHOOK=0 git commit -m "msg"
Key Paths
| Path | Purpose |
lib/rails_error_dashboard/ | Core gem code |
lib/rails_error_dashboard/engine.rb | Engine setup, middleware, subscriber |
lib/rails_error_dashboard/configuration.rb | 100+ config options |
lib/rails_error_dashboard/commands/ | CQRS commands (writes) |
lib/rails_error_dashboard/queries/ | CQRS queries (reads) |
lib/rails_error_dashboard/services/ | Services (algorithms) |
app/views/rails_error_dashboard/ | Dashboard views (ERB) |
spec/ | RSpec tests |
test/pre_release/ | Chaos test scripts + templates |
bin/pre-release-test | Chaos test orchestrator |
Style
- RuboCop with rails-omakase style
- Array brackets with inner spaces:
[ "a", "b" ] - No emojis in code unless user asks
- Commit messages: conventional commits style (feat/fix/chore/etc.)
Workflow Orchestration
These principles govern HOW work is done. Follow them when the path forward is clear and there are concrete steps. When the path is unclear — when you don't know the how, why, or what — ask the user questions instead of guessing. It is always better to ask than to push forward blindly.
1. Plan Mode Default
- Enter plan mode for ANY non-trivial task (3+ steps or architectural decisions)
- If something goes sideways, STOP and re-plan immediately — don't keep pushing
- Use plan mode for verification steps, not just building
- Write detailed specs upfront to reduce ambiguity
2. Subagent Strategy
- Use subagents liberally to keep main context window clean
- Offload research, exploration, and parallel analysis to subagents
- For complex problems, throw more compute at it via subagents
- One task per subagent for focused execution
3. Self-Improvement Loop
- After ANY correction from the user: update
tasks/lessons.mdwith the pattern - Write rules for yourself that prevent the same mistake
- Ruthlessly iterate on these lessons until mistake rate drops
- Review lessons at session start for this project
4. Verification Before Done
- Never mark a task complete without proving it works
- Diff behavior between main and your changes when relevant
- Ask yourself: "Would a staff engineer approve this?"
- Run tests, check logs, demonstrate correctness
5. Demand Elegance (Balanced)
- For non-trivial changes: pause and ask "is there a more elegant way?"
- If a fix feels hacky: "Knowing everything I know now, implement the elegant solution"
- Skip this for simple, obvious fixes — don't over-engineer
- Challenge your own work before presenting it
6. Autonomous Bug Fixing
- When given a bug report: just fix it. Don't ask for hand-holding
- Point at logs, errors, failing tests — then resolve them
- Zero context switching required from the user
- Go fix failing CI tests without being told how
7. Task Management
- Plan First: Write plan to
tasks/todo.mdwith checkable items - Verify Plan: Check in before starting implementation
- Track Progress: Mark items complete as you go
- Explain Changes: High-level summary at each step
- Document Results: Add review section to
tasks/todo.md - Capture Lessons: Update
tasks/lessons.mdafter corrections
8. Core Principles
- Simplicity First: Make every change as simple as possible. Impact minimal code.
- No Laziness: Find root causes. No temporary fixes. Senior developer standards.
- Minimal Impact: Changes should only touch what's necessary. Avoid introducing bugs.
Common Gotchas
- Thor colors: Only
:black,:red,:green,:yellow,:blue,:magenta,:cyan,:white,:bold— no:grayor:light_* - Ruby 4.0.1:
ostructremoved from default gems; sqlite3 2.8.1 doesn't compile on macOS - Puma in test scripts: Always
lsof -ti :$port | xargs kill -9before starting. Never use-d(daemonize) — use&instead - SQLite pragmas:
pragmas:(plural) notpragma:in database.yml - Separate DB: With a separate database selected (
--separate-database, oruse_separate_database = truein an existing initializer), the installer copies migrations todb/error_dashboard_migrate/(since #83). Since #93 it skips migrations an app already has in either folder, so an app moving from the main database must move them itself (docs/guides/DATABASE_OPTIONS.md)
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
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.

