Claude Skills for Java and Spring Boot

How to encode Spring Boot conventions, testing expectations and review steps as reusable Claude skills, with fenbs keeping project decisions and proven instructions shared across your coding assistants.

Updated 5 min read

Claude skills for Java and Spring Boot encode your project's coding conventions, testing expectations and review steps into reusable instructions. Rather than explaining the project standard in each session, you activate a skill and Claude applies the agreed approach to the code you share. Tools like fenbs keep the proven skill instructions alongside the project decisions that informed them, so every coding assistant on the team works from the same standard.

Spring Boot projects accumulate conventions over time: which annotations are preferred, how services are structured, how tests are organized, which beans are expected in which context. A new developer, or a new AI session, that does not know those conventions produces code that technically compiles but creates inconsistency and review friction. A skill captures those conventions so Claude applies them from the first line of code.

What to put in a Spring Boot coding skill

Start with the decisions your team makes most often in code review. If the same comments come up repeatedly -- "use constructor injection, not field injection," "add a unit test for this service method," "use the existing UserRepository rather than creating a new one" -- those belong in a skill. The skill turns recurring review feedback into a front-loaded check rather than a catch-after-the-fact.

Add the Spring Boot version and any project-specific starter dependencies to the skill context. Advice that is correct for Spring Boot 3 may differ from Spring Boot 2. Specifying the version prevents Claude from applying recommendations that do not apply to your project. The Spring Boot documentation (opens in a new tab) is the primary source for version-specific behavior.

See claude skills examples for patterns from other development contexts. For how to store and share skills across a team, see claude skills files. For project-level decision tracking alongside the skill library, claude skills for project management covers the broader approach.

Skill 1: Spring Boot code generation review

Use this skill before or after generating a new service, controller or repository. It checks the generated code against your project's conventions before it goes into the codebase. Add your project-specific conventions to the relevant check.

Spring Boot code generation review skill
Review the Spring Boot code I share below against our project conventions.

Check:
1. Injection: whether constructor injection is used throughout, not field injection with @Autowired.
2. Service layer: whether business logic lives in @Service classes, not in @RestController methods.
3. Exception handling: whether checked exceptions are handled or declared, and whether custom exceptions extend the right base class for our project.
4. Transactional boundaries: whether @Transactional is applied at the service layer, not in repositories or controllers.
5. Naming: whether class, method and variable names follow Java conventions and are consistent with the rest of the project.
6. Test coverage: whether the service methods have corresponding unit tests in the test package.

For each issue, give the class name, the line or method, and the correction needed.

Paste the generated Java class or classes after activating the skill. For large classes, focus one review on structure and conventions and a separate pass on exception handling and transaction boundaries.

Skill 2: reviewing a REST endpoint

Use this skill when adding or modifying a REST endpoint in a Spring Boot controller. It checks request mapping, response structure, validation and error handling.

Spring Boot REST endpoint review skill
Review the Spring Boot REST endpoint I share below.

Check:
1. Request mapping: whether the HTTP method, path and path variables are correct and follow the project's URL convention.
2. Input validation: whether @Valid or @Validated is used for request bodies, and whether constraint annotations are present on the DTO fields.
3. Response structure: whether the method returns the expected HTTP status codes for success and error cases, using ResponseEntity where appropriate.
4. Error handling: whether exceptions from the service layer are caught or delegated to a @ControllerAdvice handler.
5. Security: whether the endpoint has the expected @PreAuthorize or security configuration, consistent with similar endpoints in the project.

For each issue, name the method, describe the problem, and say what to change.

Include the controller class and the relevant DTO when you paste the code. If your project uses a specific security configuration, add a note about the expected authorization pattern so the skill check covers it.

Skill 3: writing a JUnit test for a service

Use this skill to generate or review a JUnit test for a Spring Boot service class. The skill enforces the project's testing conventions: mocking strategy, naming pattern and assertion style.

Spring Boot service unit test skill
I will share a Spring Boot @Service class. Write a JUnit 5 unit test for it, or review an existing test I share.

