From rails-agent-skills
Creates install generators for Rails engines using Thor, enforcing an idempotent workflow: GENERATE, VERIFY, RERUN, TEST, DOCUMENT. Helps build mountable engine setups with initializers, migrations, and route mounts.
How this skill is triggered — by the user, by Claude, or both
Slash command
/rails-agent-skills:create-engine-installerThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
When building or reviewing an install generator, follow these steps in order. **DO NOT ship a generator without completing steps 3 and 4.**
When building or reviewing an install generator, follow these steps in order. DO NOT ship a generator without completing steps 3 and 4.
config/initializers/, migrations at db/migrate/, route mount in config/routes.rb).Key implementation rules:
All generator actions must be safe to run multiple times. Guard every file creation and injection at the point of use:
def create_initializer
return if File.exist?(File.join(destination_root, 'config/initializers/my_engine.rb'))
create_file 'config/initializers/my_engine.rb', <<~RUBY
MyEngine.configure do |config|
config.user_class = "User"
end
RUBY
end
def mount_route
# inject_into_file with force: false skips insertion if sentinel already present
inject_into_file 'config/routes.rb',
"\n mount MyEngine::Engine, at: '/admin'\n",
after: "Rails.application.routes.draw do",
force: false
end
Minimal rerun spec:
it 'does not duplicate the route mount on rerun' do
2.times { run_generator }
expect(File.read(file('config/routes.rb')).scan('mount MyEngine::Engine').size).to eq(1)
end
For larger installers, extract extended guard patterns and spec templates into a dedicated companion file alongside the generator (e.g. lib/generators/my_engine/install/install_generator_patterns.rb) to keep the generator lean and this skill focused on workflow. Reference that file explicitly in your generator's comments so future maintainers know where to find the shared patterns.
| Skill | When to chain |
|---|---|
| create-engine | When designing the engine structure that installers will configure |
| document-engine | When documenting install steps or upgrade instructions |
| test-engine | When adding generator specs or dummy-app install coverage |
npx claudepluginhub igmarin/rails-agent-skills --plugin rails-agent-skillsCreates or refactors Rails engines with proper structure, namespace isolation, host-app contracts, and dummy app integration tests.
Creates expert-level Ruby on Rails generators for models, services, controllers, and full-stack features. Useful for custom scaffolds, code generation tools, or Rails/Thor automation.
Write idiomatic Ruby code with metaprogramming, Rails patterns, and performance optimization. Specializes in Ruby on Rails, gem development, and testing frameworks.