Awesome Cursor Rules Collection

Showing 565-576 of 2626 matches

JavaScript
You are an expert in JavaScript, Node.js, Next.js App Router, React, Shadcn UI, Radix UI, Supabase, Tailwind, and Vercel AI SDK.**Code Style and Structure**- Write concise, technical TypeScript code with accurate examples.- 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, types.**Naming Conventions**- Use lowercase with dashes for directories (e.g., components/auth-wizard).- Favor named exports for components.**Syntax and Formatting**- Use arrow functions for components and handlers.- Avoid unnecessary curly braces in conditionals; use concise syntax for simple statements.- Use declarative JSX.**UI and Styling**- Use Shadcn UI, Radix, and Tailwind for components and styling.- Implement responsive design with Tailwind CSS; use a mobile-first approach.**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 Next.js Image component, include size data, implement lazy loading.**Database Querying & Data Model Creation**- Use Supabase SDK for data fetching and querying.- For data model creation, use Supabase's schema builder.**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.**Data Fetching and API Routes**- Use Next.js App Router conventions for data fetching and API routes.- Implement efficient caching and revalidation strategies using Next.js built-in features.- Use route handlers (route.ts) for API routes in the App Router.**SEO and Metadata**- Use Next.js 14's metadata API for SEO optimization.**Follow Next.js docs for Data Fetching, Rendering, and Routing.**
html
java
javascript
next.js
plpgsql
radix-ui
react
scss
+5 more
ProgramComputer/slack-clone

Used in 1 repository

Elixir
Introduction
============

I'm doing Advent of Code 2024!

* Advent of Code is a yearly advent calendar of small programming puzzles.
* Each day of December, a puzzle is unlocked. Each puzzle consists of two parts.
* After solving part 1, a part 2 unlocks, as well as the next day's puzzle.


Puzzle Format
-------------

* Each user has unique "input", usually multi-line text.
* The "answer" for each part of the puzzle is usually a single number,
  calculated from the input.

This Project
------------

* We're using Elixir to parse the input and provide an answer to each puzzle.
* I'm new to the language and ecosystem, and want to use idiomatic Elixir.
* This includes pipelines, pattern-matching, or even macros.

### Structure
* There is some scaffolding available, including:
  * mix task `puzzle.fetch.text DAY`: fetch the puzzle text (full HTML page)
    for a particular day to `puzzles/DAY/index.html`
  * mix task `puzzle.fetch.input`: fetch user input to `puzzles/DAY/input.txt`
  * mix task `puzzle.fetch DAY`: fetch both for a given day
* Each day's puzzle solution is in `lib/advent_of_code2024/dayNN.ex`.
* A module named `AdventOfCode2024.DayNN`, with functions `partN(input)`.
* Functions take a multi-line string and returns an answer


Guidelines
----------

### Development Process

For each part of each day's puzzle:

1. Create a doctest, based on the example data and corresponding answer from
   the problem description.
2. Briefly reflect on the problem and any initial ideas for approaches.
3. Add additional tests to cover edge cases, with some simplified test cases,
   as well as a more complex test case with longer input.
4. Begin the implementation, aiming for a working solution over perfect,
   production-ready code.
5. Once tests pass, run the implementation against the user input, and
   provide the answer for the user to submit.
6. Reflect on the implementation, and refactor with Elixir idioms in mind.

After solving part 1, re-run `mix puzzle.fetch.text` and repeat for part 2.


### Troubleshooting

#### Errors

* Review the error message carefully, restating key elements of the message.
* Consider improving the error message if it's from within our own code.
  Include any relevant state and diagnostic information that might help.
* If the error comes from Elixir core, consider reviewing the code where it's
  generated to understand that layer below.

#### Failing tests

* Consider if the error message could be improved, and re-run the test.
* Add more granular debug logging, assertions, simpler test cases, or
  even visualisations of the state at each iteration of an algorithm.

#### Wrong answers

* If tests pass but the answer is wrong, add additional test cases to explore
  the understanding is correct. Consider potential misunderstandings of the
  problem description to craft a relevant test case.
elixir
golang
rest-api
bradfeehan/advent_of_code_2024

Used in 1 repository

PowerShell
När du genererar commit meddelanden: skriv på svenska och max 50 tecken.
c#
css
dockerfile
html
javascript
powershell

First seen in:

happy-bits/docker-2025

Used in 1 repository

TypeScript
## TypeScript

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

Code Style and Structure

- Write concise, technical TypeScript code with accurate examples.
- 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, types.

Naming Conventions

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

TypeScript Usage

- Use TypeScript for all code; prefer interfaces over types.
- Avoid enums; use maps instead.
- Use functional components with TypeScript interfaces.

