DeGraciaMathieu/cursor-mdc-rules
Cursor rule
Avoid writing complex conditional expressions with multiple combined conditions. Encapsulate the logic into clearly named methods or objects to express intent rather than implementation details.
Cursor Rules for writing clear, readable, and maintainable PHP code
DeGraciaMathieu/cursor-mdc-rules
Cursor rule
Avoid writing complex conditional expressions with multiple combined conditions. Encapsulate the logic into clearly named methods or objects to express intent rather than implementation details.
DeGraciaMathieu/cursor-mdc-rules
Cursor rule
Avoid negative conditions in code. Positive (affirmative) conditions are easier to read and understand.
DeGraciaMathieu/cursor-mdc-rules
Cursor rule
Method and variable names should be clear and expressive, but avoid adding unnecessary context that does not contribute to understanding. Overcontextualization introduces noise and reduces readability.
DeGraciaMathieu/cursor-mdc-rules
Cursor rule
Write code that is clear and readable rather than overly concise or clever. Prioritize human comprehension over clever syntax tricks.
DeGraciaMathieu/cursor-mdc-rules
Cursor rule
Comments should provide context or clarifications that the code alone cannot convey. They are not a substitute for clear code, but a complement to explain why something is done or what external constraints apply.
DeGraciaMathieu/cursor-mdc-rules
Cursor rule
A class should only interact with its direct dependencies. It must not reach through objects to access their internals or depend on transitive dependencies.
DeGraciaMathieu/cursor-mdc-rules
Cursor rule
Methods should group only lines of code that share a common intention. Different responsibilities must be extracted into separate methods or services.
DeGraciaMathieu/cursor-mdc-rules
Cursor rule
Keep lines of code short enough to be easily readable and understandable at a glance. Long lines reduce readability, increase cognitive load, and complicate code reviews.
DeGraciaMathieu/cursor-mdc-rules
Cursor rule
Method names must clearly communicate the action or intention of the method. The level of detail should correspond to the method’s position in the execution chain.
DeGraciaMathieu/cursor-mdc-rules
Cursor rule
A method should operate at a single level of abstraction from start to finish. It should either express a high-level intention ("what") or execute low-level implementation details ("how"), but not both.
DeGraciaMathieu/cursor-mdc-rules
Cursor rule
Prefer pure methods over impure ones. A pure method has no side effects and depends only on its explicit arguments.
DeGraciaMathieu/cursor-mdc-rules
Cursor rule
A method should limit the number of arguments it accepts. If a method has more than three arguments, consider grouping them into a single parameter object to reduce complexity and improve clarity.
DeGraciaMathieu/cursor-mdc-rules
Cursor rule
Use intermediate variables to give context and clarify the intention behind expressions, rather than writing overly compact code.