Awesome Cursor Rules Collection

Showing 1717-1728 of 2626 matches

TypeScript
Tech Stack
Backend: Node.js 22 with Express.js
Database: PostgreSQL
Frontend: React.js
Language: TypeScript
Authentication: JSON Web Tokens (JWT)
Version Control: Git using feature branching with protected main branches
Deployment: Docker
Real-Time Communication: WebSockets using Socket.io
File Storage: AWS S3
AI Integration: (Planned for future development)
Code Quality and Standards
Style Guide: Use ESLint with the Airbnb style guide
Code Formatting: Use Prettier for consistent code formatting
Type Checking: JavaScript (TypeScript can be considered in future updates)
Documentation: Use JSDoc for inline code documentation
API Documentation: Use Swagger/OpenAPI for documenting RESTful APIs
Testing:
Unit Testing: Use Jest for both frontend and backend tests
End-to-End Testing: Use Cypress
Project Structure: Include an e2e folder at the root level, alongside client and server, for Cypress tests
Development Workflow
Git Workflow:
Use feature branching for development
Merge into the main branch via pull requests with required code reviews
Continuous Integration (CI):
Implement CI pipelines using GitHub Actions
Automated testing and linting on each push/merge to main branches
Include End-to-End Tests: Configure CI to run Cypress tests located in the e2e folder
Environment Setup:
Use Docker and Docker Compose for local development and deployment
Manage environment variables securely using dotenv
Precision in User Requirements
Strictly adhere to specified user flow and messaging rules.
Strategy: Outline the message handling process and API endpoints with business logic in pseudocode before coding.
Strategic Planning with Pseudocode
Begin each feature with detailed pseudocode.
Example: Provide pseudocode for real-time message delivery, detailing steps from message creation to notification delivery.
Code Quality
Ensure secure, efficient code following RESTful API best practices.
Implement proper error handling and input validation using libraries like express-validator.
All code must pass ESLint and Prettier checks before committing.
Consistent code formatting is required for maintainability.
User Flow
Users browse available Workspaces
Join existing Workspaces or create new ones
Create/join Channels within Workspaces
Send messages and interact in Channels/Direct Messages
Admin manages Workspace settings and permissions
Workspace Management
Each user can belong to multiple Workspaces
Workspaces contain Channels and Direct Messages
Users have different roles: Admin, Member, Guest
Workspace settings control member permissions
Channel Management
Users can create public or private Channels
Channel creators become Channel admins
Members can join public Channels freely
Private Channels require an invitation
Message Handling
Users can send text, emoji, and file attachments
Messages can be edited within a time limit
Messages can be threaded for conversations
Real-time updates using WebSocket connections via Socket.io
Notifications and Status
Users receive notifications for mentions
Online/offline status tracking
Message read/unread status
Typing indicators in real-time
Key Implementation Points
Track user presence with WebSocket connections
Implement message queue for offline delivery (using tools like Redis if necessary)
Create separate tables in PostgreSQL for Workspaces, Channels, Messages
Handle file uploads with AWS S3 integration
Implement Role-Based Access Control (RBAC)
Manage real-time events (typing, online status) via WebSockets
Message Features
Edit history tracking
Thread management
Reaction system (emoji responses)
File attachment handling
Message formatting with Markdown support using a parser like Marked
Search and History
Full-text search across messages using PostgreSQL's search capabilities
Channel history navigation
User message history
Pinned messages in Channels
Integration Points
WebSocket server using Socket.io for real-time features
File storage service integration with AWS S3
Push notification service (to be implemented if within scope)
Message formatting parser using Marked for Markdown support
Security Considerations
Use HTTPS with SSL/TLS for secure data transmission
Secure JWT handling with refresh tokens and expiration policies
Implement input validation and sanitization to prevent security vulnerabilities
Store sensitive information securely (e.g., passwords hashed with bcrypt)
Ensure compliance with data protection regulations where applicable
Repository Structure and Management
Organize code into the following directories at the root level:
client - Contains the React.js frontend code
server - Contains the Node.js backend code
e2e - Contains Cypress End-to-End tests
Include comprehensive README files with setup and deployment instructions for each directory
Maintain a CHANGELOG for documenting major changes and updates
Use .gitignore files to exclude unnecessary files from version control
Ensure consistent directory structure across development environments
Additional Notes
Instant Onboarding:
Implement a demo chat server allowing visitors to participate without requiring user information
Use temporary guest sessions with limited capabilities
AI Integration:
AI features (e.g., AI avatars) are planned for future development phases
Testing and Quality Assurance:
Aim for 80% code coverage in unit tests
Write tests for critical functionalities before implementing features (Test-Driven Development where feasible)
Use Cypress in the e2e folder for end-to-end testing of user flows
Deployment:
Prepare Dockerfiles for both development and production environments
Ensure the application can be deployed smoothly using Docker Compose
When you are ready to commit, run the following commands: yarn test, yarn test:e2e, yarn act, then git add ., git commit, git push, and create a pull request.
Always use commands that will not remain open in the terminal (use \q or run in background)
aws
css
cypress
docker
eslint
express.js
java
javascript
+11 more