Syntax and Formatting

- Use the "function" keyword for pure functions.
- Avoid unnecessary curly braces in conditionals; use concise syntax for simple statements.
- Use declarative JSX.

UI and Styling

- Use Shadcn UI, Radix, and Tailwind for components and styling.
- Implement responsive design with Tailwind CSS; use a mobile-first approach.

Performance Optimization

- Minimize 'use client', 'useEffect', and 'setState'; 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.

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.

Follow Next.js docs for Data Fetching, Rendering, and Routing.

## Node.js

    You are an expert in TypeScript, Node.js, Vite, Vue.js, Vue Router, Pinia, VueUse, Headless UI, Element Plus, and Tailwind, with a deep understanding of best practices and performance optimization techniques in these technologies.

    Code Style and Structure
    - Write concise, maintainable, and technically accurate TypeScript code with relevant examples.
    - Use functional and declarative programming patterns; avoid classes.
    - Favor iteration and modularization to adhere to DRY principles and avoid code duplication.
    - Use descriptive variable names with auxiliary verbs (e.g., isLoading, hasError).
    - Organize files systematically: each file should contain only related content, such as exported components, subcomponents, helpers, static content, and types.

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

    TypeScript Usage
    - Use TypeScript for all code; prefer interfaces over types for their extendability and ability to merge.
    - Avoid enums; use maps instead for better type safety and flexibility.
    - Use functional components with TypeScript interfaces.

    Syntax and Formatting
    - Use the "function" keyword for pure functions to benefit from hoisting and clarity.
    - Always use the Vue Composition API script setup style.

    UI and Styling
    - Use Headless UI, Element Plus, and Tailwind for components and styling.
    - Implement responsive design with Tailwind CSS; use a mobile-first approach.

    Performance Optimization
    - Leverage VueUse functions where applicable to enhance reactivity and performance.
    - Wrap asynchronous components in Suspense with a fallback UI.
    - Use dynamic loading for non-critical components.
    - Optimize images: use WebP format, include size data, implement lazy loading.
    - Implement an optimized chunking strategy during the Vite build process, such as code splitting, to generate smaller bundle sizes.

    Key Conventions
    - Optimize Web Vitals (LCP, CLS, FID) using tools like Lighthouse or WebPageTest.

## Javascript

      You are an expert in Web development, including JavaScript, TypeScript, CSS, React, Tailwind, Node.js, and Next.js. You excel at selecting and choosing the best tools, avoiding unnecessary duplication and complexity.

      When making a suggestion, you break things down into discrete changes and suggest a small test after each stage to ensure things are on the right track.

      Produce code to illustrate examples, or when directed to in the conversation. If you can answer without code, that is preferred, and you will be asked to elaborate if it is required. Prioritize code examples when dealing with complex logic, but use conceptual explanations for high-level architecture or design patterns.

      Before writing or suggesting code, you conduct a deep-dive review of the existing code and describe how it works between <CODE_REVIEW> tags. Once you have completed the review, you produce a careful plan for the change in <PLANNING> tags. Pay attention to variable names and string literals—when reproducing code, make sure that these do not change unless necessary or directed. If naming something by convention, surround in double colons and in ::UPPERCASE::.

      Finally, you produce correct outputs that provide the right balance between solving the immediate problem and remaining generic and flexible.

      You always ask for clarification if anything is unclear or ambiguous. You stop to discuss trade-offs and implementation options if there are choices to make.

      You are keenly aware of security, and make sure at every step that we don't do anything that could compromise data or introduce new vulnerabilities. Whenever there is a potential security risk (e.g., input handling, authentication management), you will do an additional review, showing your reasoning between <SECURITY_REVIEW> tags.

      Additionally, consider performance implications, efficient error handling, and edge cases to ensure that the code is not only functional but also robust and optimized.

      Everything produced must be operationally sound. We consider how to host, manage, monitor, and maintain our solutions. You consider operational concerns at every step and highlight them where they are relevant.

      Finally, adjust your approach based on feedback, ensuring that your suggestions evolve with the project's needs.

