Use when maintaining compatibility for Rails engines across Rails and Ruby versions. Trigger words: Zeitwerk, autoloading, Rails upgrade, dependency bounds, gemspec, feature detection, CI matrix, reload safety, deprecated APIs, cross-version support.
64
56%
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Passed
No known issues
Optimize this skill with Tessl
npx tessl skill review --optimize ./rails-engine-compatibility/SKILL.mdUse this skill when the task is to make an engine stable across framework versions and host environments.
Compatibility work should reduce surprises for host applications. Prefer explicit support targets over accidental compatibility.
| Compatibility Aspect | Check |
|---|---|
| Zeitwerk | File paths match constant names; no anonymous or root-level constants |
| Gemspec bounds | add_dependency and required_ruby_version match tested versions |
| Feature detection | Use respond_to?, defined?, or adapter seams instead of Rails.version |
| Test matrix | CI runs against each claimed Rails/Ruby combination |
| Mistake | Reality |
|---|---|
| Hardcoding Rails version checks | Use feature detection or adapter seams; version branching is brittle and often wrong |
| Missing Zeitwerk compatibility | File paths must match constant names; mismatches break autoloading in Rails 6+ |
| No CI matrix | Claiming support for multiple versions without testing them leads to silent breakage |
Rails.version checks instead of feature detectionto_prepare or initializer hooksGemspec version bounds (honest, testable):
# Good: narrow and tested
spec.add_dependency "rails", ">= 7.0", "< 8.0"
spec.required_ruby_version = ">= 3.0"
# Bad: claims support without CI
# spec.add_dependency "rails", ">= 5.2" # untested on 5.2/6.xZeitwerk: file and constant must match:
# File: lib/my_engine/widget_policy.rb
# Good: constant matches path
module MyEngine
class WidgetPolicy
end
end
# Bad: will break with Zeitwerk
# class WidgetPolicy # expected in widget_policy.rb at rootReload-safe hook:
# In engine.rb
config.to_prepare do
MyEngine::Decorator.apply # runs on each reload in dev
endWhen asked to improve compatibility:
| Skill | When to chain |
|---|---|
| rails-engine-testing | Test matrix setup, CI configuration, multi-version tests |
| rails-engine-author | Engine structure, host contract, namespace design |
| rails-engine-release | Versioning, changelog, upgrade notes for compatibility changes |
ae8ea63
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.