RuleStack

Configs

Stacks

Compare

Diff

RuleStack

Configs

Stacks

Compare

Diff

Read API

RuleStack

Configs

Stacks

Compare

Diff

Read API

Configs/.cursorrules/paulpham157/paul-s-cursor-rules

.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 blocks

Repository

28

— · pushed 478 days ago

Last changed

3 days ago

First indexed 3 days ago.
paulpham157/paul-s-cursor-rules/1/framework_rules/rules/typescript-nestjs-best-practices-cursorrules-promp/.cursorrulesRawGitHub
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.
2 
3## TypeScript General Guidelines
4 
5### Basic Principles
6 
7- 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.
14 
15### Nomenclature
16 
17- 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 loops
28 - err for errors
29 - ctx for contexts
30 - req, res, next for middleware function parameters
31 
32### Functions
33 
34- 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-RO
47 - 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.
51 
52### Data
53 
54- 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.
59 
60### Classes
61 
62- 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.
69 
70### Exceptions
71 
72- 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.
77 
78### Testing
79 
80- 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.
88 
89## Specific to NestJS
90 
91### Basic Principles
92 
93- Use modular architecture
94- 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 artifacts
105 - 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 - Utilities
111 - Shared business logic
112 
113### Testing
114 
115- 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.
119 
120 

Sections

  • TypeScript General Guidelines
  • Basic Principles
  • Nomenclature
  • Functions
  • Data
  • Classes
  • Exceptions
  • Testing
  • Specific to NestJS
  • Basic Principles
  • Testing

What it covers

testcode-styletypesdocs

Stack — with the evidence

github-actions

(0.60)

Format

.cursorrules

Cursor's original single-file format, superseded by .cursor/rules/*.mdc. Tracked here precisely because it is dead: how much of the ecosystem is still shipping a deprecated file is a measurable answer, and a large share of the "best cursor rules" pages on the web still teach this format.

What the corpus says about it

Repository

Owner
paulpham157
Language
—
License
—
Archived
no

All configs in this repo

Also in paulpham157/paul-s-cursor-rules

Diff this repo’s formats

One 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?

The other instruction files in this repository
RepositoryFormatStackCoversScoreChanged
paulpham157/paul-s-cursor-rules1/framework_rules/rules/react-styled-components-cursorrules-prompt-file/.cursorrules · 28.cursorrulesgithub-actionsstyle42/1003 days ago
paulpham157/paul-s-cursor-rules1/framework_rules/rules/react-typescript-nextjs-nodejs-cursorrules-prompt-/.cursorrules · 28.cursorrulesgithub-actionsstyle44/1003 days ago
paulpham157/paul-s-cursor-rules1/framework_rules/.cursorrules · 28.cursorrulesgithub-actionsdocs34/1003 days ago
paulpham157/paul-s-cursor-rules1/framework_rules/rules/android-jetpack-compose-cursorrules-prompt-file/.cursorrules · 28.cursorrulesgithub-actionstesting-strategy38/1003 days ago
paulpham157/paul-s-cursor-rules1/framework_rules/rules/angular-novo-elements-cursorrules-prompt-file/.cursorrules · 28.cursorrulesgithub-actionstestlint-formatstylearch+370/1003 days ago
paulpham157/paul-s-cursor-rules1/framework_rules/rules/angular-typescript-cursorrules-prompt-file/.cursorrules · 28.cursorrulesgithub-actionsteststyledocs38/1003 days ago
paulpham157/paul-s-cursor-rules1/framework_rules/rules/ascii-simulation-game-cursorrules-prompt-file/.cursorrules · 28.cursorrulesgithub-actionsno sections34/1003 days ago
paulpham157/paul-s-cursor-rules1/framework_rules/rules/aspnet-abp-cursorrules-prompt-file/.cursorrules · 28.cursorrulesgithub-actionstestlint-formatstylearch+570/1003 days ago
paulpham157/paul-s-cursor-rules1/framework_rules/rules/astro-typescript-cursorrules-prompt-file/.cursorrules · 28.cursorrulesgithub-actionsgit30/1003 days ago
paulpham157/paul-s-cursor-rules1/framework_rules/rules/chrome-extension-dev-js-typescript-cursorrules-pro/.cursorrules · 28.cursorrulesgithub-actionsstyle38/1003 days ago
paulpham157/paul-s-cursor-rules1/framework_rules/rules/cpp-programming-guidelines-cursorrules-prompt-file/.cursorrules · 28.cursorrulesgithub-actionsteststylearchperformance68/1003 days ago
paulpham157/paul-s-cursor-rules1/framework_rules/rules/cursor-ai-react-typescript-shadcn-ui-cursorrules-p/.cursorrules · 28.cursorrulesgithub-actionsno sections16/1003 days ago
paulpham157/paul-s-cursor-rules1/framework_rules/rules/cursorrules-cursor-ai-nextjs-14-tailwind-seo-setup/.cursorrules · 28.cursorrulesgithub-actionsstyletypesuido-not65/1003 days ago
paulpham157/paul-s-cursor-rules1/framework_rules/rules/cursorrules-cursor-ai-wordpress-draft-macos-prompt/.cursorrules · 28.cursorrulesgithub-actionsno sections16/1003 days ago
paulpham157/paul-s-cursor-rules1/framework_rules/rules/cursorrules-file-cursor-ai-python-fastapi-api/.cursorrules · 28.cursorrulesgithub-actionsstyletypes38/1003 days ago
paulpham157/paul-s-cursor-rules1/framework_rules/rules/deno-integration-techniques-cursorrules-prompt-fil/.cursorrules · 28.cursorrulesgithub-actionsno sections16/1003 days ago
paulpham157/paul-s-cursor-rules1/framework_rules/rules/dragonruby-best-practices-cursorrules-prompt-file/.cursorrules · 28.cursorrulesgithub-actionsstyle34/1003 days ago
paulpham157/paul-s-cursor-rules1/framework_rules/rules/drupal-11-cursorrules-prompt-file/.cursorrules · 28.cursorrulesgithub-actionsstyle46/1003 days ago
paulpham157/paul-s-cursor-rules1/framework_rules/rules/elixir-engineer-guidelines-cursorrules-prompt-file/.cursorrules · 28.cursorrulesgithub-actionsno sections16/1003 days ago
paulpham157/paul-s-cursor-rules1/framework_rules/rules/elixir-phoenix-docker-setup-cursorrules-prompt-fil/.cursorrules · 28.cursorrulesgithub-actionsgit30/1003 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.