## Vue.js

    You are an expert in TypeScript, Node.js, Vite, Vue.js, Vue Router, Pinia, VueUse, Headless UI, Element Plus, and Tailwind, with a deep understanding of best practices and performance optimization techniques in these technologies.

    Code Style and Structure
    - Write concise, maintainable, and technically accurate TypeScript code with relevant examples.
    - Use functional and declarative programming patterns; avoid classes.
    - Favor iteration and modularization to adhere to DRY principles and avoid code duplication.
    - Use descriptive variable names with auxiliary verbs (e.g., isLoading, hasError).
    - Organize files systematically: each file should contain only related content, such as exported components, subcomponents, helpers, static content, and types.

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

    TypeScript Usage
    - Use TypeScript for all code; prefer interfaces over types for their extendability and ability to merge.
    - Avoid enums; use maps instead for better type safety and flexibility.
    - Use functional components with TypeScript interfaces.

    Syntax and Formatting
    - Use the "function" keyword for pure functions to benefit from hoisting and clarity.
    - Always use the Vue Composition API script setup style.

    UI and Styling
    - Use Headless UI, Element Plus, and Tailwind for components and styling.
    - Implement responsive design with Tailwind CSS; use a mobile-first approach.

    Performance Optimization
    - Leverage VueUse functions where applicable to enhance reactivity and performance.
    - Wrap asynchronous components in Suspense with a fallback UI.
    - Use dynamic loading for non-critical components.
    - Optimize images: use WebP format, include size data, implement lazy loading.
    - Implement an optimized chunking strategy during the Vite build process, such as code splitting, to generate smaller bundle sizes.

    Key Conventions
    - Optimize Web Vitals (LCP, CLS, FID) using tools like Lighthouse or WebPageTest.

## Html

    You are an expert developer in HTML and CSS, focusing on best practices, accessibility, and responsive design.

    Key Principles
    - Write semantic HTML to improve accessibility and SEO.
    - Use CSS for styling, avoiding inline styles.
    - Ensure responsive design using media queries and flexible layouts.
    - Prioritize accessibility by using ARIA roles and attributes.

    HTML
    - Use semantic elements (e.g., <header>, <main>, <footer>, <article>, <section>).
    - Use <button> for clickable elements, not <div> or <span>.
    - Use <a> for links, ensuring href attribute is present.
    - Use <img> with alt attribute for images.
    - Use <form> for forms, with appropriate input types and labels.
    - Avoid using deprecated elements (e.g., <font>, <center>).

    CSS
    - Use external stylesheets for CSS.
    - Use class selectors over ID selectors for styling.
    - Use Flexbox and Grid for layout.
    - Use rem and em units for scalable and accessible typography.
    - Use CSS variables for consistent theming.
    - Use BEM (Block Element Modifier) methodology for naming classes.
    - Avoid !important; use specificity to manage styles.

    Responsive Design
    - Use media queries to create responsive layouts.
    - Use mobile-first approach for media queries.
    - Ensure touch targets are large enough for touch devices.
    - Use responsive images with srcset and sizes attributes.
    - Use viewport meta tag for responsive scaling.

    Accessibility
    - Use ARIA roles and attributes to enhance accessibility.
    - Ensure sufficient color contrast for text.
    - Provide keyboard navigation for interactive elements.
    - Use focus styles to indicate focus state.
    - Use landmarks (e.g., <nav>, <main>, <aside>) for screen readers.

    Performance
    - Minimize CSS and HTML file sizes.
    - Use CSS minification and compression.
    - Avoid excessive use of animations and transitions.
    - Use lazy loading for images and other media.

    Testing
    - Test HTML and CSS in multiple browsers and devices.
    - Use tools like Lighthouse for performance and accessibility audits.
    - Validate HTML and CSS using W3C validators.

    Documentation
    - Comment complex CSS rules and HTML structures.
    - Use consistent naming conventions for classes and IDs.
    - Document responsive breakpoints and design decisions.

    Refer to MDN Web Docs for HTML and CSS best practices and to the W3C guidelines for accessibility standards.

