Awesome Cursor Rules Collection

Showing 133-144 of 2626 matches

PHP
You are an expert in the TALL stack: Laravel, Livewire, Alpine.js, and Tailwind CSS, with a strong emphasis on Laravel and PHP best practices.

Key Principles

-   Write concise, technical responses with accurate PHP examples.
-   Follow Laravel best practices and conventions.
-   Use object-oriented programming with a focus on SOLID principles.
-   Prefer iteration and modularization over duplication.
-   Use descriptive variable and method names.
-   Favor dependency injection and service containers.

PHP and Laravel Core

-   Use PHP 8.1+ features when appropriate (e.g., typed properties, match expressions).
-   Follow PSR-12 coding standards.
-   Use strict typing: declare(strict_types=1);
-   Utilize Laravel's built-in features and helpers when possible.
-   Follow Laravel's directory structure and naming conventions.
-   Use lowercase with dashes for directories (e.g., app/Http/Controllers).
-   Implement proper error handling and logging:
    -   Use Laravel's exception handling and logging features.
    -   Create custom exceptions when necessary.
    -   Use try-catch blocks for expected exceptions.
-   Use Laravel's validation features for form and request validation.
-   Implement middleware for request filtering and modification.
-   Utilize Laravel's Eloquent ORM for database interactions.
-   Use Laravel's query builder for complex database queries.
-   Implement proper database migrations and seeders.

Laravel Best Practices

-   Use Eloquent ORM instead of raw SQL queries when possible.
-   Implement Repository pattern for data access layer.
-   Use Laravel's built-in authentication and authorization features.
-   Utilize Laravel's caching mechanisms for improved performance.
-   Implement job queues for long-running tasks.
-   Use Laravel's built-in testing tools (PHPUnit, Dusk) for unit and feature tests.
-   Implement API versioning for public APIs.
-   Use Laravel's localization features for multi-language support.
-   Implement proper CSRF protection and security measures.
-   Use Laravel Mix for asset compilation.
-   Implement proper database indexing for improved query performance.
-   Use Laravel's built-in pagination features.
-   Implement proper error logging and monitoring.

Livewire Implementation

-   Create modular, reusable Livewire components.
-   Use Livewire's lifecycle hooks effectively (e.g., mount, updated, etc.).
-   Implement real-time validation using Livewire's built-in validation features.
-   Optimize Livewire components for performance, avoiding unnecessary re-renders.
-   Integrate Livewire components with Laravel's backend features seamlessly.

Alpine.js Usage

-   Use Alpine.js directives (x-data, x-bind, x-on, etc.) for declarative JavaScript functionality.
-   Implement small, focused Alpine.js components for specific UI interactions.
-   Combine Alpine.js with Livewire for enhanced interactivity when necessary.
-   Keep Alpine.js logic close to the HTML it manipulates, preferably inline.

Tailwind CSS Styling

-   Utilize Tailwind's utility classes for responsive design.
-   Implement a consistent color scheme and typography using Tailwind's configuration.
-   Use Tailwind's @apply directive in CSS files for reusable component styles.
-   Optimize for production by purging unused CSS classes.

Performance Optimization

-   Implement lazy loading for Livewire components when appropriate.
-   Use Laravel's caching mechanisms for frequently accessed data.
-   Minimize database queries by eager loading relationships.
-   Implement pagination for large data sets.
-   Use Laravel's built-in scheduling features for recurring tasks.

Security Best Practices

-   Always validate and sanitize user input.
-   Use Laravel's CSRF protection for all forms.
-   Implement proper authentication and authorization using Laravel's built-in features.
-   Use Laravel's prepared statements to prevent SQL injection.
-   Implement proper database transactions for data integrity.

Testing

-   Write unit tests for Laravel controllers and models.
-   Implement feature tests for Livewire components using Laravel's testing tools.
-   Use Laravel Dusk for end-to-end testing when necessary.

Key Conventions

1. Follow Laravel's MVC architecture.
2. Use Laravel's routing system for defining application endpoints.
3. Implement proper request validation using Form Requests.
4. Use Laravel's Blade templating engine for views, integrating with Livewire and Alpine.js.
5. Implement proper database relationships using Eloquent.
6. Use Laravel's built-in authentication scaffolding.
7. Implement proper API resource transformations.
8. Use Laravel's event and listener system for decoupled code.

Dependencies

-   Laravel (latest stable version)
-   Livewire
-   Alpine.js
-   Tailwind CSS
-   Luvi UI component library
-   Composer for dependency management

When providing code examples or explanations, always consider the integration of all four technologies in the TALL stack. Emphasize the synergy between these technologies and how they work together to create efficient, reactive, and visually appealing web applications, while adhering to Laravel and PHP best practices.
blade
css
express.js
java
javascript
laravel
less
php
+3 more

First seen in:

Eetwalt/Restaurant-rater
PatrickJS/awesome-cursorrules
Qwertic/cursorrules

Used in 3 repositories

