Typescript .cursorrules prompt file guidelines
About .cursorrules prompt file
What you can build
TypeScript Code Analyzer: A tool that analyzes TypeScript code to ensure adherence to best practices and conventions, focusing on readability, simplicity, and testability.
Chain of Thought Code Helper: An AI assistant that guides developers through the process of outlining detailed plans, writing pseudocode, and implementing concise code in TypeScript.
Readable Code Linter: A linter that not only checks for syntax but also emphasizes readability, explicitness, and beginner-friendliness in TypeScript code.
Codebase Consistency Checker: A service that scans a codebase to ensure adherence to established conventions and patterns, minimizing style inconsistencies in TypeScript projects.
Functional Programming Guide for TypeScript: An educational platform that teaches developers how to write functional, side-effect-free code in TypeScript, complying with best practices.
Temp Directory Test Framework: A testing framework specifically designed to run tests using real files and directories, maintaining minimal shared state and practicing TypeScript test best practices.
@shopify/cli-kit Function Finder: A search tool integrated with the code editor to help developers find existing functions in the @shopify/cli-kit library, encouraging code reuse.
Explicitness Evaluator: A tool that analyzes TypeScript code to identify areas where clarity is compromised, suggesting improvements to make the code more explicit and understandable.
Descriptive Variables Enforcer: A code review tool that ensures descriptive, human-readable variable and function names are used throughout a TypeScript project.
Lint Compliance Refactoring Tool: A utility that automatically refactors TypeScript code to pass lint checks, ensuring the code is concise and follows the existing code style.
Benefits
- Emphasizes Chain of Thought method for solution development: detailed planning, pseudocode, confirmation, writing, and refinement for concision/readability.
- Focuses on clear coding principles, such as simplicity, readability, explicitness, and beginner-friendliness, alongside adherence to linting and codebase conventions.
- Prioritizes a developer-friendly experience, advocating for functional style, comprehensive implementation, and insightful commenting for clarity.
Synopsis
Developers can use this prompt to create maintainable, efficient, and readable TypeScript applications while adhering to best practices and company conventions.
Overview of .cursorrules prompt
The .cursorrules file provides guidelines for a Principal Developer to write clean, efficient, and maintainable Typescript code. It emphasizes adherence to codebase conventions, simplicity, readability, and testability, ensuring a beginner-friendly approach. The developer is instructed to employ a methodical approach using the Chain of Thought technique, integrating step-by-step planning, pseudocode, code refinement, and reasoning. It details strict coding practices, including avoiding placeholders (TODOs, FIXMEs), using descriptive naming, ensuring lint compliance, referencing existing functions, and writing functional-style code. Additionally, the importance of using real files in tests and minimizing shared states is highlighted. The file encourages honesty about knowledge gaps, stating that it's better to admit uncertainty than to guess.