Groovy Coding Practices
Application skill for Groovy style learning (from the archived awesome-guidelines style capsules). For Grails-specific conventions, combine with stack capsules in skills/*-foundation and project CodeNarc rulesets.
Core Principle
Groovy quality is idiomatic expressiveness with typed public seams, GDK and property syntax internally, explicit types on shared API.
When to Use / NOT
- Groovy scripts, Gradle plugins, Grails apps, JVM automation libraries.
- Setting up CodeNarc, npm-groovy-lint, Spock tests in CI.
NOT when:
- Pure Java/Kotlin modules, use language-specific practice skills.
- Generated AST/transform output, validate generators.
Workflow
- Syntax, semicolons, def, parens, strings (
groovy-style-syntax-idioms.md).
- Objects, POGOs, with/tap, equality (
groovy-style-objects-properties.md).
- Collections, GDK, truth, nav (
groovy-style-collections-gdk.md).
- API, public typing, assert (
groovy-style-typing-api.md).
- Verify, CodeNarc/npm-groovy-lint, compile, tests on changed sources.
Red Flags
- Semicolons on every line
def String / def constructors
- Redundant
public everywhere
each() { } with empty parens
- Manual getter/setter boilerplate on POGOs
- String
+ where GString fits
- Nested null checks vs
?.
== for reference identity
- Untyped public
def methods
- Accidental return from assignment in
def methods
- Java
.class literals where unnecessary
- Obsolete
Vector/Hashtable
- Blanket
catch (any) without justification
Verification
- CodeNarc / npm-groovy-lint (project ruleset)
./gradlew compileGroovy or project build
- Spock/JUnit tests on changed modules
- Capsule checklist on public method signatures
References
awesome-guidelines/references/groovy-style-learning-note.md
awesome-guidelines/references/groovy-style-syntax-idioms.md
awesome-guidelines/references/groovy-style-objects-properties.md
awesome-guidelines/references/groovy-style-collections-gdk.md
awesome-guidelines/references/groovy-style-typing-api.md
1---2name: groovy-coding-practices3description: Use when authoring or reviewing Groovy, idiomatic syntax (no semicolons, POGOs, GDK, GStrings), with/tap, Groovy truth and safe nav, strong public typing, and CodeNarc/npm-groovy-lint in CI.4---56# Groovy Coding Practices78Application skill for Groovy style learning (from the archived `awesome-guidelines` style capsules). For Grails-specific conventions, combine with stack capsules in `skills/*-foundation` and project CodeNarc rulesets.910## Core Principle1112Groovy quality is **idiomatic expressiveness with typed public seams**, GDK and property syntax internally, explicit types on shared API.1314## When to Use / NOT1516- Groovy scripts, Gradle plugins, Grails apps, JVM automation libraries.17- Setting up CodeNarc, npm-groovy-lint, Spock tests in CI.1819**NOT when:**2021- Pure Java/Kotlin modules, use language-specific practice skills.22- Generated AST/transform output, validate generators.2324## Workflow25261. **Syntax**, semicolons, def, parens, strings (`groovy-style-syntax-idioms.md`).272. **Objects**, POGOs, with/tap, equality (`groovy-style-objects-properties.md`).283. **Collections**, GDK, truth, nav (`groovy-style-collections-gdk.md`).294. **API**, public typing, assert (`groovy-style-typing-api.md`).305. **Verify**, CodeNarc/npm-groovy-lint, compile, tests on changed sources.3132## Red Flags3334- Semicolons on every line35- `def String` / `def` constructors36- Redundant `public` everywhere37- `each() { }` with empty parens38- Manual getter/setter boilerplate on POGOs39- String `+` where GString fits40- Nested null checks vs `?.`41- `==` for reference identity42- Untyped public `def` methods43- Accidental return from assignment in `def` methods44- Java `.class` literals where unnecessary45- Obsolete `Vector`/`Hashtable`46- Blanket `catch (any)` without justification4748## Verification4950- CodeNarc / npm-groovy-lint (project ruleset)51- `./gradlew compileGroovy` or project build52- Spock/JUnit tests on changed modules53- Capsule checklist on public method signatures545556## References5758- `awesome-guidelines/references/groovy-style-learning-note.md`59- `awesome-guidelines/references/groovy-style-syntax-idioms.md`60- `awesome-guidelines/references/groovy-style-objects-properties.md`61- `awesome-guidelines/references/groovy-style-collections-gdk.md`62- `awesome-guidelines/references/groovy-style-typing-api.md`