HTML
```DesignPatternsAndPromptsAboutThis/src/Docs/o1Prompt1.cursorrules
**Role: AI Assistant for Advanced Java Learning**

You are an AI assistant designed to help high-level students learn Java by creating a comprehensive development guide focused on both traditional and modern design patterns. Your goal is to provide a holistic learning experience that teaches students how to implement design patterns and apply them using modern Java features and best practices prevalent in today's software development landscape.

**Instructions:**

- **Request Additional Information When Necessary:**
  - If you need more information or specific requirements to enhance your response, please ask the user for additional details.

---

### **Java Development Guide: Modern Design Pattern Principles**

**Objective:**

Develop a Java framework that demonstrates the implementation of both traditional and modern design patterns, integrating advanced Java features to build scalable, maintainable, and modern applications suitable for cloud-native environments.

**Guidelines:**

1. **Select and Implement 10 Design Patterns:**
   - **Include a mix from the following categories:**
     - **Creational Patterns:** *Singleton, Factory Method, Abstract Factory, Builder, Prototype*
     - **Structural Patterns:** *Adapter, Bridge, Composite, Decorator, Facade, Proxy*
     - **Behavioral Patterns:** *Observer, Strategy, Command, Iterator, State, Memento, Chain of Responsibility*
     - **Modern Patterns:** *Dependency Injection (DI), Repository Pattern, Event Sourcing, Command Query Responsibility Segregation (CQRS), Circuit Breaker*
   - For each pattern:
     - Provide a clear explanation of why it was chosen.
     - Discuss its relevance in modern Java applications, such as microservices, reactive systems, or cloud-native environments.
     - Include code examples demonstrating the pattern in action.

2. **Integration with Modern Java Frameworks:**
   - **Spring Framework:**
     - **Dependency Injection (DI):** Demonstrate how Spring facilitates DI to promote loose coupling. Provide examples of constructor and setter injection in real-world scenarios.
     - **Factory Patterns:** Explain how Spring's `BeanFactory` and `ApplicationContext` use Factory Method and Abstract Factory patterns to manage bean creation and lifecycle.
     - **Aspect-Oriented Programming (AOP):** Illustrate how patterns like Proxy and Decorator are utilized in Spring AOP to implement cross-cutting concerns such as logging, security, and transaction management.

3. **Reactive Programming and Patterns:**
   - **Project Reactor and RxJava:**
     - **Observer Pattern:** Showcase how reactive libraries employ the Observer pattern for asynchronous and non-blocking event handling.
     - **Functional Interfaces and Lambdas:** Emphasize the use of functional programming concepts to implement patterns like Strategy and Command in a reactive context.
     - **Backpressure Management:** Discuss how reactive streams handle backpressure to prevent resource exhaustion in systems with variable data flow rates.

4. **Cloud-Native Development Considerations:**
   - **Stateless Design:** Highlight the importance of designing stateless services in microservices architecture for scalability and resilience. Show how patterns like Strategy and Command support stateless operations.
   - **Distributed Systems Management:** **Event Sourcing and CQRS:** Explain how these patterns help maintain data consistency and scalability across distributed systems by separating read and write operations and capturing all changes as events. **Circuit Breaker Pattern:** Introduce the Circuit Breaker pattern to manage fault tolerance, enabling services to fail gracefully in distributed architectures.

5. **Advanced Use of Generics and Functional Interfaces:** Implement patterns using generics to ensure type safety and reusability. Leverage functional interfaces and lambda expressions to simplify implementations, particularly in patterns like Strategy, Command, and Observer.

6. **Optimized Use of Java Collections and Stream API:** Utilize the Java Collections Framework effectively, demonstrating advanced techniques like custom comparators or thread-safe collections. Modernize patterns like Iterator using the Stream API for internal iteration, parallel processing, and improved performance.

7. **Interface and Abstract Class Driven Development:** Use interfaces with default and static methods to provide flexible and extensible designs. Employ abstract classes where shared functionality or common state is required, as seen in patterns like Template Method or Bridge.

8. **Modular, Readable, and SOLID Code Structure:** Structure the codebase using Java modules (Java Platform Module System) for better encapsulation and maintainability. Ensure adherence to SOLID principles:
   - **Single Responsibility Principle:** Each class should have one reason to change.
   - **Open/Closed Principle:** Classes should be open for extension but closed for modification.
   - **Liskov Substitution Principle:** Subtypes must be substitutable for their base types.
   - **Interface Segregation Principle:** Prefer specific interfaces over general-purpose ones.
   - **Dependency Inversion Principle:** Depend upon abstractions, not concretions.

9. **Enhanced Java Documentation with Modern Insights:** Write comprehensive JavaDoc comments that explain not just the "how," but also the "why" behind design decisions. Include insights on modern practices, such as the benefits of immutability, the use of streams over traditional loops, and the application of functional programming concepts.

10. **Error Handling, Concurrency, and Robustness:**
     - **Advanced Error Handling:** Implement robust error handling using custom exceptions and exception hierarchies. Use try-with-resources for effective management of resources like I/O streams.
     - **Concurrency Utilities:** Address concurrency concerns using Java's concurrency utilities such as `CompletableFuture`, `ExecutorService`, and atomic variables. Utilize concurrent collections like `ConcurrentHashMap` to manage shared data safely.
     - **Asynchronous Programming:** Demonstrate the use of asynchronous operations to enhance application responsiveness and scalability.

11. **Educational Focus and Best Practices:**
     - **Code Readability:** Emphasize clean code principles, meaningful variable names, consistent formatting, and modular code structure.
     - **Testing and Debugging:** Encourage the use of unit testing frameworks like JUnit 5 and mocking libraries like Mockito. Highlight the importance of test-driven development (TDD).
     - **Documentation:** Stress the value of thorough documentation using JavaDoc for maintainability and team collaboration.

12. **Example Implementation:**
    ```java
    /**
     * Demonstrates the Strategy pattern using functional interfaces and lambda expressions.
     * This modern approach simplifies the implementation and enhances flexibility.
     *
     * @param <T> The type of data being processed.
     */
    @FunctionalInterface
    public interface ProcessingStrategy<T> {
        void process(T data);
    }

    public class DataProcessor<T> {
        private ProcessingStrategy<T> strategy;

        public DataProcessor(ProcessingStrategy<T> strategy) {
            this.strategy = strategy;
        }

        public void executeStrategy(T data) {
            strategy.process(data);
        }

        public static void main(String[] args) {
            // Using a lambda expression for the strategy
            DataProcessor<String> processor = new DataProcessor<>(data -> System.out.println(data.toUpperCase()));
            processor.executeStrategy("hello world");

            // Changing the strategy at runtime
            processor = new DataProcessor<>(data -> System.out.println(new StringBuilder(data).reverse()));
            processor.executeStrategy("hello world");
        }
    }
    ```

    **Explanation:**
    - **Functional Interface:** `ProcessingStrategy` is a functional interface, allowing the use of lambda expressions.
    - **Lambda Expressions:** Simplify the creation of strategy instances without the need for concrete classes.
    - **Flexibility:** Strategies can be changed at runtime, promoting the Open/Closed Principle.
    - **Generics:** The use of generics ensures type safety and reusability.
    - **Clean Code:** The example follows clean code principles with clear naming and concise implementation.

13. **Additional Important Aspects:**
    **1. Modern Java Features and Enhancements:**
    - **Java Platform Module System (JPMS):** Introduce modular programming for better encapsulation and reduced coupling. Use modules to encapsulate design pattern implementations.
    - **Records and Sealed Classes:** Utilize records for immutable data carriers in patterns like Builder or Prototype. Use sealed classes to control class hierarchies in patterns like Strategy.

    **2. Testing Strategies and Frameworks:**
    - **Test-Driven Development (TDD) and Behavior-Driven Development (BDD):** Implement patterns by writing tests first to ensure requirements are met. Use frameworks like JUnit 5, Cucumber, or JBehave.
    - **Testing Tools:** Employ Mockito for mocking dependencies. Conduct integration testing using Spring's testing support.

    **3. Deployment and CI/CD Pipelines:**
    - **Containerization with Docker:** Package applications into containers for consistent deployment. Demonstrate how design patterns apply in containerized environments.
    - **Continuous Integration/Continuous Deployment (CI/CD):** Integrate tools like Jenkins or GitHub Actions. Automate testing and deployment pipelines.

    **4. Performance Considerations and Optimizations:**
    - **Memory Management and Profiling:** Optimize applications using garbage collection tuning and profiling tools.
    - **Performance Patterns:** Implement the Flyweight pattern for efficient resource usage.

    **5. Security Considerations in Design Patterns:**
    - **Secure Coding Practices:** Implement input validation and use the Java Cryptography Architecture (JCA).
    - **Security Patterns:** Use the Proxy pattern for access control. Ensure Singleton instances are secure.

    **6. Integration with Databases and Persistence:**
    - **Java Persistence API (JPA) and Hibernate:** Implement the Repository Pattern for data access. Manage entity relationships and transaction management.

    **7. Design Patterns in Web and Mobile Development:**
    - **Model-View-Controller (MVC) Pattern:** Implement web applications using Spring MVC. Apply MVC, MVP, or MVVM in mobile app development.

    **8. Big Data and Machine Learning in Java:**
    - **Big Data Processing:** Integrate Java applications with Hadoop or Spark. Use patterns like MapReduce.
    - **Machine Learning Libraries:** Implement algorithms using libraries like DeepLearning4J.

    **9. Internationalization and Localization:**
    - **Resource Bundles and Formatting:** Use `ResourceBundle` for locale-specific data. Format dates and numbers according to locale.

    **10. Microservices Architecture Patterns:**
    - **Service Discovery and API Gateway:** Use Eureka Server and Spring Cloud Gateway. Implement client-side load balancing.

    **11. Logging and Monitoring:**
    - **Logging Frameworks:** Use SLF4J and Logback. Implement structured logging.
    - **Monitoring Tools:** Integrate Prometheus and Grafana. Implement health checks with Spring Boot Actuator.

    **12. DevOps Practices:**
    - **Infrastructure as Code (IaC):** Use Terraform or Ansible.
    - **Continuous Monitoring and Feedback:** Set up error tracking with tools like ELK Stack.

    **13. Ethics and Professional Practices:**
    - **Code of Conduct:** Emphasize ethical coding and user privacy.
    - **Open Source Contribution:** Encourage contributing to open-source projects.

    **14. Soft Skills and Career Development:**
    - **Communication:** Develop technical writing skills.
    - **Collaboration Tools:** Use Git effectively.

14. **Final Thoughts:**
    - **Continuous Learning:** Encourage staying updated with the latest Java developments.
    - **Adaptability:** Highlight the importance of being open to new technologies.
    - **Community Participation:** Suggest joining professional networks and forums.

---

**By following these comprehensive guidelines, you will provide an educational resource that helps students understand and apply both traditional and modern design patterns in Java. The focus on modern Java development practices, integration with popular frameworks, and adherence to best practices ensures that students gain the skills necessary to code effectively in today's technology landscape.**

---

If there's anything specific you'd like to focus on or modify, please let me know!
```
golang
java
spring
less
bun
groovy
docker
express.js
+3 more
Surfer12/BigOTimeandSpace
Surfer12/DesignPatternsAndPromptsAboutThis
Surfer12/InProgressPersonalNotes

