andrew-kane-gem-writer

andrew-kane-gem-writer is a skill for Claude Code from davekilleen/Dex. It costs 88 tokens per session (1,182 once invoked), scanned A, original, MIT.

A guide to writing Ruby gems, which are reusable Ruby libraries, according to Andrew Kane's coding practices.

In plain words
What is it for?
Use it when creating a Ruby gem, changing its interface, refactoring its code, or reviewing library design.
Why use it?
It helps keep a gem's public interface small, clear, and suitable for production. It also provides direction when improving an existing library.

Skill for Claude Code

Written for Claude Code: installed under .claude/.

Part of the compound-engineering plugin — 17 skills, 19 commands shipped together

Good fit Use it when creating a Ruby gem, changing its interface, refactoring its code, or reviewing library design.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/davekilleen/dex/andrew-kane-gem-writer
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 davekilleen/Dex --skill andrew-kane-gem-writer
Clone the repo
git clone --depth 1 https://github.com/davekilleen/Dex

Made for: Claude Code.

Or install compound-engineering, the plugin that ships this one along with the rest of its 17 skills, 19 commands.

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 andrew-kane-gem-writer

README.md
[![agentmods](https://agentmods.dev/badge/skills/davekilleen/dex/andrew-kane-gem-writer/github.svg)](https://agentmods.dev/skills/davekilleen/dex/andrew-kane-gem-writer)
Your own site
<a href="https://agentmods.dev/skills/davekilleen/dex/andrew-kane-gem-writer"><img src="https://agentmods.dev/badge/skills/davekilleen/dex/andrew-kane-gem-writer/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 andrew-kane-gem-writer

Your own site · 80×15
<a href="https://agentmods.dev/skills/davekilleen/dex/andrew-kane-gem-writer"><img src="https://agentmods.dev/badge/skills/davekilleen/dex/andrew-kane-gem-writer.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 88 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,182 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.00088 $0.01182
Opus 5.5 $0.00035 $0.00473
Sonnet 5.5 $0.00018 $0.00236
Haiku 4.5 $0.00009 $0.00118

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

Security

Grade A, and why

andrew-kane-gem-writer 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.

Origin

Copies of this mod

3 near-identical copies found in the catalogue:

.claude/plugins/compound-engineering/skills/andrew-kane-gem-writer/SKILL.md · 185 lines

How it starts

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

Andrew Kane Gem Writer

Write Ruby gems following Andrew Kane's battle-tested patterns from 100+ gems with 374M+ downloads (Searchkick, PgHero, Chartkick, Strong Migrations, Lockbox, Ahoy, Blazer, Groupdate, Neighbor, Blind Index).

Core Philosophy

Simplicity over cleverness. Zero or minimal dependencies. Explicit code over metaprogramming. Rails integration without Rails coupling. Every pattern serves production use cases.

Entry Point Structure

Every gem follows this exact pattern in lib/gemname.rb:

# 1. Dependencies (stdlib preferred)
require "forwardable"

# 2. Internal modules
require_relative "gemname/model"
require_relative "gemname/version"

# 3. Conditional Rails (CRITICAL - never require Rails directly)
require_relative "gemname/railtie" if defined?(Rails)

# 4. Module with config and errors
module GemName
  class Error < StandardError; end
  class InvalidConfigError < Error; end

  class << self
    attr_accessor :timeout, :logger
    attr_writer :client
  end

  self.timeout = 10  # Defaults set immediately
end

Class Macro DSL Pattern

The signature Kane pattern—single method call configures everything:

# Usage
class Product < ApplicationRecord
  searchkick word_start: [:name]
end

# Implementation
module GemName
  module Model
    def gemname(**options)
      unknown = options.keys - KNOWN_KEYWORDS
      raise ArgumentError, "unknown keywords: #{unknown.join(", ")}" if unknown.any?

      mod = Module.new
      mod.module_eval do
        define_method :some_method do
          # implementation
        end unless method_defined?(:some_method)
      end
      include mod

      class_eval do
        cattr_reader :gemname_options, instance_reader: false
        class_variable_set :@@gemname_options, options.dup
      end
    end
  end
end

Rails Integration

Always use ActiveSupport.on_load—never require Rails gems directly:

# WRONG
require "active_record"
ActiveRecord::Base.include(MyGem::Model)

# CORRECT
ActiveSupport.on_load(:active_record) do
  extend GemName::Model
end

# Use prepend for behavior modification
ActiveSupport.on_load(:active_record) do
  ActiveRecord::Migration.prepend(GemName::Migration)
end

Read the full file on GitHub · 185 lines

Files

What ships with it

5 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. 3mo ago First seen · 185 lines · 88 tokens per session scan A 20fd6aa1a165

Subscribe to this mod's changes

andrew-kane-gem-writer is a skill published in the GitHub repository davekilleen/Dex (522 stars, last pushed 6d ago), licensed MIT. It adds 88 tokens to every session and 1,182 once invoked, about $0.0004 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

andrew-kane-gem-writer compared with skills from other repositories

andrew-kane-gem-writer next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
andrew-kane-gem-writerdavekilleen/DexSkill5226d agoMITA88Claude Code
fastapi-templateswshobson/agentsSkill43k6d agoMITA37Claude Code
temporal-python-testingwshobson/agentsSkill43k6d agoMITA45Claude Code
rubyllmcrmne/ruby_llmSkill4.5ktodayMITA78Codex
programmingcode-yeongyu/oh-my-openagentSkill71ktodaynoneA90Claude Code, Codex
ruby-patternssoftspark/ai-toolkitSkill18012d agoApache-2.0A60Claude Code
ruby-rulessoftspark/ai-toolkitSkill18012d agoApache-2.0A48Claude Code