- Home
- Skills
- Everyinc
- Compound Engineering Plugin
- Andrew Kane Gem Writer
andrew-kane-gem-writer_skill
- TypeScript
10.5k
GitHub Stars
1
Bundled Files
2 months ago
Catalog Refreshed
4 months ago
First Indexed
Readme & install
Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.
Installation
Preview and clipboard use veilstrat where the catalogue uses aiagentskills.
npx veilstrat add skill everyinc/compound-engineering-plugin --skill andrew-kane-gem-writer- SKILL.md4.8 KB
Overview
This skill generates and refactors Ruby gems using Andrew Kane’s proven patterns and philosophy. It focuses on simple, production-ready libraries with minimal dependencies, explicit code, and safe Rails integration. Use it to produce consistent entry points, configuration, error handling, testing, and gemspecs that follow battle-tested conventions.
How this skill works
The skill applies a template-driven approach: it scaffolds lib/gemname.rb with the standard entry-point structure, creates the class-macro DSL for model integration, and adds ActiveSupport.on_load hooks for Rails integration. It enforces configuration via module-level accessors, a small error hierarchy, Minitest-focused test files, and a gemspect pattern that avoids runtime deps. When refactoring, it identifies anti-patterns (method_missing, heavy DSLs, direct Rails requires, config objects) and suggests concrete replacements.
When to use it
- Creating a new Ruby gem intended for production use
- Designing a simple, explicit API for a library or Rails extension
- Refactoring an existing gem to reduce dependencies and increase clarity
- Implementing Rails integration without coupling to Rails
- Writing Minitest-based test suites and a minimal gemspec
Best practices
- Prefer stdlib and zero runtime dependencies; keep dev deps in Gemfile
- Use class << self attr_accessor for configuration; avoid config objects
- Expose a single class-macro method to opt-in behavior; validate unknown keywords early
- Use ActiveSupport.on_load for safe Rails hooks and prepend for behavior changes
- Favor define_method over method_missing; prefer explicit methods over clever metaprogramming
Example use cases
- Scaffold a new gem with proper lib/gemname.rb, version, and module layout
- Add a model DSL (e.g., searchkick-style) that sets class-level options and instance helpers
- Refactor a gem that incorrectly requires Rails or uses heavy runtime dependencies
- Create a small cryptography helper gem with environment-backed config and strict argument validation
- Write Minitest files and CI-friendly testing patterns for multi-Ruby support
FAQ
No. Rails hooks are added conditionally via ActiveSupport.on_load so the gem works without Rails at runtime.
How should I expose configuration values?
Use module-level accessors (class << self with attr_accessor/attr_writer) and provide sensible defaults, falling back to ENV when appropriate.
Which testing framework is recommended?
Minitest only; keep tests minimal and dependency-free using bundler/setup and minitest/autorun.