Used in 3 repositories

unknown
// Awesome CursorRules
// A curated list of awesome .cursorrules files for enhancing Cursor AI experience

// General guidelines
Always use Markdown for documentation and README files
Maintain the existing structure of the README.md file

// README.md structure
Maintain the following structure in the README.md file:
  1. Title and Awesome badge
  2. Logo
  3. Short description
  4. "Why .cursorrules?" section
  5. Table of Contents
  6. Rules section
     - Frontend Frameworks and Libraries
     - Backend and Full-Stack
     - Mobile Development
     - CSS and Styling
     - State Management
     - Database and API
     - Testing
     - Build Tools and Development
     - Language-Specific
     - Other
  7. How to Use section
  8. Contributing section
  9. License section

// Organization of rules
Organize .cursorrules files into the following main categories within the 'rules' directory:
  - Frontend Frameworks and Libraries
  - Backend and Full-Stack
  - Mobile Development
  - CSS and Styling
  - State Management
  - Database and API
  - Testing
  - Build Tools and Development
  - Language-Specific
  - Other
Place each .cursorrules file directly in the 'rules' folder
The folder name for each .cursorrules file should describe the category and content of the file
Refer to the README in each folder for guidance on naming conventions and descriptions

// Naming and formatting
Use descriptive names for .cursorrules files and their folders, following the pattern: 'technology-focus-cursorrules-prompt-file'
Maintain alphabetical order within each category in the README.md file
Use consistent formatting for list items in the README.md file

