Supplemental guidance for AI coding assistants (Claude Code, Codex, Cursor, Copilot, Gemini, Aider, and similar tools) contributing to Apache Groovy.
This file supplements — it does not replace — the human-facing contributor docs at the repository root: README.adoc, CONTRIBUTING.md, ARCHITECTURE.md, COMPATIBILITY.md, and GOVERNANCE.md. Those, together with the project website at https://groovy.apache.org/, remain the authoritative sources; this file just layers AI-specific guidance on top.
Apache Groovy is licensed under Apache License 2.0. Contributions must meet the ASF's Generative Tooling guidance. In particular:
Do not copy verbatim from incompatibly-licensed sources. This includes GPL / AGPL / LGPL code, proprietary code, unlicensed snippets, and Stack Overflow / blog / forum excerpts whose licensing is unclear. Reimplement from specifications, standards, or Apache-compatible sources (see the ASF 3rd Party Licensing Policy).
Every new source file needs the ASF license header. See any existing .java or .groovy file for the canonical form.
Attribute AI assistance in commits. When AI tooling assisted on a change, consider adding an Assisted-by: trailer naming the tool(s) — for example:
Assisted-by: <tool name and version>
Assisted-by: is the default and reflects the ASF‘s stance that a human contributor performs the final check on every change. Co-authored-by: is conventionally used for human co-authors. Generated-by: is reserved for special cases where AI tooling produced a change with minimal human modification. The ASF’s Generative Tooling guidance is the authoritative source — the wording above reflects the emerging consensus from the ASF AI working group, but follow the guidance page if the two diverge.
The contributor remains responsible for what they submit. Review generated output for licensing, correctness, and style before committing.
Canonical instructions live in README.adoc (see the “Building” section). The short form:
./gradlew clean dist # full build ./gradlew test # run tests ./gradlew :test --tests <TestClassName>
JDK 17+ is required. Use the Gradle wrapper (./gradlew / gradlew.bat); do not invoke a system gradle.
Follow what's already in the tree. Specifically:
.editorconfig.NOTICE / LICENSE update.For API/behaviour changes, add or update tests alongside the code change.
GROOVY-12345: short description. Project issues are tracked at https://issues.apache.org/jira/browse/GROOVY.Three project-wide rules for AI tooling. The skills under .agents/skills/ cite this section rather than restating it.
@Grab) is off by default (-Dgroovy.grape.enable=false) until a human permits it. With no human available (a batch sweep), flagged code is not run — it is set aside for review. The pre-screen is a fallible aid, never a substitute for the human reading the code; a sandboxed run (container/VM) is the escalation for a flagged or uneasy case, not a routine requirement. The operational gate lives in groovy-reproducer.Many contributors run AI tooling on metered subscriptions with monthly token caps. A recommended workflow that makes the agent re-derive a deterministic, rarely-changing operation on every run imposes a recurring token cost on exactly the volunteers the project depends on — a contributor-equity concern, not just an efficiency one.
.groovy helper that relies on a Groovy version) asserts the version as its first action and fails fast with a clear remediation message (“requires Groovy 4.0+, found X; run sdk use groovy …”), rather than breaking with a cryptic parser or runtime error deep in execution. Keep the script parser-conservative enough that the check itself still runs on the version being rejected. (A jbang header or a groovyw-style auto-version wrapper would supersede the manual check; until one exists this is the required fallback.).agents/skills/; the skill cites it and keeps the manual equivalent as the documented fallback. Methodology stays in the human-facing docs or the skill, never only in the script.Task-specific guidance lives under .agents/skills/, each in its own directory with a SKILL.md describing when to use it, the recurring failure modes for that area, and a validation checklist. Load the relevant skill before writing or modifying code in its area — the skill is more focused than this file and points into the human-facing docs above.
| Skill | Use for |
|---|---|
groovy-build | AI-tooling guardrails over the Gradle build conventions in ARCHITECTURE.md — no fabricated DSL, no hard-coded versions, regenerate verification-metadata.xml after dependency changes, exercise installed builds after repackaging changes |
groovy-fix-workflow | AI-tooling guardrails over the fix workflow in CONTRIBUTING.md — no autonomous PR opening or JIRA comments, no merges, no sibling-repo edits without committer flag, hand-back to a human |
groovy-internals | AI-tooling guardrails over the compiler/runtime architecture in ARCHITECTURE.md — no hallucinated AST shapes, verified identifiers, ClassHelper / GeneralUtils preferred, default-public-visibility trap, regression test before the fix |
groovy-jira | AI-tooling guardrails over the JIRA conventions in CONTRIBUTING.md — no autonomous comments or workflow transitions, no fabricated field values, drafts go back to a human for review |
groovy-reassess | Bulk reassessment of old JIRA issues — selection, per-issue reproduction, classification (fixed-on-master / still-fails-* / cannot-run-* / …), report and evidence-package hand-back; read-only against JIRA |
groovy-reproducer | Extracting and running a JIRA-reported reproducer — shape classification, adaptation without fabrication, bounded run, deterministic evidence (rev/JDK/command/output) and an outcome classification |
groovy-skills | Meta-skill — conventions for authoring or refactoring a SKILL.md (layout, frontmatter, section order, failure-mode framing, granularity heuristics, cross-linking, AGENTS.md table maintenance) |
groovy-tests | AI-tooling guardrails over the test conventions in CONTRIBUTING.md — no fabricated assertions, regression tests that actually fail on master before the fix, no scratch files left behind, hand-back for review |
groovy-triage | AI-tooling guardrails over the triage methodology in CONTRIBUTING.md — output is always advisory and never posts to JIRA or PR autonomously; no transitions, closures, or merges |
groovysh | AI-tooling guardrails over the groovy-groovysh subproject architecture in subprojects/groovy-groovysh/ARCHITECTURE.md — no fabricated JLine APIs, terminal tests use dumb(true).streams(...), no full-string ANSI assertions, fork-sync diffs against fork-base |
Some subprojects have their own architecture and conventions captured in a subproject-local ARCHITECTURE.md (with a thin AGENTS.md pointer alongside). Load the relevant subproject's guide when working in its directory tree.
| Subproject | Scope |
|---|---|
groovy-groovysh | Interactive REPL — vendored JLine forks, terminal-aware test infrastructure, JLine bump procedure (subproject ARCHITECTURE.md is the canonical contributor map) |