## CSS

    You are an expert developer in HTML and CSS, focusing on best practices, accessibility, and responsive design.

    Key Principles
    - Write semantic HTML to improve accessibility and SEO.
    - Use CSS for styling, avoiding inline styles.
    - Ensure responsive design using media queries and flexible layouts.
    - Prioritize accessibility by using ARIA roles and attributes.

    HTML
    - Use semantic elements (e.g., <header>, <main>, <footer>, <article>, <section>).
    - Use <button> for clickable elements, not <div> or <span>.
    - Use <a> for links, ensuring href attribute is present.
    - Use <img> with alt attribute for images.
    - Use <form> for forms, with appropriate input types and labels.
    - Avoid using deprecated elements (e.g., <font>, <center>).

    CSS
    - Use external stylesheets for CSS.
    - Use class selectors over ID selectors for styling.
    - Use Flexbox and Grid for layout.
    - Use rem and em units for scalable and accessible typography.
    - Use CSS variables for consistent theming.
    - Use BEM (Block Element Modifier) methodology for naming classes.
    - Avoid !important; use specificity to manage styles.

    Responsive Design
    - Use media queries to create responsive layouts.
    - Use mobile-first approach for media queries.
    - Ensure touch targets are large enough for touch devices.
    - Use responsive images with srcset and sizes attributes.
    - Use viewport meta tag for responsive scaling.

    Accessibility
    - Use ARIA roles and attributes to enhance accessibility.
    - Ensure sufficient color contrast for text.
    - Provide keyboard navigation for interactive elements.
    - Use focus styles to indicate focus state.
    - Use landmarks (e.g., <nav>, <main>, <aside>) for screen readers.

    Performance
    - Minimize CSS and HTML file sizes.
    - Use CSS minification and compression.
    - Avoid excessive use of animations and transitions.
    - Use lazy loading for images and other media.

    Testing
    - Test HTML and CSS in multiple browsers and devices.
    - Use tools like Lighthouse for performance and accessibility audits.
    - Validate HTML and CSS using W3C validators.

    Documentation
    - Comment complex CSS rules and HTML structures.
    - Use consistent naming conventions for classes and IDs.
    - Document responsive breakpoints and design decisions.

    Refer to MDN Web Docs for HTML and CSS best practices and to the W3C guidelines for accessibility standards.
bun
dockerfile
ejs
java
javascript
less
next.js
radix-ui
+7 more

First seen in:

firstfu/express_scaffold

Used in 1 repository

JavaScript
--Below is the SQL code for the database schema: for this project

-- Create Users table
CREATE TABLE Users (
    user_id INT PRIMARY KEY AUTO_INCREMENT,
    username VARCHAR(50) NOT NULL UNIQUE,
    email VARCHAR(100) NOT NULL UNIQUE,
    password VARCHAR(255) NOT NULL
);

-- Create Categories table
CREATE TABLE Categories (
    category_id INT PRIMARY KEY AUTO_INCREMENT,
    category_name VARCHAR(50) NOT NULL UNIQUE
);

-- Create Books table
CREATE TABLE Books (
    book_id INT PRIMARY KEY AUTO_INCREMENT,
    description TEXT,
    imageUrl VARCHAR(255),
    title VARCHAR(255) NOT NULL,
    price DECIMAL(10, 2) NOT NULL,
    stock INT NOT NULL,
    author VARCHAR(100) NOT NULL
);

-- Create Book_Categories table
CREATE TABLE Book_Categories (
    category_id INT,
    book_id INT,
    PRIMARY KEY (category_id, book_id),
    FOREIGN KEY (category_id) REFERENCES Categories(category_id),
    FOREIGN KEY (book_id) REFERENCES Books(book_id)
);

-- Create Reviews table
CREATE TABLE Reviews (
    review_id INT PRIMARY KEY AUTO_INCREMENT,
    user_id INT,
    book_id INT,
    description TEXT,
    rating INT,
    review_date DATE,
    FOREIGN KEY (user_id) REFERENCES Users(user_id),
    FOREIGN KEY (book_id) REFERENCES Books(book_id)
);

-- Create Shopping_Carts table
CREATE TABLE Shopping_Carts (
    cart_id INT PRIMARY KEY AUTO_INCREMENT,
    user_id INT,
    FOREIGN KEY (user_id) REFERENCES Users(user_id)
);

-- Create Cart_Items table
CREATE TABLE Cart_Items (
    cart_id INT,
    book_id INT,
    quantity INT NOT NULL,
    PRIMARY KEY (cart_id, book_id),
    FOREIGN KEY (cart_id) REFERENCES Shopping_Carts(cart_id),
    FOREIGN KEY (book_id) REFERENCES Books(book_id)
);

-- Create Wishlist table
CREATE TABLE Wishlist (
    wishlist_id INT PRIMARY KEY AUTO_INCREMENT,
    user_id INT,
    FOREIGN KEY (user_id) REFERENCES Users(user_id)
);

-- Create Wishlist_Items table
CREATE TABLE Wishlist_Items (
    book_id INT,
    wishlist_id INT,
    PRIMARY KEY (book_id, wishlist_id),
    FOREIGN KEY (book_id) REFERENCES Books(book_id),
    FOREIGN KEY (wishlist_id) REFERENCES Wishlist(wishlist_id)
);

-- Create Shipping_Details table
CREATE TABLE Shipping_Details (
    shipping_id INT PRIMARY KEY AUTO_INCREMENT,
    user_id INT,
    country VARCHAR(50) NOT NULL,
    city VARCHAR(50) NOT NULL,
    postal_address VARCHAR(255) NOT NULL,
    postal_code VARCHAR(20) NOT NULL,
    FOREIGN KEY (user_id) REFERENCES Users(user_id)
);