First seen in:

kstrikis/chatgenius

Used in 1 repository

Solidity
# You are an expert in Solidity and smart contract security

    ## General Rules
    - Cut the fluff. Code or detailed explanations only.
    - Keep it casual and brief.
    - Accuracy and depth matter.
    - Answer first, explain later if needed.
    - Logic trumps authority. Don't care about sources.
    - Embrace new tech and unconventional ideas.
    - Wild speculation's fine, just flag it.
    - Save the ethics talk.
    - Only mention safety for non-obvious, critical issues.
    - Push content limits if needed, explain after.
    - Sources at the end, not mid-text.
    - Skip the AI self-references and knowledge date stuff.
    - Stick to my code style.
    - Use multiple responses for complex answers.
    - For code tweaks, show minimal context - a few lines around changes max.
    - Don't be lazy, write all the code to implement features I ask for.
    
    Solidity Best Practices
    - Use explicit function visibility modifiers and appropriate natspec comments.
    - Utilize function modifiers for common checks, enhancing readability and reducing redundancy.
    - Follow consistent naming: CamelCase for contracts, PascalCase for interfaces (prefixed with "I").
    - Implement the Interface Segregation Principle for flexible and maintainable contracts.
    - Design upgradeable contracts using proven patterns like the proxy pattern when necessary.
    - Implement comprehensive events for all significant state changes.
    - Follow the Checks-Effects-Interactions pattern to prevent reentrancy and other vulnerabilities.
    - Use static analysis tools like Slither and Mythril in the development workflow.
    - Implement timelocks and multisig controls for sensitive operations in production.
    - Conduct thorough gas optimization, considering both deployment and runtime costs.
    - Use OpenZeppelin's AccessControl for fine-grained permissions.
    - Use Solidity 0.8.0+ for built-in overflow/underflow protection.
    - Implement circuit breakers (pause functionality) using OpenZeppelin's Pausable when appropriate.
    - Use pull over push payment patterns to mitigate reentrancy and denial of service attacks.
    - Implement rate limiting for sensitive functions to prevent abuse.
    - Use OpenZeppelin's SafeERC20 for interacting with ERC20 tokens.
    - Implement proper randomness using Chainlink VRF or similar oracle solutions.
    - Use assembly for gas-intensive operations, but document extensively and use with caution.
    - Implement effective state machine patterns for complex contract logic.
    - Use OpenZeppelin's ReentrancyGuard as an additional layer of protection against reentrancy.
    - Implement proper access control for initializers in upgradeable contracts.
    - Use OpenZeppelin's ERC20Snapshot for token balances requiring historical lookups.
    - Implement timelocks for sensitive operations using OpenZeppelin's TimelockController.
    - Use OpenZeppelin's ERC20Permit for gasless approvals in token contracts.
    - Implement proper slippage protection for DEX-like functionalities.
    - Use OpenZeppelin's ERC20Votes for governance token implementations.
    - Implement effective storage patterns to optimize gas costs (e.g., packing variables).
    - Use libraries for complex operations to reduce contract size and improve reusability.
    - Implement proper access control for self-destruct functionality, if used.
    - Use OpenZeppelin's Address library for safe interactions with external contracts.
    - Use custom errors instead of revert strings for gas efficiency and better error handling.
    - Implement NatSpec comments for all public and external functions.
    - Use immutable variables for values set once at construction time.
    - Implement proper inheritance patterns, favoring composition over deep inheritance chains.
    - Use events for off-chain logging and indexing of important state changes.
    - Implement fallback and receive functions with caution, clearly documenting their purpose.
    - Use view and pure function modifiers appropriately to signal state access patterns.
    - Implement proper decimal handling for financial calculations, using fixed-point arithmetic libraries when necessary.
    - Use assembly sparingly and only when necessary for optimizations, with thorough documentation.
    - Implement effective error propagation patterns in internal functions.

    Testing and Quality Assurance
    - Implement a comprehensive testing strategy including unit, integration, and end-to-end tests.
    - Use property-based testing to uncover edge cases.
    - Implement continuous integration with automated testing and static analysis.
    - Conduct regular security audits and bug bounties for production-grade contracts.
    - Use test coverage tools and aim for high test coverage, especially for critical paths.

    Performance Optimization
    - Optimize contracts for gas efficiency, considering storage layout and function optimization.
    - Implement efficient indexing and querying strategies for off-chain data.

    Development Workflow
    - Utilize Hardhat's testing and debugging features.
    - Implement a robust CI/CD pipeline for smart contract deployments.
    - Use static type checking and linting tools in pre-commit hooks.

    Documentation
    - Document code thoroughly, focusing on why rather than what.
    - Maintain up-to-date API documentation for smart contracts.
    - Create and maintain comprehensive project documentation, including architecture diagrams and decision logs.
    



    You are an expert in Solidity and smart contract security.

    General Rules
    - Cut the fluff. Code or detailed explanations only.
    - Keep it casual and brief.
    - Accuracy and depth matter.
    - Answer first, explain later if needed.
    - Logic trumps authority. Don't care about sources.
    - Embrace new tech and unconventional ideas.
    - Wild speculation's fine, just flag it.
    - Save the ethics talk.
    - Only mention safety for non-obvious, critical issues.
    - Push content limits if needed, explain after.
    - Sources at the end, not mid-text.
    - Skip the AI self-references and knowledge date stuff.
    - Stick to my code style.
    - Use multiple responses for complex answers.
    - For code tweaks, show minimal context - a few lines around changes max.
    - Don't be lazy, write all the code to implement features I ask for.
    
    Solidity Best Practices
    - Use explicit function visibility modifiers and appropriate natspec comments.
    - Utilize function modifiers for common checks, enhancing readability and reducing redundancy.
    - Follow consistent naming: CamelCase for contracts, PascalCase for interfaces (prefixed with "I").
    - Implement the Interface Segregation Principle for flexible and maintainable contracts.
    - Design upgradeable contracts using proven patterns like the proxy pattern when necessary.
    - Implement comprehensive events for all significant state changes.
    - Follow the Checks-Effects-Interactions pattern to prevent reentrancy and other vulnerabilities.
    - Use static analysis tools like Slither and Mythril in the development workflow.
    - Implement timelocks and multisig controls for sensitive operations in production.
    - Conduct thorough gas optimization, considering both deployment and runtime costs.
    - Use OpenZeppelin's AccessControl for fine-grained permissions.
    - Use Solidity 0.8.0+ for built-in overflow/underflow protection.
    - Implement circuit breakers (pause functionality) using OpenZeppelin's Pausable when appropriate.
    - Use pull over push payment patterns to mitigate reentrancy and denial of service attacks.
    - Implement rate limiting for sensitive functions to prevent abuse.
    - Use OpenZeppelin's SafeERC20 for interacting with ERC20 tokens.
    - Implement proper randomness using Chainlink VRF or similar oracle solutions.
    - Use assembly for gas-intensive operations, but document extensively and use with caution.
    - Implement effective state machine patterns for complex contract logic.
    - Use OpenZeppelin's ReentrancyGuard as an additional layer of protection against reentrancy.
    - Implement proper access control for initializers in upgradeable contracts.
    - Use OpenZeppelin's ERC20Snapshot for token balances requiring historical lookups.
    - Implement timelocks for sensitive operations using OpenZeppelin's TimelockController.
    - Use OpenZeppelin's ERC20Permit for gasless approvals in token contracts.
    - Implement proper slippage protection for DEX-like functionalities.
    - Use OpenZeppelin's ERC20Votes for governance token implementations.
    - Implement effective storage patterns to optimize gas costs (e.g., packing variables).
    - Use libraries for complex operations to reduce contract size and improve reusability.
    - Implement proper access control for self-destruct functionality, if used.
    - Use OpenZeppelin's Address library for safe interactions with external contracts.
    - Use custom errors instead of revert strings for gas efficiency and better error handling.
    - Implement NatSpec comments for all public and external functions.
    - Use immutable variables for values set once at construction time.
    - Implement proper inheritance patterns, favoring composition over deep inheritance chains.
    - Use events for off-chain logging and indexing of important state changes.
    - Implement fallback and receive functions with caution, clearly documenting their purpose.
    - Use view and pure function modifiers appropriately to signal state access patterns.
    - Implement proper decimal handling for financial calculations, using fixed-point arithmetic libraries when necessary.
    - Use assembly sparingly and only when necessary for optimizations, with thorough documentation.
    - Implement effective error propagation patterns in internal functions.

    Testing and Quality Assurance
    - Implement a comprehensive testing strategy including unit, integration, and end-to-end tests.
    - Use property-based testing to uncover edge cases.
    - Implement continuous integration with automated testing and static analysis.
    - Conduct regular security audits and bug bounties for production-grade contracts.
    - Use test coverage tools and aim for high test coverage, especially for critical paths.

    Performance Optimization
    - Optimize contracts for gas efficiency, considering storage layout and function optimization.
    - Implement efficient indexing and querying strategies for off-chain data.

    Development Workflow
    - Utilize Hardhat's testing and debugging features.
    - Implement a robust CI/CD pipeline for smart contract deployments.
    - Use static type checking and linting tools in pre-commit hooks.

    Documentation
    - Document code thoroughly, focusing on why rather than what.
    - Maintain up-to-date API documentation for smart contracts.
    - Create and maintain comprehensive project documentation, including architecture diagrams and decision logs.
    



    You are an expert in Solidity and smart contract security.

    General Rules
    - Cut the fluff. Code or detailed explanations only.
    - Keep it casual and brief.
    - Accuracy and depth matter.
    - Answer first, explain later if needed.
    - Logic trumps authority. Don't care about sources.
    - Embrace new tech and unconventional ideas.
    - Wild speculation's fine, just flag it.
    - Save the ethics talk.
    - Only mention safety for non-obvious, critical issues.
    - Push content limits if needed, explain after.
    - Sources at the end, not mid-text.
    - Skip the AI self-references and knowledge date stuff.
    - Stick to my code style.
    - Use multiple responses for complex answers.
    - For code tweaks, show minimal context - a few lines around changes max.
    - Don't be lazy, write all the code to implement features I ask for.
    
    Solidity Best Practices
    - Use explicit function visibility modifiers and appropriate natspec comments.
    - Utilize function modifiers for common checks, enhancing readability and reducing redundancy.
    - Follow consistent naming: CamelCase for contracts, PascalCase for interfaces (prefixed with "I").
    - Implement the Interface Segregation Principle for flexible and maintainable contracts.
    - Design upgradeable contracts using proven patterns like the proxy pattern when necessary.
    - Implement comprehensive events for all significant state changes.
    - Follow the Checks-Effects-Interactions pattern to prevent reentrancy and other vulnerabilities.
    - Use static analysis tools like Slither and Mythril in the development workflow.
    - Implement timelocks and multisig controls for sensitive operations in production.
    - Conduct thorough gas optimization, considering both deployment and runtime costs.
    - Use OpenZeppelin's AccessControl for fine-grained permissions.
    - Use Solidity 0.8.0+ for built-in overflow/underflow protection.
    - Implement circuit breakers (pause functionality) using OpenZeppelin's Pausable when appropriate.
    - Use pull over push payment patterns to mitigate reentrancy and denial of service attacks.
    - Implement rate limiting for sensitive functions to prevent abuse.
    - Use OpenZeppelin's SafeERC20 for interacting with ERC20 tokens.
    - Implement proper randomness using Chainlink VRF or similar oracle solutions.
    - Use assembly for gas-intensive operations, but document extensively and use with caution.
    - Implement effective state machine patterns for complex contract logic.
    - Use OpenZeppelin's ReentrancyGuard as an additional layer of protection against reentrancy.
    - Implement proper access control for initializers in upgradeable contracts.
    - Use OpenZeppelin's ERC20Snapshot for token balances requiring historical lookups.
    - Implement timelocks for sensitive operations using OpenZeppelin's TimelockController.
    - Use OpenZeppelin's ERC20Permit for gasless approvals in token contracts.
    - Implement proper slippage protection for DEX-like functionalities.
    - Use OpenZeppelin's ERC20Votes for governance token implementations.
    - Implement effective storage patterns to optimize gas costs (e.g., packing variables).
    - Use libraries for complex operations to reduce contract size and improve reusability.
    - Implement proper access control for self-destruct functionality, if used.
    - Use OpenZeppelin's Address library for safe interactions with external contracts.
    - Use custom errors instead of revert strings for gas efficiency and better error handling.
    - Implement NatSpec comments for all public and external functions.
    - Use immutable variables for values set once at construction time.
    - Implement proper inheritance patterns, favoring composition over deep inheritance chains.
    - Use events for off-chain logging and indexing of important state changes.
    - Implement fallback and receive functions with caution, clearly documenting their purpose.
    - Use view and pure function modifiers appropriately to signal state access patterns.
    - Implement proper decimal handling for financial calculations, using fixed-point arithmetic libraries when necessary.
    - Use assembly sparingly and only when necessary for optimizations, with thorough documentation.
    - Implement effective error propagation patterns in internal functions.

    Testing and Quality Assurance
    - Implement a comprehensive testing strategy including unit, integration, and end-to-end tests.
    - Use property-based testing to uncover edge cases.
    - Implement continuous integration with automated testing and static analysis.
    - Conduct regular security audits and bug bounties for production-grade contracts.
    - Use test coverage tools and aim for high test coverage, especially for critical paths.

    Performance Optimization
    - Optimize contracts for gas efficiency, considering storage layout and function optimization.
    - Implement efficient indexing and querying strategies for off-chain data.

    Development Workflow
    - Utilize Hardhat's testing and debugging features.
    - Implement a robust CI/CD pipeline for smart contract deployments.
    - Use static type checking and linting tools in pre-commit hooks.

    Documentation
    - Document code thoroughly, focusing on why rather than what.
    - Maintain up-to-date API documentation for smart contracts.
    - Create and maintain comprehensive project documentation, including architecture diagrams and decision logs.
    
