grails
Installation
SKILL.md
Grails Developer Skill
Reference: Grails Framework Documentation | Groovy Language
Framework Overview
Grails is a high-productivity web framework for the JVM based on the Groovy language. It relies heavily on "Convention over Configuration," strongly resembling Ruby on Rails, but built on top of Spring Boot and Hibernate.
Language & Style (Groovy)
- Use Groovy's dynamic typing, closures, and collection methods (
.collect(),.find(),.findAll()). - Leverage GStrings (
"Hello ${name}") instead of Java string concatenation. - Respect Groovy truth (e.g., empty strings, null, and empty collections evaluate to
false).
Architecture (MVC + Services)
- Domain Classes (
grails-app/domain): Define the data model. Grails automatically injects GORM (Grails Object Relational Mapping) methods into these classes. - Controllers (
grails-app/controllers): Handle web requests. Keep them thin. Map URLs, bind parameters, and delegate complex logic to services. - Services (
grails-app/services): This is where business logic lives. Services in Grails are transactional by default. - Views (
grails-app/views): Use GSP (Groovy Server Pages) for HTML rendering, or JSON views (JSON Views / Gson) for REST APIs.