Agent skill

Caching Patterns

by dilolabs in dilolabs/nosia

Implements HTTP caching with ETags, fragment caching, Russian doll caching, and Solid Cache configuration.

MITAuto-check passedBackend & APIs

Install Caching Patterns

skills CLI
$ npx skills add dilolabs/nosia --skill caching-patterns -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install dilolabs/nosia caching-patterns --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/dilolabs/nosia.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.vibe/skills/caching-patterns .claude/skills/caching-patterns && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
caching-patterns
GitHub stars
213
Used in
1 other repo
Token cost
~1.9k tokens
SKILL.md length
327 words
Files
4 (incl. references)
Skills in repo
15
Repo updated
First seen
Licence
MIT

At a glance

Implements HTTP caching with ETags, fragment caching, Russian doll caching, and Solid Cache configuration.

  • Works in 4 steps: HTTP caching -- fresh_when / stale? in… → Fragment caching -- cache blocks in… → Collection caching -- cache_collection… → …
  • Optimizing performance
  • SKILL.md covers Philosophy: Cache…, Project Knowledge, Caching Strategy Hierarchy and Pattern 1: HTTP Caching with…, plus 8 more sections
  • Calls rails

What it does

Caching Patterns is an agent skill from dilolabs/nosia. Implements HTTP caching with ETags, fragment caching, Russian doll caching, and Solid Cache configuration. Use when optimizing performance, adding caching layers, or when user mentions ETags, freshwhen, stale?, cache keys, or Russian doll caching. WHEN NOT: For Turbo Stream real-time updates (use turbo-patterns), for background job cache warming logic (use job-patterns).

Its SKILL.md is about 1.9k tokens, which your agent loads only when the skill is triggered. The skill folder holds 4 other files, including reference files (for example `references/cache-invalidation.md`, `references/fragment-caching.md` and `references/http-caching.md`). Compatibility notes: Ruby 3.3+, Rails 8.0+, Solid Cache

It sits in Backend & APIs, covering Caching. It works with Redis. The repository describes itself as: Self-hosted AI RAG + MCP Platform. The licence is MIT.

When your agent uses it

  • Optimizing performance
  • Adding caching layers
  • User mentions ETags
  • Russian doll caching

Example prompts

  • “Use the caching-patterns skill to implement HTTP caching with ETags, fragment caching, Russian doll caching, and Solid Cache configuration”
  • “/caching-patterns”

Requirements

  • Compatibility (from SKILL.md): Ruby 3.3+, Rails 8.0+, Solid Cache

Workflow steps

4 steps, taken from the first numbered list in SKILL.md.

  1. HTTP caching -- fresh_when / stale? in controllers (free 304s)
  2. Fragment caching -- cache blocks in views (Russian doll)
  3. Collection caching -- cache_collection for lists of partials
  4. Low-level caching -- Rails.cache.fetch for expensive computations

What it can do on your machine

Read from SKILL.md and the folder at commit 0ef5e5d. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • rails

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

  • Compatibility

    Ruby 3.3+, Rails 8.0+, Solid Cache

    From compatibility in the SKILL.md frontmatter.

Context cost

Caching Patterns loads about 1.9k tokens when it runs, and up to ~5.4k if it reads all its reference files. Until then it costs about 98 tokens; SKILL.md has 327 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~98
When it runs · the whole SKILL.md, loaded when a task matches
~1.9k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~5.4k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from dilolabs/nosia at commit 0ef5e5d, republished under its MIT licence (© dilolabs). 327 words, ~1,926 tokens.