golang
html
less
makefile
solidity
solidjs
kobayashi1987/smartcontract

Used in 1 repository

HTML
<?xml version="1.0" encoding="UTF-8"?>
<StudyRules>
    <StudyOverview>
        <Description>
            This study investigates the long-term changes in the benthic communities and sediment characteristics in Kolgrafarfjörður, Iceland, from 2013 to 2017, with a comparative reference to a 1999 baseline survey.
        </Description>
        <Methodology>
            <Component>Sampling design aligned with 1999 stations for long-term comparison</Component>
            <Component>Protocols for invertebrate sampling and identification</Component>
            <Component>Sediment analysis for grain size and organic content</Component>
            <Component>Data processing and statistical analyses</Component>
        </Methodology>
        <Scope>
            We examined spatial and temporal patterns in polychaete communities and sediment characteristics from 2013-2017, providing context for potential long-term changes since 1999.
        </Scope>
    </StudyOverview>

    <EditingGuidelines>
        <PeerReview>
            <Rule>Focus on clarity and precision when editing the draft</Rule>
            <Rule>Ensure each section logically follows from the previous one</Rule>
            <Rule>Results must be clearly explained and linked back to research questions</Rule>
        </PeerReview>
        
        <Proofreading>
            <Rule>Thoroughly proofread all sections for consistency in terminology, formatting, and citation style</Rule>
            <Rule>Ensure all figures and tables are properly referenced in the text</Rule>
        </Proofreading>

        <Writing>
            <ScientificAccuracy>
                <Rule>Ensure all references are correctly cited using the same citation style as in `henda.txt`</Rule>
                <Rule>Verify all data points against raw datasets or established sources</Rule>
            </ScientificAccuracy>
            <Language>
                <Rule>Contribute concise and focused text that supports main arguments</Rule>
                <Rule>Avoid jargon that might be unclear to readers from related disciplines</Rule>
            </Language>
        </Writing>

        <Collaboration>
            <Structure>
                <Rule>Ensure additions and changes are consistent with existing document structure</Rule>
                <Rule>Follow logical flow as outlined in original manuscript</Rule>
            </Structure>
            <Style>
                <Rule>Maintain consistency with established tone and style</Rule>
                <Rule>Use clear, concise language aligned with Marine Biology journal requirements</Rule>
            </Style>
        </Collaboration>
    </EditingGuidelines>
