erb-to-view-model

Installation
SKILL.md

ERB → ViewModel: Extract Ruby logic out of an ERB template

When the user types /erb-to-view-model, migrate an ERB template away from instance variables / helper calls by precomputing all required values in a Ruby ViewModel under app/view_models/, following existing repo conventions.

1) Collect required inputs (ask before doing anything)

Before proceeding, ask the user for these parameters (do not proceed until all are provided):

  • ERB template path: <erb-path> (example: app/views/groups/index.html.erb)
  • Controller + action: <controller>#<action> (example: GroupsController#index)
  • Target ViewModel constant: <view-model-constant> (example: Groups::IndexViewModel)
  • Target ViewModel file path: <view-model-path> (example: app/view_models/groups/index_view_model.rb)

This command always uses the template local variable name view_model (it is not configurable).

Also ask for these parameters (strongly recommended; do not proceed without tests):

  • Characterization spec path: <spec-path> (example: spec/controllers/groups_controller_characterization_spec.rb)
  • Feature flag constraint: <feature-flag> (example: groups_index_view_model_migration)
Related skills
Installs
3
Repository
dailydm/skills
First Seen
Mar 9, 2026