Download SKILL.mdSave it as .claude/skills/caching-patterns/SKILL.md (or your agent's skills folder). This skill also uses 3 other files; get the full folder from GitHub.
name
caching-patterns
description
Implements HTTP caching with ETags, fragment caching, Russian doll caching, and Solid Cache configuration. Use when optimizing performance, adding caching layers, or when user mentions ETags, fresh_when, stale?, cache keys, or Russian doll caching. WHEN NOT: For Turbo Stream real-time updates (use turbo-patterns), for background job cache warming logic (use job-patterns).
compatibility
Ruby 3.3+, Rails 8.0+, Solid Cache
license
MIT

Caching Patterns

Philosophy: Cache Aggressively, Invalidate Precisely

  • HTTP caching with ETags and fresh_when for free 304 Not Modified responses
  • Russian doll caching with touch: true for automatic cache invalidation
  • Fragment caching in views with cache keys based on updated_at timestamps
  • Solid Cache (database-backed, no Redis) for production caching
  • Collection caching with cache_collection for lists
  • Low-level caching with Rails.cache.fetch for expensive computations

Project Knowledge

Stack: Solid Cache (database-backed), Turbo for page refreshes, ETags with conditional GET, fragment caching in ERB views, collection caching for lists.

Multi-tenancy: Cache keys scoped to account. URL-based: app.myapp.com/123/projects/456.

Commands:

bash
rails solid_cache:install        # Install Solid Cache
rails db:migrate                 # Run cache migrations
rails cache:clear                # Clear cache

Caching Strategy Hierarchy

Apply caching in this order (highest impact first):

  1. HTTP caching -- fresh_when / stale? in controllers (free 304s)
  2. Fragment caching -- cache blocks in views (Russian doll)
  3. Collection caching -- cache_collection for lists of partials
  4. Low-level caching -- Rails.cache.fetch for expensive computations

Pattern 1: HTTP Caching with ETags

See @references/http-caching.md for full details.

ruby
# Single resource -- returns 304 if ETag matches
class BoardsController < ApplicationController
  def show
    @board = Current.account.boards.find(params[:id])
    fresh_when @board
  end

  def index
    @boards = Current.account.boards.includes(:creator)
    fresh_when @boards
  end
end

# Composite ETag from multiple objects
def show
  fresh_when [@board, @card, Current.user]
end

# API with stale? for conditional rendering
def show
  @board = Current.account.boards.find(params[:id])
  if stale?(@board)
    render json: @board
  end
end

# Custom ETag with parameters
fresh_when etag: [@activities, @report_date, Current.user.timezone]

Pattern 2: Russian Doll Caching

See @references/fragment-caching.md for full details.

Set up touch cascades in models:

ruby
class Card < ApplicationRecord
  belongs_to :board, touch: true
end

class Comment < ApplicationRecord
  belongs_to :card, touch: true
  # Updating comment touches card -> touches board -> invalidates all caches
end

Nest cache blocks in views:

erb
<% cache @board do %>
  <h1><%= @board.name %></h1>
  <% @board.columns.each do |column| %>
    <% cache column do %>
      <% column.cards.each do |card| %>
        <% cache card do %>
          <%= render card %>
        <% end %>
      <% end %>
    <% end %>
  <% end %>
<% end %>

Pattern 3: Collection Caching

erb
<%# Cache each item individually with multi-fetch optimization %>
<% cache_collection @boards, partial: "boards/board" %>

<%# Manual alternative %>
<% @boards.each do |board| %>
  <% cache board do %>
    <%= render "boards/board", board: board %>
  <% end %>
<% end %>

Use counter caches to avoid N+1 in cache keys:

ruby
class Card < ApplicationRecord
  belongs_to :board, counter_cache: true, touch: true
end

class Board < ApplicationRecord
  def cache_key_with_version
    "#{cache_key}/cards-#{cards_count}-#{updated_at.to_i}"
  end
end

Pattern 4: Fragment Caching with Custom Keys

erb
<%# Multiple dependencies %>
<% cache ["board_header", @board, Current.user] do %>
  <h1><%= @board.name %></h1>
  <% if Current.user.can_edit?(@board) %>
    <%= link_to "Edit", edit_board_path(@board) %>
  <% end %>
<% end %>

<%# With expiration %>
<% cache ["board_stats", @board], expires_in: 15.minutes do %>
  <div class="stats"><%= @board.cards.count %> cards</div>
<% end %>

<%# Conditional caching %>
<% cache_if @enable_caching, board do %>
  <%= board.name %>
<% end %>

<%# Multi-key with locale %>
<% cache ["dashboard", Current.account, Current.user,
          @boards.maximum(:updated_at), I18n.locale] do %>
  <%= render "boards_summary", boards: @boards %>
<% end %>

Pattern 5: Low-Level Caching

ruby
class Board < ApplicationRecord
  def statistics
    Rails.cache.fetch([self, "statistics"], expires_in: 1.hour) do
      {
        total_cards: cards.count,
        completed_cards: cards.joins(:closure).count,
        total_comments: cards.joins(:comments).count
      }
    end
  end

  # Race condition protection for expensive operations
  def expensive_calculation
    Rails.cache.fetch(
      [self, "expensive_calculation"],
      expires_in: 1.hour,
      race_condition_ttl: 10.seconds
    ) { calculate_complex_metrics }
  end

  # Version-based cache busting
  STATS_VERSION = 2
  def versioned_statistics
    Rails.cache.fetch([self, "statistics", "v#{STATS_VERSION}"],
                      expires_in: 1.hour) { calculate_statistics }
  end
end

Pattern 6: Cache Invalidation

See @references/cache-invalidation.md for full details.

ruby
# Prefer touch: true cascades (automatic)
belongs_to :board, touch: true

# Manual invalidation for low-level caches
class Card < ApplicationRecord
  after_create_commit :clear_board_caches
  after_destroy_commit :clear_board_caches

  private

  def clear_board_caches
    Rails.cache.delete([board, "statistics"])
    Rails.cache.delete([board, "card_distribution"])
  end
end

# Sweeper pattern for batch invalidation
class CacheSweeper
  def self.clear_board_caches(board)
    Rails.cache.delete([board, "statistics"])
    Rails.cache.delete([board, "card_distribution"])
    Rails.cache.delete([board, "activity_summary", Date.current])
  end
end

Pattern 7: Solid Cache Configuration

ruby
# config/environments/production.rb
config.cache_store = :solid_cache_store

# config/environments/development.rb
config.cache_store = :memory_store, { size: 64.megabytes }

# config/environments/test.rb
config.cache_store = :null_store

Pattern 8: Cache Warming

ruby
class CacheWarmerJob < ApplicationJob
  queue_as :low_priority

  def perform(account)
    account.boards.find_each do |board|
      board.statistics
      board.card_distribution
    end
  end
end

# config/recurring.yml
cache:
  daily_refresh:
    class: DailyCacheRefreshJob
    schedule: every day at 3am
    queue: low_priority

Boundaries

Always
  • Use fresh_when for index and show actions
  • Use touch: true on associations for automatic invalidation
  • Use Solid Cache in production (database-backed, no Redis)
  • Include expires_in for time-based data
  • Scope cache keys to account in multi-tenant apps
  • Use counter caches for counts
  • Eager load associations to prevent N+1 queries
Ask First
  • Whether to cache user-specific content
  • Cache expiration times (freshness vs performance)
  • Whether to warm caches in background jobs
Never
  • Use Redis for caching (use Solid Cache)
  • Cache without considering invalidation strategy
  • Forget touch: true with Russian doll caching
  • Cache CSRF tokens or sensitive user data
  • Use generic cache keys without version/timestamp
  • Cache in test environment (use :null_store)
  • Cache across account boundaries in multi-tenant apps

© dilolabs, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 3 other files (references) in .vibe/skills/caching-patterns of dilolabs/nosia.

  • SKILL.md
  • references/cache-invalidation.md
  • references/fragment-caching.md
  • references/http-caching.md

Open the folder on GitHubat commit 0ef5e5d

Used in 1 other repository

We found 3 copies of this SKILL.md (exact, near-identical or edited) in other folders, from 1 other GitHub owner. This page covers the copy in dilolabs/nosia, which our catalogue first saw on October 7, 2026.

Compare with similar skills

Caching Patterns next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Caching Patterns compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Caching Patterns this skilldilolabs/nosia2131 repos~1.9kAutomated safety check: PassMIT
Stripe Projectsfossasia/eventyay1.7k5 repos~2kAutomated safety check: NotesApache-2.0
FoundatioFoundatioFx/Foundatio2.1k—~3.9kAutomated safety check: PassApache-2.0
FastAPI-Redis SDK Developmentredis/fastapi-redis-sdk404—~2.5kAutomated safety check: NotesMIT
Cachingcodewithmukesh/dotnet-claude-kit7511 repos~1.4kAutomated safety check: PassMIT
Caching StrategiesThibautBaissac/rails_ai_agents665—~1.4kAutomated safety check: PassMIT

Similar skills

  • Stripe Projects

    fossasia/eventyay

    A skill your agent uses when the user wants to provision infrastructure or third-party services using Stripe Projects.

    1.7k GitHub starsUsed in 5 repos~2k tokens
    Backend & APIsAuto-check: notes
  • Foundatio

    FoundatioFx/Foundatio

    A skill your agent uses when working with Foundatio infrastructure abstractions for .NET -- caching, queuing, messaging, file storage, distributed locking, or background jobs.

    2.1k GitHub stars~3.9k tokensUpdated today
    Backend & APIsAuto-check passed
  • FastAPI-Redis SDK Development

    redis/fastapi-redis-sdk

    Official

    Guides development on the fastapi-redis-sdk library itself - its connection lifecycle, dependency-injected caching, and async/sync bridging.

    404 GitHub stars~2.5k tokensUpdated 6 days ago
    Backend & APIsAuto-check: notes
  • Caching

    codewithmukesh/dotnet-claude-kit

    Caching strategies for .NET 10 applications. An agent skill from codewithmukesh/dotnet-claude-kit.

    751 GitHub starsUsed in 1 repo~1.4k tokens
    Backend & APIsAuto-check passed
  • Caching Strategies

    ThibautBaissac/rails_ai_agents

    Implements Rails caching patterns for performance optimization.

    665 GitHub stars~1.4k tokensUpdated 4 mo ago
    Backend & APIsAuto-check passed
  • Frontmcp Config

    agentfront/frontmcp

    A skill your agent uses when configuring a FrontMCP server through frontmcp.config or the @FrontMcp options.

    146 GitHub stars~7k tokensUpdated today
    Backend & APIsAuto-check passed

More from dilolabs/nosia

All 15 skills in this repo
  • API Patterns

    dilolabs/nosia

    Builds REST APIs using respondto blocks with Jbuilder templates following the 37signals same-controllers-different-formats philosophy.

    213 GitHub starsUsed in 1 repo~2.5k tokens
    Auto-check passed
  • Auth Setup

    dilolabs/nosia

    Implements custom passwordless authentication without Devise.

    213 GitHub starsUsed in 1 repo~2.9k tokens
    Auto-check passed
  • Concern Patterns

    dilolabs/nosia

    Creates and refactors model and controller concerns for shared behavior.

    213 GitHub starsUsed in 1 repo~1.8k tokens
    Auto-check passed
  • Event Tracking

    dilolabs/nosia

    Builds event tracking, activity feeds, and webhook systems following 37signals patterns with a generic Event model and Eventable concern.

    213 GitHub starsUsed in 1 repo~3.3k tokens
    Auto-check passed
  • Job Patterns

    dilolabs/nosia

    Implements shallow background jobs with later/now conventions using Solid Queue.

    213 GitHub starsUsed in 1 repo~1.6k tokens
    Auto-check passed
  • Mailer Patterns

    dilolabs/nosia

    Creates minimal Action Mailer classes with bundled notification patterns following 37signals conventions.

    213 GitHub starsUsed in 1 repo~2.6k tokens
    Auto-check passed

Works with

Categories

Questions about Caching Patterns

What does Caching Patterns do?

Implements HTTP caching with ETags, fragment caching, Russian doll caching, and Solid Cache configuration. Caching Patterns is an agent skill from dilolabs/nosia. Implements HTTP caching with ETags, fragment caching, Russian doll caching, and Solid Cache configuration.

When should I use Caching Patterns?

Caching Patterns fits situations like: optimizing performance; adding caching layers; user mentions ETags; russian doll caching.

How do I install Caching Patterns in Claude Code?

Run `npx skills add dilolabs/nosia --skill caching-patterns -a claude-code`. Or copy the skill folder (.vibe/skills/caching-patterns in dilolabs/nosia) into .claude/skills/caching-patterns in your project. Claude Code loads it when a task matches its description.

How do I install Caching Patterns in Codex?

Run `npx skills add dilolabs/nosia --skill caching-patterns -a codex`. Or copy the skill folder (.vibe/skills/caching-patterns in dilolabs/nosia) into .agents/skills/caching-patterns in your project. Codex loads it when a task matches its description.

Can I use Caching Patterns in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add dilolabs/nosia --skill caching-patterns -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/caching-patterns, .gemini/skills/caching-patterns, .github/skills/caching-patterns and .opencode/skills/caching-patterns in your project.

What does Caching Patterns need to run?

Going by SKILL.md and its folder, Caching Patterns needs the command-line tools its instructions call (rails). Compatibility (from SKILL.md): Ruby 3.3+, Rails 8.0+, Solid Cache.

Does Caching Patterns access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Caching Patterns safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Caching Patterns use?

Caching Patterns is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Caching Patterns use?

About 1.9k tokens (SKILL.md is roughly 7.7k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 3.5k tokens, read only when the agent opens those files.

What are the alternatives to Caching Patterns?

Skills that share tags, products or a category with Caching Patterns: Stripe Projects (fossasia/eventyay, 1.7k stars), Foundatio (FoundatioFx/Foundatio, 2.1k stars), FastAPI-Redis SDK Development (redis/fastapi-redis-sdk, 404 stars) and Caching (codewithmukesh/dotnet-claude-kit, 751 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Caching Patterns?

dilolabs (a GitHub organization) maintains it in dilolabs/nosia, which has 213 GitHub stars. The repository holds 15 skills in this directory. The repository was last updated on September 9, 2026.

Source: dilolabs/nosia on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.