anantbhandarkar/make-it-right/mir-backend-jvm-micronaut
Claude Code and agent skill by anantbhandarkar/make-it-right
- community
Checking that the SKILL.md file is still in the repository.
Make It Right (Micronaut module). Micronaut 5.x / 4.x + Micronaut Data + Micronaut Security + Netty footguns. Covers: compile-time DI and AOT (bean definitions are generated at build, but resolution is still runtime, so NoSuchBeanException/NonUniqueBeanException surfaces after startup because singletons are lazy), bean scope pitfalls (@Singleton default), blocking the Netty event loop (@ExecuteOn(TaskExecutors.BLOCKING), virtual-thread backed where supported, or reactive types), Micronaut Data repository transaction scoping and self-invocation, compile-time AOP interceptor limits on final/private/new-ed instances, and Micronaut security (CORS wide open when enabled with no configurations, allowCredentials defaulting to true on 4.x and false on 5.x, @Secured object-level authorization, and the HTTP-client credential-leakage and unbounded-redirect advisories). Chains: mir-backend -> mir-backend-jvm -> this, which adds only Micronaut library mechanics. TRIGGER only when the JVM backend stack is Micronaut — building, reviewing, or debugging a Micronaut controller, service, repository, filter, HTTP client, or security rule. SKIP for Spring Boot (mir-backend-jvm-spring), Quarkus (mir-backend-jvm-quarkus), standalone Vert.x, Helidon, Ktor, every other non-Micronaut JVM framework, and every non-JVM runtime.
Install
npx vskill@latest install anantbhandarkar/make-it-right/mir-backend-jvm-micronautSKILL.md
The same SKILL.md was published earlier as anantbhandarkar/make-it-right/mir-backend-jvm-micronaut.
/mir-backend-jvm-micronaut · Make It Right (Micronaut)
Bottom tier of the chain: mir-backend (generic gates) → mir-backend-jvm (JVM runtime model) → this (Micronaut library mechanics). Run the gates first; load the JVM runtime tier for threading, GC, and container-heap concerns; reach for this at Gate 5 (design mechanics), Gate 6 (implementation), and Gate 7 review. Runtime-level concerns (virtual-thread pinning, pool sizing, GC tuning, `-XX:MaxRAMPercentage`, ThreadLocal hygiene, JMM visibility) live in `mir-backend-jvm` — not here.
Stack assumed: Micronaut 5.x (or 4.x — the differences are called out) · Micronaut Data JPA (Hibernate) or Micronaut Data JDBC · Micronaut Security · Micronaut HTTP Server (Netty) · GraalVM for native image.
Version status, verified 13 Aug 2026:
| Line | Status | What changes | |
|---|---|---|---|
| Micronaut 5.x | GA 20 May 2026 (5.0.0). Latest verified release 5.1.0, 27 Jul 2026 | Java 25 baseline — virtual threads, structured concurrency, scoped values and pattern matching are all available unconditionally. Groovy 5 and Kotlin 2.3 baselines, GraalVM 25.0.3. Adds a ScopedValue-based context-propagation implementation alongside the thread-local one | |
| Micronaut 4.x | Still maintained (4.10.x line) | Keeps Java 17 and 21 support and runs on 25. Stay here if you cannot move to a Java 25 baseline |
A Micronaut 5 answer written from Micronaut 4 memory will usually still compile; the risk is the opposite direction — 5-only APIs suggested for a 4.x project, and a Java 25 baseline assumed for a service still built on 17.
The Micronaut footguns AI walks into most
1. Compile-time DI — missing bean is a compile error, not a runtime NPE
Micronaut generates bean definitions and injection metadata at compile time via annotation processors — no runtime classpath scanning, no reflection for injection. What that does not buy you:
- Candidate resolution still happens at runtime. A missing or ambiguous dependency raises
NoSuchBeanException,NonUniqueBeanException, orDependencyInjectionExceptionwhen the dependent bean is created — and because singletons are lazy, that can be well after startup rather than at build time. Do not tell a reviewer "if it compiled, the graph is wired." Force it with eager initialization or a context-startup test. - Classes used only via reflection (Jackson mixins, custom TypeConverter, serialization targets for native image) are not automatically discovered. Register them explicitly.
`@Factory` for third-party types: if you need to inject a type you can't annotate, use @Factory:
2. @Singleton default scope: never store per-request state
Micronaut beans are not implicitly singletons — a class needs a bean-defining annotation, and @Bean/@Prototype gives prototype scope. But almost every service you or an AI writes carries @Singleton, which is one lazily created instance shared by all threads. That is the same trap as Spring's singleton scope, and Micronaut's lack of a default @RequestScope proxy makes it easier to miss.
Available scopes: @Singleton, @Prototype (new instance per injection point), @RequestScope (per HTTP request), @ThreadLocal (per thread — correct for pooled-thread use). Default to @Singleton for stateless services; use @Prototype for stateful helpers.
@ThreadLocal scope and thread-local context propagation both behave differently once every request has its own virtual thread — see mir-backend-jvm §2 and §7. Micronaut 5 offers a ScopedValue-based context-propagation implementation as an alternative to the thread-local one.
3. Blocking the Netty event loop: @ExecuteOn is mandatory for blocking work
Micronaut's HTTP server runs on Netty's event loop. Like Quarkus reactive, blocking the event loop thread degrades the entire server — one blocking call can stall all concurrent requests on that loop.
`TaskExecutors.BLOCKING` is the name to use. Micronaut detects virtual-thread support and backs the blocking executor with virtual threads when the JVM provides them, falling back to the platform-thread I/O pool otherwise. On Micronaut 5 (Java 25 baseline) that means virtual threads always. TaskExecutors.IO still exists and still names the pooled executor — code that hard-codes it opts out of virtual threads without saying so.
Two consequences of the virtual-thread path:
- The pool no longer bounds concurrency. Size the datasource pool and any downstream limit explicitly; that is now the only ceiling.
micronaut.executors.io.type=fixedwithnThreadsstill applies to the platform-thread pool if you deliberately choose it. @ExecuteOnis required on filters that block too (@ServerFilter/@RequestFiltermethods), not just controllers. A blocking filter stalls the event loop exactly like a blocking controller.
For Kotlin coroutines: mark the controller function suspend; Micronaut handles the dispatch. Never call runBlocking on the event loop.
4. Micronaut Data transactions: @Transactional and repository scope
Micronaut Data uses compile-time-generated repositories (no runtime proxies). @Transactional is applied via a compile-time AOP interceptor — which means self-invocation bypasses the interceptor, same as Spring.
Micronaut Data repositories operate in the transaction of their caller. If you call a repository from outside a @Transactional boundary, each repository call gets its own auto-committed mini-transaction. This is correct for reads but breaks for multi-step writes.
JDBC repositories: Micronaut Data JDBC uses a simpler mapping layer than JPA — no lazy loading, no session, no LazyInitializationException. N+1 is still possible via explicit nested queries in a loop; use @Join on repository finder methods to specify eager joins.
5. Compile-time AOP interceptors: what they can and cannot intercept
Micronaut AOP is compile-time — the framework generates interceptor wrappers at build time. This is fast and native-image-friendly but has hard constraints:
- Only beans managed by Micronaut's DI container can be intercepted. Objects created with
newbypass AOP.@Transactional,@Cacheable,@Retryableall silently do nothing on anew-ed instance. - `final` methods cannot be intercepted (they can't be overridden in the generated subclass).
- `private` methods cannot be intercepted for the same reason.
6. GraalVM native image with Micronaut: what Micronaut handles vs. what you must declare
Micronaut generates GraalVM metadata (reflect-config.json, resource-config.json, proxy-config.json) automatically for its own classes and for beans it discovers at compile time. The gaps:
- Dynamic class loading or reflection outside Micronaut's DI — third-party libraries, JDBC drivers, Jackson polymorphic subtypes — must still be registered.
- Resources not on the classpath path that are loaded with
getClass().getResourceAsStream(). - Runtime-initialized classes with side effects in static initializers (same trap as Quarkus — see runtime-map JVM notes).
Run native-image-agent with your test suite before your first native build to auto-generate the bulk of the config:
Then review and trim the generated config (it over-reports). Commit it alongside the source.
7. Micronaut Security: token validation and route-level authorization
Micronaut Security's @Secured or security rules in SecurityRule beans control access. The same IDOR trap applies as in Spring: role/authentication checks do not confirm object ownership.
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/mir-backend-jvm-micronaut/SKILL.md
Popularity
- Repository stars
- 15
- 7-day trend score
- 14
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/anantbhandarkar/make-it-right/mir-backend-jvm-micronaut)