agentleFS
igmarinigmarin/rails-agent-skills/skills/create-engine/SKILL.md

create-engine

Skill26 starsChanged 4 months agoMITView on GitHub

Use when scaffolding a new Rails engine. Keep a narrow public API and a dummy app. Trigger words: create engine, new engine, mountable engine.

The file

We split this skill into the rules it gives an agent

9 rules. About 0 are common, 7 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈7

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use this skill when the task is to create, scaffold, or refactor a Rails engine, Rails plugin, or engine gem.

    line 16
  2. Distinctive:

    Keep this skill focused on structure and design.

    line 18
  3. Very specific:

    Create the minimal engine structure.

    line 62
  4. Distinctive:

    Write minimum integration coverage through the dummy app.

    line 64
  5. Distinctive:

    Document the host-app contract clearly enough for follow-on work.

    line 65
  6. Distinctive:

    If the user does not specify the engine type, infer it from the requested behavior and say which type you chose.

    line 67
  7. Very specific:

    When asked to create or scaffold a Rails engine, your output answer.md MUST follow this style:

    line 79
  8. Distinctive:

    Integration Test Coverage: Write integration specs covering configuration, routing, HTTP request flow, domain services, and …

    line 83
  9. Distinctive:

    Language: Must be in English unless explicitly requested otherwise.

    line 84

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Create Engine

Use this skill when the task is to create, scaffold, or refactor a Rails engine, Rails plugin, or engine gem.

Keep this skill focused on structure and design. Use adjacent skills for installer details, deep test coverage, release workflow, or documentation work.

Quick Reference

Engine TypeWhen to Use
Plain gemNo Rails hooks or app directories needed; pure Ruby library
RailtieNeeds Rails initialization hooks but not models/controllers/routes/views
EngineNeeds Rails autoload paths, initializers, migrations, assets, jobs, or host integration
Mountable engineNeeds its own routes, controllers, views, assets, and namespace boundary

HARD-GATE

Before engine work is complete, confirm all of the following:

STRUCTURE & CONTRACT:
1. Root file requires only version, configuration, and engine.
2. Public engines use isolate_namespace; configuration exposes .configure block.
3. Host model references are configurable strings (e.g., "User"), never hard-coded ::User.
4. Host-app contract is documented (see Host App Contract section).

SAFETY CHECKS:
5. Engine code never auto-applies migrations at boot (no db:migrate, ActiveRecord::Migrator, or config.paths['db/migrate'] in initializers).
6. Initializers are idempotent and safe in development reloads.
7. Assets and generators are namespaced and idempotent.

VERIFICATION COMMANDS:
8. Dummy app exists: `ls spec/dummy` or `ls test/dummy` should return the app directory.
9. Integration tests pass: `bundle exec rspec` or `bundle exec rake test` exits 0.
10. Routes load correctly: `bundle exec rails routes` inside dummy app shows engine routes.
11. No hard-coded host constants: `grep -r "::User\|::Employee" lib/ app/` returns nothing.
12. No migration auto-apply patterns: `grep -r "db:migrate\|ActiveRecord::Migrator\|config.paths\['db/migrate'\]" lib/` returns nothing.

Core Process

  1. Identify the engine type before writing code. Scaffold with the correct generator:
    rails plugin new my_engine --mountable   # mountable engine
    rails plugin new my_engine --full        # full engine (non-isolated)
    rails plugin new my_engine               # plain Railtie/gem
  2. Define the host-app contract (what the host must provide, what the engine exposes, which extension points are supported). See reference.md for the full contract template.
  3. Create the minimal engine structure. Checkpoint: bundle exec rake inside the engine must pass.
  4. Implement features behind the namespace. Checkpoint: mount engine in dummy app routes and verify with bundle exec rails routes.
  5. Write minimum integration coverage through the dummy app. See TESTING.md for coverage requirements.
  6. Document the host-app contract clearly enough for follow-on work.

If the user does not specify the engine type, infer it from the requested behavior and say which type you chose.

Extended Resources

  • reference.md — full host-app contract template, recommended file structure, and code scaffolding examples
  • EXAMPLES.md — extended engine examples
  • TESTING.md — coverage requirements and dummy app setup
  • assets/examples.md
  • assets/release-checklist.md

Output Style

When asked to create or scaffold a Rails engine, your output answer.md MUST follow this style:

  1. Concrete Artifact Files: Display the full generated .gemspec and Rakefile contents, correctly namespaced under the engine namespace.
  2. Verification & Rake Status: Explicitly state that bundle exec rake inside the engine passes (exits 0), with a simulated passing output block.
  3. Integration Test Coverage: Write integration specs covering configuration, routing, HTTP request flow, domain services, and host-integration hooks. See TESTING.md for the required spec categories and paths. Keep unit tests for models/services separate from request/integration specs.
  4. Language: Must be in English unless explicitly requested otherwise.

Integration

SkillWhen to chain
test-engineDummy app setup, integration tests, regression coverage
review-engineFindings-first audits, structural review
document-engineREADME, installation guide, host-app contract documentation
create-engine-installerGenerator-heavy setup, install scripts, copy migrations
generate-api-collectionWhen the engine exposes HTTP endpoints (generate/update Postman collection)

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

Reviews can't be read right now.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.