andrew-kane-gem-writer

Generate Ruby gem skeletons with macro DSL and Minitest conventions.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/mengblom/dex-ghx --skill andrew-kane-gem-writer-mengblom
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: andrew-kane-gem-writer
Source: https://github.com/mengblom/dex-ghx/tree/main/.claude/plugins/compound-engineering/skills/andrew-kane-gem-writer
Command: npx skills add https://github.com/mengblom/dex-ghx --skill andrew-kane-gem-writer-mengblom

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

It helps you write Ruby gems that follow Andrew Kane's proven, battle-tested patterns so your library code stays simple, maintainable, and production-ready.

Core Features & Use Cases

  • Gem entry-point structure: Enforces a consistent lib/gemname.rb layout with standard library requires, internal requires, and conditional Rails loading.
  • Kane-style class macro DSL: Creates a single configuration method approach that defines methods safely and stores options for later use.
  • Rails integration patterns: Guides Rails coupling avoidance by using ActiveSupport.on_load and optionally prepend for behavior changes.
  • Production-grade gem hygiene: Recommends clean error hierarchies, minimal runtime dependencies, and Minitest-only testing conventions.

Quick Start

Use the skill to write a new Ruby gem named "AcmeNotes" that exposes a small Rails-friendly API and follows Andrew Kane's patterns.

Frequently Asked Questions about andrew-kane-gem-writer

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I structure a Ruby gem for Rails integration without requiring Rails directly?

Use ActiveSupport.on_load to hook into Rails frameworks and conditionally load Rails-specific code. This avoids hard dependencies, ensuring your Ruby gem functions independently while enabling seamless Rails integration.

What is the best way to design a configuration DSL for a Ruby gem?

Implement a macro-style DSL that defines configuration methods safely and stores options for later use. This single-method approach keeps your Ruby gem API clean, stable, and maintainable.

How do I set up Minitest for testing a new Ruby gem?

Configure Minitest as your sole testing framework with minimal runtime dependencies. This keeps the gem lightweight and avoids the overhead of heavier testing frameworks.

When should I use prepend to modify behavior in a Rails gem?

Use prepend to modify existing Rails behavior when ActiveSupport.on_load hooks are insufficient. This allows your gem to cleanly override or extend methods without heavily monkey-patching production code.

Why does my Ruby gem need a clean error hierarchy?

A clean error hierarchy improves gem maintainability and user debugging. Defining specific error classes allows consumers to rescue expected failures gracefully without catching unrelated production code errors.

Can I refactor an existing Ruby gem to follow Andrew Kane's patterns?

Yes, you can refactor existing gem internals by applying a standard entry-point structure, macro-style DSL, and minimal dependencies. This simplifies the codebase and improves long-term maintainability.