andrew-kane-gem-writer

Guide Ruby gem development with minimal dependencies and explicit requires.

Updated Dec 21, 2023
One-click install
npx skills add https://github.com/Hff1230/FFNotes --skill andrew-kane-gem-writer-hff1230
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: andrew-kane-gem-writer
Source: https://github.com/Hff1230/FFNotes/tree/main/AI%E5%BA%93/Skill/compound-engineering-zh/skills/andrew-kane-gem-writer
Command: npx skills add https://github.com/Hff1230/FFNotes --skill andrew-kane-gem-writer-hff1230

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This skill guides Ruby developers to write gems using Andrew Kane's proven patterns and philosophy, reducing ambiguity and aligning gems with production-ready conventions.

Core Features & Use Cases

  • Minimal dependencies and explicit requires to keep gems lightweight and maintainable.
  • Rails integration via on_load so gems avoid eager Rails loading and stay plug-and-play in Rails apps.
  • Modular architecture and a canonical gem layout inspired by Kane's patterns to promote clarity and maintainability.
  • Testing and error-handling guidance including Minitest-focused patterns and clear error hierarchies for gem code.
  • Use Case: Create a new gem, refactor an existing gem, or design a gem API following proven Kane methodologies for production readiness.

Quick Start

Provide a minimal, production-ready Ruby gem scaffold following 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 build a Ruby gem with minimal dependencies and a modular architecture?

To build a Ruby gem with minimal dependencies, use explicit requires and a modular architecture. This approach keeps gems lightweight and maintainable by avoiding unnecessary external code and ensuring clear separation of concerns.

What is the best way to integrate a Ruby gem with Rails without eager loading?

The best way to integrate a Ruby gem with Rails without eager loading is using the on_load hook. This ensures the gem remains plug-and-play within Rails applications while avoiding unnecessary framework initialization overhead.

How do I structure error handling and testing patterns for a new Ruby gem?

Structure Ruby gem testing and error handling by implementing clear error hierarchies and using Minitest-focused patterns. This provides reliable test coverage and explicit failure modes for production-ready code.

Can I use Andrew Kane's gem patterns to refactor an existing Ruby on Rails project?

Yes, you can apply Kane's gem patterns to refactor existing Ruby on Rails projects. The methodology guides refactoring toward zero or minimal dependencies, explicit requires, and modular architecture for better maintainability.

Why does my Ruby gem require explicit requires instead of autoload in production?

Ruby gems require explicit requires instead of autoload to ensure predictable loading behavior and minimal dependencies. This production-ready convention prevents load-order issues and keeps the gem lightweight across different Ruby environments.