Rename model

From jasonswett/llm-skills · View interactive version

Rename model is an AI agent skill from the GitHub repository jasonswett/llm-skills. This guide describes how to rename a Rails model. We'll use renaming `Circle` to `Shape` as an example.

How to use this skill

Skill file

Model Name Migration Guide

This guide describes how to rename a Rails model. We'll use renaming Circle to Shape as an example.

Step 1: Rename the database table

Create a migration to rename the table:

rename_table :circles, :shapes

Commit and deploy this change before proceeding. The old model code will

continue to work because Rails looks up the table name from the model class,

and the model still references the old table name until we update it.

Step 2: Create new model file

Before:

class Circle < ApplicationRecord
  # contents of model
end

After:

class Circle < Shape
  # class is now empty
end
class Shape < ApplicationRecord
  # contents of model
end

Note: Circle < Shape is a transitional backwards-compatibility shim, not

Single Table Inheritance. STI is irrelevant here — Circle exists only so

existing references keep working until they're updated to Shape. No type

column is needed on the table.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.