A few days ago, I published my proposition of the Claude Code template for a typical Spring Boot application in this GitHub repository. The level of interest in this repository has exceeded my highest expectations. I’ve received a lot of feedback from you, but I’m looking forward to more. Of course, the project itself is still under development. So if you’d like to provide feedback or have ideas for improving it, I encourage you to create issues, pull requests, or visit the “Discussions” panel, which I’ve enabled for this repository.

On my blog, you’ll find several other articles about Claude Code. For example, the following article explains how to run Claude Code on Ollama and use local or cloud models served by Ollama to create Java apps.

Motivation

Before we get into the details, let me explain why I created this template. In the Claude Code documentation, you’ll find a number of best practices for using it to generate code. Of course, you can simply launch Claude Code and enter any prompt that will generate something. However, if you want the generated code to meet your expectations, it’s worth following these best practices.

Most of you, therefore, when you start your journey with Claude Code, will sooner or later look for a ready-made repository template that matches the type of application you want to generate. On the other hand, creating such a template on your own can take a lot of time and require a great deal of trial and error. Communities that focus on a specific technology should keep, improve, and share their templates. This benefits everyone involved.

So, where is the best place to find inspiration for these types of templates across various technologies? Probably among people who post a lot online about a given topic. And since I post quite a bit about Spring Boot and Java, I feel it’s my duty to maintain and develop such a template. You can use this repository as inspiration to create your own, or as a ready-to-use starter repository that requires only minimal changes to the CLAUDE.md file.

Source Code

Feel free to use my source code if you’d like to try it out yourself. To do that, you must clone my sample GitHub repository. Then you should only follow my instructions. Here’s the current repository structure. But of course, the project is still under development, so it may undergo further changes.

Claude Recommendations

General

Claude works far more effectively when it has a way to check its own results – whether that’s running tests, comparing screenshots, or validating outputs against expectations. Without clearly defined success criteria, it can generate solutions that appear correct on the surface but fail in practice. In those cases, you become the sole source of feedback, meaning every flaw depends on your review and correction.

The recommended workflow by Antrophic should have four phases:

  1. Explore
  2. Plan
  3. Implement
  4. Commit

I don’t want to list all the best practices described by Antrophic here. Just take a look at this page. Basically, the main file we need to create in our repository is CLAUDE.md. I’ll admit that, when it comes to its structure, I drew heavily on the work of the folks at Antrophic, who have published information online about the contents of their CLAUDE.md files. CLAUDE.md acts as a built-in briefing that Claude loads at the beginning of every interaction. It’s the place to define things like common Bash commands, coding conventions, and team workflows. By putting this information in one file, you give Claude consistent context and guidance that it wouldn’t be able to reliably deduce just by analyzing your codebase.

CLAUDE.md in the repository

Take a look at my CLAUDE.md file. It contains a number of general instructions for a universal design, as well as a few elements specific to my application. It was important for me to enable the planning mode so I could see exactly what would be generated before Claude Code got to work.

Another key step is verifying the generated code by creating automated tests and running them. I also want the generated code to be as simple as possible, which is why I also ask Claude to review it for overengineering. Points 5 and 6 cover how to load and use skills and subagents. Skills are absolutely essential. We’ll get to them later. On the other hand, subagents can significantly increase the number of tokens used, so it’s worth considering using them.

Everything listed in the “Project General Instructions” section represents my key expectations for the generated code. Even if some of these points are addressed in one of the skills, they are important enough to me that I want to emphasize them once more. From your perspective, these might be specific technologies, such as CircleCI, which you can simply skip by removing the relevant line from CLAUDE.md.

If you don’t want to use subgents, you can rewrite Section 6 CLAUDE.md in the following way. It forces Claude Code to use spring-boot-engineer agent, which specializes in generating code for Spring Boot applications.

You can verify a list of available agents by executing the /agents command.

claude-code-spring-boot-agents

Skills

Before you enter your prompt and generate the code, you can check the list of loaded skills using the /skills command. As you can see, I defined nine skills in the .claude/skills directory.

claude-code-spring-boot-skills

Skills aim to extend Claude’s knowledge with information specific to technologies used by a given application. Each skill should have a header section inside the --- brackets. It should have the name and description tags. We can also add some additional labels inside the metadata tag. The skills in my repository are mainly related to the best practices for coding in Spring, Java, and JPA (Hibernate). Here’s a fragment of one skill from my repository.

Using Claude Code for Spring Boot

Input prompt

It’s time to test our template. After cloning the repository, navigate to its root directory and run Claude Code. Below is the prompt I used to generate a sample application for this exercise. It briefly describes what the application should do and what technologies to use. Of course, this prompt should be viewed as part of a broader whole, along with all the components I have presented so far.

Immediately after launching Claude Code, enter the prompt described above or your own prompt, as you prefer. As you can see, Claude Code starts by creating a plan and developing an implementation strategy.

claude-code-spring-boot-prompt

Below is the generated work plan. Claude Code will also provide an estimate of the number of tokens required to generate our application based on the specified requirements.

Screenshot 2026 03 23 at 23.59.00

The plan is very detailed. To summarize, here is a list of key technologies and architectural decisions, along with the criteria for success. All that’s left is to approve the plan and proceed to generate the code.

Screenshot 2026 03 23 at 23.53.33

Code generation

Claude Code has divided the project into 10 phases. You can check the current phase and see the generated outputs. Along with the standard components of the Spring Boot application, it will also generate a CircleCI pipeline, tests using Testcontainers, a Dockerfile, and Kubernetes deployment manifests.

Screenshot 2026 03 23 at 23.57.11

After a while, the application is generated. What’s important to me is a detailed description of what was done and how. Both at the end and during the planning process. Claude also created and ran all JUnit tests.

claude-code-spring-boot-results

Here’s a final project structure and a brief description of the next steps. You can also verify the total cost by running the /cost command. You can verify the generated code in the pull request related to the sonnet branch. It generated around 3700 lines of code.

claude-code-spring-boot-cost

Here’s a cost for the same prompt, but with the main built-in agent instead of the spring-boot-engineer agent.

Screenshot 2026 03 22 at 00.34.37

Conclusion

This Claude Code template for Spring Boot is primarily designed to generate high-quality code that meets your expectations. Token consumption has a lower priority here.

I’m still comparing different settings and working on optimizing the template for my app’s generation process. Generally, the Claude documentation offers plenty of recommendations on how to structure a template, but it’s hard to immediately and definitively determine the impact of a given change, for example, on generation time, the number of tokens used, and code quality together. You can also use this template as a starting point for your experiments.

Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
Leave A Reply