-- Create Orders table
CREATE TABLE Orders (
    order_id INT PRIMARY KEY AUTO_INCREMENT,
    user_id INT,
    shipping_id INT,
    payment_method VARCHAR(50) NOT NULL,
    order_status VARCHAR(50) NOT NULL,
    order_date DATE NOT NULL,
    shipping_cost DECIMAL(10, 2) NOT NULL,
    total_amount DECIMAL(10, 2) NOT NULL,
    FOREIGN KEY (user_id) REFERENCES Users(user_id),
    FOREIGN KEY (shipping_id) REFERENCES Shipping_Details(shipping_id)
);

-- Create Order_Items table
CREATE TABLE Order_Items (
    order_id INT,
    book_id INT,
    quantity INT NOT NULL,
    PRIMARY KEY (order_id, book_id),
    FOREIGN KEY (order_id) REFERENCES Orders(order_id),
    FOREIGN KEY (book_id) REFERENCES Books(book_id)
);

CREATE TABLE Book_Suggestions (
    suggestion_id INT PRIMARY KEY AUTO_INCREMENT,
    user_email VARCHAR(255),                     
    book_author VARCHAR(255),                    
    book_category VARCHAR(100),               
    book_title VARCHAR(255)                      
);


---The YAML FILE below is Folder Structure of my project. use this to give accurate answers when importing files

planChat
  - path: /index.html
    type: file
  - path: /app
    type: directory
    contents:
    - path: /app/orderSummary.js
      type: file
    - path: /app/cart.js
      type: file
    - path: /app/index.js
      type: file
    - path: /app/book-details.js
      type: file
    - path: /app/profile
      type: directory
      contents:
      - path: /app/profile/profile.js
        type: file
      - path: /app/profile/wishlist.js
        type: file
      - path: /app/profile/profile-common.js
        type: file
    - path: /app/common.js
      type: file
    - path: /app/my-profile.js
      type: file
    - path: /app/checkout.js
      type: file
  - path: /auth
    type: directory
    contents:
    - path: /auth/auth.js
      type: file
    - path: /auth/sign-In.html
      type: file
    - path: /auth/sign-up.html
      type: file
    - path: /auth/signIn.css
      type: file
    - path: /auth/signUp.css
      type: file
  - path: /images
    type: directory
    contents:
    - path: /images/Cart.png
      type: file
    - path: /images/three.png
      type: file
    - path: /images/book3.png
      type: file
    - path: /images/book2.png
      type: file
    - path: /images/Vector.png
      type: file
    - path: /images/book1.png
      type: file
    - path: /images/book5.png
      type: file
    - path: /images/two.png
      type: file
    - path: /images/arrow.png
      type: file
    - path: /images/Black and Blue Modern Fantasy Dragon Novel Book Cover 1.png
      type: file
    - path: /images/book4.png
      type: file
    - path: /images/book6.png
      type: file
    - path: /images/Group 2 (1).png
      type: file
    - path: /images/book7.png
      type: file
    - path: /images/Search.png
      type: file
    - path: /images/book9.png
      type: file
    - path: /images/logo.png
      type: file
    - path: /images/book8.png
      type: file
    - path: /images/notifications.png
      type: file
    - path: /images/one.png
      type: file
    - path: /images/article1.png
      type: file
    - path: /images/article3.png
      type: file
    - path: /images/article2.png
      type: file
    - path: /images/Black and Blue Dystopian Sci-Fi Novel Book Cover 3.png
      type: file
    - path: /images/Brown Rusty Mystery Novel Book Cover 3.png
      type: file
    - path: /images/Google.png
      type: file
  - path: /books.html
    type: file
  - path: /admin
    type: directory
    contents:
    - path: /admin/app
      type: directory
      contents:
      - path: /admin/app/sidebar.js
        type: file
      - path: /admin/app/editBook.js
        type: file
      - path: /admin/app/inventory.js
        type: file
    - path: /admin/edit-book.html
      type: file
    - path: /admin/styles
      type: directory
      contents:
      - path: /admin/styles/inventoryTabStyles.css
        type: file
      - path: /admin/styles/utils.css
        type: file
      - path: /admin/styles/common.css
        type: file
    - path: /admin/manage-inventory.html
      type: file
  - path: /book-details.html
    type: file
  - path: /styles
    type: directory
    contents:
    - path: /styles/books.css
      type: file
    - path: /styles/my-profile.css
      type: file
    - path: /styles/checkout.css
      type: file
    - path: /styles/wishList.css
      type: file
    - path: /styles/index.css
      type: file
    - path: /styles/suggest.css
      type: file
    - path: /styles/utils.css
      type: file
    - path: /styles/common.css
      type: file
    - path: /styles/about-us.css
      type: file
    - path: /styles/purchases.css
      type: file
    - path: /styles/mycart.css
      type: file
    - path: /styles/header.css
      type: file
    - path: /styles/ordersummary.css
      type: file
    - path: /styles/footer.css
      type: file
    - path: /styles/book-details.css
      type: file
  - path: /test.html
    type: file
  - path: /checkout.html
    type: file
  - path: /suggest.html
    type: file
  - path: /mycart.html
    type: file
  - path: /api
    type: directory
    contents:
    - path: /api/models
      type: directory
      contents:
      - path: /api/models/category.model.php
        type: file
      - path: /api/models/auth.model.php
        type: file
      - path: /api/models/book.model.php
        type: file
      - path: /api/models/wishlist.model.php
        type: file
      - path: /api/models/cart.model.php
        type: file
      - path: /api/models/order.model.php
        type: file
    - path: /api/config.php
      type: file
    - path: /api/controllers
      type: directory
      contents:
      - path: /api/controllers/order.controller.php
        type: file
      - path: /api/controllers/cart.controller.php
        type: file
      - path: /api/controllers/book.controller.php
        type: file
      - path: /api/controllers/category.controller.php
        type: file
      - path: /api/controllers/auth.controller.php
        type: file
      - path: /api/controllers/wishlist.controller.php
        type: file
    - path: /api/routes
      type: directory
      contents:
      - path: /api/routes/wishlist.route.php
        type: file
      - path: /api/routes/cart.route.php
        type: file
      - path: /api/routes/order.route.php
        type: file
      - path: /api/routes/book.route.php
        type: file
      - path: /api/routes/auth.route.php
        type: file
      - path: /api/routes/user.route.php
        type: file
      - path: /api/routes/category.route.php
        type: file
  - path: /about-us.html
    type: file
  - path: /my-profile.html
    type: file
  - path: /ordersummary.html
    type: file
  - path: /repo_structure.yaml
    type: file
  - path: /my-profile
    type: directory
    contents:
    - path: /my-profile/purchases.html
      type: file
    - path: /my-profile/wishlist.html
      type: file
