Cursor-rules-java provides system prompts for Java that assist software engineers in daily programming tasks and CI/CD pipelines. It integrates with Claude and supports IntelliJ IDEA and VSCode. Engineers benefit from automated code generation, debugging, and optimization.
git clone https://github.com/jabrena/cursor-rules-java.gitcursor-rules-java provides a collection of reusable skills, agents, and commands designed to enhance Java development within AI coding assistants like Cursor, Claude Code, and GitHub Copilot. The project enables structured workflows across the software development lifecycle: planning with user stories and architecture decisions, building with Maven best practices and secure coding guidance, and operating with observability and performance testing. Teams use these skills to guide AI agents through complex tasks—from reviewing Maven projects to implementing features with Spring Boot, Quarkus, or Micronaut—while maintaining engineering control over proposed changes. It also includes compliance-focused skills for EU regulations including the AI Act, GDPR, and DORA, helping teams integrate regulatory awareness into their development process.
[{"step":"Install the cursor-rules-java plugin in your IDE (IntelliJ IDEA or VSCode).","action":"Search for 'cursor-rules-java' in your IDE's plugin marketplace and install it. Restart your IDE if required.","tip":"Ensure you have the latest version of the plugin for all features to work properly."},{"step":"Configure your project's build tool (Maven/Gradle) to match the expected dependencies.","action":"Add required dependencies to your pom.xml or build.gradle based on the generated code. For Spring Boot, ensure you have spring-boot-starter-web, spring-boot-starter-validation, and spring-boot-starter-test.","tip":"Use the same versions as your existing project to avoid dependency conflicts."},{"step":"Use the prompt template in your AI assistant (Claude/ChatGPT) to generate Java code.","action":"Copy the prompt template and replace [PLACEHOLDERS] with your specific requirements. For example: 'Generate a Java class that implements a JWT authentication filter using Spring Security 6 with proper error handling and logging.'","tip":"Be as specific as possible with your requirements to get better results. Include framework versions, coding standards, and any specific libraries you want to use."},{"step":"Review and customize the generated code.","action":"Check the generated code against your project's standards. Modify any parts that don't fit your architecture or requirements.","tip":"Pay special attention to package names, class names, and method signatures to ensure consistency with your existing codebase."},{"step":"Run tests and integrate the code into your CI/CD pipeline.","action":"Execute the generated unit tests and integration tests. Add the new code to your version control and CI pipeline configuration.","tip":"Set up pre-commit hooks to run tests automatically before each commit to catch issues early."}]
Review Maven projects for best practices and apply approved improvements
Generate feature implementations using framework-specific agents (Spring Boot, Quarkus, Micronaut)
Create and update GitHub Issues and ADRs with AI guidance
Perform secure code reviews and apply security hardening patterns
No install command available. Check the GitHub repository for manual installation instructions.
git clone https://github.com/jabrena/cursor-rules-javaCopy the install command above and run it in your terminal.
Launch Claude Code, Cursor, or your preferred AI coding agent.
Use the prompt template or examples below to test the skill.
Adapt the skill to your specific use case and workflow.
Generate a Java class that [IMPLEMENTS_SPECIFIC_FUNCTIONALITY] using best practices for [FRAMEWORK/LIBRARY]. Include unit tests with [TESTING_FRAMEWORK] and follow [CODE_STYLE_GUIDELINE]. Add comments explaining key design decisions. [ADDITIONAL_REQUIREMENTS].
```java
/**
* A REST controller for managing user profiles in a Spring Boot application.
* Implements CRUD operations with validation and proper error handling.
*/
@RestController
@RequestMapping("/api/users")
@RequiredArgsConstructor
public class UserProfileController {
private final UserService userService;
private final UserMapper userMapper;
@GetMapping("/{id}")
public ResponseEntity<UserDTO> getUser(@PathVariable Long id) {
User user = userService.findById(id)
.orElseThrow(() -> new ResourceNotFoundException("User not found with id: " + id));
return ResponseEntity.ok(userMapper.toDto(user));
}
@PostMapping
public ResponseEntity<UserDTO> createUser(@Valid @RequestBody UserCreateRequest request) {
User user = userMapper.toEntity(request);
User savedUser = userService.save(user);
return new ResponseEntity<>(userMapper.toDto(savedUser), HttpStatus.CREATED);
}
@PutMapping("/{id}")
public ResponseEntity<UserDTO> updateUser(
@PathVariable Long id,
@Valid @RequestBody UserUpdateRequest request) {
User existingUser = userService.findById(id)
.orElseThrow(() -> new ResourceNotFoundException("User not found with id: " + id));
userMapper.updateEntityFromDto(request, existingUser);
User updatedUser = userService.save(existingUser);
return ResponseEntity.ok(userMapper.toDto(updatedUser));
}
@DeleteMapping("/{id}")
public ResponseEntity<Void> deleteUser(@PathVariable Long id) {
userService.deleteById(id);
return ResponseEntity.noContent().build();
}
}
```
```java
/**
* Unit tests for UserProfileController using JUnit 5 and Mockito.
* Tests cover happy paths, validation, and error scenarios.
*/
@ExtendWith(MockitoExtension.class)
@WebMvcTest(UserProfileController.class)
class UserProfileControllerTest {
@Autowired
private MockMvc mockMvc;
@MockBean
private UserService userService;
@MockBean
private UserMapper userMapper;
@Test
void getUser_shouldReturnUserWhenExists() throws Exception {
// Given
Long userId = 1L;
User user = new User(userId, "[email protected]", "password123", "Test User");
UserDTO userDTO = new UserDTO(userId, "[email protected]", "Test User");
given(userService.findById(userId)).willReturn(Optional.of(user));
given(userMapper.toDto(user)).willReturn(userDTO);
// When & Then
mockMvc.perform(get("/api/users/{id}", userId))
.andExpect(status().isOk())
.andExpect(jsonPath("$.id").value(userId))
.andExpect(jsonPath("$.email").value("[email protected]"));
}
@Test
void createUser_shouldReturnCreatedUser() throws Exception {
// Given
UserCreateRequest request = new UserCreateRequest("[email protected]", "password123", "New User");
User user = new User(2L, "[email protected]", "password123", "New User");
UserDTO userDTO = new UserDTO(2L, "[email protected]", "New User");
given(userMapper.toEntity(request)).willReturn(user);
given(userService.save(user)).willReturn(user);
given(userMapper.toDto(user)).willReturn(userDTO);
// When & Then
mockMvc.perform(post("/api/users")
.contentType(MediaType.APPLICATION_JSON)
.content(asJsonString(request)))
.andExpect(status().isCreated())
.andExpect(jsonPath("$.id").value(2L));
}
private static String asJsonString(final Object obj) {
try {
return new ObjectMapper().writeValueAsString(obj);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}
```Free code editor with IntelliSense, Git, and debugging
The AI Code Editor for productive developers
Get your product discovered in AI chat tools
Get more done every day with Microsoft Teams – powered by AI
Agentic AI Workflow platform
Connected workspace for docs, wikis, and projects
Take a free 3-minute scan and get personalized AI skill recommendations.
Take free scan