Skip to content
Skills Library
Programming · Building & coding

dynamic-forms

/dynamic-forms

Build forms that change as they are filled in — cascading or dependent dropdowns, conditional fields and sections, option lists that depend on another field, STI type switches — with the turbo_form gem. Use when a form must update without a full page reload, when adding or changing a dynamic form, or when touching existing `turbo_fetch` routes, actions, or `turbo-form`/`turbo-fetch` Stimulus wiring.

Repository
skills ↗
Licence
MIT
Last repository change
27.10.2026

Assessment and security

95/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content30 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
1
Scripts
0
HTML comments
0
URLs in SKILL.md
2
Deprecation

No signals detected. Repository changed on 27.10.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

Build forms that change as they are filled in — cascading or dependent dropdowns, conditional fields and sections, option lists that depend on another field, STI type switches — with the turbo_form gem. Use when a form must update without a full page reload, when adding or changing a dynamic form, or when touching existing `turbo_fetch` routes, actions, or `turbo-form`/`turbo-fetch` Stimulus wiring.

Original author description

Build forms that change as they are filled in — cascading or dependent dropdowns, conditional fields and sections, option lists that depend on another field, STI type switches — with the turbo_form gem. Use when a form must update without a full page reload, when adding or changing a dynamic form, or when touching existing `turbo_fetch` routes, actions, or `turbo-form`/`turbo-fetch` Stimulus wiring.

How it works

  1. Setup
  2. Shape
  3. Existing turbofetch code
Original SKILL.md headings · 31 lines, 271 words
SKILL.md preview
---
name: dynamic-forms
description: Build forms that change as they are filled in — cascading or dependent dropdowns, conditional fields and sections, option lists that depend on another field, STI type switches — with the turbo_form gem. Use when a form must update without a full page reload, when adding or changing a dynamic form, or when touching existing `turbo_fetch` routes, actions, or `turbo-form`/`turbo-fetch` Stimulus wiring.
metadata:
  triggers: "dynamic form, dependent dropdown, cascading dropdown, conditional field, conditional section, dynamic options, update form on change, turbo_form, dynamic: true, dynamic_trigger, dynamic_action, expect_dynamic_form_request, turbo_fetch, turbo-fetch, turbo-form controller"
---

# Dynamic Forms

The [turbo_form](https://github.com/OutlawAndy/turbo_form) gem is RoleModel's mechanism for dynamic form interaction. Every new dynamic form uses it. Do not write a `turbo_fetch` route, controller action, `.turbo_stream` view, or Stimulus controller for a form that turbo_form can drive.

The gem's [README](https://github.com/OutlawAndy/turbo_form#readme) is the API documentation. Read it before writing or changing a dynamic form. This skill does not restate it.

## Setup

Check the `Gemfile` for `turbo_form`. If it is missing, add it and run `bin/rails generate turbo_form:install`, then draw the `:turbo_form` route concern on the resource:

```ruby
resources :products, concerns: :turbo_form
```

The engine defines the concern and the controller behavior. Do not define a `:turbo_form` or `:turbo_fetch` concern in `config/routes.rb`.

## Shape

```slim
= simple_form_for @product, dynamic: true do |f|
  = f.association :category, input_html: { dynamic_trigger: true }
  = f.association :subcategory, collection: @product.category&.subcategories || []
```

The trigger re-renders the page through its own `new` or `edit` action with the submitted values assigned, so `@product.category` is the category just picked and its subcategories fill the second select. The options, conventions, `dynamic_action:` for custom Turbo Stream responses, and `expect_dynamic_form_request` for system tests are all in the README.

## Existing `turbo_fetch` code

Older apps wire dynamic forms by hand: a `turbo_fetch` route concern, a `turbo_fetch` controller action, a `turbo_fetch.turbo_stream` view, a Stimulus controller registered as `turbo-form` or `turbo-fetch` (installed by `rolemodel_rails`, and unrelated to the turbo_form gem despite the name), and `expect_turbo_form_request` or `expect_turbo_fetch_request` in specs. That pattern is superseded. Do not extend it. When a change touches one of these forms, convert it to turbo_form and delete the route, action, view, and spec helper usage it no longer needs.

Versions

The database has no other skills named dynamic-forms.

Database snapshot: 13.11.2026 · package version 7898a30a2f87 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100fec-form-handling
    Use when building or reviewing substantial forms with React Hook Form, Zod schemas, typed validation, dynamic fields, controlled third-party inputs, file upload, multi-step flows, dependent validation, or form performance. Do not use for trivial 1-3 field forms without…
  • 95advanced-forms-build-forms
    Build Flutter forms on advanced_forms. Use when building or changing a form; when wiring validation, cross-field rules, server field errors, or an edit-form prefill; when a section or wizard step joins the form; when UI collects structured input without being called a form; or…
  • 90webiny-form-model
    Building forms with the FormModel system — field types, renderers, layout, validation, conditional rules, computed fields, and dynamic zones. Use this skill when the developer needs to define form fields with the builder API, choose renderers, build layouts with…
  • 100react-hook-form
    Build and modify forms that use React Hook Form or whose project conventions require it. Use when implementing controlled widgets, schema validation, fetched edit forms, conditional fields, multi-step wizards, field arrays, submission errors, or dirty-state handling. For review…
  • 100turbo-patterns
    Creates Turbo Streams, Turbo Frames, and morphing patterns for real-time UI updates. Use when adding real-time updates, partial page rendering, form submissions, or broadcasting. WHEN NOT: For Stimulus JavaScript controllers (see stimulus-patterns skill). For general view…
  • 100rails-design-system
    Ruby on Rails design system guidelines for building consistent, maintainable UI with minimal abstraction. This skill should be used when creating or refactoring Rails views, partials, components, form builders, helpers, Stimulus controllers, Turbo Frames, Turbo Streams, or…

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.