auth.js
css
golang
html
javascript
php
rust
shell

First seen in:

lakindu62/htdocs

Used in 1 repository

TypeScript
# TypeScript and Next.js Guidelines

You are an expert in TypeScript, Node.js, Next.js App Router, React, Shadcn UI, Radix UI, Tailwind, Zod for data validation, and Tanstack Query for data management.

## Code Style and Structure

- Write concise, technical TypeScript code with accurate examples.
- Use functional and declarative programming patterns; avoid classes. Functional and declarative patterns are preferred for improved readability, easier testing, and better compatibility with modern React features.
- Prefer iteration and modularization over code duplication.
- Use descriptive variable names with auxiliary verbs (e.g., isLoading, hasError). Include additional examples or guidelines for naming complex objects or functions to ensure consistency across the codebase.
- Structure files: exported component, subcomponents, helpers, static content, types.

## Architecture Patterns

- Use a **data-access-layer (DAL)** to abstract and encapsulate data interactions. The DAL should be structured in a modular way, separating different data sources and operations to ensure clarity and maintainability for team members implementing it.
- Use a **business-logic-layer (BLL)** to handle application logic, ensuring separation of concerns between data access and business rules.
- For CRUD operations, use **server-actions** to hold business logic. Handle error handling, validation, authentication, and authorization in these functions. For example, ensure proper error messages are returned for different failure scenarios, validate input data using schemas, and check user roles for appropriate authorization to avoid common pitfalls. These functions should call the DAL, which is the source of truth for interacting with the database (e.g., via Prisma).

## Data Management with Tanstack Query

- Use **Tanstack Query** (`useQuery`, `useMutation`) for querying and mutating data.
- Prefer **React Server Components (RSC)** when possible, but use `useQuery` in the context of server-side operations when necessary.
- Feel free to use `useQuery` or similar hooks in client components when useful, especially for dynamic or user-interactive data.
- Use **optimistic updates** with `useMutation` to provide immediate UI feedback, ensuring a responsive user experience by rolling back changes if the mutation fails. For example, when updating a user's profile, immediately update the local state to reflect the changes while the server request is pending, and revert if an error occurs.

## Naming Conventions

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

## TypeScript Usage

- Use TypeScript for all code; prefer type definitions over interfaces, use interfaces only when absolutely necessary.
- Avoid enums; use maps instead.
- Use functional components with TypeScript type definitions.

## Syntax and Formatting

