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 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.
[{"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."}]
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, "test@example.com", "password123", "Test User");
UserDTO userDTO = new UserDTO(userId, "test@example.com", "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("test@example.com"));
}
@Test
void createUser_shouldReturnCreatedUser() throws Exception {
// Given
UserCreateRequest request = new UserCreateRequest("new@example.com", "password123", "New User");
User user = new User(2L, "new@example.com", "password123", "New User");
UserDTO userDTO = new UserDTO(2L, "new@example.com", "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);
}
}
}
```Powerful code editor with intelligent completion, version control, and debugging tools.
AI-first code editor
Get your product discovered in AI chat tools
IronCalc is a spreadsheet engine and ecosystem
Enterprise workflow automation and service management platform
Automate your spreadsheet tasks with AI power
Take a free 3-minute scan and get personalized AI skill recommendations.
Take free scan