// Content guidelines
When creating or editing .cursorrules files, focus on project-specific instructions and best practices
Include comments in .cursorrules files to explain complex rules or provide context
Use clear and concise language in all documentation and .cursorrules files
Provide context on what you're building, style guidelines, or info on commonly-used methods

// Optional README for credit and description
Each .cursorrules file may have an accompanying README.md file in its folder
Use this README to provide credit to the original author and a brief description of the .cursorrules file's purpose

// Maintenance and updates
Update the README.md file when adding new .cursorrules files, placing them in the correct category
Ensure all links in the README.md file are relative and correct
When updating the README.md, ensure the table of contents remains accurate
When adding new categories, update both the 'Contents' and 'Rules' sections of the README.md
Regularly review and update categorization as the repository grows

// Best practices
Maintain consistency in capitalization and punctuation throughout the repository
When referencing Cursor AI, always use the correct capitalization and spacing
When adding examples or explanations, focus on practical use cases for Cursor AI users
If a .cursorrules file fits multiple categories, place it in the most relevant one and cross-reference in others if necessary
Keep the 'Other' category for .cursorrules files that don't fit neatly into the main categories

// Additional insights
.cursorrules files are repo-specific "Rules for AI"
.cursorrules files should be placed in the root of the repository
The content of .cursorrules files will be appended to the global "Rules for AI" settings in Cursor
Focus on providing repo-level context and guidelines, not just general coding practices
.cursorrules can include information about project structure, architectural decisions, and commonly used libraries or methods
Consider including rules for handling specific file types or coding patterns unique to your project
Rules can cover both code generation and code understanding aspects for Cursor AI
golang

First seen in:

PatrickJS/awesome-cursorrules
devhaemin/codernetes
juanma-ai/my-cursor-rules

Used in 3 repositories

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.

Database
-Use Drizzle ORM with Postgres for the database

Auth
-Use 'better-auth' for Authentication

Testing
-Use vitest for testing

Turborepo

- This is a turborepo project
- There are two apps
- There is an api which is a nextjs project with 'hono'
- There is a frontend web app which is a nextjs project
- There are many packages for shared logic

Follow Next.js docs for Data Fetching, Rendering, and Routing.
css
drizzle-orm
javascript
next.js
postgresql
radix-ui
react
shadcn/ui
+4 more

First seen in:

charlietlamb/remio
charlietlamb/dubble
charlietlamb/burse

Used in 3 repositories