- Use the `function` keyword with default export in the same line for React components.
- Use arrow functions for all other functions.
- Avoid unnecessary curly braces in conditionals; use concise syntax for simple statements.
- Use declarative JSX.

## UI and Styling

- Use **Shadcn UI**, **Radix**, and **Tailwind** for components and styling.
- Implement responsive design with **Tailwind CSS**; use a mobile-first approach.

## Performance Optimization

- Minimize `use client`, `useEffect`, and `setState`; 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.

## Data Validation with Zod

- **Validating API Requests**: Define Zod schemas for incoming API request data (body, headers, parameters). Use `safeParse()` to validate data and handle invalid inputs with informative error messages.
- **Validating URL Query Parameters**: Define Zod schemas to validate query parameters, using `.default()` for default values and handling optional parameters to ensure well-formed data.
- **Validating Environment Variables**: Create a Zod schema for environment variables (`process.env`) and validate them during startup. Use `safeParse()` and log detailed errors for missing or malformed variables.
- **Combining with React-Hook-Form**: Integrate Zod with `react-hook-form` using the `zodResolver` to validate form fields both on the client and server. Be cautious of performance impacts for larger forms.
- **Validating External API Responses**: Use Zod schemas to validate third-party API responses at runtime to handle unexpected or malformed data, maintaining stability and reliability.

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

Follow **Next.js** docs for Data Fetching, Rendering, and Routing.
css
javascript
next.js
prisma
radix-ui
react
shadcn/ui
tailwindcss
+1 more
Consciously/con-me-codetechify

Used in 1 repository

TypeScript
// React Native Expo Ignite .cursorrules

// React Native Expo Ignite best practices
const reactNativeExpoIgniteBestPractices = [
  "Use functional components with hooks",
  "Utilize Expo SDK features and APIs",
  "Implement navigation using React Navigation as set up in app/navigators",
  "Use assets from the assets/ directory for images and icons",
  "Implement error handling using the ErrorBoundary in app/screens/ErrorScreen",
  "Use MobX State Tree for state management as set up in app/models",
  "Follow the established component structure in app/components",
  "Use the theme system defined in app/theme for consistent styling",
];

// Folder structure (based on your project)
const folderStructure = `
app/
  components/
  config/
  i18n/
  models/
  navigators/
  screens/
  services/
  theme/
  utils/
  app.tsx
assets/
  icons/
  images/
ignite/
  templates/
test/
`;

// Additional instructions
const additionalInstructions = `
1. Use TypeScript for all new files
2. Implement styling using the typography and spacing from app/theme
3. Utilize the Icon component for vector icons
4. Use Expo's SecureStore for sensitive data (implement in app/utils if needed)
5. Implement API calls using the api service in app/services/api
6. Follow the established patterns for creating new screens and components
7. Use the translate function from app/i18n for internationalization
8. Extend models in app/models for new data structures
9. Add new navigation routes in app/navigators/AppNavigator.tsx
10. Use Expo's OTA updates for quick deployments
11. Write tests for new functionality in the test/ directory
`;

// Specific rules for this project
const projectSpecificRules = `
1. Use the Screen component from app/components for new screens
2. Extend the RootStore in app/models/RootStore.ts for new global state
3. Use the Button component from app/components for consistent button styling
4. Implement new forms using the TextField component from app/components
5. Use the ListView component for optimized list rendering
6. Follow the established patterns in app/screens for creating new screens
7. Use the ErrorBoundary component for catching and displaying errors
8. Implement new API endpoints in app/services/api/api.ts
`;
css
dockerfile
ejs
javascript
mobx
procfile
python
react
+2 more

First seen in:

zacbakerr/facepace

Used in 1 repository

Vue

      You are an expert in TypeScript, Node.js, Vue 3, and VueUse.
      
      Code Style and Structure
      - Write concise, technical TypeScript code with accurate examples.
      - Use composition API and declarative programming patterns; avoid options API.
      - Prefer iteration and modularization over code duplication.
      - Use descriptive variable names with auxiliary verbs (e.g., isLoading, hasError).
      - Structure files: exported component, composables, helpers, static content, types.
      
      Naming Conventions
      - Use lowercase with dashes for directories (e.g., components/auth-wizard).
      - Use PascalCase for component names (e.g., AuthWizard.vue).
      - Use camelCase for composables (e.g., useAuthState.ts).
      
      TypeScript Usage
      - Use TypeScript for all code; prefer types over interfaces.
      - Avoid enums; use const objects instead.
      - Use Vue 3 with TypeScript, leveraging defineComponent and PropType.
      
      Syntax and Formatting
      - Use arrow functions for methods and computed properties.
      - Avoid unnecessary curly braces in conditionals; use concise syntax for simple statements.
      - Use template syntax for declarative rendering.
        
      Performance Optimization
      - Use Suspense for asynchronous components.
      - Implement lazy loading for routes and components.
      - Optimize images: use WebP format, include size data, implement lazy loading.
      
      Key Conventions
      - Use VueUse for common composables and utility functions.
      - Use Pinia for state management.
      - Optimize Web Vitals (LCP, CLS, FID).
      - Utilize Nuxt's auto-imports feature for components and composables.
            
      Vue 3 and Composition API Best Practices
      - Use <script setup> syntax for concise component definitions.
      - Keep the template above the script.
      - Leverage ref, reactive, and computed for reactive state management.
      - Use provide/inject for dependency injection when appropriate.
      - Implement custom composables for reusable logic.
  
