rails-model-generator

Generate Rails ActiveRecord models through a TDD-first workflow from tests to migrations.

1|Updated Jan 8, 2026
One-click install
npx skills add https://github.com/LaunchPadLab/ai-bank --skill rails-model-generator-launchpadlab
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: rails-model-generator
Source: https://github.com/LaunchPadLab/ai-bank/tree/main/claude/skills/rails-model-generator
Command: npx skills add https://github.com/LaunchPadLab/ai-bank --skill rails-model-generator-launchpadlab

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill solves the problem of building correct Rails models reliably without guessing validations, associations, scopes, or database constraints by guiding you through a TDD-first creation flow.

Core Features & Use Cases

  • TDD-first model workflow: Define model requirements, write the model tests (expecting RED), then generate migrations and implement the model until tests pass (GREEN).
  • Validation and association scaffolding: Includes templates and patterns for common Rails concerns like presence/uniqueness/format validations, enums, scopes, callbacks, and association behavior.
  • Database-ready migrations: Produces migration guidance including indexes, defaults, null constraints, and multi-tenant ownership considerations.
  • Use case: When adding a new domain model (e.g., a Tenant-scoped User/Account child model) with required attributes, uniqueness rules, associations to other records, and scoped queries, use this Skill to generate the full implementation loop with tests driving correctness.

Quick Start

Use the rails-model-generator skill to create a new Rails model by describing its table, attributes, validations, associations, and scopes, then follow the TDD checklist to generate the migration and implement the model until the tests pass.

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 Rails models using a TDD workflow?

Generate Rails models using TDD by defining requirements, writing failing tests, creating migrations, and implementing validations and associations until tests pass. This workflow ensures correctness by driving model implementation directly from test expectations.

What's the best way to add database constraints and indexes for ActiveRecord migrations?

Adding database constraints and indexes for ActiveRecord migrations requires guidance on null constraints, defaults, and indexes. Multi-tenant ownership considerations must also be applied to ensure data integrity at the database level.

How do I scaffold Rails validations and associations from model requirements?

Scaffold Rails validations and associations from model requirements using templates for presence, uniqueness, and format validations. Association behavior, enums, scopes, and callbacks are implemented alongside these validation patterns.

Can I extend existing ActiveRecord models with enum-backed states and scopes?

Extending existing ActiveRecord models with enum-backed states and scopes is fully supported. The TDD workflow applies to both creating new models and adding required attributes, scoped queries, and associations to existing ones.

How do I structure fixtures and tests for multi-tenant Rails models?

Structuring fixtures and tests for multi-tenant Rails models involves producing test-first structures that account for tenant ownership constraints. Failing tests are written first to verify multi-tenant database constraints before model implementation.

Does the Rails model generation process handle callbacks and rich domain model patterns?

The Rails model generation process handles callbacks and rich domain model patterns by providing references for validation and complex domain logic. Callbacks are implemented during the model phase after migrations and failing tests are established.