Same format, overlapping stack, ranked by quality
RepositoryFormatStackCoversScoreChanged
SkeneTechnologies/skene-cookbook.cursorrules · 51.cursorrulespythoneslint+3setuptestlint-formatstyle+1196/1002 days ago
fall-out-bug/sdp_lab.cursorrules · 0.cursorrulesgodocker+3setupbuildtestlint-format+386/1003 days ago
paulpham157/paul-s-cursor-rules1/framework_rules/rules/python-llm-ml-workflow-cursorrules-prompt-file/.cursorrules · 28.cursorrulesgithub-actionstestlint-formatstyletypes+480/1003 days ago
storybookjs/storybook.cursorrules · 91k.cursorrulestypescriptjavascript+6teststylearchdo-not+178/1003 days ago
paulpham157/paul-s-cursor-rules1/framework_rules/rules/flutter-riverpod-cursorrules-prompt-file/.cursorrules · 28.cursorrulesgithub-actionsstylearchdo-notagent-behaviour71/1003 days ago
forem/forem.cursorrules · 23k.cursorrulesrubyrails+9teststyletypesdatabase+471/1003 days ago
paulpham157/paul-s-cursor-rules1/framework_rules/rules/angular-novo-elements-cursorrules-prompt-file/.cursorrules · 28.cursorrulesgithub-actionstestlint-formatstylearch+370/1003 days ago
paulpham157/paul-s-cursor-rules1/framework_rules/rules/aspnet-abp-cursorrules-prompt-file/.cursorrules · 28.cursorrulesgithub-actionstestlint-formatstylearch+570/1003 days ago
RuleStack

Built by

Kynth Studio

Directory

Configs
Stacks
Compare formats
Diff two configs
Best AGENTS.md examples

Formats

AGENTS.md
CLAUDE.md
Cursor rules
Copilot instructions

Reference

Read API
Corpus health
Privacy Policy
Terms

RuleStack

RuleStack

Built by

Kynth Studio

Directory

Configs
Stacks
Compare formats
Diff two configs
Best AGENTS.md examples

Formats

AGENTS.md
CLAUDE.md
Cursor rules
Copilot instructions

Reference

Read API
Corpus health
Privacy Policy
Terms

RuleStack

RuleStack

Built by

Kynth Studio

Directory

Configs
Stacks
Compare formats
Diff two configs
Best AGENTS.md examples

Formats

AGENTS.md
CLAUDE.md
Cursor rules
Copilot instructions

Reference

Read API
Corpus health
Privacy Policy
Terms

RuleStack