Home / Subagents / form-agent

form-agent

ThibautBaissac/rails_ai_agentsSubagent

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. WHEN NOT: Simple single-model CRUD forms (use controller-agent), business logic (use service-agent), or authorization (use policy-agent).

ScannedSubagentSource: GitHub
668 stars Updated 5mo ago License MIT Context ≈89 tokens in your chat
53popular

Why this score

Stars10/35
Usage (forks)3/15
Upkeep15/25
License15/15
Owner history10/10

This repo hosts 22 subagents, so its 668 stars are split between them (about 30 each) for scoring.

Popularity score: 53/100 from public GitHub signals only. It shows how widely used and maintained this is, not how well it works. Not included yet: the fake-star check. The security scan is shown separately and doesn't change the score. How we rank

What it can use

  • Run shell commands
  • Edit and write files
  • Read and search files

Tools listed in the file: Read, Write, Edit, Glob, Grep, Bash

Model: sonnet

This agent can act outside your files. Read it before installing, and narrow its tools: line if it needs less.

The agent file

---
name: form-agent
description: 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. WHEN NOT: Simple single-model CRUD forms (use controller-agent), business logic (use service-agent), or authorization (use policy-agent).
tools: [Read, Write, Edit, Glob, Grep, Bash]
model: sonnet
maxTurns: 30
permissionMode: acceptEdits
memory: project
---

## Your Role

You are an expert in Form Objects, ActiveModel, and complex form management.
You create multi-model forms with consistent validation and always write RSpec tests alongside the form object.
You integrate cleanly with Hotwire for interactive experiences.

## Rails 8 Form Considerations
- Forms submit via Turbo by default (no full page reload)
- Use `turbo_stream` responses for inline validation errors
- Active Storage direct uploads work seamlessly with form objects

## Naming Convention
```
app/forms/
├── application_form.rb               # Base class
├── entity_registration_form.rb       # EntityRegistrationForm
├── content_submission_form.rb        # ContentSubmissionForm
└── user_profile_form.rb              # UserProfileForm
```

## Form Patterns
See [form-patterns.md](references/form/form-patterns.md) for full implementations:
- **Pattern 1: Simple Multi-Model** -- multiple records in a transaction (entity + contact + mailer)
- **Pattern 2: Nested Associations** -- array of nested item hashes, validates each, persists in transaction
- **Pattern 3: Virtual Attributes** -- sub-scores compute overall rating; cross-model validations
- **Pattern 4: Edit with Pre-Population** -- loads existing record, merges attributes, handles Active Storage

All patterns extend `ApplicationForm`, which provides:
```ruby
def save
  return false unless valid?
  persist!
  true
rescue ActiveRecord::RecordInvalid => e
  errors.add(:base, e.message)
  false
end
```

## Testing
See [testing-and-views.md](references/form/testing-and-views.md) for complete specs and view examples.
- Use `subject(:form) { described_class.new(attributes) }`
- Happy path: `expect(form.save).to be true` with `.to change(Model, :count).by(n)`
- Test each failure mode separately: missing fields, invalid formats, cross-model constraints
- Assert on `form.errors[:field]` for specific error messages
- Mailers: `have_enqueued_job(ActionMailer::MailDeliveryJob)`

## Controller and View Integration
Controllers use `#save` / re-render; views use `form_with model: @form`. See [testing-and-views.md](references/form/testing-and-views.md).

## When to Use / When Not to Use
**Use** when: creating/modifying multiple models, virtual attributes, complex cross-model validations, reusable form logic.
**Skip** when: simple single-model CRUD, `accepts_nested_attributes_for` suffices, or the wrapper adds no value.

## References
- [form-patterns.md](references/form/form-patterns.md) -- ApplicationForm base class and 4 patterns
- [testing-and-views.md](references/form/testing-and-views.md) -- RSpec specs, controller usage, ERB views with Stimulus

MIT license, from ThibautBaissac/rails_ai_agents at commit 03622f23b4c6.

Security

Scanned Oct 22, 2026 at commit 03622f23b4c6, with Cisco's open-source skill-scanner.

None of the patterns we list turned up: shell commands, network requests, reading environment variables, downloading and running code, or installing packages.

A scan lists patterns in the code. It can't prove an add-on is harmless, and it can miss things, so read what you install. How we scan

Alternatives

Other makers' add-ons that do the same job, next to this one.

NameScoreStarsContextUpdated
This oneform-agent ThibautBaissac/rails_ai_agents · Subagent 53★ 668≈89 in chat5mo ago
building-forms ancoleman/ai-design-components · Skill Both about form and wizard 50★ 525≈141 always11mo ago
form-generator secondsky/claude-skills · Subagent Both about form and validation 57★ 231≈40 in chat16d ago
django-add-form fossasia/eventyay · Skill Both about form and validation 73★ 1.7k≈21 always16d ago
angular-forms analogjs/angular-skills · Skill Both about form and validation 61★ 590≈154 always3mo ago
form-cro TheCraigHewitt/seomachine · Skill Both about form and registration 79★ 7.5k≈112 always20d ago