Use when creating install generators, copied migrations, or initializer installers for Rails engines. Covers idempotent setup tasks, host-app onboarding, and route mount setup.
79
73%
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-installers/SKILL.mdUse this skill when the task is to design or review how a host app installs and configures a Rails engine.
Good installation flows are explicit, repeatable, and safe to rerun.
| Installer Component | Purpose |
|---|---|
| Generator | Creates initializer, route mount, or optional setup files; must be idempotent |
| Migrations | Copies engine migrations into host db/migrate; host owns and runs them |
| Initializer | Provides configuration defaults; generated once, editable by host |
| Routes | Adds mount Engine, at: '/path'; document or generate, avoid duplicates |
| Mistake | Reality |
|---|---|
| Non-idempotent generators | Generators must be safe to run multiple times; check before injecting routes or files |
| Mutating host in boot | Never modify host files or state from initializers or engine.rb at load time |
| No rollback for install | Document manual rollback steps; generators cannot reliably undo all changes |
install generator for initializer plus route guidanceinstall:migrations or copied migrations for persistence changesFlag these problems:
Idempotent install generator (only inject once):
# lib/generators/my_engine/install/install_generator.rb
module MyEngine
class InstallGenerator < Rails::Generators::Base
def inject_initializer
return if initializer_already_present?
create_file 'config/initializers/my_engine.rb', <<~RUBY
MyEngine.configure do |config|
config.user_class = "User"
end
RUBY
end
def inject_routes
route "mount MyEngine::Engine, at: '/admin'"
end
private
def initializer_already_present?
File.exist?(File.join(destination_root, 'config/initializers/my_engine.rb'))
end
end
endGenerator test (idempotency):
it 'does not duplicate route on second run' do
run_generator
run_generator
expect(File.read('config/routes.rb')).to have_content('mount MyEngine::Engine', 1)
endWhen asked to implement setup flow:
| Skill | When to chain |
|---|---|
| rails-engine-author | When designing the engine structure that installers will configure |
| rails-engine-docs | When documenting install steps or upgrade instructions |
| rails-engine-testing | When adding generator specs or dummy-app install coverage |
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.