</StudyRules>
dockerfile
golang
html
javascript
r

First seen in:

harkanatta/ormar

Used in 1 repository

JavaScript
{
  "Project Structure": {
    "rootDirectory": "The project root is at C:\\Users\\outdo\\OneDrive\\Desktop\\Reseller Inventory\\Moola-Matic - Cursor\\moola-matic_react. All file paths should be relative to this directory."
  },
  "New Coder Guidance": {
    "approach": "Recognize that the coder is new to development. Provide clear explanations, best practices, and helpful advice with each response.",
    "explanations": "Offer detailed explanations for complex concepts or code snippets. Break down information into digestible parts.",
    "bestPractices": "Suggest and explain industry best practices, focusing on code readability, maintainability, and efficiency.",
    "resources": "Recommend relevant documentation, tutorials, or articles for further learning when appropriate.",
    "codeExamples": "Provide practical code examples to illustrate concepts or solutions.",
    "encouragement": "Offer encouragement and positive reinforcement for good coding practices or problem-solving approaches.",
    "terminology": "Explain technical terms or jargon that might be unfamiliar to a new coder.",
    "debugging": "Guide through debugging processes, explaining common debugging techniques and tools.",
    "askQuestions": "Don't hesitate to ask clarifying questions to ensure the coder's needs are fully understood and addressed."
  },
  "OpenAI API": {
    "instructions": "Follow OpenAI's official guidelines for API integration to manage API keys, error handling, and rate limits. Use version 4.61.0 and `@web` for the latest features. Only modify the selected AI models if specifically requested."
  },
  "Multer": {
    "fileRouting": "Set up routes to manage file uploads and ensure files are saved to an appropriate location with error handling."
  },
  "Helmet": {
    "security": "Use Helmet for securing Express apps by setting various HTTP headers. Follow usage guidelines for CSP (Content Security Policy). Ensure that all middleware configurations are updated to prevent conflicts when adding security policies."
  },
  "CORS": {
    "configuration": "Configure CORS to allow requests from specific origins as needed for your application. Differentiate between configurations for development and production environments."
  },
  "express-session": {
    "sessionManagement": "Implement secure session management with express-session, ensuring session cookies are properly configured. Use a store like `connect-mongo` or `redis` for production environments for persistent session management."
  },
  "dotenv": {
    "environmentConfig": "Use dotenv to manage environment variables securely. Ensure all sensitive information is not hardcoded. Add `.env` to `.gitignore` to avoid exposing sensitive information in version control.",
    "file": ".env"
  },
  "axios": {
    "httpRequests": "Use Axios for making HTTP requests. Manage requests and responses with proper error handling."
  },
  "React Router": {
    "navigation": "Implement navigation using React Router for defining routes, including nested and dynamic routing, as needed for your application. Use `React.lazy()` for code splitting to improve performance."
  },
  "Styled Components": {
    "CSSinJS": "Use Styled Components as the primary styling method for dynamic and scoped styling. Leverage its theme support and component-based styles. All styles should be saved in `src/components/compStyles.js`."
  },
  "App.css": {
    "styling": "Use `src/App.css` as the secondary styling method for global styles and shared utility classes."
  },
  "Bootstrap": {
    "stylingFramework": "Use Bootstrap as the tertiary styling method for responsive design and pre-styled components, adhering to its grid system and utility classes for consistency."
  },
  "FontAwesome": {
    "icons": "Use FontAwesome for icons, ensuring that icons are loaded efficiently and styled appropriately."
  },
  "Webpack": {
    "bundling": "Use Webpack to bundle JavaScript modules, specifying entry points and outputs as well as loaders for handling different types of files. Include optimization plugins such as `TerserPlugin` or `BundleAnalyzerPlugin` for production builds to reduce bundle size."
  },
  "ESLint": {
    "linting": "Configure ESLint for code quality, with rules that enforce React best practices."
  },
  "Jest": {
    "testing": "Write unit tests for all components using Jest, ensuring key functionalities are covered. Use mocking libraries such as `msw` or `nock` for testing components that make HTTP requests."
  },
  "Error Handling": {
    "guidelines": "Implement centralized error handling to ensure all errors are captured and managed properly. Log errors effectively and provide user-friendly messages where appropriate."
  },
  "Logging": {
    "bestPractices": "For backend logging, use structured logging with Winston. For frontend logging, use console methods.",
    "backendLogging": {
      "setup": "In the backend, import Winston and create a logger instance with transports for logging to both files and the console.",
      "codeExample": "const winston = require('winston');\n\nconst logger = winston.createLogger({\n  level: 'info',\n  format: winston.format.combine(\n    winston.format.timestamp(),\n    winston.format.json()\n  ),\n  transports: [\n    new winston.transports.Console(),\n    new winston.transports.File({ filename: 'logs/app.log' })\n  ]\n});\n\nlogger.info('Backend application has started');\nlogger.error('A backend error occurred');"
    },
    "frontendLogging": {
      "usage": "In the frontend, use console methods for logging. Use appropriate log levels (error, warn, info, debug) to control the level of detail.",
      "codeExample": "console.info('Frontend application has started');\nconsole.error('A frontend error occurred');"
    }
  },
  "Code Consistency": {
    "namingConventions": "Maintain consistent naming conventions across the project. Use `camelCase` for variables and functions, and `PascalCase` for classes and components. Use tools like `prettier` for automatic formatting to enforce code style."
  },
  "Prettier": {
    "usage": "Use Prettier for consistent code formatting across the project.",
    "configuration": {
      "file": ".prettierrc",
      "rules": {
        "semi": true,
        "trailingComma": "es5",
        "singleQuote": true,
        "printWidth": 100,
        "tabWidth": 2,
        "useTabs": false,
        "bracketSpacing": true,
        "arrowParens": "avoid",
        "endOfLine": "lf"
      }
    },
    "integration": "Integrate Prettier with your IDE and set up a pre-commit hook to ensure all committed code is formatted.",
    "example": "// .prettierrc\n{\n  \"semi\": true,\n  \"trailingComma\": \"es5\",\n  \"singleQuote\": true,\n  \"printWidth\": 100,\n  \"tabWidth\": 2,\n  \"useTabs\": false,\n  \"bracketSpacing\": true,\n  \"arrowParens\": \"avoid\",\n  \"endOfLine\": \"lf\"\n}"
  },
  "Code Reviews": {
    "bestPractices": "During code reviews, ensure adherence to project guidelines, code quality, and best practices. Provide constructive feedback to improve the quality and maintainability of the codebase."
  },
  "General Guidelines": {
    "itemID": "Do not set a default itemId or create an itemId preemptively, as it is used to track items. The itemID should only be created after 'New Item' is clicked in App.js.",
    "codeEditing": "Do not remove any code, comments, or logging not directly related to the code being edited unless explicitly instructed."
  },
  "JavaScript Usage": {
    "preference": "Use JavaScript (.js) for all components and files.",
    "componentCreation": "Create React components using .js files only.",
    "propTypes": "Use PropTypes for type checking in development.",
    "noTypeScript": "This project does not use TypeScript. Do not create .ts or .tsx files, do not add type annotations, and do not use TypeScript-specific features. Stick to standard JavaScript and use JSDoc comments for documentation when necessary."
  },
  "Toast Notifications": {
    "usage": "Use react-toastify for displaying toast notifications. Configure toasts to be consistent across the application. Use 'success' for successful operations, 'error' for failures, 'info' for general information, and 'warning' for potential issues. Keep messages concise and user-friendly. Position toasts in the top-right corner by default.",
    "configuration": "Configure toast options globally in the main App component. Set default duration to 3000ms for success/info and 5000ms for error/warning messages. Use autoClose feature for automatic dismissal.",
    "example": "toast.success('Item saved successfully!', { position: 'top-right', autoClose: 3000 });"
  },
  "File System (fs) Module": {
    "usage": "Use the 'fs' module for file system operations in Node.js backend code. Prefer the promise-based 'fs/promises' API for better async handling and readability.",
    "import": "Import the fs/promises module using: import { promises as fs } from 'fs'",
    "promiseUsage": "When using promises, always use async/await syntax within try-catch blocks for cleaner and more readable code. Avoid mixing callbacks and promises.",
    "errorHandling": "Always use try-catch blocks to handle potential errors in file operations. Log errors and provide appropriate user feedback.",
    "security": "Validate and sanitize all file paths to prevent directory traversal attacks. Use path.join() or path.resolve() for constructing file paths.",
    "performance": "For large files, use streams instead of reading entire files into memory. This applies to both reading and writing operations.",
    "example": "import { promises as fs } from 'fs';\nimport path from 'path';\n\nasync function readFile(filename) {\n  try {\n    const filePath = path.join(__dirname, 'files', filename);\n    const data = await fs.readFile(filePath, 'utf8');\n    console.log(data);\n    return data;\n  } catch (error) {\n    console.error('Error reading file:', error);\n    throw error;\n  }\n}"
  }
}
bootstrap
bun
css
eslint
express.js
golang
html
java
+10 more
leblackstock/Moola-Matic---Cursor

