kotlin-spring-proxy-compatibility
Skill18 starsChanged 9 months agoMITView on GitHub
Diagnose and prevent Kotlin plus Spring proxy failures around `@Transactional`, `@Cacheable`, `@Async`, method security, retry, configuration proxies, and JPA entity requirements. Use when AOP annotations appear to do nothing, transactional or cache behavior is inconsistent, compiler plugins may be missing, self-invocation is suspected, or Kotlin final-by-default semantics may break Spring behavior.
1 other project uses a version of this, 1 of them edited.
Adopted by
Most recently taken up by
- JetBrains/skillsedited, first seen Apr 28, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 1
- JetBrains/skills★ 36096% same
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository24 other files it gives its agents.
- ci-cd-containerization-advisorSkill
- configuration-properties-profiles-kotlin-safeSkill
- dependency-conflict-resolverSkill
- domain-decomposition-api-design-advisorSkill
- error-model-validation-architectSkill
- gradle-kotlin-dsl-doctorSkill
- integration-resilience-engineerSkill
- jackson-kotlin-serialization-specialistSkill
- java-kotlin-migration-assistantSkill
- jpa-spring-data-kotlin-mapperSkill
- kotlin-idiomatic-refactorer-spring-awareSkill
- observability-integratorSkill
- performance-concurrency-advisorSkill
- production-incident-responderSkill
- project-context-ingestionSkill
- schema-migration-plannerSkill
- spring-context-di-reasoningSkill
- spring-kotlin-code-reviewSkill
- spring-mvc-webflux-api-builderSkill
- spring-security-configurator-auditorSkill
- stacktrace-log-triageSkill
- test-suite-builderSkill
- transaction-consistency-designerSkill
- upgrade-breaking-change-navigatorSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
24 rules. About 0 are common, 17 are distinctive, and 7 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈17
Distinctive · estimate
This author's own choices. Worth a look.
7
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 25
Verify whether a proxy should exist at all.
- Distinctive: line 26
Verify whether the call crosses the proxy boundary.
- Distinctive: line 27
Verify whether the class or method is proxyable.
- Distinctive: line 28
Verify whether the annotation is placed on the method Spring actually intercepts.
- Distinctive: line 29
Verify whether build-time plugins opened the relevant classes.
- Distinctive: line 30
Verify whether the bug is actually transactional semantics, not proxy creation.
- Distinctive: line 34
Check for self-invocation.
- Distinctive: line 35
Check whether the target class or method is effectively final for the chosen proxy strategy.
- Distinctive: line 36
Check whether a JDK proxy is used.
- Distinctive: line 37
Check whether the annotated method is private or otherwise non-interceptable.
- Very specific: line 38
Check whether @Configuration classes, @Service classes, and JPA entities rely on the correct Kotlin compiler plugins.
- Distinctive: line 39
Check whether the symptom comes from coroutines or async boundaries rather than proxy absence.
- Distinctive: line 43
Prefer fixes in this order:
- Very specific: line 49
Only as a last resort, inject the proxied bean into itself or use AopContext, and explain why this is a compromise.
- Very specific: line 63
If the symptom is "annotation present but behavior absent," first ask whether the relevant call crossed a bean boundary.
- Distinctive: line 64
If the team wants a local helper method to stay private, do not force proxy semantics onto it.
- Very specific: line 70
Prefer compiler plugins over manually marking entire class hierarchies as open.
- Very specific: line 71
Do not generate JPA entities as data class.
- Distinctive: line 72
Do not assume annotations on private methods will work because they compile.
- Distinctive: line 74
If migrating Java to Kotlin, re-check every proxy-reliant class after translation.
- Very specific: line 88
Do not suggest making every class open manually without first checking compiler plugins.
- Distinctive: line 89
Do not confuse proxy absence with wrong propagation, wrong cache key, or other business logic issues.
- Very specific: line 90
Do not recommend data class entities or blanket allOpen for unrelated code.
- Distinctive: line 91
Do not leave self-invocation unexplained.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Kotlin Spring Proxy Compatibility
Source mapping: Tier 1 critical skill derived from Kotlin_Spring_Developer_Pipeline.md (SK-03).
Mission
Explain exactly why Spring interception does or does not happen for Kotlin code, then propose the safest fix. Focus on runtime behavior, not on code that merely looks annotated.
Read These Inputs
- The class and method carrying
@Transactional,@Cacheable,@Async,@Retryable, security annotations, or other proxy-triggering annotations. - The call site. Determine whether the method is called through another bean or through
this. - Build files. Verify
kotlin("plugin.spring"),kotlin("plugin.jpa"), or any customallOpenandnoArgconfiguration. - Whether the bean is proxied through an interface or through CGLIB class proxies.
- For persistence problems, read the entity class shape and JPA plugin setup.
Diagnose In This Order
- Verify whether a proxy should exist at all.
- Verify whether the call crosses the proxy boundary.
- Verify whether the class or method is proxyable.
- Verify whether the annotation is placed on the method Spring actually intercepts.
- Verify whether build-time plugins opened the relevant classes.
- Verify whether the bug is actually transactional semantics, not proxy creation.
Core Checks
- Check for self-invocation. A method calling another annotated method in the same class bypasses the proxy.
- Check whether the target class or method is effectively final for the chosen proxy strategy.
- Check whether a JDK proxy is used. If so, interception works through interface methods, not arbitrary class methods.
- Check whether the annotated method is private or otherwise non-interceptable.
- Check whether
@Configurationclasses,@Serviceclasses, and JPA entities rely on the correct Kotlin compiler plugins. - Check whether the symptom comes from coroutines or async boundaries rather than proxy absence.
Preferred Fixes
Prefer fixes in this order:
- Enable the correct Kotlin compiler plugin in Gradle.
- Move the intercepted method behind a real Spring bean boundary.
- Adjust interface or proxy strategy only if the current strategy is incompatible.
- Refactor responsibilities so that external callers cross the proxy naturally.
- Only as a last resort, inject the proxied bean into itself or use
AopContext, and explain why this is a compromise.
Advanced Interception Traps
@PostConstruct, constructors, and init blocks run on the target object before ordinary proxy interception can help. Advice that depends on transactions, caching, security, or retries will not rescue initialization logic.@Asyncchanges threads. Transaction, security, MDC, and request context do not automatically flow the same way they do in synchronous code.@Retryable,@Transactional,@Cacheable, and method security can stack. Advisor ordering changes behavior, especially when retries and transactions combine.@TransactionalEventListenerdepends on transaction phase. If no transaction exists, the listener may never fire or may fire immediately depending on fallback behavior.@Configuration(proxyBeanMethods = false)disables configuration-class method interception. Treat this as a performance and semantics choice, not a cosmetic flag.- Interface default methods, non-public methods, and methods reached only from internal helper paths may compile cleanly while still missing interception at runtime.
- In coroutine and reactive flows, transaction and security propagation depend on the underlying stack and context propagation model. A proxy can exist while context still does not flow the way the author expects.
Expert Heuristics
- If the symptom is "annotation present but behavior absent," first ask whether the relevant call crossed a bean boundary. This catches more real bugs than checking
openalone. - If the team wants a local helper method to stay private, do not force proxy semantics onto it. Move the transactional or cache boundary outward instead.
- For caching and security, verify key computation and authorization point as separate concerns from proxy presence.
- For JPA entities and configuration classes, distinguish opening for framework mechanics from opening for general extensibility. The former is usually acceptable; the latter may not be.
Kotlin-Specific Rules
- Prefer compiler plugins over manually marking entire class hierarchies as
open. - Do not generate JPA entities as
data class. - Do not assume annotations on private methods will work because they compile.
- Explain the difference between Kotlin source semantics and Spring runtime semantics.
- If migrating Java to Kotlin, re-check every proxy-reliant class after translation.
Output Contract
Return these sections:
Broken mechanism: what Spring feature is expected to intercept the call.Why it failed: one concrete runtime reason with code evidence.Minimal fix: the smallest change that restores interception.Safer design option: only if the current structure invites future proxy bugs.Verification: how to prove the annotation now takes effect.
Guardrails
- Do not suggest making every class
openmanually without first checking compiler plugins. - Do not confuse proxy absence with wrong propagation, wrong cache key, or other business logic issues.
- Do not recommend
data classentities or blanketallOpenfor unrelated code. - Do not leave self-invocation unexplained. It is one of the most common hidden causes.
Quality Bar
A good run of this skill makes the proxy model explicit and the fix easy to verify.
A bad run tells the user to add annotations or open keywords without proving why interception failed.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