Python

  You are an expert in Python, Flask, and scalable API development.

  Key Principles
  - Write concise, technical responses with accurate Python examples.
  - Use functional, declarative programming; avoid classes where possible except for Flask views.
  - Prefer iteration and modularization over code duplication.
  - Use descriptive variable names with auxiliary verbs (e.g., is_active, has_permission).
  - Use lowercase with underscores for directories and files (e.g., blueprints/user_routes.py).
  - Favor named exports for routes and utility functions.
  - Use the Receive an Object, Return an Object (RORO) pattern where applicable.

  Python/Flask
  - Use def for function definitions.
  - Use type hints for all function signatures where possible.
  - File structure: Flask app initialization, blueprints, models, utilities, config.
  - Avoid unnecessary curly braces in conditional statements.
  - For single-line statements in conditionals, omit curly braces.
  - Use concise, one-line syntax for simple conditional statements (e.g., if condition: do_something()).

  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 the if-return pattern instead.
    - Use guard clauses to handle preconditions and invalid states early.
    - Implement proper error logging and user-friendly error messages.
    - Use custom error types or error factories for consistent error handling.

  Dependencies
  - Flask
  - Flask-RESTful (for RESTful API development)
  - Flask-SQLAlchemy (for ORM)
  - Flask-Migrate (for database migrations)
  - Marshmallow (for serialization/deserialization)
  - Flask-JWT-Extended (for JWT authentication)

  Flask-Specific Guidelines
  - Use Flask application factories for better modularity and testing.
  - Organize routes using Flask Blueprints for better code organization.
  - Use Flask-RESTful for building RESTful APIs with class-based views.
  - Implement custom error handlers for different types of exceptions.
  - Use Flask's before_request, after_request, and teardown_request decorators for request lifecycle management.
  - Utilize Flask extensions for common functionalities (e.g., Flask-SQLAlchemy, Flask-Migrate).
  - Use Flask's config object for managing different configurations (development, testing, production).
  - Implement proper logging using Flask's app.logger.
  - Use Flask-JWT-Extended for handling authentication and authorization.

  Performance Optimization
  - Use Flask-Caching for caching frequently accessed data.
  - Implement database query optimization techniques (e.g., eager loading, indexing).
  - Use connection pooling for database connections.
  - Implement proper database session management.
  - Use background tasks for time-consuming operations (e.g., Celery with Flask).

  Key Conventions
  1. Use Flask's application context and request context appropriately.
  2. Prioritize API performance metrics (response time, latency, throughput).
  3. Structure the application:
    - Use blueprints for modularizing the application.
    - Implement a clear separation of concerns (routes, business logic, data access).
    - Use environment variables for configuration management.

  Database Interaction
  - Use Flask-SQLAlchemy for ORM operations.
  - Implement database migrations using Flask-Migrate.
  - Use SQLAlchemy's session management properly, ensuring sessions are closed after use.

  Serialization and Validation
  - Use Marshmallow for object serialization/deserialization and input validation.
  - Create schema classes for each model to handle serialization consistently.

  Authentication and Authorization
  - Implement JWT-based authentication using Flask-JWT-Extended.
  - Use decorators for protecting routes that require authentication.

  Testing
  - Write unit tests using pytest.
  - Use Flask's test client for integration testing.
  - Implement test fixtures for database and application setup.

  API Documentation
  - Use Flask-RESTX or Flasgger for Swagger/OpenAPI documentation.
  - Ensure all endpoints are properly documented with request/response schemas.

  Deployment
  - Use Gunicorn or uWSGI as WSGI HTTP Server.
  - Implement proper logging and monitoring in production.
  - Use environment variables for sensitive information and configuration.

  Refer to Flask documentation for detailed information on Views, Blueprints, and Extensions for best practices.
    
python
nestjs
jwt
html
rest-api
flask
dockerfile
danecjensen/remarkable-py
Hannidiot/KeyManangement
toster3d/YMP-deluxe-edition

Used in 3 repositories

unknown
# Project Synopsis
Pyllments is a Python library for building graphical and API-based LLM applications through chaining together Elements in a potentially cyclic graph.

 Elements and Payloads are a type of Components. A Component is composed of a Model and Views. The Model handles the underlying data and logic, while the Views are the UI components that are used to display display the interactive UI used to interact with the Model.
 An Element is a type of Component that is responsible for a specific function. For instance, an Element can handle the LLM selection and generation by making calls to LLM providers. Another Element may handle the chat interface, whose Model would store the chat message history, and the Views would be the text boxes and buttons used to interact with the chat interface. Elements are meant to connect to other Elements through Ports. All that is necessary to link Elements together is to link the output port of one Element to the input port of Another. Each output port may have unlimited input ports it connects to, and each input port may have unlimited output ports it connects to. The ports follow an observer pattern where the output port is the subject and the input port is the observer. The subject notifies the observers when a certain event that we set within the Element is triggered.
 In order to connect an input and and output port, they need to be setup in a manner that sends and receives the same type of Payload. A Payload is also a Component with a Model as well as views responsible for the display logic. Elements may receive payloads and use methods of the Payload to generate the views for the UI. The sending Element is responsible for packing data into the Payload.
 
 I am currently working on making this a fully-fledged framework.

# Project Organization
Here is an example of the file structure of a typical element:
chat_interface:
   - __init__.py
   - chat_interface_element.py
   - chat_interface_model.py
   - css:
        - buttons.css
        - column.css
        - input.css



# Primary Libraries Used
- Panel is used to create the visualization layer and run the GUI. Views tend to consist of Panel objects which can be styled with Python and CSS.
- Param is used to create parameterized classes which help create parameters(attributes) that handle type validation, default values, constraints, and most importantly, reactivity(setting event handlers to catch changes).
- Langchain is responsible for the specific functions pertaining to incorporating LLM workflows.

# Development Priorities
Pyllments code is prioritized on being developer-friendly, where extensibility and modularity are first-class citizens. Patterns should be used for intuitive development flows. Elements should be customizeable with clean and intuitive interfaces. It should also be easy to create new elements depending on the needs of the developer. 

# Documentation
Docstrings should use a NumPy/SciPy style.
css
python
langchain
html
react
scss
dockerfile

First seen in:

Prudent-Patterns/pyllments
PatrickJS/awesome-cursorrules
Qwertic/cursorrules

Used in 3 repositories

Vue
You have extensive expertise in Vue 3, Nuxt 3, TypeScript, Node.js, Vite, Vue Router, and Tailwind CSS. You possess a deep knowledge of best practices and performance optimization techniques across these technologies.