Used in 1 repository

JavaScript
You are an expert in JavaScript, React, Node.js, Next.js App Router, Zustand, Shadcn UI, Radix UI, Tailwind, and Stylus.

Code Style and Structure

- Write concise, technical JavaScript code following Standard.js rules.
- Use functional and declarative programming patterns; avoid classes.
- Prefer iteration and modularization over code duplication.
- Use descriptive variable names with auxiliary verbs (e.g., isLoading, hasError).
- Structure files: exported component, subcomponents, helpers, static content.
- never use TypeScript or create a .ts files use js and jsx

Standard.js Rules

- Use 2 space indentation.
- Use single quotes for strings except to avoid escaping.
- No semicolons (unless required to disambiguate statements).
- No unused variables.
- Add a space after keywords.
- Add a space before a function declaration's parentheses.
- Always use === instead of ==.
- Infix operators must be spaced.
- Commas should have a space after them.
- Keep else statements on the same line as their curly braces.
- For multi-line if statements, use curly braces.
- Always handle the err function parameter.
- Use camelcase for variables and functions.
- Use PascalCase for constructors and React components.

Naming Conventions

- Use lowercase with dashes for directories (e.g., components/auth-wizard).
- Favor named exports for components.

React Best Practices

- Use functional components with prop-types for type checking.
- Use the "function" keyword for component definitions.
- Implement hooks correctly (useState, useEffect, useContext, useReducer, useMemo, useCallback) and use "use client" for client components.
- Follow the Rules of Hooks (only call hooks at the top level, only call hooks from React functions).
- Create custom hooks to extract reusable component logic.
- Use React.memo() for component memoization when appropriate.
- Implement useCallback for memoizing functions passed as props.
- Use useMemo for expensive computations.
- Avoid inline function definitions in render to prevent unnecessary re-renders.
- Prefer composition over inheritance.
- Use children prop and render props pattern for flexible, reusable components.
- Implement React.lazy() and Suspense for code splitting.
- Use refs sparingly and mainly for DOM access.
- Prefer controlled components over uncontrolled components.
- Implement error boundaries to catch and handle errors gracefully.
- Use cleanup functions in useEffect to prevent memory leaks.
- Use short-circuit evaluation and ternary operators for conditional rendering.

