rails-canonical-log-line

rails-canonical-log-line is a skill for Claude Code from sorah/config. It costs 230 tokens per session (2,617 once invoked), scanned A, original, MIT.

A Rails logging guide for making one request log line explain who made a web request, what handled it, how it ended and what work it did. Rails is a web application framework, and a request log records activity from each browser or API request.

In plain words
What is it for?
Use it when adding request context to Rails logs, especially with around-actions, authentication, handled errors or semantic logging.
Why use it?
It addresses missing user, session and error details in Rails' completed-request log line.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin. Also seen: mentions CLAUDE.md.

Part of the sorah-guides plugin — 23 skills, 3 commands, 1 agent shipped together

Good fit Use it when adding request context to Rails logs, especially with around-actions, authentication, handled errors or semantic logging.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/sorah/config/rails-canonical-log-line
View source ↗ sorah/config
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 sorah/config --skill rails-canonical-log-line
Clone the repo
git clone --depth 1 https://github.com/sorah/config

Made for: Claude Code.

Or install sorah-guides, the plugin that ships this one along with the rest of its 23 skills, 3 commands, 1 agent.

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 rails-canonical-log-line

README.md
[![agentmods](https://agentmods.dev/badge/skills/sorah/config/rails-canonical-log-line/github.svg)](https://agentmods.dev/skills/sorah/config/rails-canonical-log-line)
Your own site
<a href="https://agentmods.dev/skills/sorah/config/rails-canonical-log-line"><img src="https://agentmods.dev/badge/skills/sorah/config/rails-canonical-log-line/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 rails-canonical-log-line

Your own site · 80×15
<a href="https://agentmods.dev/skills/sorah/config/rails-canonical-log-line"><img src="https://agentmods.dev/badge/skills/sorah/config/rails-canonical-log-line.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 230 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,617 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.
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.00230 $0.02617
Opus 5.5 $0.00092 $0.01047
Sonnet 5.5 $0.00046 $0.00523
Haiku 4.5 $0.00023 $0.00262

Measured 24d ago against content hash 20092ee86d3b, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

rails-canonical-log-line 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 24d ago.

The scan reads SKILL.md. This mod also ships 9 executable files (references/app/controllers/concerns/action_log_payloadable.rb, references/app/controllers/concerns/handler_log_taggable.rb, references/app/models/request_log_context.rb, …), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

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.

claude/marketplace/plugins/sorah-guides/skills/rails-canonical-log-line/SKILL.md · 135 lines

How it starts

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

Canonical Log Lines on Rails

One line per request that says who made it, what handled it, how it ended and what work it did, after Stripe's canonical log lines. In a Rails app on rails_semantic_logger, that line already exists: the ActionController Completed line. The work is making it carry the request's context, not adding another line. Taken from a production rollout on Rails 8.1, rails_semantic_logger 4.19 and semantic_logger 4.17. Project-specific conventions (CLAUDE.md, docs/) always take priority.

Why the Completed line loses context

  • Completed is logged by a process_action.action_controller subscriber when ActionController::Instrumentation#process_action finishes, outside the callback chain. An around_action { logger.tagged(user_id: ...) { yield } } has already unwound by then. Lines logged inside the action carry the tags, Completed does not.
  • A Rack middleware's SemanticLogger.tagged block does wrap Completed, but it runs before routing and authentication, so it can tag only what the raw request carries.
  • An error handled by rescue_from never reaches payload[:exception], so a 4xx line has no reason. rails_semantic_logger deletes :exception from the payload of an unhandled one.
  • rails_semantic_logger logs Completed at info whatever the status, and the Rack Started line at info too. Every request writes two lines and a 500 looks like a 200.

The pieces

Piece Purpose Reference
RequestLogContext (ActiveSupport::CurrentAttributes) Request-scoped tags and counters app/models/request_log_context.rb
SemanticLogger.on_log hook Merges the context's tags into every line as it is written config/initializers/semantic_logger.rb
RequestLogTagger middleware Tags from the raw request: request_id, trace ids same initializer
HandlerLogTaggable concern handler tag, set before any other callback app/controllers/concerns/handler_log_taggable.rb
ActionLogPayloadable concern Outcome fields and counters on the Completed payload app/controllers/concerns/action_log_payloadable.rb
MyApp::ActionControllerLogSubscriber Level by status, status and handler in the message lib/my_app/action_controller_log_subscriber.rb

Read the full file on GitHub · 135 lines

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. 24d ago First seen · 135 lines · 230 tokens per session scan A 20092ee86d3b

Subscribe to this mod's changes

rails-canonical-log-line is a skill published in the GitHub repository sorah/config (31 stars, last pushed 11d ago), licensed MIT. It adds 230 tokens to every session and 2,617 once invoked, about $0.0009 per session on Opus 5.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-11-08.

Related

rails-canonical-log-line compared with skills from other repositories

rails-canonical-log-line next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
rails-canonical-log-linesorah/configSkill3111d agoMITA230Claude Code
systematic-debuggingopen-metadata/OpenMetadataSkill16ktodayApache-2.0A37Claude Code
log-error-digestzebbern/claude-code-guideSkill4.7ktodayMITA71Claude Code, Codex
observability-audit-sessionsIBM/mcp-context-forgeSkill4.9ktodayApache-2.0A64Claude Code, Codex
cwv-optimizeradobe/skillsSkill342todayApache-2.0A112Claude Code
ci-fixersipyourdrink-ltd/bernsteinSkill1.2ktodayApache-2.0A15Claude Code, Codex
verus-query-timinglbx154/ArgusSkill337yesterdayMITA28Claude Code, Codex