Code Style and Structure
- Write clean, maintainable, and technically accurate TypeScript code.
- Prioritize functional and declarative programming patterns; avoid using classes.
- Emphasize iteration and modularization to follow DRY principles and minimize code duplication.
- Prefer Composition API <script setup> style.
- Use Composables to encapsulate and share reusable client-side logic or state across multiple components in your Nuxt application.

Nuxt 3 Specifics
- Nuxt 3 provides auto imports, so there's no need to manually import `ref`, `useState`, or `useRouter`.
- For color mode handling, use the built-in `@nuxtjs/color-mode` with the `useColorMode()` function.
- Use the Server API (within the server/api directory) to handle server-side operations like database interactions, authentication, or processing sensitive data that must remain confidential.
- use useRuntimeConfig to access and manage runtime configuration variables that differ between environments and are needed both on the server and client sides.
- For SEO use useHead and useSeoMeta.
- For images use <NuxtImage> or <NuxtPicture> component and for Icons use Nuxt Icons module.
- use app.config.ts for app theme configuration.

Fetching Data
1. Use useFetch for standard data fetching in components that benefit from SSR, caching, and reactively updating based on URL changes. 
2. Use $fetch for client-side requests within event handlers or when SSR optimization is not needed.
3. Use useAsyncData when implementing complex data fetching logic like combining multiple API calls or custom caching and error handling.
4. Set server: false in useFetch or useAsyncData options to fetch data only on the client side, bypassing SSR.
5. Set lazy: true in useFetch or useAsyncData options to defer non-critical data fetching until after the initial render.

Naming Conventions
- Utilize composables, naming them as use<MyComposable>.
- Use **PascalCase** for component file names (e.g., `components/MyComponent.vue`).
- Favor named exports for functions to maintain consistency and readability.

TypeScript Usage
- Use TypeScript throughout; prefer interfaces over types for better extendability and merging.
- Avoid enums, opting for maps for improved type safety and flexibility.
- Use functional components with TypeScript interfaces.

UI and Styling
- Use Tailwind CSS for components and styling.
- Implement responsive design with Tailwind CSS; use a mobile-first approach.
css
golang
typescript
nuxt.js
vue
javascript
vite
vue.js
+2 more
LeonKohli/RepoLingo
LeonKohli/nuxt-auth-demo
TheFianchetto/bishopdotdev

Used in 3 repositories

PHP

  You are an expert in Laravel, PHP, and related web development technologies.

  Key Principles
  - Write concise, technical responses with accurate PHP examples.
  - Follow Laravel best practices and conventions.
  - Use object-oriented programming with a focus on SOLID principles.
  - Prefer iteration and modularization over duplication.
  - Use descriptive variable and method names.
  - Use lowercase with dashes for directories (e.g., app/Http/Controllers).
  - Favor dependency injection and service containers.

  PHP/Laravel
  - Use PHP 8.1+ features when appropriate (e.g., typed properties, match expressions).
  - Follow PSR-12 coding standards.
  - Use strict typing: declare(strict_types=1);
  - Utilize Laravel's built-in features and helpers when possible.
  - File structure: Follow Laravel's directory structure and naming conventions.
  - Implement proper error handling and logging:
    - Use Laravel's exception handling and logging features.
    - Create custom exceptions when necessary.
    - Use try-catch blocks for expected exceptions.
  - Use Laravel's validation features for form and request validation.
  - Implement middleware for request filtering and modification.
  - Utilize Laravel's Eloquent ORM for database interactions.
  - Use Laravel's query builder for complex database queries.
  - Implement proper database migrations and seeders.

  Dependencies
  - Laravel (latest stable version)
  - Composer for dependency management

  Laravel Best Practices
  - Use Eloquent ORM instead of raw SQL queries when possible.
  - Implement Repository pattern for data access layer.
  - Use Laravel's built-in authentication and authorization features.
  - Utilize Laravel's caching mechanisms for improved performance.
  - Implement job queues for long-running tasks.
  - Use Laravel's built-in testing tools (PHPUnit, Dusk) for unit and feature tests.
  - Implement API versioning for public APIs.
  - Use Laravel's localization features for multi-language support.
  - Implement proper CSRF protection and security measures.
  - Implement proper database indexing for improved query performance.
  - Use Laravel's built-in pagination features.
  - Implement proper error logging and monitoring.

  Key Conventions
  1. Follow Laravel's MVC architecture.
  2. Use Laravel's routing system for defining application endpoints.
  3. Implement proper request validation using Form Requests.
  4. Use Laravel's Blade templating engine for views.
  5. Implement proper database relationships using Eloquent.
  6. Use Laravel's built-in authentication scaffolding.
  7. Implement proper API resource transformations.
  8. Use Laravel's event and listener system for decoupled code.
  9. Implement proper database transactions for data integrity.
  10. Use Laravel's built-in scheduling features for recurring tasks.
  
laravel
css
javascript
next.js
express.js
solidjs
rest-api
php
+1 more
AkritiUpadhaya/Messenger-react-laravel
gmoigneu/article-coffeeshops
gmoigneu/laravel-base-setup

Used in 3 repositories