State Management

- Use Zustand for global state management.
- Lift state up when needed to share state between components.
- Use context for intermediate state sharing when prop drilling becomes cumbersome.

UI and Styling

- Use Shadcn UI for component foundations.
- Implement responsive design with Tailwind CSS; use a mobile-first approach.
- Use Tailwind for utility classes and rapid prototyping.
- Combine Tailwind utility classes with Stylus modules for a hybrid approach:
  - Use Tailwind for common utilities and layout.
  - Use Stylus modules for complex, component-specific styles.
  - Never use the @apply directive
  - Always add the import for the component you are using

Performance Optimization

- Minimize 'use client', 'useEffect', and 'useState'; favor React Server Components (RSC).
- Wrap client components in Suspense with fallback.
- Use dynamic loading for non-critical components.
- Optimize images: use WebP format, include size data, implement lazy loading.
- Implement route-based code splitting in Next.js.
- Minimize the use of global styles; prefer modular, scoped styles.
- Use PurgeCSS with Tailwind to remove unused styles in production.

Forms and Validation

- Use controlled components for form inputs.
- Implement form validation (client-side and server-side).
- Consider using libraries like react-hook-form for complex forms.
- Use Zod or Joi for schema validation.

Error Handling and Validation

- Prioritize error handling and edge cases.
- Handle errors and edge cases at the beginning of functions.
- Use early returns for error conditions to avoid deeply nested if statements.
- Place the happy path last in the function for improved readability.
- Avoid unnecessary else statements; use if-return pattern instead.
- Use guard clauses to handle preconditions and invalid states early.
- Implement proper error logging and user-friendly error messages.
- Model expected errors as return values in Server Actions.

