andrew-kane-gem-writer

Create and refactor Ruby gems with minimal dependencies and safe Rails integration.

1|Updated Apr 4, 2026
One-click install
npx skills add https://github.com/ybbms777/compound-engineering --skill andrew-kane-gem-writer-ybbms777
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: andrew-kane-gem-writer
Source: https://github.com/ybbms777/compound-engineering/tree/main/skills/andrew-kane-gem-writer
Command: npx skills add https://github.com/ybbms777/compound-engineering --skill andrew-kane-gem-writer-ybbms777

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill solves the common pain points of building Ruby gems that are bloated with unnecessary dependencies, tightly coupled to Rails, or filled with metaprogramming that makes them hard to maintain, by providing battle-tested patterns from a developer with 100+ production gems and 374M+ total downloads.

Core Features & Use Cases

  • Proven Gem Architecture: Provides exact templates for entry point structure, version files, module organization, and class macro DSLs that power popular gems like Searchkick, PgHero, and Lockbox.
  • Safe Rails Integration: Includes patterns for lazy Rails loading via ActiveSupport.on_load, Railtie/Engine setup, and behavior modification with prepend to avoid loading order issues and coupling.
  • Production-Grade Best Practices: Covers error handling hierarchies, gemspec configuration, multi-database adapter patterns, Minitest test setup, and CI workflows for testing across multiple Ruby and Rails versions.
  • Use Case Example: If you are refactoring an existing Ruby gem to remove unnecessary dependencies and add safe Rails integration, this Skill gives you the exact code patterns to implement it correctly without introducing breaking changes.

Quick Start

Use the andrew-kane-gem-writer skill to create a new Ruby gem for PostgreSQL performance monitoring following Andrew Kane's PgHero patterns, including the database adapter setup, Rails Engine configuration, and Minitest test suite.

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 build a Ruby gem with safe Rails integration without tight coupling?

To build a Ruby gem with safe Rails integration, use lazy Rails loading via ActiveSupport.on_load and behavior modification with prepend. This prevents loading order issues and avoids tight coupling, ensuring your gem works independently of Rails.

What are the best practices for setting up a Minitest test suite for a Ruby gem?

Minitest test suite best practices for Ruby gems include configuring cross-version test suites and CI workflows for testing across multiple Ruby and Rails versions. This ensures compatibility and validates your gem against different environment configurations.

How do I reduce unnecessary runtime dependencies when creating a Ruby gem?

To reduce unnecessary runtime dependencies when creating a Ruby gem, enforce zero or minimal dependencies and prefer explicit code over excessive metaprogramming. This keeps the gem lightweight, maintainable, and free of common bloat anti-patterns.

Can I use class macro DSL patterns to design a clean gem API?

Yes, you can use class macro DSL patterns to design a clean gem API. This approach provides explicit, maintainable interfaces for users, avoiding magic code while powering popular gems like Searchkick and Lockbox.

How do I implement multi-database adapters in a Ruby gem?

To implement multi-database adapters in a Ruby gem, apply dedicated database adapter patterns that isolate connection logic. This allows your gem to support multiple database backends safely without hardcoding dependencies or breaking Rails Engine configurations.

When should I avoid using metaprogramming in Ruby gem development?

You should avoid excessive metaprogramming in Ruby gem development when it obscures code logic and makes maintenance difficult. Prefering explicit code over magic ensures the gem remains readable, debuggable, and free of complex anti-patterns.