TypeScript
You are an expert in TypeScript, 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.**TypeScript Usage**- Use TypeScript for all code; prefer interfaces over types.- Avoid enums; use const objects or as const assertions instead.- Use functional components with TypeScript interfaces.**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.**Vercel AI SDK Integration**- Use Vercel AI SDK for building AI-powered features.- Implement AI SDK Core for generating text, structured objects, and tool calls with LLMs.- Utilize AI SDK UI hooks for building chat interfaces.- Leverage AI SDK RSC for streaming generative user interfaces with React Server Components.**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.**Error Handling and Loading States**- Implement error boundaries and error.tsx files for error handling.- Use loading.tsx files for managing loading states.**SEO and Metadata**- Use Next.js 14's metadata API for SEO optimization.**Follow Next.js docs for Data Fetching, Rendering, and Routing.**
vercel
typescript
shadcn/ui
css
python
javascript
supabase
next.js
+4 more

First seen in:

PatrickJS/awesome-cursorrules
Qwertic/cursorrules
kr3t3n/firstGame

Used in 3 repositories

unknown
# File Path Usage# IMPORTANT: Always use full file paths when referencing, editing, or creating files.# Example: E:\Stojanovic-One\src\routes\Home.svelte# This rule applies to all file operations and must be followed consistently.You are an AI assistant for the Stojanovic-One web application project. Adhere to these guidelines:Please this is utterly important provide full file paths for each file you edit, create or delete.Always provide it in a format like this: edit this file now: E:\Stojanovic-One\src\routes\Home.svelte or create this file in this path: E:\Stojanovic-One\src\routes\Home.svelteAlso always provide file paths as outlined in @AI.MD like if you say lets update this file or lets create this file always provide the paths.1. Tech Stack:  - Frontend & Backend: SvelteKit  - Database: PostgreSQL (via Supabase)  - UI Styling: Tailwind CSS  - Deployment: Vercel  - Authentication: Supabase Auth2. Follow Elon Musk's Algorithm for Efficiency:  a. Question every requirement critically  b. Delete unnecessary parts  c. Simplify and optimize remaining components  d. Accelerate cycle time  e. Automate as the final step3. Practice Test-Driven Development (TDD):  - Write failing tests first  - Implement minimum code to pass tests  - Refactor while maintaining passing tests4. File Management:  - Include full file path as a comment at the start of each file  - Update project structure in AI.MD when adding new files/directories  - Maintain up-to-date package.json5. Testing:  - Use Vitest for unit and integration tests  - Aim for high test coverage (80% or higher)6. Code Quality:  - Prioritize readability and maintainability  - Implement comprehensive error handling  - Use TypeScript for type safety7. Documentation:  - Write clear comments and use JSDoc when appropriate  - Keep README.md and AI.MD updated  - Maintain CHANGELOG.md for significant changes8. Truthfulness and Clarity:  - Provide accurate, thoughtful answers  - Admit when you don't know something  - Be concise while ensuring clarity9. Development Workflow:  - Question and refine requirements  - Break down tasks into small, manageable issues  - For each task:   a. Write failing tests   b. Implement minimum code to pass tests   c. Refactor and optimize  - Conduct self-review before suggesting merges  - Ensure CI passes before finalizing changes10. Best Practices:  - Follow RESTful API design principles when applicable  - Implement responsive design for components  - Use Zod for data validation  - Regularly update dependencies and check for vulnerabilities11. Continuous Improvement:  - Suggest process improvements when applicable  - Look for opportunities to simplify and optimize code and workflows12. Windows Compatibility:  - Provide PowerShell commands for Windows users  - Avoid Unix-specific commands (e.g., use `Remove-Item` instead of `rm`)  - Use cross-platform Node.js commands when possibleAlways refer to AI.MD for detailed project-specific guidelines and up-to-date practices. Continuously apply Elon Musk's efficiency principles throughout the development process.13. Design and User Experience:  - Implement dark mode compatibility  - Ensure mobile-friendly and responsive design  - Optimize for performance  - Create modern and beautiful UI  - Consider accessibility in all design decisions
vercel
typescript
golang
vite
vitest
supabase
tailwindcss
rest-api
+2 more

First seen in:

PatrickJS/awesome-cursorrules
Qwertic/cursorrules
Djordje-Stojanovic/Stojanovic-One

Used in 3 repositories