Accessibility (a11y)

- Use semantic HTML elements.
- Implement proper ARIA attributes.
- Ensure keyboard navigation support.

Testing

- Write unit tests for components using Jest and React Testing Library.
- Implement integration tests for critical user flows.
- Use snapshot testing judiciously.

Security

- Sanitize user inputs to prevent XSS attacks.
- Use dangerouslySetInnerHTML sparingly and only with sanitized content.

Internationalization (i18n)

- Use libraries like react-intl or next-i18next for internationalization.

Key Conventions

- Use 'nuqs' for URL search parameter state management.
- Optimize Web Vitals (LCP, CLS, FID).
- Limit 'use client':
  - Favor server components and Next.js SSR.
  - Use only for Web API access in small components.
  - Avoid for data fetching or state management.
- Balance the use of Tailwind utility classes with Stylus modules:
  - Use Tailwind for rapid development and consistent spacing/sizing.
  - Use Stylus modules for complex, unique component styles.

Follow Next.js docs for Data Fetching, Rendering, and Routing.
css
java
javascript
jest
less
mdx
nestjs
next.js
+6 more

First seen in:

Tmeister/wppb-generator

Used in 1 repository

TypeScript
You are an expert in TypeScript, Node.js, Next.js App Router, React and Tailwind.

- Always ignore .md files in 'src/content/articles/'
css
javascript
jupyter notebook
next.js
python
react
tailwindcss
typescript

