rb:state-audit

rb:state-audit is a skill for Claude Code from slbug/claude-ruby-grape-rails. It costs 33 tokens per session (1,434 once invoked), scanned A, original, MIT.

An audit guide for request-scoped state in Rails, including values, sessions, cookies, caches, Redis, and Turbo Streams. It looks for data that can accidentally persist between requests or become inconsistent.

In plain words
What is it for?
Use it before releases or after state-related bugs to inspect CurrentAttributes, background jobs, sessions, Redis expiration, Turbo Stream broadcasts, and data integrity.
Why use it?
It helps find production bugs caused by leaked request state, growing sessions or Redis keys, duplicate work, and stale caches.

Skill for Claude Code

Written for Claude Code: disable-model-invocation in frontmatter.

Part of the ruby-grape-rails plugin — 52 skills, 19 agents, 17 hooks shipped together

Good fit Use it before releases or after state-related bugs to inspect CurrentAttributes, background jobs, sessions, Redis expiration, Turbo Stream broadcasts, and data integrity.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/slbug/claude-ruby-grape-rails/request-state-audit
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add slbug/claude-ruby-grape-rails --skill request-state-audit
Clone the repo
git clone --depth 1 https://github.com/slbug/claude-ruby-grape-rails

Made for: Claude Code.

Or install ruby-grape-rails, the plugin that ships this one along with the rest of its 52 skills, 19 agents, 17 hooks.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for rb:state-audit

README.md
[![agentmods](https://agentmods.dev/badge/skills/slbug/claude-ruby-grape-rails/request-state-audit/github.svg)](https://agentmods.dev/skills/slbug/claude-ruby-grape-rails/request-state-audit)
Your own site
<a href="https://agentmods.dev/skills/slbug/claude-ruby-grape-rails/request-state-audit"><img src="https://agentmods.dev/badge/skills/slbug/claude-ruby-grape-rails/request-state-audit/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for rb:state-audit

Your own site · 80×15
<a href="https://agentmods.dev/skills/slbug/claude-ruby-grape-rails/request-state-audit"><img src="https://agentmods.dev/badge/skills/slbug/claude-ruby-grape-rails/request-state-audit.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 33 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,434 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector warn 7 Sept 2026
SkillSpector: 1 finding, up to high

These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →

  • high Data Exfiltration · line 59
    Code or instructions that leak agent conversation context to external services, potentially exposing sensitive user interactions.
    Fix: Remove any code that sends prompts, responses, or session data externally. Preserve user privacy; never exfiltrate conversation content.
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00033 $0.01434
Opus 5 $0.00016 $0.00717
Sonnet 5 $0.00007 $0.00287
Haiku 4.5 $0.00003 $0.00143

Measured 9d ago against content hash 6f3e3e86886a, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-12, from the pricing page.

Security

Grade A, and why

rb:state-audit scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 9d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/ruby-grape-rails/skills/request-state-audit/SKILL.md · 162 lines

How it starts

The opening of the file, as written. The whole thing — 162 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Request State Audit

Audit your Rails application for common state management issues that cause production bugs.

What This Audit Covers

Category Issues Detected
CurrentAttributes Leakage across requests, missing resets, async flow contamination
Session/Cookie Bloat, ActiveRecord objects stored, unbounded growth
Redis Missing namespaces, keys without TTL, memory leaks
Turbo Streams Double-work, broadcasts before commit, DB queries in streams
Data Integrity Duplicated sources of truth, cache invalidation bugs

When to Run

  • Before major releases
  • When adding new Current attributes
  • After switching to Turbo Streams
  • When Redis memory usage grows unexpectedly
  • After session-related bug reports

Audit Procedure

Step 1: CurrentAttributes Check

Modern Rails Behavior: CurrentAttributes automatically resets before and after each request. Manual reset middleware is not required for normal request flow.

Audit Focus: Jobs, threads, and async contexts where automatic reset does not apply.

Search for patterns:

  • Use Grep: pattern Current\., path app/jobs and app/workers, glob *.rb
  • Use Grep: pattern Thread\.new|Concurrent|Async|Fiber\.schedule, path app/, glob *.rb, context 5 — then check results for current references

Verify:

  • Jobs using Current explicitly set context via Current.set or pass values as args
  • Custom threads/fibers don't access Current without explicit context
  • External collaborators (Time.zone, etc.) registered via resets { ... } if needed
  • Not over-stuffing controller-specific values into global Current

See: references/audit-procedures.md#currentattributes-usage

Step 2: Session Bloat Detection

Detect session store type first:

Use Grep: pattern config\.session_store, path config/initializers and config/application.rb.

For ActiveRecord session store: In rails console, run ActiveRecord::SessionStore::Session.pluck(:data).map { |d| d.to_s.bytesize }.max.

Read the full file on GitHub · 162 lines

Files

What ships with it

2 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 9d ago First seen · 162 lines · 33 tokens per session scan A 6f3e3e86886a

Subscribe to this mod's changes

rb:state-audit is a skill published in the GitHub repository slbug/claude-ruby-grape-rails (7 stars, last pushed 8d ago), licensed MIT. It adds 33 tokens to every session and 1,434 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

Other skills, from other repositories

api-errors

McpError constructor, JsonRpcErrorCode reference, and error handling patterns for @cyanheads/mcp-ts-core. Use when looking up error codes, understanding where errors should be thrown vs. caught, or using ErrorHandler.tryCatch in services.

cyanheads/obsidian-mcp-server · 54 tokens

footprint

Use when building flowchart pipelines with footprintjs — stage functions, decider branches, selectors, subflows, loops, narrative traces, recorders, redaction, contracts, and LLM-ready output. Also use when someone asks how footprint.js works or wants to understand the library.

footprintjs/footPrint · 60 tokens

error-handling-patterns

Master error handling patterns across languages including exceptions, Result types, error propagation, and graceful degradation to build resilient applications. Use when implementing error handling, designing APIs, or improving application reliability.

HermeticOrmus/LibreUIUX-Claude-Code · 43 tokens

fastify-troubleshooting

This skill should be used when debugging Fastify issues, identifying Fastify anti-patterns, diagnosing common Fastify mistakes, performing Fastify error troubleshooting, investigating request.body undefined in hook, fixing decorator shared across requests, resolving hook executing twice, handling reply already sent…

RadOrigin-LLC/RAD-Claude-Skills · 103 tokens

drupal-debugging

Drupal debugging techniques — Devel module, Drush watchdog, Twig debug, XDebug, error logging, and common troubleshooting patterns.

edutrul/drupal-ai · 31 tokens

a-unslop-code

Finds what makes source code read as AI-written and points you at the parts that actually ship bugs. Sorts every tell into three buckets and fixes them in that order: bugs (swallowed errors, a made-up API, a left-in "rest of the code" stub), substance (tutorial-shaped boilerplate, over-engineering, code that ignores…

imisic/claude-marketplace · 187 tokens