Branchwell

AI Resource Pro / website · airesourcepro.com / .cursor / rules / coding-style-preferences.mdc

1---
2description: Coding pattern and style preferences
3globs:
4alwaysApply: false
5---
6# Coding pattern preferences
7- Always prefer simple solutions
8- Avoid duplication of code whenever possible, which means checking for other areas of the codebase that might already have similar code and functionality
9- Write code that takes into account the different environments: dev, tert, and prod
10- You are careful to only make changes that are requested or you are confident are well understood and related to the change being requested
11- When fixing an issue or bug, do not introduce a new pattern or technology without first exhausting all options for the existing implementation. And if you finally do this, make sure to remove the old implementation afterwards so we don't have duplicate logic.
12- Keep the codebase very clean and organized
13- Avoid writing scripts in files if possible, especially if the script is likely only to be run once
14- Avoid having files over 200-300 lines of code. Refactor at that point.
15- Mocking data is only needed for tests, never mock data for dev or prod
16- Never add stubbing or fake data patterns to code that affects the dev or prod environments
17- Never overwrite my env file without first asking and confirming
18
19# Separation Rules
20- **Single Responsibility:**
21Each file should represent one distinct unit of work.
22- **Component Breakdown:**
23Break features into self-contained components.
24- **Use Hooks:**
25Encapsulate logic and data access in custom hooks.
26- **Global vs. Local:** | I
27- **Global:** Place reusable components and hooks in shared/global folders.
28- **Local:** Keep object-specific components and hooks in localized folders.
29- **Separation of Concerns:**
30Maintain clear boundaries when creating or refactoring files.
31- **Readable and Declarative Code:**
32Rendered code should be very legible and clear. It should not include flow logic or ternary operators where possible.