caching-strategies

caching-strategies is a skill for Claude Code from ThibautBaissac/rails_ai_agents. It costs 77 tokens per session (1,434 once invoked), scanned A, original, MIT.

A guide to caching in Rails, a Ruby web framework. Caching stores reusable pages, data, or responses so an application does not have to calculate or fetch them every time.

In plain words
What is it for?
Choose and implement Rails fragment, Russian doll, low-level, HTTP, query, and memoization caching. It also helps configure cache stores and handle cache keys and invalidation.
Why use it?
It helps reduce repeated work and improve response speed while accounting for cache expiration and invalidation. It covers different places where cached content can live, including memory, a database, Redis, files, browsers, and CDNs.

Skill for Claude Code

Written for Claude Code: paths in frontmatter. Also seen: installed under .agents/ (shared by several agents).

Good fit Choose and implement Rails fragment, Russian doll, low-level, HTTP, query, and memoization caching. It also helps configure cache stores and handle cache keys and invalidation.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/thibautbaissac/rails_ai_agents/caching-strategies
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 ThibautBaissac/rails_ai_agents --skill caching-strategies
Clone the repo
git clone --depth 1 https://github.com/ThibautBaissac/rails_ai_agents

Made for: Claude Code.

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 caching-strategies

README.md
[![agentmods](https://agentmods.dev/badge/skills/thibautbaissac/rails_ai_agents/caching-strategies/github.svg)](https://agentmods.dev/skills/thibautbaissac/rails_ai_agents/caching-strategies)
Your own site
<a href="https://agentmods.dev/skills/thibautbaissac/rails_ai_agents/caching-strategies"><img src="https://agentmods.dev/badge/skills/thibautbaissac/rails_ai_agents/caching-strategies/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 caching-strategies

Your own site · 80×15
<a href="https://agentmods.dev/skills/thibautbaissac/rails_ai_agents/caching-strategies"><img src="https://agentmods.dev/badge/skills/thibautbaissac/rails_ai_agents/caching-strategies.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 77 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 pass 7 Sept 2026
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.00077 $0.01434
Opus 5.5 $0.00031 $0.00574
Sonnet 5.5 $0.00015 $0.00287
Haiku 4.5 $0.00008 $0.00143

Measured 2mo ago against content hash b85f4b265474, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

caching-strategies 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 2mo 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.

.agents/skills/caching-strategies/SKILL.md · 191 lines

How it starts

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

Caching Strategies for Rails 8

Overview

Rails provides multiple caching layers:

  • Fragment caching: Cache view partials
  • Russian doll caching: Nested cache fragments
  • Low-level caching: Cache arbitrary data
  • HTTP caching: Browser and CDN caching
  • Query caching: Automatic within requests

Quick Start

# config/environments/development.rb
config.action_controller.perform_caching = true
config.cache_store = :memory_store

# config/environments/production.rb
config.cache_store = :solid_cache_store  # Rails 8 default
# OR
config.cache_store = :redis_cache_store, { url: ENV["REDIS_URL"] }

Enable caching in development:

bin/rails dev:cache

Cache Store Options

Store Use Case Pros Cons
:memory_store Development Fast, no setup Not shared, limited size
:solid_cache_store Production (Rails 8) Database-backed, no Redis Slightly slower
:redis_cache_store Production Fast, shared Requires Redis
:file_store Simple production Persistent, no Redis Slow, not shared
:null_store Testing No caching N/A

Fragment Caching

Basic Fragment Cache

<%# app/views/events/_event.html.erb %>
<% cache event do %>
  <article class="event-card">
    <h3><%= event.name %></h3>
    <p><%= event.description %></p>
    <time><%= l(event.event_date, format: :long) %></time>
    <%= render event.venue %>
  </article>
<% end %>

Cache Key Components

Rails generates cache keys from:

  • Model name
  • Model ID
  • updated_at timestamp
  • Template digest (automatic)
# Generated key example:
# views/events/123-20240115120000000000/abc123digest

Custom Cache Keys

<%# With version %>
<% cache [event, "v2"] do %>
  ...
<% end %>

<%# With user-specific content %>
<% cache [event, current_user] do %>
  ...
<% end %>

<%# With explicit key %>
<% cache "featured-events-#{Date.current}" do %>
  <%= render @featured_events %>
<% end %>

Read the full file on GitHub · 191 lines

Files

What ships with it

3 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. 2mo ago First seen · 191 lines · 77 tokens per session scan A b85f4b265474

Subscribe to this mod's changes

caching-strategies is a skill published in the GitHub repository ThibautBaissac/rails_ai_agents (672 stars, last pushed 5mo ago), licensed MIT. It adds 77 tokens to every session and 1,434 once invoked, about $0.0003 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-08-30.

Related

caching-strategies compared with skills from other repositories

caching-strategies next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
caching-strategiesThibautBaissac/rails_ai_agentsSkill6725mo agoMITA77Claude Code
mem0-oss-to-platformmem0ai/mem0Skill68k2d agoApache-2.0A217Claude Code, Codex
azure-mgmt-botservice-dotnetmicrosoft/skillsSkill3.2kyesterdayMITA78Claude Code
fastapi-router-pymicrosoft/skillsSkill3.2kyesterdayMITA46Claude Code
dev-runtimelangwatch/langwatchSkill5.0kyesterdayApache-2.0A172Claude Code
api-designericrisco/rsc-harnessSkill5032d agoMITA105Claude Code, Codex
migrate-segw-to-raparc-mcp/arc-1Skill252yesterdayMITA106Claude Code