rails-model-generator

Generate Rails models with TDD, RSpec, and FactoryBot.

Updated Feb 8, 2026
One-click install
npx skills add https://github.com/mlbright/notes --skill rails-model-generator-mlbright
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: rails-model-generator
Source: https://github.com/mlbright/notes/tree/main/.github/skills/rails-model-generator
Command: npx skills add https://github.com/mlbright/notes --skill rails-model-generator-mlbright

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill streamlines the process of creating new Rails models by enforcing a Test-Driven Development (TDD) approach, ensuring code quality and maintainability from the outset.

Core Features & Use Cases

  • TDD Workflow: Guides users through defining requirements, writing specs, generating migrations, and implementing models.
  • Boilerplate Reduction: Automates the generation of spec files, factories, and migration files.
  • Use Case: When starting a new feature that requires a new database table and corresponding model, use this Skill to set up the foundation following best practices.

Quick Start

Use the rails-model-generator skill to create a new User model with name and email attributes.

Frequently Asked Questions about rails-model-generator

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I generate a Rails model using TDD?

To generate a Rails model using TDD, write RSpec specifications and FactoryBot definitions first, then generate the database migration and implement the model with validations and associations.

What is the best way to set up RSpec and FactoryBot for a new Rails database model?

Setting up RSpec and FactoryBot for a new Rails database model involves defining test specifications and factories before implementation, ensuring your database tables and models adhere to strict test-driven development practices.

Can I add Rails validations and associations through a test-first workflow?

Yes, you can add Rails validations and associations through a test-first workflow by defining the expected behavior in RSpec specs first, then implementing the model logic and running the tests until they pass.

Does this TDD approach require existing Rails migration files to work?

No, this TDD approach does not require existing Rails migration files; it facilitates the creation of new migrations and database tables alongside the model implementation after defining the initial specifications.

What is the TDD workflow for creating new database tables in Ruby on Rails?

The TDD workflow for creating new database tables in Ruby on Rails starts with defining requirements, writing RSpec specs and FactoryBot factories, generating the migration file, and finally implementing the model.