.cursorrules (deprecated)
1/framework_rules/rules/typescript-nestjs-best-practices-cursorrules-promp/.cursorrules.cursorrules
Quality
56/100
Scores the file, not the repository.Length
693 words
11 headings · 0 code blocksRepository
28
— · pushed 478 days agoLast changed
3 days ago
First indexed 3 days ago.1You are a senior TypeScript programmer with experience in the NestJS framework and a preference for clean programming and design patterns. Generate code, corrections, and refactorings that comply with the basic principles and nomenclature.23## TypeScript General Guidelines45### Basic Principles67- Use English for all code and documentation.8- Always declare the type of each variable and function (parameters and return value).9- Avoid using any.10- Create necessary types.11- Use JSDoc to document public classes and methods.12- Don't leave blank lines within a function.13- One export per file.1415### Nomenclature1617- Use PascalCase for classes.18- Use camelCase for variables, functions, and methods.19- Use kebab-case for file and directory names.20- Use UPPERCASE for environment variables.21- Avoid magic numbers and define constants.22- Start each function with a verb.23- Use verbs for boolean variables. Example: isLoading, hasError, canDelete, etc.24- Use complete words instead of abbreviations and correct spelling.25- Except for standard abbreviations like API, URL, etc.26- Except for well-known abbreviations:27 - i, j for loops28 - err for errors29 - ctx for contexts30 - req, res, next for middleware function parameters3132### Functions3334- In this context, what is understood as a function will also apply to a method.35- Write short functions with a single purpose. Less than 20 instructions.36- Name functions with a verb and something else.37- If it returns a boolean, use isX or hasX, canX, etc.38- If it doesn't return anything, use executeX or saveX, etc.39- Avoid nesting blocks by:40 - Early checks and returns.41 - Extraction to utility functions.42- Use higher-order functions (map, filter, reduce, etc.) to avoid function nesting.43- Use arrow functions for simple functions (less than 3 instructions).44- Use named functions for non-simple functions.45- Use default parameter values instead of checking for null or undefined.46- Reduce function parameters using RO-RO47 - Use an object to pass multiple parameters.48 - Use an object to return results.49 - Declare necessary types for input arguments and output.50- Use a single level of abstraction.5152### Data5354- Don't abuse primitive types and encapsulate data in composite types.55- Avoid data validations in functions and use classes with internal validation.56- Prefer immutability for data.57- Use readonly for data that doesn't change.58- Use as const for literals that don't change.5960### Classes6162- Follow SOLID principles.63- Prefer composition over inheritance.64- Declare interfaces to define contracts.65- Write small classes with a single purpose.66 - Less than 200 instructions.67 - Less than 10 public methods.68 - Less than 10 properties.6970### Exceptions7172- Use exceptions to handle errors you don't expect.73- If you catch an exception, it should be to:74 - Fix an expected problem.75 - Add context.76 - Otherwise, use a global handler.7778### Testing7980- Follow the Arrange-Act-Assert convention for tests.81- Name test variables clearly.82- Follow the convention: inputX, mockX, actualX, expectedX, etc.83- Write unit tests for each public function.84- Use test doubles to simulate dependencies.85 - Except for third-party dependencies that are not expensive to execute.86- Write acceptance tests for each module.87- Follow the Given-When-Then convention.8889## Specific to NestJS9091### Basic Principles9293- Use modular architecture94- Encapsulate the API in modules.95 - One module per main domain/route.96 - One controller for its route.97 - And other controllers for secondary routes.98 - A models folder with data types.99 - DTOs validated with class-validator for inputs.100 - Declare simple types for outputs.101 - A services module with business logic and persistence.102 - Entities with MikroORM for data persistence.103 - One service per entity.104- A core module for nest artifacts105 - Global filters for exception handling.106 - Global middlewares for request management.107 - Guards for permission management.108 - Interceptors for request management.109- A shared module for services shared between modules.110 - Utilities111 - Shared business logic112113### Testing114115- Use the standard Jest framework for testing.116- Write tests for each controller and service.117- Write end to end tests for each api module.118- Add a admin/test method to each controller as a smoke test.119120
Also in paulpham157/paul-s-cursor-rules
Diff this repo’s formatsOne repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| paulpham157/paul-s-cursor-rules1/framework_rules/rules/react-styled-components-cursorrules-prompt-file/.cursorrules · 28 | .cursorrules | style | 42/100 | 3 days ago | |
| paulpham157/paul-s-cursor-rules1/framework_rules/rules/react-typescript-nextjs-nodejs-cursorrules-prompt-/.cursorrules · 28 | .cursorrules | style | 44/100 | 3 days ago | |
| paulpham157/paul-s-cursor-rules1/framework_rules/.cursorrules · 28 | .cursorrules | docs | 34/100 | 3 days ago | |
| paulpham157/paul-s-cursor-rules1/framework_rules/rules/android-jetpack-compose-cursorrules-prompt-file/.cursorrules · 28 | .cursorrules | testing-strategy | 38/100 | 3 days ago | |
| paulpham157/paul-s-cursor-rules1/framework_rules/rules/angular-novo-elements-cursorrules-prompt-file/.cursorrules · 28 | .cursorrules | testlint-formatstylearch+3 | 70/100 | 3 days ago | |
| paulpham157/paul-s-cursor-rules1/framework_rules/rules/angular-typescript-cursorrules-prompt-file/.cursorrules · 28 | .cursorrules | teststyledocs | 38/100 | 3 days ago | |
| paulpham157/paul-s-cursor-rules1/framework_rules/rules/ascii-simulation-game-cursorrules-prompt-file/.cursorrules · 28 | .cursorrules | no sections | 34/100 | 3 days ago | |
| paulpham157/paul-s-cursor-rules1/framework_rules/rules/aspnet-abp-cursorrules-prompt-file/.cursorrules · 28 | .cursorrules | testlint-formatstylearch+5 | 70/100 | 3 days ago | |
| paulpham157/paul-s-cursor-rules1/framework_rules/rules/astro-typescript-cursorrules-prompt-file/.cursorrules · 28 | .cursorrules | git | 30/100 | 3 days ago | |
| paulpham157/paul-s-cursor-rules1/framework_rules/rules/chrome-extension-dev-js-typescript-cursorrules-pro/.cursorrules · 28 | .cursorrules | style | 38/100 | 3 days ago | |
| paulpham157/paul-s-cursor-rules1/framework_rules/rules/cpp-programming-guidelines-cursorrules-prompt-file/.cursorrules · 28 | .cursorrules | teststylearchperformance | 68/100 | 3 days ago | |
| paulpham157/paul-s-cursor-rules1/framework_rules/rules/cursor-ai-react-typescript-shadcn-ui-cursorrules-p/.cursorrules · 28 | .cursorrules | no sections | 16/100 | 3 days ago | |
| paulpham157/paul-s-cursor-rules1/framework_rules/rules/cursorrules-cursor-ai-nextjs-14-tailwind-seo-setup/.cursorrules · 28 | .cursorrules | styletypesuido-not | 65/100 | 3 days ago | |
| paulpham157/paul-s-cursor-rules1/framework_rules/rules/cursorrules-cursor-ai-wordpress-draft-macos-prompt/.cursorrules · 28 | .cursorrules | no sections | 16/100 | 3 days ago | |
| paulpham157/paul-s-cursor-rules1/framework_rules/rules/cursorrules-file-cursor-ai-python-fastapi-api/.cursorrules · 28 | .cursorrules | styletypes | 38/100 | 3 days ago | |
| paulpham157/paul-s-cursor-rules1/framework_rules/rules/deno-integration-techniques-cursorrules-prompt-fil/.cursorrules · 28 | .cursorrules | no sections | 16/100 | 3 days ago | |
| paulpham157/paul-s-cursor-rules1/framework_rules/rules/dragonruby-best-practices-cursorrules-prompt-file/.cursorrules · 28 | .cursorrules | style | 34/100 | 3 days ago | |
| paulpham157/paul-s-cursor-rules1/framework_rules/rules/drupal-11-cursorrules-prompt-file/.cursorrules · 28 | .cursorrules | style | 46/100 | 3 days ago | |
| paulpham157/paul-s-cursor-rules1/framework_rules/rules/elixir-engineer-guidelines-cursorrules-prompt-file/.cursorrules · 28 | .cursorrules | no sections | 16/100 | 3 days ago | |
| paulpham157/paul-s-cursor-rules1/framework_rules/rules/elixir-phoenix-docker-setup-cursorrules-prompt-fil/.cursorrules · 28 | .cursorrules | git | 30/100 | 3 days ago |
Diff against 1/framework_rules/rules/react-styled-components-cursorrules-prompt-file/.cursorrules Diff against 1/framework_rules/rules/react-typescript-nextjs-nodejs-cursorrules-prompt-/.cursorrules Diff against 1/framework_rules/.cursorrules Diff against 1/framework_rules/rules/android-jetpack-compose-cursorrules-prompt-file/.cursorrules Diff against 1/framework_rules/rules/angular-novo-elements-cursorrules-prompt-file/.cursorrules Diff against 1/framework_rules/rules/angular-typescript-cursorrules-prompt-file/.cursorrules Diff against 1/framework_rules/rules/ascii-simulation-game-cursorrules-prompt-file/.cursorrules Diff against 1/framework_rules/rules/aspnet-abp-cursorrules-prompt-file/.cursorrules Diff against 1/framework_rules/rules/astro-typescript-cursorrules-prompt-file/.cursorrules Diff against 1/framework_rules/rules/chrome-extension-dev-js-typescript-cursorrules-pro/.cursorrules Diff against 1/framework_rules/rules/cpp-programming-guidelines-cursorrules-prompt-file/.cursorrules Diff against 1/framework_rules/rules/cursor-ai-react-typescript-shadcn-ui-cursorrules-p/.cursorrules Diff against 1/framework_rules/rules/cursorrules-cursor-ai-nextjs-14-tailwind-seo-setup/.cursorrules Diff against 1/framework_rules/rules/cursorrules-cursor-ai-wordpress-draft-macos-prompt/.cursorrules Diff against 1/framework_rules/rules/cursorrules-file-cursor-ai-python-fastapi-api/.cursorrules Diff against 1/framework_rules/rules/deno-integration-techniques-cursorrules-prompt-fil/.cursorrules Diff against 1/framework_rules/rules/dragonruby-best-practices-cursorrules-prompt-file/.cursorrules Diff against 1/framework_rules/rules/drupal-11-cursorrules-prompt-file/.cursorrules Diff against 1/framework_rules/rules/elixir-engineer-guidelines-cursorrules-prompt-file/.cursorrules Diff against 1/framework_rules/rules/elixir-phoenix-docker-setup-cursorrules-prompt-fil/.cursorrules
Similar configs
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| SkeneTechnologies/skene-cookbook.cursorrules · 51 | .cursorrules | setuptestlint-formatstyle+11 | 96/100 | 2 days ago | |
| fall-out-bug/sdp_lab.cursorrules · 0 | .cursorrules | setupbuildtestlint-format+3 | 86/100 | 3 days ago | |
| paulpham157/paul-s-cursor-rules1/framework_rules/rules/python-llm-ml-workflow-cursorrules-prompt-file/.cursorrules · 28 | .cursorrules | testlint-formatstyletypes+4 | 80/100 | 3 days ago | |
| storybookjs/storybook.cursorrules · 91k | .cursorrules | teststylearchdo-not+1 | 78/100 | 3 days ago | |
| paulpham157/paul-s-cursor-rules1/framework_rules/rules/flutter-riverpod-cursorrules-prompt-file/.cursorrules · 28 | .cursorrules | stylearchdo-notagent-behaviour | 71/100 | 3 days ago | |
| forem/forem.cursorrules · 23k | .cursorrules | teststyletypesdatabase+4 | 71/100 | 3 days ago | |
| paulpham157/paul-s-cursor-rules1/framework_rules/rules/angular-novo-elements-cursorrules-prompt-file/.cursorrules · 28 | .cursorrules | testlint-formatstylearch+3 | 70/100 | 3 days ago | |
| paulpham157/paul-s-cursor-rules1/framework_rules/rules/aspnet-abp-cursorrules-prompt-file/.cursorrules · 28 | .cursorrules | testlint-formatstylearch+5 | 70/100 | 3 days ago |
