JavaScript Node.js ES6+ .cursorrules prompt file
About .cursorrules prompt file
What you can build
Code Optimization Tool for JavaScript: A web-based tool that analyzes JavaScript code according to performance optimization guidelines such as chunking strategies, dynamic component loading, and best practices for pure functions. It outputs personalized optimization suggestions and refactors code automatically.
JavaScript Modularization Platform: An app that helps developers modularize their JavaScript code by organizing files systematically according to DRY principles. It provides a visual interface to sort files by their relevance and assists in naming conventions and directory structures.
ES6+ Syntax Highlighter and Converter: A browser extension that highlights and suggests ES6+ syntax improvements for JavaScript code written in other versions. The extension can automatically convert older syntax to ES6+ and highlight areas where async/await can replace traditional callback patterns.
Performance-Focused Node.js Template Generator: A website that generates boilerplate code for Node.js projects with built-in performance optimizations such as code splitting and dynamic imports. It uses the best practices as default configurations in the generated templates.
JavaScript Declarative Coding Tool: An IDE plugin that suggests transitions from imperative to declarative coding patterns. It provides on-the-fly suggestions to refactor loops into declarative operations like map, filter, reduce, and emphasizes functional patterns over object-oriented approaches.
Descriptive Naming Conventions Checker: A service that scans JavaScript projects and checks for descriptive variable naming practices, ensuring verbs and nouns are used correctly. It provides suggestions for improving variable names based on code context and auxiliary verbs guidelines.
Async/Await Refactoring Assistant: A development tool that analyzes asynchronous code using callbacks or promises and provides refactoring suggestions to convert them to async/await, highlighting improved clarity and potential pitfalls in callback hell.
Pure Function Verifier: A web app that allows users to enter code snippets and verify if a function is pure. It provides insights into side effects and suggests ways to refactor functions to adhere to purity principles for better performance and maintainability.
Benefits
- Emphasis on functional and declarative programming, discourages class usage, and promotes DRY principles.
- Advocates systematic organization of files by related content, ensuring clear separation of concerns.
- Recommends "function" keyword for pure functions, prioritizes async/await for asynchronous operations.
Synopsis
This prompt would benefit full-stack developers building scalable applications using JavaScript, Node.js, and Express by ensuring code maintainability and performance optimization.
Overview of .cursorrules prompt
The .cursorrules file provides guidelines for writing JavaScript, Node.js, and Typescript code with a focus on performance optimization and best practices. It emphasizes the use of functional and declarative programming patterns while avoiding classes. The rules aim for concise, maintainable, and technically accurate code, prioritizing iteration, modularization, and adherence to the DRY principle. It mandates the use of descriptive variable names and systematic organization of files. The file also specifies naming conventions for directories and exports, and details syntax preferences such as using the "function" keyword and async/await for asynchronous operations. Additionally, it includes strategies for performance optimization, such as dynamic loading and code splitting to reduce bundle sizes.