form-agent

Build and validate multi-model Rails forms with nested attributes.

Updated Nov 1, 2025
One-click install
npx skills add https://github.com/nschneble/rails-superstack --skill form-agent-nschneble
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: form-agent
Source: https://github.com/nschneble/rails-superstack/tree/main/.agents/skills/form-agent
Command: npx skills add https://github.com/nschneble/rails-superstack --skill form-agent-nschneble

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Creates form objects for complex multi-model forms with validations, type coercion, and nested attributes. Use when building search forms, wizard forms, registration forms, or when user mentions form objects or virtual models.

Core Features & Use Cases

  • Pattern-driven form objects: Encapsulates multi-model persistence in a single, testable form.
  • Nested attributes & virtual fields: Handles nested structures, virtual attributes, and cross-model validations.
  • Testing-first workflow: Encourages RSpec-based form specs and transactional persistence.
  • Rails + ActiveModel integration: Aligns with Rails conventions (app/forms, app/models, app/validators, etc.).

Quick Start

Create an EntityRegistrationForm with valid attributes and call save to persist the entity and its contact info.

Frequently Asked Questions about form-agent

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

FAQPage Schema
How do I handle multi-model Rails forms with cross-model validations and nested attributes?

Multi-model Rails forms are handled by encapsulating multiple models and nested attributes in a single ActiveModel form object. This pattern applies transactional persistence with cross-model validations to ensure complex data submits atomically.

What are Rails form objects and when should I use them for complex forms?

Rails form objects are ActiveModel-based classes that encapsulate multi-model persistence in a single, testable form. Use them for complex forms like registrations, wizard flows, or configurable entities where attributes live across multiple models requiring cross-model validations.

Do I need Rails 8.1 and Ruby 3.3 to use ActiveModel form objects with nested attributes?

Yes, building these form objects requires Ruby 3.3+ and Rails 8.1+. This environment ensures proper ActiveModel integration and transactional persistence support for handling nested structures and virtual attributes.

What's the best way to test Rails form objects with cross-model validations?

The best way to test Rails form objects is through a testing-first workflow using RSpec-based form specs. This validates transactional persistence and cross-model validations before integrating the form object into your application.

Can I use form objects for wizard flows and search forms in Rails?

Yes, you can use form objects for wizard flows, search forms, and registration forms in Rails. They handle virtual fields, nested structures, and type coercion while aligning with Rails conventions like app/forms and app/validators.