Enforcing Excellence: Custom AI Guidelines for Laravel and Filament
Laravel Daily////3 min read
Overview
AI models like and have reached a point where they can generate functional code with minimal prompting. However, "functional" is not synonymous with "production-ready." Default configurations often miss project-specific nuances, especially within the ecosystem. By implementing custom guidelines, developers can move beyond generic code generation to enforce architectural integrity, automated testing, and specific framework requirements like themes.
Prerequisites
To implement these strategies, you should have a solid grasp of the framework and the TALL stack. Familiarity with AI agentic workflows—specifically using tools like or —is essential for integrating markdown-based rule files into your development cycle.
Key Libraries & Tools
- : The primary PHP framework used for web application development.
- : An admin panel and TALL stack toolkit for Laravel.
- : An AI agent designed to interact directly with your local codebase.
- : A tool for managing and applying custom developer guidelines to AI prompts.

Code Walkthrough
To enforce specific standards, you must create a .md file (e.g., guidelines.md) that the AI agent reads before generating code. Below is a conceptual example of how to structure a rule for smoke tests.
## Testing Rules
- For every new Filament Resource, you MUST generate a Pest or PHPUnit smoke test.
- The test must verify that the list, create, and edit pages return a 200 status code.
When the AI processes this, it checks its output against the directive. Without this specific prompt, models often skip testing to speed up generation, leaving you with technical debt. Another critical rule involves integration within Filament custom pages:
## Filament Custom Themes
- If a custom Blade view includes Tailwind classes, automatically generate a custom Filament theme.
- Register the theme in the Panel Provider to ensure CSS is compiled correctly.
Syntax Notes
Custom guidelines rely on clear, imperative language. Use strong verbs like "MUST," "ALWAYS," or "NEVER." Structure these in Markdown format within specialized files like CLAUDE.md or agents.md. AI agents prioritize these local instructions over their general training data, allowing you to override default behaviors such as Facade usage in favor of helper functions.
Practical Examples
A common real-world application is the enforcement of across a project. Instead of allowing the AI to use hard-coded strings for statuses, a guideline can mandate that all status fields utilize a specific Enum directory. This ensures that when the AI generates a table, it automatically implements the HasLabel and HasColor interfaces, providing a consistent UI without manual refactoring.
Tips & Gotchas
Avoid over-complicating your guidelines with minor stylistic preferences. High-noise guidelines can overwhelm the model's context window, leading it to ignore more critical instructions like security protocols or test generation. Focus your custom rules on high-impact areas: test enforcement, complex framework configurations, and project-specific architectural patterns.

My AI Guidelines for Laravel/Filament: March 2026 Update
WatchLaravel Daily // 9:12