At RubyEvents.org, we generate a lot of YAML. Contributors need an easy, idiomatic way to generate event files to the latest standards in an unfamiliar codebase. AI needs to generate files from unstructured data without drifting. These feel like different problems, but custom Rails generators can solve both.
Rails generators power rails generate — a built-in tool for creating and modifying files from the command line. Custom generators feel natural for anyone familiar with Rails and allow you to extend Rails' conventions with your own.
This will be a deep dive into how to build a custom generator — templates, mutating files, testing, and everything we learned the hard way at RubyEvents.