r/JavaProgramming • u/fykup • 3d ago
Follow-up: I turned lessons from rewriting Spring PetClinic into reusable AI Agent Skills
A few days ago, I shared my experiment rewriting Spring PetClinic without Spring Boot or Hibernate.
That rewrite was considerably more involved than simply replacing framework APIs. I had to work through persistence relationships, transaction boundaries, validation, HTTP behavior, and other details that Spring Boot and Hibernate normally handle.
The interesting follow-up is what I did with those lessons.
I used the experience to create two experimental Agent Skills that can help Codex and other coding agents approach similar Java migrations:
- JPA Migration Skill: Helps migrate Spring Data JPA/Hibernate persistence to explicit SQL using CoilBase/Jdbi, while optionally keeping Spring Boot.
- Spring Boot Migration Skill: Helps migrate application infrastructure to CoilBase with Avaje Jex, including routing, configuration, wiring, and lifecycle decisions.
These aren't one-click converters. They guide the agent through identifying existing behavior, making architectural decisions explicit, and verifying the resulting application.
But do the skills actually work?
I tested them separately against a fresh, pinned Spring PetClinic revision using Codex.
In the first trial, Codex replaced owner, pet, and visit persistence while keeping Spring Boot. All 17 packaged H2 checks passed, including HTTP workflows, committed database state, rollback, concurrency, and restart.
Independent code review still found two bugs:
- An UPDATE affecting zero rows incorrectly reported success.
- A repository accepted sorting parameters but silently ignored them.
Both were fixed with regression tests.
I also tested the skills sequentially: first migrating all three JPA repository groups, then replacing Spring Boot/MVC with Avaje Jex while reusing the SQL repositories. That application passed 28 Maven tests and the tested H2 workflows.
These were H2-only experiments, and I haven't run a controlled comparison without the skills, so I can't quantify their effectiveness.
The goal isn't to automate every architectural decision. It's to make migration knowledge reusable so an agent can handle more of the straightforward work while highlighting what needs careful review.
Full article, with links to both skills and the public experiment:
https://pvrlabs.xyz/articles/ai-agent-jpa-migration-code-review.html
I'm also the author of CoilBase, the lightweight Java foundation used in these experiments.
Has anyone tried turning lessons from a difficult Java migration into reusable instructions for coding agents? I'm curious how well that knowledge transfers to other applications.