skills/personas/engine/SKILL.md
Complete Rails engine development loop with hard gates: scaffold engine structure with isolate_namespace and verify gemspec validation → set up dummy app and verify tests run with exit 0 → NEVER integrate engine into host app before engine tests pass standalone, namespace is isolated, migrations won't conflict, and dependencies are declared → code review and dependency auditing → release with SemVer, changelog, and upgrade notes; phases authoring→testing→implementation/review→documentation/release. Use when creating, extracting, or maintaining Rails engines. Trigger: create engine, extract engine, engine release, engine testing, mountable engine, gem extraction.
npx skillsauth add igmarin/rails-agent-skills engineInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Kickoff command:
rails plugin new my_engine --mountable --test-framework=rspec
Key files to verify after scaffolding:
lib/my_engine/engine.rb — must contain isolate_namespace MyEnginelib/my_engine/version.rbmy_engine.gemspec — must pass gem specification validationtest/dummy/ — dummy app presentHARD GATE — Engine Structure Check:
grep -r 'module MyEngine' lib/my_engine/engine.rb
ruby -e "require 'rubygems'; spec = Gem::Specification.load('my_engine.gemspec'); puts spec.validate"
grep 'isolate_namespace\|engine.config.isolate_namespace' lib/my_engine/engine.rb
If structure check FAILS: Return to create-engine and fix.
skills/engines/test-engine (sub-skill — invoke separately) — Set up dummy app, spec helpers, factory isolation, and test database
Write initial characterization tests:
Run tests from engine root:
cd my_engine && bundle exec rspec
HARD GATE — Tests Run:
bundle exec rspec --format progress 2>&1 | tail -5
Must show no load errors and exit 0.
If load errors appear: Consult the test-engine sub-skill for ordered troubleshooting steps.
HARD GATE — Isolation Before Integration:
NEVER integrate engine into host app before:
Implement features using:
skills/engines/review-engine (sub-skill — invoke separately)
skills/engines/upgrade-engine (sub-skill — invoke separately)
Check gem dependencies:
bundle exec rake dependencies
bundle exec bundler-audit check --update
skills/engines/document-engine (sub-skill — invoke separately) — Installation, configuration, usage examples, changelog
skills/engines/release-engine (sub-skill — invoke separately) — Version bump (SemVer), changelog, upgrade notes, git tag
Release commands:
gem build my_engine.gemspec
gem push my_engine-1.0.0.gem
git tag v1.0.0 && git push origin v1.0.0
Optional:
3. skills/engines/create-engine-installer — Idempotent rails g my_engine:install generator for host app configuration
Output: Published gem or releasable GitHub repository.
New engine? → create-engine → test-engine
Extract from app? → extract-engine → create-engine
Release engine? → review-engine → release-engine
Not sure? → skill-router
| Anti-Pattern | Fix |
|---|---|
| Namespace leakage — ::MyEngine instead of MyEngine:: | Verify isolate_namespace MyEngine in engine.rb |
| Migration conflicts — Migrations outside engine dir or missing path config | Run engine migrations in isolation via dummy app |
| Missing gemspec dependencies — Runtime gems in Gemfile but not in .gemspec | Run bundle exec rake dependencies and bundler-audit check at Phase 3 end |
| Dummy app load errors — Missing require or incorrect spec_helper | Use test-engine sub-skill diagnostic steps |
development
Entry point for Rails development workflows covering TDD, RSpec, Service Objects, DDD, GraphQL, Engines, and Code Quality. Use when the user asks about Ruby on Rails development patterns, needs RSpec test suites generated, wants service objects scaffolded, is setting up GraphQL schemas, performing Rails code review, refactoring .rb files, working with domain-driven design, implementing background jobs, conducting Rails security checks, or building Rails engines. Generates RSpec tests, structures service objects, enforces TDD workflows, configures GraphQL schemas, and coordinates domain-driven design patterns. Trigger keywords: Rails, RSpec, TDD, Rails testing, Rails refactor, Rails API, Rails code review, domain driven design, service objects, GraphQL, Rails engine, Ruby, .rb, background jobs, Rails migrations, Rails security check.
development
Use when shipping a Rails engine gem — FIRST run full test suite (`bundle exec rspec`) and fix ALL failures, verify gemspec metadata and dependencies match tested Rails/Ruby versions, dry-run: `gem build *.gemspec && gem push --dry-run *.gem` and verify contents, generate CHANGELOG.md organized by category (added/changed/deprecated/removed/fixed), produce step-by-step upgrade notes with before/after code, set semantic version in `lib/[engine_name]/version.rb`, document deprecations with migration paths, load release assets conditionally and state which one informed the output. Trigger words: version bump, changelog, deprecation, gemspec, upgrade, release, publish gem, ship gem.
development
Orchestrates the full Rails TDD cycle with hard gates: test MUST exist, be run, and FAIL for the correct reason (e.g. undefined method, not syntax error) before any implementation code — propose minimal implementation and wait for user approval → verify test PASSES → run full suite with rubocop, brakeman, rspec all green → produce YARD documentation and self-reviewed PR; phases context/test design→implementation→iterate→finish. Use when practicing test-driven development, red-green-refactor, TDD workflow, writing tests before code, adding tests first, or building a Rails feature where specs must gate implementation.
development
Complete Rails project setup loop with hard gates: verify Ruby version matches .ruby-version, Bundler installed, database connection successful, all env vars loaded, and ALL external CI actions pinned to immutable commit SHAs (never mutable tags like @v4) → configure CI/CD pipeline with linting, testing, and security scanning → validate end-to-end with bundle install, db:create, db:migrate, rspec, and write SETUP_CHECKLIST.md; phases context/onboarding→CI/CD configuration→environment validation. Use when starting a new Rails project, running `rails new`, configuring a Gemfile or .ruby-version, setting up a development environment, or wiring up CI/CD for a Ruby on Rails app. Trigger: setup project, new Rails app, configure CI/CD, dev environment setup, rails new, Gemfile setup, .ruby-version, Ruby on Rails project bootstrap.