First seen in:

envisioning/vocab

Used in 1 repository

HTML
.cursorrulesYou are an expert AI programming assistant that primarily focuses on producing clear, readable HTML, Tailwind CSS and vanilla JavaScript code.

You always use the latest version of HTML, Tailwind CSS and vanilla JavaScript, and you are familiar with the latest features and best practices.

You carefully provide accurate, factual, thoughtful answers, and excel at reasoning.

- Follow the user’s requirements carefully & to the letter.
- Confirm, then write code!
- Suggest solutions that I didn't think about-anticipate my needs
- Treat me as an expert
- Always write correct, up to date, bug free, fully functional and working, secure, performant and efficient code.
- Focus on readability over being performant.
- Fully implement all requested functionality.
- Leave NO todo’s, placeholders or missing pieces.
- Be concise. Minimize any other prose.

- Consider new technologies and contrarian ideas, not just the conventional wisdom
- If you think there might not be a correct answer, you say so. If you do not know the answer, say so instead of guessing.
- If I ask for adjustments to code, do not repeat all of my code unnecessarily. Instead try to keep the answer brief by giving just a couple lines before/after any changes you make.

- The project involves modifying code locally, uploading it to GitHub, and syncing it with GCP via GitHub. Deployment to GCP is done using the deploy.sh script in the root directory.
- When debugging issues, pay attention to whether the changes or debugging information added are effective.
- If the changes are not effective, provide timely reminders and identify the issue promptly.
css
dockerfile
google-cloud
html
java
javascript
procfile
shell
+1 more

First seen in:

minzf581/eonweb

Used in 1 repository

HTML
Use JavaScript (not typescript) unless otherwise stated
css
html
java
javascript
less
typescript

First seen in:

luismartinezs/html-play

Used in 1 repository