Skip to content
Agentmart
Submit a tool

extract-engine

Use when extracting a host-app feature into a Rails engine.

Skill by igmarin

IndexedMIT★ 28
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/igmarin-extract-engine

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Use when extracting a host-app feature into a Rails engine. Do not change behavior in the same step. Trigger words: extract to engine, move feature, host coupling.

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md and code. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/extract-engine

What's inside

Skill name
extract-engine
Description
Use when extracting a host-app feature into a Rails engine. Do not change behavior in the same step. Trigger words: extract to engine, move feature, host coupling.
License
MIT
Metadata
version: 1.0.0 · user-invocable: true
Instructions
100 lines in SKILL.md · view on GitHub

Files (4)

  • SKILL.md
  • checklist.json · assets/
  • examples.md · assets/
  • adapter_examples.md · references/

SKILL.md (first lines)

# Extract Engine


Use this skill when the task is to move existing code out of a Rails app and into an engine.
Prefer incremental extraction over big-bang rewrites. Preserve behavior first, then improve design.

## Quick Reference

| Phase | Focus |
|-------|-------|
| Prep | Identify bounded feature and host dependencies |
| Logic | Move stable domain logic (POROs, services) first |
| Seams | Add adapters/config for host dependencies |
| Web | Move controllers, routes, views last |

## HARD-GATE

```text
DO NOT extract and change behavior in the same step.
Extraction must preserve existing behavior; refactoring and improvements belong in a separate step after the move is complete and verified.
```

## Core Process

1. Identify the bounded feature to extract — one coherent responsibility.
2. List hard dependencies on the host app (models, services, config).
3. Define the future engine boundary and host contract.
4. Move stable domain logic first: POROs, services, value objects, policies, query objects. Delay direct host model references, authentication, route ownership, and asset integration.
5. Add adapters or configuration seams for host-owned dependencies. Replace hardcoded host references with config values, adapter objects, or service interfaces.
6. Move controllers, routes, views, or jobs only after seams are clear.
7. Keep regression coverage green throughout each slice.

Each slice must have: one coherent responsibility, minimal new public API, passing regression tests, and a clear next step.

## Extended Resources

**Pitfalls**

| Pitfall | What to do |
|---------|------------|
| Extracting too much at once | One bounded slice per step |
| Direct host references in engine | Use adapters or config |
| Behavior changes mixed with extraction | Preserve behavior first; refactor after |
| Circular dependencies introduced | Verify import graph before each slice |
| Implicit host contract | Explicitly document and test the host app contract |

**Examples**

**First slice (move PORO, no host model yet):**
```bash
mkdir -p my_engine/app/services/my_engine
mv app/services/pricing/calculator.rb my_engine/app/services/my_engine/pricing_calculator.rb
```
```ruby
# Before (in host app): module Pricing; class Calculator
# After (in engine):
module MyEngine
  class PricingCalculator
    def initialize(line_items)
      @line_items = line_items
    end

    def total
      @line_items.sum { |item| item.price * item.quantity }
    end
  end
end
```
Verify regression coverage still passes before proceeding:
```bash
bundle exec rspec spec/services/pricing/ spec/requests/orders/
```

**Adapter for host dependency:**
```ruby
module MyEngine
  def self.current_user_for(request)
    config.current_user_provider.call(request)
  end
end

# usage
OrderCreator.for_request(request) # resolves via MyEngine.current_user_for(request)
```

## Output Style

1. Propose one small, bounded extraction slice at a time.
2. Outline the files moving, the new boundaries, and the regression tests to run.
3. Language — Must be in English unless explicitly requested otherwise.

## Integration

| Skill | When to chain |
|-------|----------------|
| create-engine | Engine structure, host contract, namespace design after extraction |
| test-engine | Dummy app, regression tests, integration verification |
| refactor-code | Behavior-preserving refactors before or after extraction slices |

From igmarin/rails-agent-skills, MIT.

More from igmarin/rails-agent-skills

Signals

Stars
28
Forks
8
Open issues
0
Contributors
7
Last commit (this folder)
Sep 28, 2026 (1 month ago)
Last release
May 16, 2026 (5 months ago)

From GitHub (fetched Oct 24, 2026).

Details

Version
1.0.0
License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from igmarin

Cite this page

extract-engine skill. Agent Mart. https://agentmart.dev/skills/igmarin-extract-engine (last updated 2026-10-24)