This commit is contained in:
sanjeed5
2025-05-12 01:32:37 +05:30
239 changed files with 519 additions and 548 deletions
+1 -1
View File
@@ -7,7 +7,7 @@ EXA_API_KEY=your_exa_api_key_here
# Choose one of the following based on your LLM provider:
# For Gemini (default in config.yaml)
GOOGLE_API_KEY=your_google_api_key_here
GEMINI_API_KEY=your_google_api_key_here
# For OpenAI models (uncomment if using)
# OPENAI_API_KEY=your_openai_api_key_here
+4
View File
@@ -56,6 +56,10 @@
"name": "qwik",
"tags": ["frontend", "framework", "javascript"]
},
{
"name": "astro",
"tags": ["frontend", "framework", "javascript", "ssr"]
},
{
"name": "express",
"tags": ["backend", "framework", "javascript", "nodejs"]
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: Comprehensive best practices for developing robust, efficient, and maintainable applications using the actix-web framework in Rust. This rule covers coding standards, project structure, performance, security, testing, and common pitfalls.
globs: **/*.rs
globs: *.rs
---
# Actix-web Best Practices: A Comprehensive Guide
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: Comprehensive guide for aiohttp development covering code organization, performance, security, testing, and deployment best practices. Provides actionable guidance for developers to build robust and maintainable aiohttp applications.
globs: **/*.py
globs: *.py
---
# Aiohttp Best Practices
+5 -4
View File
@@ -1,6 +1,7 @@
---
description: This rule file provides best practices, coding standards, and security guidelines for developing, deploying, and maintaining applications using the amazon-ec2 library within the AWS ecosystem. It focuses on infrastructure as code (IaC), resource management, performance, and security considerations for robust and scalable EC2-based solutions.
globs: **/*.{tf,json,yml,yaml,py,js,ts,sh,java,go,rb,m}
globs: *.tf,*.json,*.yml,*.yaml,*.py,*.js,*.ts,*.sh,*.java,*.go,*.rb,*.m
alwaysApply: false
---
- ## General Principles
- **Infrastructure as Code (IaC):** Treat your infrastructure as code. Define and provision AWS resources (EC2 instances, security groups, networks) using code (e.g., AWS CloudFormation, AWS CDK, Terraform). This ensures consistency, repeatability, and version control.
@@ -312,6 +313,6 @@ globs: **/*.{tf,json,yml,yaml,py,js,ts,sh,java,go,rb,m}
- ## References
- [AWS EC2 Best Practices](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-best-practices.html)
- [AWS CDK Best Practices](https://docs.aws.amazon.com/cdk/v2/guide/best-practices.html)
- [Terraform AWS Provider Best Practices](https://docs.aws.amazon.com/prescriptive-guidance/latest/terraform-aws-provider-best-practices/structure.html)
- [AWS EC2 Best Practices](mdc:https:/docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-best-practices.html)
- [AWS CDK Best Practices](mdc:https:/docs.aws.amazon.com/cdk/v2/guide/best-practices.html)
- [Terraform AWS Provider Best Practices](mdc:https:/docs.aws.amazon.com/prescriptive-guidance/latest/terraform-aws-provider-best-practices/structure.html)
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: This rule file provides comprehensive best practices, coding standards, and security guidelines for developing applications using Amazon S3. It aims to ensure secure, performant, and maintainable S3 integrations.
globs: **/*S3*.{js,ts,jsx,tsx,py,java,go,csharp}
globs: *S3*.js,*S3*.ts,*S3*.jsx,*S3*.tsx,*S3*.py,*S3*.java,*S3*.go,*S3*.csharp
---
- Always disable public access to S3 buckets unless explicitly needed. Use AWS Identity and Access Management (IAM) policies and bucket policies for access control instead of Access Control Lists (ACLs), which are now generally deprecated.
- Implement encryption for data at rest using Server-Side Encryption (SSE), preferably with AWS Key Management Service (KMS) for enhanced security.
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: This rule file provides comprehensive best practices for Android SDK development, encompassing code organization, performance, security, testing, and common pitfalls. It aims to guide developers in creating robust, maintainable, and efficient Android applications and libraries.
globs: **/*.{java,kt,xml,gradle,properties}
globs: *.java,*.kt,*.xml,*.gradle,*.properties
---
- MUST be under source control management (SCM). RECOMMENDED source control management is git
- If you intend your source repo to be public ensure you have received the necessary management and legal approval
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: This rule provides comprehensive guidelines for Angular development, covering coding standards, best practices, performance optimization, security considerations, and testing approaches to ensure maintainable, scalable, and high-performing applications.
globs: **/*.{ts,html,scss,css}
globs: *.ts,*.html,*.scss,*.css
---
# Angular Best Practices and Coding Standards
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: This rule file provides comprehensive best practices and coding standards for Ansible projects, covering code organization, common patterns, performance, security, testing, pitfalls, and tooling. It aims to improve maintainability, reusability, and efficiency in Ansible automation.
globs: **/*.{yml,yaml,j2}
globs: *.yml,*.yaml,*.j2
---
- Adopt and adhere to the following Ansible best practices to ensure maintainable, reusable, and efficient automation code. This guide provides standards for code organization, common patterns, performance optimization, security, testing, tooling, and common pitfalls to avoid.
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: This rule enforces best practices and coding standards for projects using the Ant Design (antd) UI library within React applications. It covers code organization, performance, security, testing, and common pitfalls to ensure maintainable and efficient applications.
globs: **/*.{js,jsx,ts,tsx}
globs: *.js,*.jsx,*.ts,*.tsx
---
# Ant Design (antd) Best Practices and Coding Standards
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: This rule provides best practices and coding standards for developing with the AnyIO library, focusing on structured concurrency, task management, and proper use of synchronization primitives to create robust, cross-backend asynchronous applications.
globs: **/*.py
globs: *.py
---
# AnyIO Best Practices and Coding Standards
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: This rule provides comprehensive best practices for using Apollo Client in your projects, covering code organization, performance, security, testing, and common pitfalls. It aims to guide developers in building robust and maintainable GraphQL-powered applications.
globs: **/*.{js,jsx,ts,tsx,gql,graphql}
globs: *.js,*.jsx,*.ts,*.tsx,*.gql,*.graphql
---
- **Code Organization and Structure:**
- **Directory Structure:**
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: This rule provides comprehensive best practices and coding standards for developing with Apollo GraphQL. It covers schema design, security, performance, testing, and deployment.
globs: **/*.{js,jsx,ts,tsx,graphql}
globs: *.js,*.jsx,*.ts,*.tsx,*.graphql
---
- Always use UV when installing dependencies
- Always use python 3.12
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: This rule file provides best practices and coding standards for ASP.NET Core development, covering various aspects from code organization to security and performance optimization.
globs: **/*.cs
globs: *.cs
---
# ASP.NET Core Best Practices and Coding Standards
+168 -160
View File
@@ -1,168 +1,176 @@
---
description: Comprehensive best practices and coding standards for Astro projects, including code organization, performance considerations, security, and testing.
globs: **/*.astro
description: This rule provides comprehensive best practices and coding standards for developing Astro projects. It covers code organization, performance, security, testing, and common pitfalls.
globs: *.astro
---
- # Code Organization and Structure
- ## Directory Structure Best Practices
- `src/`: This is the heart of your Astro project.
- `components/`: Reusable UI elements. Organize components into subdirectories based on functionality or feature.
- `layouts/`: Components that define the overall page structure. Use a `BaseLayout.astro` to provide common elements like `<head>` and `<footer>`.
- `pages/`: Special components that create routes. Each file here becomes a page. Use dynamic routes (`[param].astro`) for data-driven content.
- `content/`: (Required for content collections) Store content collections and an optional `config.ts` or `config.js` file.
- `styles/`: Global CSS or Sass files. Use Astro's CSS Modules for component-specific styles.
- `scripts/`: JavaScript modules or utilities. Consider using TypeScript for type safety.
- `utils/`: Helper functions and utilities.
- `types/`: TypeScript type definitions for your project.
- `public/`: Static assets like images, fonts, and favicons. These are copied directly to the `dist/` folder without processing.
- `dist/`: (Generated) The output directory containing the built website. Usually ignored in version control.
- `node_modules/`: (Generated) Project dependencies managed by npm, pnpm or yarn. Usually ignored in version control.
- `.astro/`: (Generated) Internal Astro files. Should not be manually modified.
- ## File Naming Conventions
- **Components:** `ComponentName.astro` (PascalCase).
- **Pages:** `page-name.astro` (kebab-case). Index pages should be named `index.astro`.
- **Layouts:** `LayoutName.astro` (PascalCase).
- **Styles:** `Component.module.css` (component-specific), `global.css` (global styles).
- **Scripts:** `script-name.js` or `script-name.ts` (kebab-case).
- ## Module Organization
- Favor modularity and reusability.
- Group related components and functions into modules within the appropriate directory (e.g., `components/ui/Button.astro`).
- Use clear and descriptive names for files and folders.
- Expose only the necessary parts of a module using `export` and `import` statements.
- ## Component Architecture Recommendations
- **Atomic Design:** Consider using Atomic Design principles to create a scalable and maintainable component library (Atoms, Molecules, Organisms, Templates, Pages).
- **Composition:** Favor composition over inheritance.
- **Slots:** Utilize Astro's slots to create flexible components that accept dynamic content.
- **Props:** Use TypeScript to define prop types for your components.
- **Keep Components Focused:** A component should ideally handle a single responsibility.
- ## Code Splitting Strategies
- **Automatic Code Splitting:** Astro automatically code-splits JavaScript and CSS, so generally you don't need to manually handle code splitting.
- **Dynamic Imports:** Use dynamic imports (`import('./Component.astro')`) for components or modules that are not immediately needed. This is useful for infrequently used components or large libraries.
- **View Transitions:** Astro's View Transitions API also helps with perceived performance, providing smoother navigation between pages instead of full reloads. Optimize assets for transitions by using the `<Image>` component.
# Astro Library Best Practices and Coding Standards
- # Common Patterns and Anti-patterns
- ## Design Patterns
- **Container/Presentational:** Separate data fetching and logic (container components) from UI rendering (presentational components).
- **Higher-Order Components (HOCs):** Use HOCs or render props (though less common in Astro) to share logic between components.
- **Provider Pattern:** Utilize Astro's `<script context="module">` to provide context values to all components within a scope.
- ## Recommended Approaches
- **Data Fetching:** Fetch data in `<script>` tags inside Astro components using `fetch` or other HTTP libraries. Use `await` to handle asynchronous operations.
- **State Management:** Astro favors a simpler approach with props and events for most use cases. For complex state management, consider using tools like nanostores, zustand or redux if needed.
- **Component Communication:** Pass data down through props. For event handling, use standard JavaScript event listeners and dispatch custom events if needed.
- ## Anti-patterns
- **Mutating Props:** Avoid directly mutating props passed to a component.
- **Over-Complicated State Management:** Don't introduce complex state management libraries unless absolutely necessary.
- **Large Components:** Break down large components into smaller, more manageable pieces.
- **Inline Styles:** Avoid inline styles. Use CSS Modules or global CSS files instead.
- ## State Management Best Practices
- **Local Component State:** Use `Astro.props` for simple local state within a component.
- **Global State (If Needed):** For application-wide state, consider lightweight state management libraries such as nanostores.
- **Avoid Overusing State:** Not every value needs to be reactive state. Consider the complexity trade-off.
- ## Error Handling
- **Try/Catch:** Use `try...catch` blocks to handle errors during data fetching or other asynchronous operations.
- **Error Boundaries (Components):** Create dedicated components to catch errors and display fallback UI.
- **Centralized Logging:** Implement a centralized logging system to track errors in production.
This document outlines the recommended best practices and coding standards for developing Astro projects to ensure maintainability, performance, and security.
- # Performance Considerations
- ## Optimization Techniques
- **Image Optimization:** Use Astro's `<Image>` component for automatic image optimization (resizing, format conversion, lazy loading).
- **Font Optimization:** Use `font-display: swap;` in your CSS to prevent blocking render when loading web fonts.
- **Minification and Bundling:** Astro automatically minifies and bundles CSS and JavaScript during the build process.
- **Remove Unused CSS:** Use tools like PurgeCSS to remove unused CSS from your stylesheets, improving performance.
- **Partial Hydration:** Use Astro's directives (e.g., `client:load`, `client:idle`) to control when components are hydrated, reducing JavaScript overhead.
- ## Memory Management
- **Avoid Memory Leaks:** Be mindful of memory leaks, especially in long-running applications. Properly clean up event listeners and resources when components unmount.
- **Efficient Data Structures:** Choose appropriate data structures for your application's needs.
- ## Rendering Optimization
- **Static Rendering:** Astro favors static rendering, which delivers the fastest possible performance.
- **Server-Side Rendering (SSR):** Use SSR only when necessary for dynamic content or features that require server-side processing.
- **Client-Side Rendering (CSR):** Minimize client-side rendering to improve initial page load time.
- ## Bundle Size Optimization
- **Lazy Loading:** Use lazy loading for images and other assets that are not immediately visible on the page.
- **Tree Shaking:** Astro's build process automatically performs tree shaking to remove unused code from your JavaScript bundles.
- **Code Splitting:** Astro automatically splits your code into smaller chunks, which can improve performance by reducing the amount of code that needs to be downloaded initially.
- ## Lazy Loading Strategies
- **Images:** Use the `loading="lazy"` attribute on `<img>` tags or use the Astro `<Image>` component to automatically lazy load images.
- **Components:** Use dynamic imports to lazy load components that are not immediately needed.
- **Libraries:** Import libraries only when they are needed, using dynamic imports if necessary.
## 1. Code Organization and Structure
- # Security Best Practices
- ## Common Vulnerabilities
- **Cross-Site Scripting (XSS):** Prevent XSS attacks by sanitizing user input and escaping output.
- **Cross-Site Request Forgery (CSRF):** Use CSRF tokens to protect against CSRF attacks.
- **SQL Injection:** Protect against SQL injection attacks by using parameterized queries or an ORM.
- **Man-in-the-Middle (MitM) Attacks:** Use HTTPS to encrypt communication between the client and server.
- ## Input Validation
- **Server-Side Validation:** Always validate user input on the server-side.
- **Client-Side Validation:** Use client-side validation for immediate feedback to the user, but never rely on it as the sole means of validation.
- **Escape Output:** Escape user-provided data when rendering it to prevent XSS.
- ## Authentication and Authorization
- **Use Secure Authentication:** Use a secure authentication mechanism, such as OAuth 2.0 or JWT.
- **Implement Role-Based Access Control (RBAC):** Restrict access to resources based on user roles.
- **Protect API Endpoints:** Require authentication for all API endpoints that require authorization.
- ## Data Protection
- **Encrypt Sensitive Data:** Encrypt sensitive data at rest and in transit.
- **Use Strong Passwords:** Enforce strong password policies.
- **Regularly Back Up Data:** Regularly back up your data in case of data loss or corruption.
- ## Secure API Communication
- **Use HTTPS:** Always use HTTPS to encrypt communication between the client and server.
- **Validate API Responses:** Validate API responses to ensure that they are in the expected format.
- **Rate Limiting:** Implement rate limiting to prevent abuse of your API.
### 1.1 Project Structure
- # Testing Approaches
- ## Unit Testing
- **Test Individual Components:** Test individual components in isolation to ensure that they are working correctly.
- **Mock Dependencies:** Use mocking to isolate components from their dependencies.
- **Assertion Libraries:** Use assertion libraries like Jest or Chai to assert that components are behaving as expected.
- ## Integration Testing
- **Test Component Interactions:** Test the interactions between components to ensure that they are working together correctly.
- **Test Data Flow:** Test the flow of data through your application to ensure that data is being passed correctly between components.
- ## End-to-End Testing
- **Test User Flows:** Test user flows to ensure that users can complete tasks successfully.
- **Automate Tests:** Automate end-to-end tests to ensure that your application is working correctly after changes are made.
- ## Test Organization
- **Locate tests near components:** Keep test files close to the components being tested (e.g. `src/components/MyComponent.test.astro`).
- **Consistent naming:** Use a consistent naming convention for test files (e.g., `MyComponent.test.astro` or `MyComponent.spec.astro`).
- ## Mocking and Stubbing
- **Mock API calls:** Mock API calls to isolate components from the backend.
- **Stub External Dependencies:** Stub external dependencies to control their behavior during testing.
- **Use testing libraries:** Utilize testing libraries such as `jest`, `vitest`, or `mocha` for mocking and stubbing.
- **`src/` Directory:** This directory contains the core source code of your Astro project.
- **`src/pages/`:** This directory is crucial for routing. Every `.astro`, `.md`, or `.mdx` file in this directory automatically becomes a route. Use a clear and consistent naming convention for your pages (e.g., `about.astro`, `blog/index.astro`, `blog/[slug].astro`).
- **`src/components/`:** Store reusable UI components in this directory. Organize components into subdirectories based on their functionality or feature area (e.g., `src/components/Header/`, `src/components/Card/`).
- **`src/layouts/`:** Layouts define the overall structure of your pages (e.g., header, footer, navigation). Use layouts to maintain a consistent look and feel across your website.
- **`src/content/`:** (Recommended for content-driven sites) Use the Content Collections feature to manage structured content like blog posts, documentation, or product listings. Define schemas for your content types to ensure data consistency.
- **`src/styles/`:** Store global styles and CSS variables in this directory. Consider using CSS Modules or a CSS-in-JS solution for component-specific styling.
- **`src/scripts/`:** Place client-side JavaScript files in this directory. Use modules and avoid polluting the global scope.
- **`src/assets/`:** Store static assets like images, fonts, and other media files in this directory.
- **`public/` Directory:** This directory contains static assets that don't need processing, such as `robots.txt`, `favicon.ico`, and other files that should be served directly. Avoid placing images that require optimization in this directory; use the `src/assets/` directory instead.
- **`astro.config.mjs`:** This file contains the Astro configuration options, including integrations, build settings, and more. Keep this file well-organized and documented.
- **`.env`:** Store environment variables in this file. Use a library like `dotenv` to load environment variables into your application.
- # Common Pitfalls and Gotchas
- ## Frequent Mistakes
- **Over-reliance on Client-Side JavaScript:** Remember Astro's focus on minimal JS. Avoid hydrating components unless necessary.
- **Incorrect Component Hydration Directives:** Double-check `client:` directives to make sure components are hydrated at the correct time.
- **Ignoring Performance Metrics:** Pay attention to performance metrics like Lighthouse scores and bundle sizes.
- ## Edge Cases
- **View Transitions with Complex Animations:** Complex animations may need special handling with Astro's View Transitions API.
- **Integrating with Third-Party Libraries:** Some third-party libraries may require custom integration due to Astro's build process.
- ## Version-Specific Issues
- Refer to the Astro documentation and release notes for any version-specific issues or breaking changes.
- ## Compatibility Concerns
- Be aware of compatibility concerns when integrating with other technologies, such as backend frameworks or CMS systems.
- ## Debugging Strategies
- **Browser Developer Tools:** Use browser developer tools to inspect HTML, CSS, and JavaScript.
- **Astro Dev Toolbar:** Take advantage of Astro's built-in Dev Toolbar for component inspection and debugging.
- **Console Logging:** Strategically use `console.log` statements to debug your code.
- **Debugging in VS Code:** Configure VS Code for debugging Astro applications.
### 1.2 Component Design
- # Tooling and Environment
- ## Recommended Development Tools
- **VS Code:** Use VS Code with the official Astro extension for syntax highlighting, code completion, and other features.
- **ESLint:** Configure ESLint with the `eslint-plugin-astro` plugin to lint Astro components.
- **Prettier:** Use Prettier to automatically format your code.
- **EditorConfig:** Use EditorConfig to maintain consistent code style across different editors.
- ## Build Configuration
- **astro.config.mjs:** Configure your Astro project in the `astro.config.mjs` file.
- **Environment Variables:** Use environment variables to configure your application for different environments.
- ## Linting and Formatting
- **ESLint:** Configure ESLint with the recommended rules for Astro projects.
- **Prettier:** Configure Prettier with the recommended options for Astro projects.
- **Husky and Lint-Staged:** Use Husky and Lint-Staged to automatically lint and format your code before committing.
- ## Deployment Best Practices
- **Choose a Deployment Platform:** Choose a deployment platform that is compatible with Astro, such as Netlify, Vercel, or Cloudflare Pages.
- **Configure Build Settings:** Configure your build settings to optimize your application for production.
- **Use a CDN:** Use a CDN to serve your static assets.
- **Optimize Images:** Optimize images for web performance.
- ## CI/CD Integration
- **GitHub Actions:** Use GitHub Actions or other CI/CD tools to automate your build, test, and deployment processes.
- **Automated Testing:** Run automated tests during your CI/CD pipeline to ensure that your application is working correctly before it is deployed.
- **Atomic Design Principles:** Consider using Atomic Design principles to structure your components into atoms, molecules, organisms, templates, and pages. This promotes reusability and maintainability.
- **Single Responsibility Principle:** Each component should have a single, well-defined responsibility. Avoid creating large, complex components that do too much.
- **Props and Slots:** Use props to pass data to components and slots to allow components to accept children. Define prop types using TypeScript to ensure type safety.
## 2. Common Patterns and Anti-patterns
### 2.1 UI Framework Integration
- **Island Architecture:** Embrace Astro's island architecture to minimize JavaScript and improve performance. Only hydrate interactive components.
- **Client Directives:** Use `client:load`, `client:idle`, `client:visible`, `client:media`, and `client:only` directives appropriately to control when components are hydrated. Avoid over-hydrating components.
- **Framework Component Composition:** Compose components from different frameworks (React, Vue, Svelte, etc.) within the same Astro page. This allows you to leverage the strengths of different frameworks.
- **Passing Props and Children:** Pass props and children to framework components from Astro components. Use named slots to organize children.
- **Anti-pattern: Mixing Astro and Framework Components:** Do not import `.astro` components directly into UI framework components (e.g., `.jsx` or `.svelte`). Use slots to pass static content from Astro components to framework components.
### 2.2 Data Fetching
- **`fetch` API:** Use the `fetch` API to fetch data from external sources or internal APIs. Handle errors appropriately.
- **Content Collections API:** Use the Content Collections API to manage structured content like blog posts or documentation. Define schemas for your content types.
- **CMS Integration:** Integrate with a headless CMS like Hygraph, Contentful, or Strapi to manage content. Use the CMS's API to fetch data and display it on your website.
- **GraphQL:** When using a CMS that supports GraphQL (like Hygraph), use GraphQL queries to fetch only the data you need. This can improve performance and reduce data transfer.
### 2.3 Routing
- **File-Based Routing:** Use Astro's file-based routing to create routes automatically. Follow a consistent naming convention for your pages.
- **Dynamic Routes:** Use dynamic routes (e.g., `[slug].astro`) to handle variable segments in the URL. Access the route parameters using `Astro.params`.
- **Nested Routes:** Use nested folders within `src/pages/` to create nested routes.
- **Anti-pattern: Overly Complex Routing:** Avoid creating overly complex routing structures. Keep your routes simple and intuitive.
### 2.4 Styling
- **Scoped CSS:** Use scoped CSS within Astro components to avoid style conflicts. This ensures that component styles are isolated.
- **Global Styles:** Use global styles for site-wide styling. Store global styles in `src/styles/global.css`.
- **CSS Frameworks:** Use CSS frameworks like Tailwind CSS, Bootstrap, or Materialize to speed up development and maintain a consistent look and feel. Install the appropriate integration for your chosen CSS framework.
- **CSS Modules:** Consider using CSS Modules for component-specific styling. CSS Modules generate unique class names to avoid naming collisions.
## 3. Performance Considerations
### 3.1 Minimizing JavaScript
- **Static-First Architecture:** Embrace Astro's static-first architecture to minimize JavaScript and improve performance. Render as much as possible as static HTML.
- **Island Architecture:** Only hydrate interactive components. Avoid over-hydrating components.
- **Code Splitting:** Use code splitting to break up your JavaScript into smaller chunks. This can improve initial load times.
- **Lazy Loading:** Use lazy loading for images and other assets that are not immediately visible. This can improve initial load times.
### 3.2 Image Optimization
- **Astro's `<Image />` Component:** Use Astro's built-in `<Image />` component to optimize images. The `<Image />` component automatically optimizes images, resizes them, and generates responsive versions.
- **Image Formats:** Use modern image formats like WebP to reduce file sizes. Use AVIF for even better compression, where supported.
- **Compression:** Compress images to reduce file sizes. Use tools like ImageOptim or TinyPNG.
- **Lazy Loading:** Use lazy loading for images that are not immediately visible.
- **Responsive Images:** Use responsive images to serve different image sizes based on the user's screen size.
### 3.3 Font Optimization
- **Web Font Formats:** Use modern web font formats like WOFF2. These formats offer better compression and performance.
- **Font Loading:** Use font loading strategies to avoid blocking rendering. Consider using `font-display: swap`.
- **Preloading:** Preload important fonts to improve loading times.
### 3.4 Caching
- **Browser Caching:** Configure browser caching to cache static assets like images, fonts, and JavaScript files. This can improve performance for returning users.
- **CDN:** Use a Content Delivery Network (CDN) to serve static assets from geographically distributed servers. This can improve performance for users around the world.
## 4. Security Best Practices
### 4.1 Input Validation
- **Validate User Input:** Validate all user input to prevent injection attacks and other security vulnerabilities. Use server-side validation in addition to client-side validation.
- **Sanitize User Input:** Sanitize user input to remove potentially malicious code. Use a library like DOMPurify to sanitize HTML.
### 4.2 Cross-Site Scripting (XSS)
- **Escape Output:** Escape all output to prevent XSS attacks. Use Astro's built-in escaping mechanisms or a library like Handlebars.js.
- **Content Security Policy (CSP):** Implement a Content Security Policy (CSP) to control the resources that the browser is allowed to load. This can help prevent XSS attacks.
### 4.3 Cross-Site Request Forgery (CSRF)
- **CSRF Tokens:** Use CSRF tokens to protect against CSRF attacks. Generate a unique CSRF token for each user session and include it in all forms.
### 4.4 Authentication and Authorization
- **Secure Authentication:** Use secure authentication mechanisms to protect user accounts. Use a library like Passport.js or Auth0.
- **Authorization:** Implement authorization to control access to resources. Use roles and permissions to define what users are allowed to do.
### 4.5 Dependency Management
- **Keep Dependencies Up-to-Date:** Keep your dependencies up-to-date to patch security vulnerabilities. Use a tool like `npm audit` or `yarn audit` to identify and fix vulnerabilities.
- **Lock Dependencies:** Lock your dependencies to prevent unexpected changes. Use `package-lock.json` or `yarn.lock`.
### 4.6 Environment Variables
- **Store Secrets Securely:** Store secrets like API keys and database passwords in environment variables. Do not hardcode secrets in your code.
- **Avoid Committing `.env`:** Never commit your `.env` file to version control. Use a `.gitignore` file to exclude it.
## 5. Testing Approaches
### 5.1 Unit Testing
- **Test Individual Components:** Write unit tests to test individual components in isolation. Use a testing framework like Jest or Mocha.
- **Mock Dependencies:** Mock dependencies to isolate components during testing.
### 5.2 Integration Testing
- **Test Component Interactions:** Write integration tests to test how components interact with each other. Use a testing framework like Cypress or Playwright.
### 5.3 End-to-End Testing
- **Test User Flows:** Write end-to-end tests to test complete user flows. Use a testing framework like Cypress or Playwright.
### 5.4 Accessibility Testing
- **Automated Accessibility Testing:** Use automated accessibility testing tools to identify accessibility issues. Use a tool like axe-core.
- **Manual Accessibility Testing:** Perform manual accessibility testing to ensure that your website is accessible to users with disabilities. Use a screen reader to test your website.
## 6. Common Pitfalls and Gotchas
- **Over-Hydration:** Avoid over-hydrating components. Only hydrate interactive components.
- **Incorrect Client Directives:** Use the correct client directives for your components. Using the wrong client directive can lead to performance issues or unexpected behavior.
- **Global Scope Pollution:** Avoid polluting the global scope with JavaScript variables. Use modules to encapsulate your code.
- **Missing `alt` Attributes:** Always include `alt` attributes for images. The `alt` attribute is important for accessibility and SEO.
- **Hardcoded Secrets:** Never hardcode secrets in your code. Store secrets in environment variables.
- **Insecure Dependencies:** Keep your dependencies up-to-date to patch security vulnerabilities.
- **Not handling errors:** Always handle errors gracefully, especially when fetching data or interacting with external APIs.
## 7. Tooling and Environment
### 7.1 Code Editor
- **Visual Studio Code:** Use Visual Studio Code as your code editor. VS Code has excellent support for Astro and other web development technologies.
- **Astro VS Code Extension:** Install the Astro VS Code extension for syntax highlighting, code completion, and other features.
- **ESLint and Prettier:** Install ESLint and Prettier for code linting and formatting.
### 7.2 Package Manager
- **npm, Yarn, or pnpm:** Use npm, Yarn, or pnpm as your package manager. Choose the package manager that best suits your needs.
### 7.3 Build Tool
- **Astro's Built-in Build Tool:** Use Astro's built-in build tool to build your website. The build tool automatically optimizes your code and assets.
### 7.4 Version Control
- **Git:** Use Git for version control. Git allows you to track changes to your code and collaborate with other developers.
- **GitHub, GitLab, or Bitbucket:** Use GitHub, GitLab, or Bitbucket to host your Git repository. These platforms provide a centralized location for managing and collaborating on code.
### 7.5 Deployment
- **Netlify, Vercel, or Cloudflare Pages:** Use Netlify, Vercel, or Cloudflare Pages to deploy your website. These platforms provide easy-to-use deployment workflows and CDN integration.
By following these best practices and coding standards, you can ensure that your Astro projects are maintainable, performant, and secure.
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: This rule provides comprehensive guidelines and best practices for utilizing the asyncio library in Python, covering code organization, performance, security, testing, and common pitfalls.
globs: **/*.py
globs: *.py
---
# asyncio Best Practices and Coding Standards
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: This rule provides comprehensive guidance for Auth0 library usage, covering code organization, security, performance, testing, and common pitfalls. Adhering to these guidelines ensures secure, efficient, and maintainable Auth0 integrations.
globs: **/*.{js,jsx,ts,tsx,html,css,scss,py,java,go}
globs: *.js,*.jsx,*.ts,*.tsx,*.html,*.css,*.scss,*.py,*.java,*.go
---
---
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: Provides coding standards, best practices, and guidance specific to the AutoGen library, covering aspects from code structure to security and performance.
globs: **/*.py
globs: *.py
---
- Best practice 1: Employ Modular Design. Utilize AutoGen's multi-agent framework to create modular agents with specific roles. This enhances code reusability and simplifies the orchestration of complex workflows. Example: Create separate agents for data fetching, code execution, and response formatting.
- Best practice 2: Define Customizable Workflows. Leverage AutoGen's capabilities to define customizable workflows that integrate LLMs, human inputs, and tools. This allows for flexible agent interactions and enhances the performance of LLM applications. Implement a workflow manager to define and control agent interactions.
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: This rule provides best practices and coding standards for aws-amplify projects, covering code organization, common patterns, performance, security, testing, pitfalls, and tooling. It aims to guide developers in building robust, scalable, and maintainable aws-amplify applications.
globs: **/*.{js,jsx,ts,tsx}
globs: *.js,*.jsx,*.ts,*.tsx
---
- # aws-amplify Best Practices
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: This rule provides comprehensive guidance on best practices for developing and managing AWS resources using the AWS CLI, covering code organization, security, performance, and testing.
globs: **/*.{sh,py,yml,yaml,tf,json,md}
globs: *.sh,*.py,*.yml,*.yaml,*.tf,*.json,*.md
---
# AWS CLI Best Practices and Coding Standards
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: This rule provides best practices and coding standards for developing applications using AWS DynamoDB. It covers aspects like schema design, performance optimization, security, and testing.
globs: **/*.{js,ts,jsx,tsx,py}
globs: *.js,*.ts,*.jsx,*.tsx,*.py
---
- **Minimize the number of tables; prefer single-table design.** Having fewer tables keeps things more scalable, requires less permissions management, and reduces overhead for your DynamoDB application. Consider using a single table with appropriate use of primary and secondary indexes.
- **Identify query patterns before schema design.** Understand the application's access patterns before designing the DynamoDB schema. Knowing how the data will be queried is crucial for optimizing performance and cost.
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: This rule covers best practices for developing, deploying, and maintaining applications using AWS Elastic Container Service (ECS). It includes guidance on code organization, performance, security, testing, and common pitfalls.
globs: **/*.{tf,yml,yaml,json,sh,dockerfile}
globs: *.tf,*.yml,*.yaml,*.json,*.sh,*.dockerfile
---
- **General Principles:**
- **Infrastructure as Code (IaC):** Treat your ECS infrastructure as code. Use tools like Terraform, AWS CloudFormation, or AWS CDK to define and manage your ECS clusters, task definitions, and services.
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: Comprehensive guide for AWS Lambda development, covering best practices for code organization, performance, security, testing, and common pitfalls. Focuses on building robust, scalable, and secure serverless applications using AWS Lambda.
globs: **/*.{js,ts,jsx,tsx,py,java,go,c#,cs,ps1,sh}
globs: *.js,*.ts,*.jsx,*.tsx,*.py,*.java,*.go,*.c#,*.cs,*.ps1,*.sh
---
- **Use Documented APIs Only:** Rely solely on AWS Lambda's documented APIs to ensure compatibility and avoid unexpected behavior. Do not use undocumented or internal APIs.
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: This rule provides best practices and coding standards for developing applications that interact with AWS RDS. It covers code organization, security, performance, testing, and common pitfalls.
globs: **/*.{sql,js,py,java,tf,yaml,yml}
globs: *.sql,*.js,*.py,*.java,*.tf,*.yaml,*.yml
---
# AWS RDS Best Practices and Coding Standards
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: Comprehensive rules and best practices for AWS development using Terraform, covering code organization, security, performance, and testing. Adherence to these guidelines ensures maintainable, secure, and efficient infrastructure code.
globs: **/*.tf
globs: *.tf
---
# AWS Development Best Practices using Terraform
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: This rule provides comprehensive guidelines for using Axios effectively, covering best practices, security considerations, and performance optimization. It aims to improve code quality, maintainability, and overall application resilience when working with Axios.
globs: **/*.{js,jsx,ts,tsx}
globs: *.js,*.jsx,*.ts,*.tsx
---
- **Avoid hardcoding URLs**: Store API endpoints in configuration files or environment variables to enhance maintainability and avoid redundancy.
- **Centralize API Logic**: Create dedicated modules or services to encapsulate Axios instances and request logic. This promotes reusability and simplifies debugging.
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: Comprehensive guidelines for Azure Pipelines, covering code structure, security, performance, testing, and deployment. Provides actionable advice for developers working with Azure Pipelines YAML definitions to enhance code quality and CI/CD processes.
globs: **/*.{yml,yaml}
globs: *.yml,*.yaml
---
- # General Guidelines
- Utilize YAML pipelines for version control and ease of replication.
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: This rule provides comprehensive best practices for developing Azure applications, covering code organization, security, performance, testing, and common pitfalls. It aims to improve code quality, security posture, and overall efficiency when working with the Azure ecosystem.
globs: **/*.{az,tf,bicep,py,js,ts,json,yml,yaml,ps1,sh,cs,java}
globs: *.az,*.tf,*.bicep,*.py,*.js,*.ts,*.json,*.yml,*.yaml,*.ps1,*.sh,*.cs,*.java
---
# Azure Library Best Practices and Coding Standards
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: This rule enforces best practices and coding standards for Bash scripting to improve code quality, maintainability, and security. It covers naming conventions, formatting, error handling, security, and performance considerations.
globs: **/*.sh
globs: *.sh
---
# Bash Best Practices and Coding Standards
+1 -1
View File
@@ -1,5 +1,5 @@
---
description: This rule file outlines best practices for using the beautifulsoup4 library in Python, covering code organization, performance, security, testing, and common pitfalls.
globs: **/*.py
globs: *.py
---
By following these best practices, you can build robust, efficient, and secure web scrapers using beautifulsoup4.
+1 -1
View File
@@ -1,4 +1,4 @@
---
description: This rule file provides comprehensive best practices for writing maintainable and effective Behave BDD tests, including code organization, common patterns, performance considerations, and security.
globs: **/*.feature
globs: *.feature
---
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: Enforces consistent code formatting using Black, the uncompromising Python code formatter, promoting readability and reducing diffs. Covers best practices related to Black's configuration, usage, and integrations.
globs: **/*.py
globs: *.py
---
- Adopt Black as the primary code formatter for all Python projects.
- Adhere to Black's default style guide for consistent formatting across projects.
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: This rule file outlines best practices for using the boto3 library, including code organization, security, performance, testing, and common pitfalls. It aims to ensure efficient, secure, and maintainable AWS integrations with boto3.
globs: **/*.py
globs: *.py
---
---
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: Comprehensive coding standards, best practices, and architectural guidelines for Python backend development with the Bottle microframework, designed to improve code quality, maintainability, and security.
globs: **/*.py
globs: *.py
---
# Bottle Framework Best Practices
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: This rule provides comprehensive guidance on Bun library coding standards, best practices, and common patterns. It includes performance optimization, security considerations, and testing strategies.
globs: **/*.{js,ts,jsx,tsx,bun}
globs: *.js,*.ts,*.jsx,*.tsx,*.bun
---
# Bun Library Best Practices
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: This rule file provides a comprehensive guide to C# best practices, coding standards, and common patterns for writing maintainable, performant, and secure code.
globs: **/*.cs
globs: *.cs
---
# C# Best Practices and Coding Standards
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: This rule enforces best practices and coding standards for Chakra UI projects, including accessibility, styling, performance, and security. It aims to provide clear, actionable guidance for developers using Chakra UI.
globs: **/*.{js,jsx,ts,tsx}
globs: *.js,*.jsx,*.ts,*.tsx
---
- **Accessibility**: Ensure all components follow WAI-ARIA standards, including keyboard navigation and screen reader support.
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: This rule provides best practices for using Cheerio for web scraping and HTML parsing in JavaScript, covering code organization, performance, security, testing, and common pitfalls.
globs: **/*.js
globs: *.js
---
# Cheerio Best Practices
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: This rule file outlines comprehensive best practices for developing applications using the Clerk library, focusing on security, performance, code organization, and testing to ensure robust and maintainable authentication implementations.
globs: **/*.{js,jsx,ts,tsx}
globs: *.js,*.jsx,*.ts,*.tsx
---
---
## Clerk Library Best Practices
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: Comprehensive best practices for developing robust and maintainable command-line interfaces using the Click library in Python. Covers code structure, patterns, performance, security, testing, and common pitfalls.
globs: **/*.py
globs: *.py
---
# Click CLI Library Best Practices
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: This rule provides a comprehensive set of best practices and coding standards for developing with the Cloudflare library, specifically focusing on Terraform configurations. It aims to guide developers in creating efficient, secure, and maintainable infrastructure code.
globs: **/*.tf
globs: *.tf
---
# Cloudflare Terraform Best Practices
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: This rule provides guidelines for using CodeMirror effectively, covering code organization, performance, security, testing, and common pitfalls. It aims to ensure robust and maintainable code editor implementations.
globs: **/*.{js,ts,html,css,vue,svelte,jsx,tsx}
globs: *.js,*.ts,*.html,*.css,*.vue,*.svelte,*.jsx,*.tsx
---
# CodeMirror Best Practices and Coding Standards
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: This rule provides comprehensive best practices for developing with the CrewAI library, covering code organization, performance, security, testing, and common pitfalls. It serves as a guide for building robust and scalable AI applications using CrewAI.
globs: **/*.py
globs: *.py
---
- **General Best Practices**:
- Leverage structured responses from LLM calls using Pydantic for output validation.
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: This rule provides best practices for CSS development, covering code organization, performance, security, testing, and common pitfalls. It aims to ensure maintainable, scalable, and efficient CSS code.
globs: **/*.css
globs: *.css
---
- **Use a CSS Preprocessor**: Leverage preprocessors like Sass, Less, or Stylus for features like variables, nesting, mixins, and functions to enhance code organization and maintainability.
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: Enforces CUDA coding standards, performance optimizations, and best practices to ensure efficient and maintainable GPU-accelerated code. This rule provides guidance on code organization, memory management, error handling, and more.
globs: **/*.cu
globs: *.cu
---
- # CUDA Best Practices Guide
This document outlines best practices for CUDA development, focusing on code organization, performance optimization, and common pitfalls. It is based on NVIDIA's CUDA C++ Best Practices Guide and expands on it with more detailed recommendations.
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: This rule provides best practices for developing efficient, maintainable, and scalable GUI applications with CustomTkinter. It covers code organization, performance, security, testing, and common pitfalls.
globs: **/*.py
globs: *.py
---
- **Always use UV when installing dependencies.**
- **Always use Python 3.10 or higher.** CustomTkinter requires a modern Python version for compatibility and feature support.
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: This rule provides a comprehensive guide to Cypress best practices, covering code organization, performance, security, testing strategies, and tooling to ensure robust and maintainable end-to-end tests.
globs: **/*.{cy.js,cy.ts,spec.js,spec.ts}
globs: *.cy.js,*.cy.ts,*.spec.js,*.spec.ts
---
# Cypress Best Practices: A Comprehensive Guide
+1 -1
View File
@@ -1,5 +1,5 @@
---
description: Comprehensive best practices and coding standards for D3.js projects, covering code organization, performance, security, testing, and common pitfalls.
globs: **/*.js
globs: *.js
---
By following these best practices and coding standards, developers can create robust, maintainable, and performant data visualizations using the D3.js library.
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: Comprehensive best practices and coding standards for using Dask in Python, focusing on performance, code organization, and common pitfalls. Provides actionable guidance for developers using Dask for parallel and distributed computing.
globs: **/*.{py,ipynb}
globs: *.py,*.ipynb
---
# Dask Best Practices and Coding Standards
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: This rule outlines best practices for coding standards, observability, and effective use of the Datadog library in Python projects. It covers coding style, metric/tag naming, dashboard design, security, and performance optimization.
globs: **/*.py
globs: *.py
---
- **Coding Standards**
- Use `black` for code formatting to ensure consistent style.
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: This rule file provides comprehensive guidelines for Deno development, covering best practices for code organization, security, performance, testing, and documentation. Adhering to these standards ensures maintainable, efficient, and secure Deno applications.
globs: **/*.{ts,tsx,js,jsx,md}
globs: *.ts,*.tsx,*.js,*.jsx,*.md
---
- **Use TypeScript**: Always prefer TypeScript for its strong typing, which enhances code quality and maintainability. Provide clear type annotations and use interfaces for better structure.
- **Documentation with JSDoc**: Utilize JSDoc for documenting all exported symbols. Include concise summaries, type information, and examples. Keep documentation up-to-date with code changes.
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: This rule file provides guidelines for writing stable and maintainable end-to-end tests using Detox, covering code structure, testing strategies, and performance considerations. It includes best practices for test ID usage, dealing with flakiness, and integrating with CI/CD pipelines.
globs: **/*.{e2e.js,e2e.ts,spec.js,spec.ts}
globs: *.e2e.js,*.e2e.ts,*.spec.js,*.spec.ts
---
# Detox E2E Testing Best Practices for React Native
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: This rule provides comprehensive guidelines for DigitalOcean infrastructure and application development, covering code organization, security, performance, and deployment best practices. It aims to ensure consistent, scalable, and secure cloud solutions on the DigitalOcean platform.
globs: **/*.{tf,yml,yaml,sh,py}
globs: *.tf,*.yml,*.yaml,*.sh,*.py
---
# DigitalOcean Development Best Practices
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: This rule provides best practices and coding standards for developing applications with the discord-api library. It covers code organization, performance, security, testing, and common pitfalls to ensure robust and maintainable Discord integrations.
globs: **/*.{js,ts,jsx,tsx,py,cs}
globs: *.js,*.ts,*.jsx,*.tsx,*.py,*.cs
---
## 1. Code Organization and Structure
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: This rule file provides comprehensive best practices for Django's Object-Relational Mapper (ORM), covering code organization, performance, security, testing, and common pitfalls. It aims to guide developers in building efficient, maintainable, and secure Django applications.
globs: **/*.py
globs: *.py
---
## 1. Code Organization and Structure
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: A comprehensive guide to best practices for developing REST APIs using Django REST Framework (DRF), covering code structure, design patterns, security, performance, and testing.
globs: **/*.py
globs: *.py
---
---
# django-rest-framework Best Practices
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: Comprehensive guide to Django best practices covering code organization, performance, security, testing, and common pitfalls. This rule ensures adherence to community standards for maintainable and efficient Django applications.
globs: **/*.py
globs: *.py
---
# Django Best Practices and Coding Standards
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: This rule file provides comprehensive guidance on Docker best practices, covering Dockerfile construction, image optimization, and security considerations. It aims to improve the efficiency, maintainability, and security of Docker-based projects.
globs: **/{Dockerfile,docker-compose.yml,*.dockerfile}
globs: Dockerfile,docker-compose.yml,*.dockerfile
---
# Docker Best Practices
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: This rule outlines best practices for using Drizzle ORM in TypeScript and JavaScript projects. It covers code organization, performance, security, testing, and common pitfalls.
globs: **/*.ts,**/*.tsx,**/*.js,**/*.jsx
globs: *.ts,*.tsx,*.js,*.jsx
---
# Drizzle ORM Best Practices and Coding Standards
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: This rule file outlines best practices for developing with DuckDB, covering code organization, performance optimization, security considerations, and testing strategies. It aims to improve code quality, maintainability, and overall project health when using DuckDB.
globs: **/*.{sql,ddl,md,duckdb}
globs: *.sql,*.ddl,*.md,*.duckdb
---
# DuckDB Best Practices and Coding Standards
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: This rule provides comprehensive best practices for developing with Elasticsearch, covering code organization, performance, security, testing, and common pitfalls, ensuring efficient and maintainable Elasticsearch applications. These practices apply broadly across languages interacting with Elasticsearch.
globs: **/*.{py,js,java,go,ts,kt,scala,rb,php,rs,c,cpp,cs,swift,m,h}
globs: *.py,*.js,*.java,*.go,*.ts,*.kt,*.scala,*.rb,*.php,*.rs,*.c,*.cpp,*.cs,*.swift,*.m,*.h
---
- # Elasticsearch Library Best Practices
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: Enforces best practices, coding standards, and performance considerations for Electron development. Covers code structure, security, testing, and common pitfalls to ensure robust and maintainable applications.
globs: **/*.{js,jsx,ts,tsx,html,css,scss,mjs,cjs}
globs: *.js,*.jsx,*.ts,*.tsx,*.html,*.css,*.scss,*.mjs,*.cjs
---
- **General Practices**
- Adhere to the official Electron coding style guide. Run `npm run lint` to detect style issues using `cpplint` and `eslint`.
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: This rule outlines best practices for developing and maintaining applications within the ELK (Elasticsearch, Logstash, Kibana) stack, including coding standards, configuration, performance, security, and testing.
globs: **/*.conf, **/*.yml, **/*.json, **/*.log
globs: *.conf, *.yml, *.json, *.log
---
## ELK Stack Best Practices
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: Comprehensive guide to Emacs Lisp coding standards, best practices, and common pitfalls. Focuses on maintainability, readability, and performance for building robust Emacs extensions.
globs: **/*.el
globs: *.el
---
- ## Code Organization and Structure
- ### Directory Structure
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: This rule provides comprehensive best practices for using esbuild, focusing on performance, code organization, and security in build configurations and development workflows.
globs: **/*.{js,jsx,ts,tsx,css,json}
globs: *.js,*.jsx,*.ts,*.tsx,*.css,*.json
---
# esbuild Best Practices
+1 -1
View File
@@ -1,5 +1,5 @@
---
description: This rule provides comprehensive guidelines for ESLint, covering code organization, common patterns, performance, security, testing, and tooling, ensuring high-quality, maintainable JavaScript/TypeScript code.
globs: **/*.{js,jsx,ts,tsx,vue}
globs: *.js,*.jsx,*.ts,*.tsx,*.vue
---
By following these best practices, you can ensure that your JavaScript/TypeScript code is clean, consistent, and maintainable, reducing the risk of bugs and improving overall code quality.
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: This rule provides comprehensive best practices and coding standards for Expo projects, covering code organization, performance, security, testing, and common pitfalls to ensure maintainable and high-quality applications.
globs: **/*.{js,jsx,ts,tsx}
globs: *.js,*.jsx,*.ts,*.tsx
---
- **Code Organization and Structure**
- **Directory Structure:**
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: This rule provides comprehensive guidance on best practices for developing robust, maintainable, and performant Express.js applications, covering aspects from code organization and security to testing and deployment.
globs: **/*.js
globs: *.js
---
- # Express.js Best Practices
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: This rule provides comprehensive best practices for developing applications with Fabric.js, covering code organization, performance optimization, security considerations, and testing strategies. It aims to help developers create efficient, maintainable, and secure Fabric.js-based applications.
globs: **/*.js
globs: *.js
---
# Fabric.js Best Practices and Coding Standards
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: Comprehensive guidelines for developing robust, scalable, and maintainable FastAPI applications. Covers code structure, performance, security, testing, and common pitfalls.
globs: **/*.py
globs: *.py
---
# FastAPI Best Practices: A Comprehensive Guide
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: This rule outlines the best practices and coding standards for developing with FFmpeg, covering code organization, performance, security, testing, and common pitfalls.
globs: **/*.c
globs: *.c
---
# FFmpeg Best Practices and Coding Standards
+1 -1
View File
@@ -1,4 +1,4 @@
---
description: This rule provides comprehensive best practices for developing robust, maintainable, and scalable applications using the Fiber web framework in Go. It covers code organization, performance, security, testing, and common pitfalls.
globs: **/*.go
globs: *.go
---
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: This rule provides guidelines for Firebase library usage, covering code organization, performance, security, testing, and common pitfalls. It aims to ensure efficient, secure, and maintainable Firebase projects.
globs: **/*.{js,jsx,ts,tsx,html,css,scss,vue,swift,kt,java,py,go,rb,php,c,cpp,cs}
globs: *.js,*.jsx,*.ts,*.tsx,*.html,*.css,*.scss,*.vue,*.swift,*.kt,*.java,*.py,*.go,*.rb,*.php,*.c,*.cpp,*.cs
---
---
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: Comprehensive guide for using Flake8 effectively in Python projects, covering code style, error prevention, security, testing, and optimization. It outlines best practices, patterns, and common pitfalls to help developers maintain high code quality and adherence to standards.
globs: **/*.py
globs: *.py
---
# Flake8 Best Practices: A Comprehensive Guide
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: A comprehensive guide to best practices for developing RESTful APIs using Flask and Flask-RESTful, covering code organization, performance, security, and testing.
globs: **/*.py
globs: *.py
---
# flask-restful Best Practices: A Comprehensive Guide
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: This rule provides comprehensive best practices for developing Flask applications, covering code structure, security, performance, and testing.
globs: **/*.py
globs: *.py
---
- ## Code Organization and Structure:
- **Directory Structure Best Practices:**
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: Comprehensive guidelines and best practices for Flutter development, covering code organization, performance optimization, security, testing, and tooling.
globs: **/*.dart
globs: *.dart
---
- Adhere to the official Flutter style guide. This forms the foundation for maintainable and consistent code.
- Utilize the latest stable version of Flutter, keeping up-to-date with new features and security patches. Review Flutter's breaking changes and migration guides during updates.
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: This rule file provides comprehensive guidelines for using Font Awesome effectively, covering setup, styling, accessibility, performance, and security best practices. It ensures consistent and optimized usage across projects.
globs: **/*.{html,css,js,jsx,ts,tsx}
globs: *.html,*.css,*.js,*.jsx,*.ts,*.tsx
---
# Font Awesome Best Practices
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: Provides guidelines for using gcp-cli, including best practices for scripting, configuration management, security, and performance. Focuses on automation, predictable output, and secure authentication within Google Cloud environments.
globs: **/*.{sh,yaml,tf,py}
globs: *.sh,*.yaml,*.tf,*.py
---
- **Scripting Best Practices**:
- **Use the `--quiet` flag**: Suppress prompts for non-interactive script execution.
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: This rule provides best practices for developing and managing infrastructure and applications on Google Cloud Platform (GCP), encompassing code organization, security, performance, and deployment strategies.
globs: **/*.{tf,py,js,go,java,proto,sh,yaml,yml}
globs: *.tf,*.py,*.js,*.go,*.java,*.proto,*.sh,*.yaml,*.yml
---
---
## GCP Library Best Practices
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: This rule provides coding standards and best practices for using the gensim library, focusing on NLP, topic modeling, performance, and code organization. It offers actionable guidelines for developers to create effective and maintainable gensim-based applications.
globs: **/*.py
globs: *.py
---
# gensim Library Best Practices and Coding Standards
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: This rule provides a comprehensive set of best practices for developing Go applications, covering code organization, performance, security, testing, and common pitfalls.
globs: **/*.go
globs: *.go
---
- # Go Best Practices
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: Comprehensive coding standards and best practices for Godot Engine development, covering code organization, performance, testing, and security to ensure maintainable, efficient, and secure game projects. These rules are primarily for GDScript but also reference relevant C# practices where applicable.
globs: **/*.gd
globs: *.gd
---
# Godot Engine Best Practices and Coding Standards
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: This rule provides guidelines for Google Maps JavaScript API development, covering code organization, performance, security, testing, and common pitfalls. It promotes best practices to ensure efficient, secure, and maintainable map applications.
globs: **/*.{js,jsx,ts,tsx,html,css}
globs: *.js,*.jsx,*.ts,*.tsx,*.html,*.css
---
# Google Maps JavaScript API Best Practices
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: Comprehensive rules for Gradle best practices, covering code organization, performance, security, testing, and more. Provides actionable guidance to improve Gradle project maintainability and efficiency.
globs: **/*.gradle*
globs: *.gradle*
---
- **Use the Gradle Wrapper**: Always use the Gradle wrapper (`gradlew` and `gradlew.bat`) to ensure consistent Gradle versions across different environments. This avoids compatibility issues and simplifies collaboration.
- Command: `gradle wrapper` to generate the wrapper files.
+1 -1
View File
@@ -1,5 +1,5 @@
---
description: Comprehensive guide for Grafana development best practices, covering code organization, performance, security, testing, and common pitfalls to ensure robust and maintainable Grafana solutions. Includes guidance for creating efficient dashboards, data sources, and plugins.
globs: **/*.{ts,tsx,js,jsx,json,yml,yaml,md,mdc}
globs: *.ts,*.tsx,*.js,*.jsx,*.json,*.yml,*.yaml,*.md,*.mdc
---
By adhering to these comprehensive best practices, you can build robust, maintainable, and secure Grafana solutions that provide valuable insights into your data and systems.
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: This rule provides comprehensive best practices and coding standards for GraphQL development, covering code organization, performance, security, testing, and common pitfalls.
globs: **/*.graphql
globs: *.graphql
---
- **Naming Conventions**:
- Use `camelCase` for field names, argument names, and directive names. This is a widely accepted convention that enhances readability and consistency.
+1 -1
View File
@@ -1,5 +1,5 @@
---
description: This rule provides comprehensive guidelines for using the Guzzle HTTP client in PHP projects, covering code organization, common patterns, performance, security, testing, and tooling.
globs: **/*.php
globs: *.php
---
By following these best practices, you can ensure that your Guzzle-based code is efficient, maintainable, secure, and reliable.
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: This rule outlines best practices for Hardhat development, covering code organization, security, testing, and performance. It aims to provide a comprehensive guide for developers working with the Hardhat Ethereum development environment.
globs: **/*.{js,ts,sol,json}
globs: *.js,*.ts,*.sol,*.json
---
# Hardhat Best Practices and Coding Standards
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: Comprehensive best practices and coding standards for developing, deploying, and maintaining applications on the Heroku platform. This rule emphasizes the Twelve-Factor App methodology and provides detailed guidance for optimizing application architecture, performance, security, and maintainability on Heroku.
globs: **/*
globs: *
---
- Follow the Twelve-Factor App methodology for building software-as-a-service applications.
- **Codebase:** Maintain a single codebase tracked in version control (e.g., Git) for each application. Multiple deploys should be created from this single codebase.
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: This rule provides comprehensive best practices for htmx development, covering code organization, security, performance, testing, and common pitfalls. It aims to guide developers in building robust, maintainable, and secure htmx applications.
globs: **/*.html
globs: *.html
---
# htmx Best Practices and Coding Standards
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: This rule provides comprehensive best practices for using the httpx library, covering code organization, performance, security, testing, and common pitfalls. Adhering to these guidelines will improve code quality, maintainability, and security when working with httpx.
globs: **/*.py
globs: *.py
---
# httpx Best Practices
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: This rule provides guidelines for best practices when working with the Hugging Face Transformers library, covering code organization, performance, testing, security, and common pitfalls. It emphasizes community standards and maintainability.
globs: **/*.py
globs: *.py
---
# Hugging Face Transformers Library Best Practices
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: Comprehensive guide covering best practices for the Hypothesis Python library, including coding standards, testing, performance, and security. Provides actionable guidance for developers to write maintainable, robust, and efficient property-based tests.
globs: **/*.py
globs: *.py
---
# Hypothesis Library Best Practices and Coding Standards
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: This rule file provides best practices for using the Insomnia API Client, including project organization, environment management, testing, and collaboration to improve API development workflows.
globs: **/*.{json,yaml,yml,graphql,proto}
globs: *.json,*.yaml,*.yml,*.graphql,*.proto
---
- **Project Organization and Structure:**
- **Workspace Structure:** Organize requests into workspaces based on projects or functional areas. Within workspaces, use folders to group related requests (e.g., authentication, user management, product catalog).
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: This rule provides comprehensive best practices for Ionic Framework development, covering code organization, performance, security, testing, and more. Following these guidelines will result in more maintainable, performant, and secure Ionic applications.
globs: **/*.{ts,html,scss}
globs: *.ts,*.html,*.scss
---
---
# Ionic Framework Best Practices
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: This rule provides comprehensive guidelines for using isort in Python projects, covering code organization, common patterns, performance, security, testing, tooling, and common pitfalls. It aims to standardize import sorting and improve code quality.
globs: **/*.py
globs: *.py
---
# isort Best Practices: A Comprehensive Guide
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: Enforces best practices for Java development, covering code style, performance, security, and testing. Provides guidelines for writing clean, maintainable, and efficient Java code.
globs: **/*.java
globs: *.java
---
- # Java Best Practices
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: This rule provides best practices and coding standards for the JAX library, emphasizing functional programming, JIT compilation, automatic differentiation, and immutable data structures. It also covers performance considerations, common pitfalls, and tooling recommendations.
globs: **/*.py
globs: *.py
---
- **Functional Programming**: JAX emphasizes a functional programming style. Ensure functions are pure (no side effects, no reliance on global variables) for consistent JIT compilation and optimization.
+1 -1
View File
@@ -1,6 +1,6 @@
---
description: Comprehensive best practices for Jenkins, covering code organization, security, performance, testing, and common pitfalls. Provides guidelines for writing robust, maintainable, and secure Jenkins pipelines and configurations.
globs: **/{Jenkinsfile,*.jenkins,*.groovy}
globs: Jenkinsfile,*.jenkins,*.groovy
---
# Jenkins Library Best Practices and Coding Standards

Some files were not shown because too many files have changed in this diff Show More