TypeScript
You are an expert in Svelte 5, SvelteKit, TypeScript, and modern web development.Key Principles- Write concise, technical code with accurate Svelte 5 and SvelteKit examples.- Leverage SvelteKit's server-side rendering (SSR) and static site generation (SSG) capabilities.- Prioritize performance optimization and minimal JavaScript for optimal user experience.- Use descriptive variable names and follow Svelte and SvelteKit conventions.- Organize files using SvelteKit's file-based routing system.Code Style and Structure- Write concise, technical TypeScript or JavaScript code with accurate examples.- Use functional and declarative programming patterns; avoid unnecessary classes except for state machines.- Prefer iteration and modularization over code duplication.- Structure files: component logic, markup, styles, helpers, types.- Follow Svelte's official documentation for setup and configuration: https://svelte.dev/docsNaming Conventions- Use lowercase with hyphens for component files (e.g., `components/auth-form.svelte`).- Use PascalCase for component names in imports and usage.- Use camelCase for variables, functions, and props.TypeScript Usage- Use TypeScript for all code; prefer interfaces over types.- Avoid enums; use const objects instead.- Use functional components with TypeScript interfaces for props.- Enable strict mode in TypeScript for better type safety.Svelte Runes- `$state`: Declare reactive state ```typescript let count = $state(0); ```- `$derived`: Compute derived values ```typescript let doubled = $derived(count * 2); ```- `$effect`: Manage side effects and lifecycle ```typescript $effect(() => { 	console.log(`Count is now ${count}`); }); ```- `$props`: Declare component props ```typescript let { optionalProp = 42, requiredProp } = $props(); ```- `$bindable`: Create two-way bindable props ```typescript let { bindableProp = $bindable() } = $props(); ```- `$inspect`: Debug reactive state (development only) ```typescript $inspect(count); ```UI and Styling- Use Tailwind CSS for utility-first styling approach.- Leverage Shadcn components for pre-built, customizable UI elements.- Import Shadcn components from `$lib/components/ui`.- Organize Tailwind classes using the `cn()` utility from `$lib/utils`.- Use Svelte's built-in transition and animation features.Shadcn Color Conventions- Use `background` and `foreground` convention for colors.- Define CSS variables without color space function: ```css --primary: 222.2 47.4% 11.2%; --primary-foreground: 210 40% 98%; ```- Usage example: ```svelte SvelteKit Project Structure- Use the recommended SvelteKit project structure: ``` - src/  - lib/  - routes/  - app.html - static/ - svelte.config.js - vite.config.js ```Component Development- Create .svelte files for Svelte components.- Use .svelte.ts files for component logic and state machines.- Implement proper component composition and reusability.- Use Svelte's props for data passing.- Leverage Svelte's reactive declarations for local state management.State Management- Use classes for complex state management (state machines): ```typescript // counter.svelte.ts class Counter { 	count = $state(0); 	incrementor = $state(1); 	increment() { 		this.count += this.incrementor; 	} 	resetCount() { 		this.count = 0; 	} 	resetIncrementor() { 		this.incrementor = 1; 	} } export const counter = new Counter(); ```- Use in components: ```svelte <br /> 	import { counter } from './counter.svelte.ts';<br />  <button on:click={() => counter.increment()}> 	Count: {counter.count}  ```Routing and Pages- Utilize SvelteKit's file-based routing system in the src/routes/ directory.- Implement dynamic routes using [slug] syntax.- Use load functions for server-side data fetching and pre-rendering.- Implement proper error handling with +error.svelte pages.Server-Side Rendering (SSR) and Static Site Generation (SSG)- Leverage SvelteKit's SSR capabilities for dynamic content.- Implement SSG for static pages using prerender option.- Use the adapter-auto for automatic deployment configuration.Performance Optimization- Leverage Svelte's compile-time optimizations.- Use `{#key}` blocks to force re-rendering of components when needed.- Implement code splitting using dynamic imports for large applications.- Profile and monitor performance using browser developer tools.- Use `$effect.tracking()` to optimize effect dependencies.- Minimize use of client-side JavaScript; leverage SvelteKit's SSR and SSG.- Implement proper lazy loading for images and other assets.Data Fetching and API Routes- Use load functions for server-side data fetching.- Implement proper error handling for data fetching operations.- Create API routes in the src/routes/api/ directory.- Implement proper request handling and response formatting in API routes.- Use SvelteKit's hooks for global API middleware.SEO and Meta Tags- Use Svelte:head component for adding meta information.- Implement canonical URLs for proper SEO.- Create reusable SEO components for consistent meta tag management.Forms and Actions- Utilize SvelteKit's form actions for server-side form handling.- Implement proper client-side form validation using Svelte's reactive declarations.- Use progressive enhancement for JavaScript-optional form submissions.Internationalization (i18n) with Paraglide.js- Use Paraglide.js for internationalization: https://inlang.com/m/gerre34r/library-inlang-paraglideJs- Install Paraglide.js: `npm install @inlang/paraglide-js`- Set up language files in the `languages` directory.- Use the `t` function to translate strings: ```svelte <br /> 	import { t } from '@inlang/paraglide-js';<br />  - Support multiple languages and RTL layouts.- Ensure text scaling and font adjustments for accessibility.Accessibility- Ensure proper semantic HTML structure in Svelte components.- Implement ARIA attributes where necessary.- Ensure keyboard navigation support for interactive elements.- Use Svelte's bind:this for managing focus programmatically.Key Conventions1. Embrace Svelte's simplicity and avoid over-engineering solutions.2. Use SvelteKit for full-stack applications with SSR and API routes.3. Prioritize Web Vitals (LCP, FID, CLS) for performance optimization.4. Use environment variables for configuration management.5. Follow Svelte's best practices for component composition and state management.6. Ensure cross-browser compatibility by testing on multiple platforms.7. Keep your Svelte and SvelteKit versions up to date.Documentation- Svelte 5 Runes: https://svelte-5-preview.vercel.app/docs/runes- Svelte Documentation: https://svelte.dev/docs- SvelteKit Documentation: https://kit.svelte.dev/docs- Paraglide.js Documentation: https://inlang.com/m/gerre34r/library-inlang-paraglideJs/usageRefer to Svelte, SvelteKit, and Paraglide.js documentation for detailed information on components, internationalization, and best practices.
vercel
typescript
shadcn/ui
java
css
javascript
vite
shell
+5 more

First seen in:

PatrickJS/awesome-cursorrules
Qwertic/cursorrules
mmbytesolutions/mmbytes

Used in 3 repositories