PHPackages                             davidgut/blade-llm-specs - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. davidgut/blade-llm-specs

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

davidgut/blade-llm-specs
========================

Analyze Laravel Blade components to generate AI coding rules and specifications

v1.1.0(4mo ago)10MITPHPPHP ^8.2

Since Dec 18Pushed 4mo agoCompare

[ Source](https://github.com/davidgut/blade-llm-specs)[ Packagist](https://packagist.org/packages/davidgut/blade-llm-specs)[ RSS](/packages/davidgut-blade-llm-specs/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (6)Versions (3)Used By (0)

Blade LLM Specs
===============

[](#blade-llm-specs)

This package analyzes your Laravel Blade components and generates coding rules for AI assistants like Cursor and Antigravity. It helps LLMs understand your specific design system, components, and props.

Installation
------------

[](#installation)

```
composer require davidgut/blade-llm-specs
```

Usage
-----

[](#usage)

Generate the rules:

```
php artisan blade-specs:generate
```

By default, this runs the generators defined in your config. You can also run specific ones:

```
php artisan blade-specs:generate cursor
php artisan blade-specs:generate antigravity
php artisan blade-specs:generate all
```

Configuration
-------------

[](#configuration)

Publish the config file:

```
php artisan vendor:publish --tag=blade-specs-config
```

You can define which generators are enabled by default and where they output their files.

Watch Mode
----------

[](#watch-mode)

To automatically regenerate rules when you change a component, add the Vite plugin to your `vite.config.js`:

```
import bladeSpecs from './vendor/davidgut/blade-llm-specs/resources/js/vite-plugin';

export default defineConfig({
    plugins: [
        // ...
        bladeSpecs(),
    ],
});
```

Component Analysis Features
---------------------------

[](#component-analysis-features)

### Class Whitelist

[](#class-whitelist)

By default, the package extracts valid utility classes from your components to help the AI understand your styling. To avoid noise, you can configure a whitelist of patterns in `config/blade-specs.php`:

```
'class_whitelist' => [
    'bg-*',
    'text-*',
    'p-*',
    'm-*',
    // ...
],
```

### Categorization

[](#categorization)

The package uses a simple directory-based categorization strategy:

- **Subdirectories**: Components in folders (e.g., `components/form/input.blade.php`) are categorized by their folder name (e.g., `form`).
- **Root**: Components in the root `components` directory are categorized as `general`.

### Variant Analysis &amp; Design Options

[](#variant-analysis--design-options)

The analyzer goes beyond props and scans your `@php` blocks for design logic. If you define arrays like `$sizes` or `$variants`, the package will extract them and include them in the generated rules.

**Example:**

```
@php
    $sizes = [
        'sm' => 'px-3 py-1.5',
        'md' => 'px-4 py-2',
    ];
@endphp
```

The generated rules will explicitly list these options, allowing the AI to know exactly which `size` props are valid and what styles they apply.

### Advanced Analysis

[](#advanced-analysis)

The package now performs deeper analysis to help the AI write better code:

#### Type Inference

[](#type-inference)

It guesses prop types from their default values in `@props`:

- `false` → `boolean`
- `'text'` → `string`
- `[]` → `array`
- `10` → `integer`

#### Slot Detection

[](#slot-detection)

It scans your Blade files for usage of `$slot` and named slots (like `{{ $header }}`). The generated usage examples will include these slots, showing the AI exactly how to use them:

```

        Slot header content...

    Default slot content...

```

#### Docblocks

[](#docblocks)

Add a standard blade comment at the top of your component file, and it will be used as the component's description:

```
{{-- A flexible card component with header and footer slots --}}
...
```

Optimization
------------

[](#optimization)

### Context Awareness

[](#context-awareness)

To reduce token usage and improve AI accuracy, you can split the generated rules into multiple files based on category. This allows tools like Cursor and Antigravity to load only the relevant rules (e.g., "Forms") instead of the entire design system.

Enable this in `config/blade-specs.php`:

```
'split_by_category' => true,
```

- **Cursor**: Generates `.mdc` files in `.cursor/rules/blade/` with `globs: *.blade.php`.
- **Antigravity**: Generates `.mdc` files in `.agent/rules/blade/` with `globs: *.blade.php` and `trigger: glob`.

Verification &amp; Safety
-------------------------

[](#verification--safety)

### Safe Cleanup

[](#safe-cleanup)

The package includes a safety mechanism to prevent accidental deletion of your own files. When regenerating modular rules, it scans the target directory and **only deletes files** that contain the special signature: `\`

Any manual notes or files you add to these directories are safe.

### Canary Test

[](#canary-test)

Verify that your AI is correctly reading the rules by enabling the Canary Test in `config/blade-specs.php`:

```
'canary_test' => true,
```

When enabled, the generator injects a special "Verification Rule" at the top of every file. You can then ask your AI "What are you reading?" and it should respond with the filename (e.g., "I am reading the forms.mdc file"). This confirms that context loading is working as expected.

License
-------

[](#license)

MIT

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance74

Regular maintenance activity

Popularity2

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

144d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a1163b75d4f25d863e452d8118eb3b266c29656783beb9a9c02c9498ced60b8e?d=identicon)[davidgut\_](/maintainers/davidgut_)

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/davidgut-blade-llm-specs/health.svg)

```
[![Health](https://phpackages.com/badges/davidgut-blade-llm-specs/health.svg)](https://phpackages.com/packages/davidgut-blade-llm-specs)
```

###  Alternatives

[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k123.0M687](/packages/barryvdh-laravel-ide-helper)[orchestra/canvas

Code Generators for Laravel Applications and Packages

21017.2M158](/packages/orchestra-canvas)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

255.2k](/packages/aedart-athenaeum)[flarum/core

Delightfully simple forum software.

211.3M1.9k](/packages/flarum-core)[tehwave/laravel-achievements

Simple, elegant Achievements the Laravel way

7012.8k](/packages/tehwave-laravel-achievements)[interaction-design-foundation/laravel-geoip

Support for multiple Geographical Location services.

17221.0k3](/packages/interaction-design-foundation-laravel-geoip)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
