rails-model-generator

Scaffold Rails models through a TDD workflow from failing spec to green tests.

643|80|Updated Dec 9, 2025
One-click install
npx skills add https://github.com/ThibautBaissac/rails_ai_agents --skill rails-model-generator
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: rails-model-generator
Source: https://github.com/ThibautBaissac/rails_ai_agents/tree/main/skills/rails-model-generator
Command: npx skills add https://github.com/ThibautBaissac/rails_ai_agents --skill rails-model-generator

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Too many Rails teams waste time wiring models, migrations, and tests in separate steps, leading to misaligned design and flaky validation.

Core Features & Use Cases

  • TDD-driven workflow that starts with a failing spec, followed by a migration, then the model implementation, ensuring correctness by design.
  • Provides templates and guidance for defining model attributes, validations, associations, and database structure, enabling repeatable scaffolding.
  • Use Case: when adding a new core domain model, this Skill guides you from requirements through to green specs and a working table.

Quick Start

Define requirements for the new model, write a failing spec that expresses the desired behavior, and progressively implement the model through migration and code until the test suite passes.

Frequently Asked Questions about rails-model-generator

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

FAQPage Schema
How do I scaffold a Rails model using TDD starting with a failing spec?

To scaffold a Rails model using TDD, start by defining requirements and writing a failing spec expressing desired behavior, then progressively implement through migration and code until tests pass.

What's the best way to add validations and associations to a Rails model?

The best way to add validations and associations is through a TDD-first workflow that provides templates and guidance, ensuring repeatable scaffolding from spec through factory and migration to green tests.

How does a TDD-first workflow prevent flaky validation when creating Rails migrations?

A TDD-first workflow prevents flaky validation by starting with a failing spec that expresses desired behavior, then generating the migration and model implementation to ensure a structured path to green tests.

Can I use this Rails model scaffolding workflow for adding validations to existing models?

Yes, this Rails model scaffolding workflow applies to creating new models, adding validations, defining associations, and generating migrations, guiding you from requirements through to green specs.

Do I need to write a factory before generating a Rails model migration in this workflow?

In this workflow, you define requirements, write a failing spec expressing desired behavior, and progressively implement the model through migration and code, incorporating factory templates alongside the spec and migration.