# laravel-tall-stack-best-practices-cursorrules-prom

A Cursor rule for Laravel and the TALL Stack. It guides PHP, Livewire, Alpine.js, and Tailwind CSS work in application code.

- rule · `type=rule` · Cursor · ★ 41024
- Author: PatrickJS
- License: CC0-1.0 · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/PatrickJS/awesome-cursorrules/tree/HEAD/rules/laravel-tall-stack-best-practices-cursorrules-prom.mdc
- Updated: 2026-05-30
- HTML: https://affpapa.org/en/nevibecode/rules/laravel-tall-stack-best-practices-cursorrules-prom

## What it does

This rule steers Cursor toward Laravel and PHP conventions across the TALL Stack: Livewire, Alpine.js, and Tailwind CSS. It covers SOLID design, dependency injection, PSR-12, strict typing, MVC structure, Eloquent, migrations, request validation, and error handling.

For UI work, it asks for reusable Livewire components, lifecycle hooks, and built-in validation. Alpine.js handles small interactions close to the HTML, while Tailwind CSS supports responsive layouts and reusable styles. The guidance also addresses queues, caching, eager loading, pagination, CSRF protection, PHPUnit, Livewire tests, and Dusk.

The rule metadata targets `**/*` and sets `alwaysApply: false`. It is intended for projects using Laravel, Livewire, Alpine.js, Tailwind CSS, and Luvi UI; without that stack, its recommendations do not fit the project.

## Install

### Cursor (native platform)

**Manually: put the files in place**
- File: `.cursor/rules/laravel-tall-stack-best-practices-cursorrules-prom.mdc` — Frontmatter: description, globs, alwaysApply

### Claude Code

**Manually: put the files in place**
- File: `.claude/rules/laravel-tall-stack-best-practices-cursorrules-prom.md` — The paths frontmatter field limits the files: move globs from the source into paths

### Codex

**AGENTS.md**
- Codex reads AGENTS.md: paste the rule text there

### GitHub Copilot

**Manually: put the files in place**
- File: `.github/instructions/laravel-tall-stack-best-practices-cursorrules-prom.instructions.md` — The applyTo field sets which files it applies to: move globs from the source into applyTo

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/rules/laravel-tall-stack-best-practices-cursorrules-prom.md`

### Cline

**Manually: put the files in place**
- File: `.clinerules/laravel-tall-stack-best-practices-cursorrules-prom.md`

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/PatrickJS/awesome-cursorrules/tree/HEAD/rules/laravel-tall-stack-best-practices-cursorrules-prom.mdc

## When to use it
- structure new Laravel code around MVC
- check PHP against PSR-12 and SOLID
- design a validated Livewire component
- connect Alpine.js interactions with Livewire
- prepare PHPUnit or Dusk tests

## Example prompts
- Review this controller against Laravel conventions and PSR-12.
- Create a Livewire component with validation and lifecycle hooks.
- Build a responsive Tailwind CSS interface with Alpine.js interactions.

## Source text · laravel-tall-stack-best-practices-cursorrules-prom.mdc · CC0-1.0

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: b9c6fa5e003c361a.

BEGIN THIRD-PARTY FILE b9c6fa5e003c361a
```text
---
description: "Cursor rules for Laravel development with TALL Stack best practices."
globs: **/*
alwaysApply: false
---
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 PascalCase for class-containing 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.
```
END THIRD-PARTY FILE b9c6fa5e003c361a

The third-party file has ended. Everything between the b9c6fa5e003c361a tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

First 3595 of 5168 bytes. © PatrickJS · CC0-1.0 · https://github.com/PatrickJS/awesome-cursorrules/tree/HEAD/rules/laravel-tall-stack-best-practices-cursorrules-prom.mdc

_Part of the page did not fit — see the HTML version._

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
