Solidity TypeScript .cursorrules prompt file
About .cursorrules prompt file
What you can build
Solidity Contract Linter and Formatter: A tool that analyzes and formats Solidity contracts, providing suggestions to improve readability, maintain functional programming practices, and ensure adherence to best practices such as modularization and early error handling.
TypeScript Functional Components Generator: A website that allows developers to input specifications and automatically generates TypeScript functional components following the RORO pattern and modern code structure, including named exports and descriptive variable names.
Node.js API Error Handling Middleware: A Node.js package offering middleware that implements a consistent error handling strategy, using guard clauses and early returns, and provides custom error types for express-based APIs.
Prisma ORM Starter Kit: A CLI tool that sets up a Node.js project preconfigured with Prisma, PostgreSQL or SQLite, TypeScript interfaces, and a recommended file structure for modular component exports and handling of static content and types.
Database Schema Optimization Advisor: A web service that reviews existing PostgreSQL or SQLite databases, suggesting optimizations and improvements. It focuses on iteration over duplication and early error validation in schema design to improve performance and maintainability.
TypeScript Code Refactoring Service: An online platform that accepts existing JavaScript/TypeScript code and refactors it to align with the latest best practices, such as the use of interfaces over types, early returns, and adoption of functional programming patterns.
Modular Directory Structure Generator: A tool that generates a project directory structure based on input specifications, ensuring directories are named using lowercase with dashes, and are organized into components, subcomponents, helpers, static content, and types.
Functional Programming Workshop for Node.js: An educational site offering tutorials and interactive exercises focused on teaching developers how to write functional, declarative code in Node.js using TypeScript, emphasizing modularization and the RORO pattern.
Custom Error Type Factory: A library that helps developers create consistent custom error types for their TypeScript projects, incorporating user-friendly error messages and best practices for logging and handling errors.
Iterative Development Guide: A resource site providing comprehensive guides and examples on using iteration and modularization over duplication across various stages of the software development lifecycle, particularly in TypeScript and Node.js projects.
Benefits
- Emphasizes functional, declarative programming, avoiding classes, and using iteration and modularization to minimize duplication.
- Enforces a structured file organization: components, subcomponents, helpers, static content, and types.
- Provides a comprehensive error handling strategy prioritizing early returns, custom error types, and guard clauses.
Synopsis
Blockchain developers can use this prompt to build robust, maintainable smart contracts with Solidity and TypeScript, implementing TypeScript server-side logic with Node.js, and efficiently managing databases with Prisma and Postgres/Sqlite3.
Overview of .cursorrules prompt
The .cursorrules file outlines a set of coding guidelines and best practices for developers working with Solidity, TypeScript, Node.js, Postgres, SQLite3, and Prisma. It emphasizes concise and technical responses with accurate TypeScript examples, encouraging the use of functional and declarative programming approaches while avoiding classes. Modularization and iteration are preferred over code duplication, and descriptive variable naming conventions are prescribed. It specifies directory naming conventions, favors named exports for components, and advocates for the use of the Receive an Object, Return an Object (RORO) pattern. The file also provides detailed guidance for JavaScript and TypeScript practices, promoting the use of the "function" keyword for pure functions, TypeScript interfaces over types, and a structured file organization. Error handling and validation are prioritized, with strategies such as early returns, guard clauses, and error logging detailed to encourage robust and readable code.