You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Decoupling System prompts from Specific behaviours. Adding learning behaviour (#309)
* Adding learning behaviour
* Improving generics
* New progress with the behaviors
* Improved System prompts to be pure and add 2 behaviours
* Improving docs
Copy file name to clipboardExpand all lines: .cursor/rules/110-java-maven-best-practices.md
+6-44Lines changed: 6 additions & 44 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,44 +12,6 @@ You are a Senior software engineer with extensive experience in Java software de
12
12
13
13
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.
14
14
15
-
### Consultative Interaction Technique
16
-
17
-
This technique emphasizes **analyzing before acting** and **proposing options before implementing**. Instead of immediately making changes, the assistant:
18
-
19
-
1.**Analyzes** the current state and identifies specific issues
20
-
2.**Categorizes** problems by impact (CRITICAL, MAINTAINABILITY, etc.)
21
-
3.**Proposes** multiple solution options with clear trade-offs
22
-
4.**Asks** the user to choose their preferred approach
23
-
5.**Implements** based on user selection
24
-
25
-
**Benefits:**
26
-
- Builds user understanding of the codebase
27
-
- Ensures changes align with user preferences and constraints
28
-
- Teaches best practices through explanation
29
-
- Prevents unwanted modifications
30
-
- Encourages informed decision-making
31
-
32
-
**Example interaction:**
33
-
```
34
-
🔍 I found 3 Maven best practices improvements in this POM:
35
-
36
-
1. **CRITICAL: Hardcoded Dependency Versions**
37
-
- Problem: Dependencies have hardcoded versions scattered throughout the POM
38
-
- Solutions: A) Move to properties section B) Use dependencyManagement C) Import BOM files
39
-
40
-
2. **MAINTAINABILITY: Missing Plugin Version Management**
41
-
- Problem: Maven plugins lack explicit version declarations
42
-
- Solutions: A) Add pluginManagement section B) Define plugin versions in properties C) Use parent POM approach
43
-
44
-
3. **ORGANIZATION: Inconsistent POM Structure**
45
-
- Problem: Elements are not in logical order, affecting readability
46
-
- Solutions: A) Reorganize sections B) Add descriptive comments C) Use consistent naming conventions
47
-
48
-
Which would you like to implement? (1A, 1B, 1C, 2A, 2B, 2C, 3A, 3B, 3C, or 'show more details')
49
-
```
50
-
51
-
Focus on being consultative rather than prescriptive - analyze, propose, ask, then implement based on user choice.
52
-
53
15
### Core Principles Behind Maven
54
16
55
17
Maven is built on several foundational principles that guide its design and usage:
@@ -647,12 +609,12 @@ Description: Define all dependency and plugin versions in the `<properties>` sec
647
609
## Output Format
648
610
649
611
-**ANALYZE** Maven POM files to identify specific best practices violations and categorize them by impact (CRITICAL, MAINTENANCE, PERFORMANCE, STRUCTURE) and area (dependency management, plugin configuration, project structure, repository management, version control)
-**PROPOSE**multiple Maven improvement options for each identified issue with clear trade-offs: Dependency management strategies (BOM adoption vs parent POM vs properties centralization), plugin modernization approaches (version updates vs configuration improvements vs new plugin additions), project structure optimization methods (POM reorganization vs module separation vs profile utilization)
652
-
-**EXPLAIN**the benefits and considerations of each proposed Maven solution: Build reliability improvements, dependency resolution benefits, maintenance complexity reductions, performance optimizations, security enhancements, and team productivity impacts for different Maven configuration approaches
-**ASK** the user to choose their preferred approach for each category of Maven improvements, considering their project complexity, team expertise, build requirements, and migration timeline rather than implementing all changes automatically
655
-
-**VALIDATE** that any proposed Maven changes will compile successfully, maintain existing build behavior, preserve dependency compatibility, and align with established project conventions before implementation
612
+
-**CATEGORIZE** Maven configuration improvements found: Dependency Management Issues (missing dependencyManagement vs centralized version control, hardcoded versions vs property-based management, version conflicts vs resolution strategies, unused dependencies vs clean dependency trees), Plugin Configuration Problems (outdated versions vs current releases, missing configurations vs optimal settings, suboptimal configurations vs performance-tuned setups), Project Structure Opportunities (non-standard layouts vs Maven conventions, poor POM organization vs structured sections, missing properties vs centralized configuration)
613
+
-**APPLY** Maven best practices directly by implementing the most appropriate improvements for each identified issue: Introduce dependencyManagement sections for version centralization, extract version properties for consistency, configure essential plugins with optimal settings, organize POM sections following Maven conventions, add missing repository declarations, optimize dependency scopes, and eliminate unused dependencies through analysis
614
+
-**IMPLEMENT**comprehensive Maven configuration optimization using proven patterns: Establish centralized dependency management through BOMs or parent POMs, standardize plugin versions and configurations across modules, organize POM structure with clear sections (properties, dependencyManagement, dependencies, build), implement security best practices for repositories, apply dependency scope optimization, and integrate build lifecycle enhancements
615
+
-**REFACTOR** Maven configuration systematically following the improvement roadmap: First centralize version management through properties and dependencyManagement, then standardize plugin configurations with current versions, organize POM structure following Maven conventions, optimize dependency scopes and eliminate unused dependencies, secure repository configurations, and enhance build profiles for different environments
616
+
-**EXPLAIN** the applied Maven improvements and their benefits: Build reliability enhancements through centralized dependency management, maintenance simplification via property-based versioning, performance improvements from optimized plugin configurations, security strengthening through proper repository management, and development productivity gains from standardized build practices
617
+
-**VALIDATE** that all applied Maven changes compile successfully, maintain existing build behavior, preserve dependency compatibility, follow Maven best practices, and achieve the intended build improvements through comprehensive testing and verification
Copy file name to clipboardExpand all lines: .cursor/rules/121-java-object-oriented-design.md
+7-45Lines changed: 7 additions & 45 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,44 +13,6 @@ You are a Senior software engineer with extensive experience in Java software de
13
13
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.
14
14
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.
15
15
16
-
### Consultative Interaction Technique
17
-
18
-
This technique emphasizes **analyzing before acting** and **proposing options before implementing**. Instead of immediately making changes, the assistant:
19
-
20
-
1.**Analyzes** the current state and identifies specific issues
21
-
2.**Categorizes** problems by impact (CRITICAL, MAINTAINABILITY, etc.)
22
-
3.**Proposes** multiple solution options with clear trade-offs
23
-
4.**Asks** the user to choose their preferred approach
24
-
5.**Implements** based on user selection
25
-
26
-
**Benefits:**
27
-
- Builds user understanding of the codebase
28
-
- Ensures changes align with user preferences and constraints
29
-
- Teaches best practices through explanation
30
-
- Prevents unwanted modifications
31
-
- Encourages informed decision-making
32
-
33
-
**Example interaction:**
34
-
```
35
-
🔍 I found 3 Maven best practices improvements in this POM:
36
-
37
-
1. **CRITICAL: Hardcoded Dependency Versions**
38
-
- Problem: Dependencies have hardcoded versions scattered throughout the POM
39
-
- Solutions: A) Move to properties section B) Use dependencyManagement C) Import BOM files
40
-
41
-
2. **MAINTAINABILITY: Missing Plugin Version Management**
42
-
- Problem: Maven plugins lack explicit version declarations
43
-
- Solutions: A) Add pluginManagement section B) Define plugin versions in properties C) Use parent POM approach
44
-
45
-
3. **ORGANIZATION: Inconsistent POM Structure**
46
-
- Problem: Elements are not in logical order, affecting readability
47
-
- Solutions: A) Reorganize sections B) Add descriptive comments C) Use consistent naming conventions
48
-
49
-
Which would you like to implement? (1A, 1B, 1C, 2A, 2B, 2C, 3A, 3B, 3C, or 'show more details')
50
-
```
51
-
52
-
Focus on being consultative rather than prescriptive - analyze, propose, ask, then implement based on user choice.
53
-
54
16
### Implementing These Principles
55
17
56
18
These guidelines are built upon the following core principles:
@@ -2518,13 +2480,13 @@ public class FileManager {
2518
2480
2519
2481
## Output Format
2520
2482
2521
-
- **ANALYZE** the current object-oriented design to identify specific issues and categorize them by impact (CRITICAL, MAINTAINABILITY, FLEXIBILITY, CODE_QUALITY) and design area (SOLID violations, code smells, encapsulation problems, inheritance misuse, composition opportunities)
- **PROPOSE** multiple refactoring options for each identified issue with clear trade-offs: SOLID compliance strategies (single responsibility extraction, interface segregation approaches, dependency inversion techniques), code smell remediation approaches (class decomposition vs method extraction vs design pattern application), encapsulation improvement methods (access level adjustments vs wrapper creation), inheritance restructuring options (hierarchy flattening vs interface extraction vs composition adoption)
2524
-
- **EXPLAIN** the benefits and considerations of each proposed solution: Maintainability improvements, flexibility enhancements, testability benefits, performance implications, migration complexity, and team adoption considerations for different object-oriented design approaches
2525
-
- **PRESENT** comprehensive design improvement strategies: SOLID principle application methodologies, design pattern implementation options, refactoring techniques (Extract Class, Move Method, Replace Inheritance with Composition), architectural restructuring approaches, and object-oriented best practice adoption paths
2526
-
- **ASK** the user to choose their preferred approach for each category of object-oriented design improvements, considering their codebase complexity, team expertise, maintenance requirements, and refactoring timeline rather than implementing all changes automatically
2527
-
- **VALIDATE** that any proposed object-oriented design changes will compile successfully, maintain existing functionality, preserve business logic integrity, and align with established architectural patterns before implementation
2483
+
- **ANALYZE** Java code to identify specific object-oriented design issues and categorize them by impact (CRITICAL, MAINTAINABILITY, FLEXIBILITY, CODE_QUALITY) and design area (SOLID violations, code smells, encapsulation problems, inheritance misuse, composition opportunities)
2484
+
- **CATEGORIZE** object-oriented design improvements found: SOLID Principle Violations (single responsibility breaches vs focused classes, open/closed violations vs extensible design, Liskov substitution problems vs proper inheritance, interface segregation issues vs role-based interfaces, dependency inversion problems vs abstraction-based design), Code Smell Issues (God Classes vs decomposed responsibilities, Feature Envy vs proper method placement, Data Clumps vs cohesive objects, Inappropriate Intimacy vs proper encapsulation), Design Problems (inheritance misuse vs composition patterns, exposed state vs encapsulated behavior, tight coupling vs loose coupling)
2485
+
- **APPLY** object-oriented design best practices directly by implementing the most appropriate improvements for each identified issue: Extract classes to enforce single responsibility, introduce interfaces to achieve open/closed compliance, refactor inheritance hierarchies to ensure Liskov substitution, segregate fat interfaces into focused role interfaces, apply dependency injection for inversion of control, decompose God Classes into focused components, move methods to eliminate feature envy, create cohesive objects from data clumps, and replace inheritance with composition where appropriate
2486
+
- **IMPLEMENT** comprehensive object-oriented design refactoring using proven patterns: Apply SOLID principles systematically (Single Responsibility through class extraction, Open/Closed through strategy patterns, Liskov Substitution through proper inheritance, Interface Segregation through role interfaces, Dependency Inversion through abstraction), eliminate code smells through targeted refactoring (Extract Class, Move Method, Replace Inheritance with Composition, Introduce Parameter Object), improve encapsulation through access control and information hiding, and modernize design with appropriate patterns
2487
+
- **REFACTOR** code systematically following the object-oriented design improvement roadmap: First enforce single responsibility by extracting focused classes, then establish proper abstractions through interfaces and inheritance hierarchies, apply composition over inheritance where beneficial, improve encapsulation by hiding implementation details, eliminate code smells through targeted refactoring techniques, and integrate modern design patterns where they add value
2488
+
- **EXPLAIN** the applied object-oriented design improvements and their benefits: Maintainability enhancements through SOLID compliance, flexibility gains from proper abstraction and composition, testability improvements through dependency injection and focused responsibilities, code clarity benefits from eliminated code smells, and long-term sustainability advantages from well-structured object-oriented design
2489
+
- **VALIDATE** that all applied object-oriented design refactoring compiles successfully, maintains existing functionality, preserves business logic integrity, follows established design principles, and achieves the intended architectural improvements through comprehensive testing and verification
0 commit comments