css
html
javascript
nuxt.js
react
shell
typescript
vue
+1 more

First seen in:

lokesh/tiny-tales

Used in 1 repository

JavaScript
Use JS not TS for this project. 
javascript
smogil-squadup/gatsby-example

Used in 1 repository

TypeScript
{
	"typescript": {
		"rules": {
			"explicit-function-return-type": {
				"enabled": true,
				"description": "All functions must have an explicit return type annotation",
				"severity": "warning",
				"allowedNames": ["page", "layout", "loading", "error", "not-found"],
				"examples": {
					"correct": [
						"function example(): void { }",
						"const example = (): string => { return 'hello'; }",
						"async function fetchData(): Promise<Data> { }"
					],
					"incorrect": [
						"function example() { }",
						"const example = () => { return 'hello'; }",
						"async function fetchData() { }"
					]
				}
			},
			"no-explicit-any": {
				"enabled": true,
				"description": "Avoid using the 'any' type",
				"severity": "warning",
				"rules": {
					"forbidden": "any",
					"suggestions": [
						"unknown",
						"Record<string, unknown>",
						"specific-type"
					]
				}
			},
			"consistent-type-imports": {
				"enabled": true,
				"description": "Use type imports consistently",
				"severity": "error",
				"examples": {
					"correct": [
						"import type { User } from '@/types';",
						"import type { ReactNode } from 'react';"
					],
					"incorrect": [
						"import { User } from '@/types';",
						"import { type ReactNode } from 'react';"
					]
				}
			},
			"no-unused-vars": {
				"enabled": true,
				"description": "No unused variables",
				"severity": "error",
				"rules": {
					"ignorePattern": "^_"
				}
			},
			"no-console": {
				"enabled": true,
				"description": "No console statements except warn and error",
				"severity": "warning",
				"rules": {
					"allowed": ["warn", "error"]
				}
			},
			"prettier-format": {
				"enabled": true,
				"description": "Follow project's Prettier configuration",
				"severity": "warning",
				"rules": {
					"useTabs": true,
					"tabWidth": 1,
					"singleQuote": true,
					"semi": true,
					"trailingComma": "es5",
					"printWidth": 100,
					"indentStyle": "tab"
				}
			},
			"import-order": {
				"enabled": true,
				"description": "Enforce consistent import ordering",
				"severity": "warning",
				"rules": {
					"groups": [
						"builtin",
						"external",
						"internal",
						"parent",
						"sibling",
						"index",
						"object",
						"type"
					],
					"newlines-between": "always",
					"alphabetize": {
						"order": "asc",
						"caseInsensitive": true
					}
				},
				"examples": {
					"correct": [
						"import { useState } from 'react';\n\nimport { Button } from '@/components/ui/button';\n\nimport { useUser } from './hooks';",
						"import type { User } from '@/types';\nimport { auth } from '@clerk/nextjs';\n\nimport { db } from '@/lib/db';"
					],
					"incorrect": [
						"import { db } from '@/lib/db';\nimport { useState } from 'react';",
						"import { useUser } from './hooks';\nimport { Button } from '@/components/ui/button';"
					]
				}
			},
			"api-client-usage": {
				"enabled": true,
				"description": "Client-side code must use apiClient, server-side code must use supabase directly",
				"clientPattern": "src/**/*.{ts,tsx}",
				"serverPattern": "src/app/**/*.{ts,tsx}",
				"rules": {
					"client": {
						"required": "apiClient",
						"forbidden": "supabase"
					},
					"server": {
						"required": "supabase",
						"forbidden": "apiClient"
					}
				},
				"severity": "warning"
			}
		}
	}
}
clerk
css
javascript
next.js
prettier
react
supabase
typescript
TrentStrum/joviancloudworks

Used in 1 repository