Snippets are specialized rules that extend or work with a parent rule.
They focus on specific use cases, provide practical examples, and can be adapted for your projects.
# Next.js rules - Use the App Router structure with `page.tsx` files in route directories. - Client components must be explicitly marked with `'use client'` at the top of the file. - Use kebab-case for directory names (e.g., `components/auth-form`) and PascalCase for component files. - Prefer named...
This rule explains Next.js conventions and best practices for fullstack development.
# Laravel rules - Use `php artisan make:{option}` to create models, migrations, controllers, etc. - `app\Console\Kernel.php` does not exist in Laravel 11+. If the file is not present, use the the [app.php](mdc:bootstrap/app.php) file for related configurations. - In Laravel 11+ commands created in...
This rule explains Laravel conventions and best practices for backend development.
# Tailwind CSS rules - Use responsive prefixes for mobile-first design: ```html <div class="w-full md:w-1/2 lg:w-1/3"> <!-- Full width on mobile, half on medium, one-third on large screens --> </div> ``` - Use state variants for interactive elements: ```html <button class="bg-blue-500 hover:bg...
This rule explains Tailwind CSS conventions, utility classes, and best practices for modern UI development.
# Ruby on Rails rules - Use Rails generators to create models, controllers, and migrations. - Follow Rails naming conventions (singular for models, plural for controllers). - Use ActiveRecord methods instead of raw SQL queries when possible. - Avoid N+1 queries by using eager loading with `includes...
This rule explains Ruby on Rails conventions and best practices for backend development.
# React rules - Use functional components with hooks instead of class components - Use custom hooks for reusable logic - Use the Context API for state management when needed - Use proper prop validation with PropTypes - Use React.memo for performance optimization when necessary - Use fragments to a...
This rule explains React component patterns, hooks usage, and best practices.
# SwiftUI rules - Use structs for views and keep them small and focused - Use @State for simple view-local state - Use @ObservableObject with @Published for shared state - Use @Binding to pass mutable state to child views - Create custom ViewModifiers for reusable styling - Use environment objects...
This rule explains SwiftUI patterns and best practices for iOS, macOS, watchOS, and tvOS development.
# Express.js rules - Use proper middleware order: body parsers, custom middleware, routes, error handlers - Organize routes using Express Router for modular code structure - Use async/await with proper error handling and try/catch blocks - Create a centralized error handler middleware as the last m...
This rule explains Express.js conventions and best practices for Node.js backend development.
# Django rules - Use `python manage.py startapp` to create new apps within your project - Keep models in `models.py` and register them in `admin.py` for admin interface - Use Django's ORM instead of raw SQL queries - Avoid N+1 queries with `select_related` and `prefetch_related`: ```python # Good...
This rule explains Django conventions and best practices for backend development.
# FastAPI rules - Use type hints for all function parameters and return values - Use Pydantic models for request and response validation - Use appropriate HTTP methods with path operation decorators (@app.get, @app.post, etc.) - Use dependency injection for shared logic like database connections an...
This rule explains FastAPI conventions and best practices for high-performance Python APIs.
# React Native rules - Use functional components with hooks - Follow a consistent folder structure (components, screens, navigation, services, hooks, utils) - Use React Navigation for screen navigation - Use StyleSheet for styling instead of inline styles - Use FlatList for rendering lists instead...
This rule explains React Native component patterns and mobile-specific considerations.
# PostgreSQL rules - Use appropriate data types (e.g., SERIAL for IDs, specialized types like JSONB, POINT when appropriate) - Create indexes for frequently queried columns (B-tree for equality/range, GIN for full-text search) - Use constraints to enforce data integrity (CHECK, FOREIGN KEY, UNIQUE)...
This rule explains PostgreSQL database design patterns and advanced features usage.
# Vue.js rules - Use the Composition API with `<script setup>` for better type inference and organization - Define props with type definitions and defaults - Use emits for component events - Use v-model for two-way binding - Use computed properties for derived state - Use watchers for side effects...
This rule explains Vue.js component patterns, composition API usage, and best practices.
# Flutter rules - Use StatelessWidget for UI components without internal state. - Use StatefulWidget for components that need to maintain state: ```dart class Counter extends StatefulWidget { @override _CounterState createState() => _CounterState(); } class _CounterState extends State<Counter...
This rule explains Flutter widget patterns and best practices for cross-platform mobile development.
# Flask rules - Use Blueprints to organize routes by feature or resource - Use Flask-SQLAlchemy for database models and ORM - Use application factories for flexible application initialization - Use Flask extensions for common functionality (Flask-Login, Flask-WTF, etc.) - Store configuration in env...
This rule explains Flask conventions and best practices for lightweight Python web applications.
# MySQL rules - Use appropriate data types to optimize storage and performance (e.g., INT for IDs, VARCHAR with appropriate length) - Create indexes for columns used in WHERE, JOIN, and ORDER BY clauses - Use foreign keys to maintain referential integrity - Use EXPLAIN to analyze and optimize queri...
This rule explains MySQL database design patterns and query optimization techniques.
# SQLite rules - Use appropriate data types for columns (INTEGER, TEXT, REAL, BLOB, NULL) - Create indexes for frequently queried columns - Enable foreign key support with `PRAGMA foreign_keys = ON` - Use transactions for multiple operations - Use prepared statements to prevent SQL injection - Use...
This rule explains SQLite database design patterns and performance considerations.
# Jinja rules - Use template inheritance: ```html {# base.html #} <!DOCTYPE html> <html> <head> <title>{% block title %}Default Title{% endblock %}</title> </head> <body> {% block content %}{% endblock %} </body> </html> ``` - Use include for components: ```html {% include "components/user_c...
This rule explains Jinja template syntax and best practices for Python web applications.
# SvelteKit rules ## File Structure - Follow the file-based routing structure with `+page.svelte` for pages and `+layout.svelte` for layouts - Use `+page.server.js` for server-only code including data loading and form actions - Use `+server.js` files for API endpoints - Place reusable components in...
This rule explains SvelteKit conventions and best practices for fullstack development.