For the test:
1. Use Mockito to mock all dependencies injected through the constructor.
2. Name each test method: should_[expectedBehavior]_when_[condition].
3. Test the happy path and at least one error case for each public method.
4. Assert specific return values and verify that the relevant repository or dependent service methods were called.
5. Do not use @SpringBootTest or load a full application context for unit tests. Use @ExtendWith(MockitoExtension.class).

If reviewing an existing test, flag any test that does not follow these conventions and explain what to change.

Paste the service class and any existing test class. If your project uses a different testing library or a different naming convention, update the skill to match before saving the approved version.

How fenbs helps

Share Java conventions and decisions across the team in fenbs

Store the approved skill text in fenbs Skills and prompts. Record the team's Java and Spring Boot decisions in Decisions and rules: why constructor injection is required, which base exception classes to use, the agreed URL convention. Every coding assistant connected to fenbs reads these decisions before a session. When a convention changes -- for example, when you upgrade from Spring Boot 2 to 3 -- update the skill and record the migration decision so the reason is part of the record.

Create a free account

Free for one person · No credit card · Works with Claude, ChatGPT, Cursor and more

How to do this with fenbs

Pair the coding skills with a project record that captures the active decisions so new team members and AI assistants start from the same baseline.

  1. Create a free account and add a project for the Spring Boot application.
  2. Add the active conventions and architectural decisions to Decisions and rules: injection style, transaction strategy, test naming, URL patterns.
  3. Save the review skills in fenbs Skills and prompts. Name each one clearly: "Spring Boot code review," "REST endpoint review," "Service unit test."
  4. Connect Claude Code to fenbs over MCP from /integrations. At the start of each coding session, the assistant reads the project decisions and skill instructions.
  5. After a code review surfaces a recurring problem, update the relevant skill to include the check and add a lesson in Lessons learned.

When to update these skills

Update a skill when a code review finds an issue the skill should have caught but did not, or when the project adopts a new convention. A Spring Boot major version upgrade is a good trigger to review all three skills: check the Spring Boot migration guide and update any check that no longer applies or needs different advice. Keep a note with the version the skill was last reviewed against, so you know when it is due for an update. See claude projects vs skills vs artifacts for help deciding when a skill versus an artifact versus a project file is the right format for your instruction.

Skills for Java and Spring Boot also help when bringing a new developer onto the project. A developer reviewing their first pull request with the project's skill active learns the coding standards in the same session where they learn the codebase. That reduces the gap between what the project requires and what a fresh assistant or new contributor produces, and shortens the time before their contributions fit the established patterns.

Questions people ask.

Do these skills work with Kotlin and Spring Boot as well?

The structure works for Kotlin, but you will need to update the Java-specific details: constructor injection syntax differs, Kotlin data classes replace Java DTOs in many cases, and the test examples use Kotlin idioms. Create a Kotlin-specific version of each skill rather than adapting the Java version at runtime.

How do I handle project-specific beans and configurations in a skill?

Add a brief description of the project's key beans and configuration classes to the skill context. For example: "This project uses a custom SecurityConfig class; all new endpoints must be explicitly permitted or secured in that class." That context gives Claude enough information to check the relevant convention.

Can I use these skills in both Claude and Cursor?

Yes. Save the approved skill text in fenbs Skills and prompts. In Cursor, use the text as a cursor rule or custom instruction. In Claude Code, save it as a command file. In Claude.ai, add it to a Project. The content is the same; the storage location differs by app.

Should the skill include the Spring Boot version?

Yes. Include the Spring Boot version and any major libraries your project uses, such as Spring Security, Spring Data JPA and the JDK version. This helps Claude apply the correct behavior for your setup rather than a generic recommendation.

More in Prompts and skills for AI work

All Prompts and skills for AI work articles

Start with one thing.

Free for one person · No credit card · Works with Claude, ChatGPT, Cursor and more

There is nothing to set up first. Write one line and you’ve started.