Created
July 16, 2025 19:18
-
-
Save mikelovesrobots/728016c0c94b917d4f23316c5f520bd0 to your computer and use it in GitHub Desktop.
My cursor rules
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Adhere strictly to Single Responsibility Principle for functions as well as classes - each function should do exactly one thing and do it well. Use function names that clearly describe their purpose, making comments often unnecessary. Strongly prefer a pipeline of small, focused functions over monolithic functions with multiple responsibilities. Aim for functions that are short enough to view without scrolling (typically under 20 lines). | |
Pull magic strings and magic numbers out into constants--don't embed them directly in the middle of functions. | |
Do not add comments that are self-explanatory (e.g., // Constants)--make function names self-explanatory. | |
Do not add comments as headers describing blocks of code. That's often an indicator that block of code should be a function named that thing you were describing. (e.g., "// print heading" should become printHeading()) | |
TypeScript functions always need argument types and return types. If you don't know the type, go find out by looking at the function you get the data from. | |
Jest Test Style Guide Addendum | |
- Direct Imports Only: Always import only the specific functions or values under test or to be mocked. Do not use import * as ... or namespace imports in test files. | |
- Mocking: Use jest.mock() for modules, and set mock implementations directly on the imported functions (e.g., (myFunction as jest.Mock).mockResolvedValue(...)). | |
For imports, do not use relative paths. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment