Skip to main content
skill CX Codex

spring-framework — Claude Code skill: Spring Boot and Java rules

A skill that gives your coding agent Spring Framework and Spring Boot conventions: layering, dependency injection, testing, REST design.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add Mindrally/skills --skill spring-framework -a claude-code
Open on GitHub

What spring-framework does

The skill turns the assistant into a Spring Boot reference. It carries instructions on splitting code into controllers, services, repositories, models and configurations, on which annotations to reach for (@SpringBootApplication, @RestController, @Service), and on handling errors with @ControllerAdvice and @ExceptionHandler.

Dependency injection and testing get their own sections. Constructor injection is preferred over field injection, @Autowired should stay rare. Tests mean JUnit 5 with MockMvc for the web layer, @SpringBootTest for integration, @DataJpaTest for repositories. There are also notes on the Spring Cache abstraction, @Async, Spring Security with BCrypt, SLF4J with Logback, Actuator and Springdoc OpenAPI.

The instructions name Java 17 or later and Spring Boot 3.x, so advice about records and pattern matching will not fit older releases. Builds are described through Maven or Gradle, configuration through application.properties or application.yml and Spring Profiles.

What it helps with

  • split a monolith into controllers, services and repositories
  • move a codebase from field injection to constructor injection
  • test the web layer with MockMvc
  • centralise exception handling in one place
  • wire Springdoc OpenAPI into existing endpoints

Example prompts for the agent

  • Create a REST controller for orders following the spring-framework skill
  • Rewrite this service to use constructor injection
  • Add a @ControllerAdvice for validation errors

How to install spring-framework

1Skills CLI (Vercel)

npx skills add Mindrally/skills --skill spring-framework -a claude-code

2Manually: put the files in place

~/.claude/skills/spring-framework/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/spring-framework/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about spring-framework

How do I install spring-framework in Claude?

Run npx skills add Mindrally/skills --skill spring-framework -a claude-code. The skill then lives at ~/.claude/skills/spring-framework/SKILL.md.

What does spring-framework do?

It gives the agent Spring Boot conventions: naming, application structure, dependency injection, testing, security and API documentation.

Which Java and Spring Boot versions does it target?

The skill assumes Java 17 or later and Spring Boot 3.x. Guidance on records and pattern matching does not apply to older versions.

Source text

SKILL.md · Apache-2.0
---
name: spring-framework
description: Expert guidance for Spring Framework and Spring Boot development with Java best practices, dependency injection, and RESTful API design
metadata:
  maintainer: Mindrally
  source: https://github.com/Mindrally/skills
---

# Spring Framework

You are an expert in Java programming, Spring Boot, Spring Framework, Maven, JUnit, and related Java technologies.

## Code Style and Structure

- Write clean, efficient, and well-documented Java code with accurate Spring Boot examples
- Follow camelCase for methods and variables, PascalCase for classes
- Structure applications with clear separation: controllers, services, repositories, models, and configurations

## Spring Boot Specifics

- Utilize Spring Boot starters for quick project setup
- Implement proper use of annotations (@SpringBootApplication, @RestController, @Service)
- Leverage Spring Boot's auto-configuration capabilities
- Handle exceptions gracefully via @ControllerAdvice and @ExceptionHandler

## Naming Conventions

- Use PascalCase for class names (e.g., UserController, OrderService)
- Use camelCase for method and variable names (e.g., findUserById, isOrderValid)
- Use ALL_CAPS for constants (e.g., MAX_RETRY_ATTEMPTS, DEFAULT_PAGE_SIZE)

## Java and Spring Boot Usage

- Use Java 17 or later features when applicable (e.g., records, sealed classes, pattern matching)
- Leverage Spring Boot 3.x features and best practices
- Use Spring Data JPA for database operations
- Implement Bean Validation using Jakarta Validation annotations

## Dependency Injection

- Prefer constructor injection over field injection for better testability
- Use @Autowired sparingly; prefer explicit constructor injection
- Leverage Spring's IoC container effectively

## Testing

- Write unit tests using JUnit 5 and Spring Boot Test
- Use MockMvc for testing web layer components
- Implement integration tests with @SpringBootTest
- Use @DataJpaTest for repository layer testing

## Performance and Scalability

- Implement Spring Cache abstraction for caching strategies
- Use @Async for non-blocking operations when appropriate
- Optimize database queries using proper indexing and fetch strategies

## Security

- Implement Spring Security for authentication and authorization
- Use BCrypt for password encoding
- Configure CORS settings as needed for web applications

## Logging and Monitoring

- Use SLF4J with Logback for logging
- Implement appropriate log levels (ERROR, WARN, INFO, DEBUG)
- Leverage Spring Boot Actuator for application monitoring and metrics

## API Documentation

- Use Springdoc OpenAPI for API documentation
- Provide detailed OpenAPI annotations for endpoints and operations

## Configuration Management

- Use application.properties or application.yml for configuration
- Implement environment-specific configurations using Spring Profiles
- Use @ConfigurationProperties for type-safe configuration binding

## Build and Deployment

- Use Maven or Gradle for dependency management and builds
- Implement Docker containerization for deployment
- Configure CI/CD pipelines for automated testing and deployment

## General Best Practices

- Follow RESTful API design principles
- Consider microservices architecture where applicable
- Adhere to SOLID principles for maintainable code
- Maintain high cohesion and low coupling in component design

© Mindrally · Apache-2.0 · Mindrally/skills

Similar skills

Everything for Backend and APIs →

From the same set168

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor