Skip to content

Commit 1f25ad6

Browse files
committed
Adding roles to cursor rules
1 parent ea03452 commit 1f25ad6

23 files changed

Lines changed: 190 additions & 10 deletions

.cursor/rules/110-java-maven-best-practices.mdc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ alwaysApply: false
55
---
66
# Maven Best Practices
77

8+
## System prompt characterization
9+
10+
Role definition: You are a Senior software engineer with extensive experience in Java software development
11+
12+
## Description
13+
814
Effective Maven usage involves robust dependency management via `<dependencyManagement>` and BOMs, adherence to the standard directory layout, and centralized plugin management. Build profiles should be used for environment-specific configurations. POMs must be kept readable and maintainable with logical structure and properties for versions. Custom repositories should be declared explicitly and their use minimized, preferably managed via a central repository manager.
915

1016
## Table of contents

.cursor/rules/111-java-maven-deps-and-plugins.mdc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ alwaysApply: false
55
---
66
# Update pom.xml to add Maven dependencies & plugins
77

8+
## System prompt characterization
9+
10+
Role definition: You are a Senior software engineer with extensive experience in Java software development
11+
12+
## Description
13+
814
This rule provides a comprehensive, conversational approach to updating Maven pom.xml files with properties, dependencies, plugins, and profiles. It MUST ask questions first to understand the project needs and then conditionally add only relevant components.
915

1016
**⚠️ CRITICAL: NO CACHING OF QUESTIONS ⚠️**

.cursor/rules/112-java-maven-documentation.mdc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ alwaysApply: false
55
---
66
# Create README-DEV.md with information about how to use the Maven project
77

8+
## System prompt characterization
9+
10+
Role definition: You are a Senior software engineer with extensive experience in Java software development
11+
12+
## Description
13+
814
When creating a README-DEV.md file for a Maven project, include ONLY the following sections with the specified Maven goals. Do NOT add any additional sections, explanations, or content beyond what is explicitly listed below.
915

1016
## STRICT Structure for README-DEV.md (Template):

.cursor/rules/121-java-object-oriented-design.mdc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ alwaysApply: false
55
---
66
# Java Object-Oriented Design Guidelines
77

8+
## System prompt characterization
9+
10+
Role definition: You are a Senior software engineer with extensive experience in Java software development
11+
12+
## Description
13+
814
This document provides comprehensive guidelines for robust Java object-oriented design and refactoring. It emphasizes core principles like SOLID, DRY, and YAGNI, best practices for class and interface design including favoring composition over inheritance and designing for immutability. The rules also cover mastering encapsulation, inheritance, and polymorphism, and finally, identifying and refactoring common object-oriented design code smells such as God Classes, Feature Envy, and Data Clumps to promote maintainable, flexible, and understandable code.
915

1016
## Implementing These Principles

.cursor/rules/122-java-type-design.mdc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ alwaysApply: false
55
---
66
# Type Design Thinking in Java
77

8+
## System prompt characterization
9+
10+
Role definition: You are a Senior software engineer with extensive experience in Java software development
11+
12+
## Description
13+
814
Type design thinking in Java applies typography principles to code structure and organization. Just as typography creates readable, accessible text, thoughtful type design in Java produces maintainable, comprehensible code.
915

1016
## Implementing These Principles

.cursor/rules/123-java-general-guidelines.mdc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ alwaysApply: false
55
---
66
# Java General Guidelines
77

8+
## System prompt characterization
9+
10+
Role definition: You are a Senior software engineer with extensive experience in Java software development
11+
12+
## Description
13+
814
This document outlines general Java coding guidelines covering fundamental aspects such as naming conventions for packages, classes, methods, variables, and constants; code formatting rules including indentation, line length, brace style, and whitespace usage; standards for organizing import statements; best practices for Javadoc documentation; and comprehensive error and exception handling with a strong focus on security, including avoiding sensitive information exposure, catching specific exceptions, and secure resource management.
915

1016
## Implementing These Principles

.cursor/rules/124-java-secure-coding.mdc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ alwaysApply: false
55
---
66
# Java Secure coding guidelines
77

8+
## System prompt characterization
9+
10+
Role definition: You are a Senior software engineer with extensive experience in Java software development
11+
12+
## Description
13+
814
This document provides essential Java secure coding guidelines, focusing on five key areas: validating all untrusted inputs to prevent attacks like injection and path traversal; protecting against injection attacks (e.g., SQL injection) by using parameterized queries or prepared statements; minimizing the attack surface by adhering to the principle of least privilege and reducing exposure; employing strong, current cryptographic algorithms for hashing, encryption, and digital signatures while avoiding deprecated ones; and handling exceptions securely by avoiding the exposure of sensitive information in error messages to users and logging detailed, non-sensitive diagnostic information for developers.
915

1016
## Implementing These Principles

.cursor/rules/125-java-concurrency.mdc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ alwaysApply: false
55
---
66
# Java rules for Concurrency objects
77

8+
## System prompt characterization
9+
10+
Role definition: You are a Senior software engineer with extensive experience in Java software development
11+
12+
## Description
13+
814
Effective Java concurrency relies on understanding thread safety fundamentals, using `java.util.concurrent` utilities, and managing thread pools with `ExecutorService`. Key practices include implementing concurrent design patterns like Producer-Consumer, leveraging `CompletableFuture` for asynchronous tasks, and ensuring thread safety through immutability and safe publication. Performance aspects like lock contention and memory consistency must be considered. Thorough testing, including stress tests and thread dump analysis, is crucial. Modern Java offers virtual threads for enhanced scalability, structured concurrency for simplified task management, and scoped values for safer thread-shared data as alternatives to thread-locals.
915

1016
## Implementing These Principles

.cursor/rules/126-java-logging.mdc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ alwaysApply: false
55
---
66
# Java Logging Best Practices
77

8+
## System prompt characterization
9+
10+
Role definition: You are a Senior software engineer with extensive experience in Java software development
11+
12+
## Description
13+
814
Effective Java logging involves selecting a standard framework (SLF4J with Logback/Log4j2), using appropriate log levels (ERROR, WARN, INFO, DEBUG, TRACE),
915
and adhering to core practices like parameterized logging, proper exception handling, and avoiding sensitive data exposure.
1016
Configuration should be environment-specific with clear output formats.

.cursor/rules/131-java-unit-testing.mdc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ alwaysApply: false
55
---
66
# Java Unit testing guidelines
77

8+
## System prompt characterization
9+
10+
Role definition: You are a Senior software engineer with extensive experience in Java software development
11+
12+
## Description
13+
814
Effective Java unit testing involves using JUnit 5 annotations and AssertJ for fluent assertions. Tests should follow the Given-When-Then structure with descriptive names for clarity. Each test must have a single responsibility, be independent, and leverage parameterized tests for data variations. Mocking dependencies with frameworks like Mockito is crucial for isolating the unit under test. While code coverage is a useful guide, the focus should be on meaningful tests for critical logic and edge cases. Test classes and methods should typically be package-private. Strategies for code splitting include small test methods and helper functions. Anti-patterns like testing implementation details, hard-coded values, and ignoring failures should be avoided. Proper state management involves isolated state and immutable objects, and error handling should include testing for expected exceptions and their messages.
915

1016
## Implementing These Principles

0 commit comments

Comments
 (0)