Project Configuration
Add this skill
npx mdskills install PatrickJS/cursor-java-general-purposeComprehensive Java best practices ruleset with deep coverage of Effective Java principles
1# Project Configuration2file_location: root_directory3file_name: .cursorrules45# AI Developer Profile6ai_persona:7 role: Senior Java Developer8 principles:9 - SOLID10 - DRY11 - KISS12 - YAGNI13 - OWASP14 - DOP15 - FP16 - DDD1718# Technical Stack19tech_stack:20 framework: none21 build_tool: Maven22 java_version: 2423 dependencies:24 - Eclipse Collections25 - Commons Lang326 - Guava27 - VAVR28 - Junit529 - JQwik30 - JMH31 language: English32 code_comments: English3334# Development Guidelines35effective_java_notes:36 chapter_2:37 title: "Creating and Destroying Objects"38 items:39 - "Consider static factory methods instead of constructors"40 - "Consider a builder when faced with many constructor parameters"41 - "Enforce the singleton property with a private constructor or an enum type"42 - "Enforce noninstantiability with a private constructor"43 - "Prefer dependency injection to hardwiring resources"44 - "Avoid creating unnecessary objects"45 - "Eliminate obsolete object references"46 - "Avoid finalizers and cleaners"47 - "Prefer try-with-resources to try-finally"4849 chapter_3:50 title: "Methods Common to All Objects"51 items:52 - "Obey the general contract when overriding equals"53 - "Always override hashCode when you override equals"54 - "Always override toString"55 - "Override clone judiciously"56 - "Consider implementing Comparable"5758 chapter_4:59 title: "Classes and Interfaces"60 items:61 - "Minimize the accessibility of classes and members"62 - "In public classes, use accessor methods, not public fields"63 - "Minimize mutability"64 - "Favor composition over inheritance"65 - "Design and document for inheritance or else prohibit it"66 - "Prefer interfaces to abstract classes"67 - "Design interfaces for posterity"68 - "Use interfaces only to define types"69 - "Prefer class hierarchies to tagged classes"70 - "Favor static member classes over nonstatic"71 - "Limit source files to a single top-level class"7273 chapter_5:74 title: "Generics"75 items:76 - "Don't use raw types"77 - "Eliminate unchecked warnings"78 - "Prefer lists to arrays"79 - "Favor generic types"80 - "Favor generic methods"81 - "Use bounded wildcards to increase API flexibility"82 - "Combine generics and varargs judiciously"83 - "Consider typesafe heterogeneous containers"8485 chapter_6:86 title: "Enums and Annotations"87 items:88 - "Use enums instead of int constants"89 - "Use instance fields instead of ordinals"90 - "Use EnumSet instead of bit fields"91 - "Use EnumMap instead of ordinal indexing"92 - "Emulate extensible enums with interfaces"93 - "Prefer annotations to naming patterns"94 - "Consistently use the Override annotation"95 - "Use marker interfaces to define types"9697 chapter_7:98 title: "Lambdas and Streams"99 items:100 - "Prefer lambdas to anonymous classes"101 - "Prefer method references to lambdas"102 - "Favor the use of standard functional interfaces"103 - "Use streams judiciously"104 - "Prefer side-effect-free functions in streams"105 - "Prefer Collection to Stream as a return type"106 - "Use caution when making streams parallel"107108 chapter_8:109 title: "Methods"110 items:111 - "Check parameters for validity"112 - "Make defensive copies when needed"113 - "Design method signatures carefully"114 - "Use overloading judiciously"115 - "Use varargs judiciously"116 - "Return empty collections or arrays, not nulls"117 - "Return optionals judiciously"118 - "Write doc comments for all exposed API elements"119120 chapter_9:121 title: "General Programming"122 items:123 - "Minimize the scope of local variables"124 - "Prefer for-each loops to traditional for loops"125 - "Know and use the libraries"126 - "Avoid float and double if exact answers are required"127 - "Prefer primitive types to boxed primitives"128 - "Avoid strings where other types are more appropriate"129 - "Beware the performance of string concatenation"130 - "Refer to objects by their interfaces"131 - "Prefer interfaces to reflection"132 - "Use native methods judiciously"133 - "Optimize judiciously"134 - "Adhere to generally accepted naming conventions"135136 chapter_10:137 title: "Exceptions"138 items:139 - "Use exceptions only for exceptional conditions"140 - "Use checked exceptions for recoverable conditions and runtime exceptions for programming errors"141 - "Avoid unnecessary use of checked exceptions"142 - "Favor the use of standard exceptions"143 - "Throw exceptions appropriate to the abstraction"144 - "Document all exceptions thrown by each method"145 - "Include failure-capture information in detail messages"146 - "Strive for failure atomicity"147 - "Don't ignore exceptions"148149 chapter_11:150 title: "Concurrency"151 items:152 - "Synchronize access to shared mutable data"153 - "Avoid excessive synchronization"154 - "Prefer executors, tasks, and streams to threads"155 - "Prefer concurrency utilities to wait and notify"156 - "Document thread safety"157 - "Use lazy initialization judiciously"158 - "Don't depend on the thread scheduler"159160 chapter_12:161 title: "Serialization"162 items:163 - "Prefer alternatives to Java serialization"164 - "Implement Serializable with great caution"165 - "Consider using a custom serialized form"166 - "Write readObject methods defensively"167 - "For instance control, prefer enum types to readResolve"168 - "Consider serialization proxies instead of serialized instances"169170# Best Practices171concurrency_guidelines:172 - "Try to not maintain state in the class"173174functional_programming_guidelines:175 - "Try to use immutable objects"176 - "Try to not mutate the state of the objects"177178data_oriented_programming_pillars:179 - "Separate code from data"180 - "Represent data with generic data structures"181 - "Data should be immutable"182 - "Use pure functions to manipulate data"183 - "Keep data flat and denormalized"184 - "Keep data generic until it needs to be specific"185 - "Data integrity is maintained through validation functions"186 - "Data access should be flexible and generic"187 - "Data transformation should be explicit and traceable"188 - "Data flow should be unidirectional"
Full transparency — inspect the skill content before installing.