PHPackages                             foodlz/laravel-ai-skills - 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. foodlz/laravel-ai-skills

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

foodlz/laravel-ai-skills
========================

Adds a procedural knowledge skills layer to the Laravel AI SDK.

v0.1.2(1mo ago)48MITPHPPHP ^8.3

Since May 21Pushed 1mo agoCompare

[ Source](https://github.com/foodlz/laravel-ai-skills)[ Packagist](https://packagist.org/packages/foodlz/laravel-ai-skills)[ RSS](/packages/foodlz-laravel-ai-skills/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (10)Versions (4)Used By (0)

Laravel AI Skills
=================

[](#laravel-ai-skills)

**Procedural knowledge skills for the [Laravel AI SDK](https://github.com/laravel/ai).** Teach your AI agents *how to behave* — not just *what to do*.

[![PHP 8.3+](https://camo.githubusercontent.com/c8d8dad6beb757a2b8acba331d16140813699543b88a37af0a81f20bd35f61de/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e332532422d626c7565)](https://php.net)[![Laravel 12+](https://camo.githubusercontent.com/1a1716bf63711a20b8493d316e6c06b44fa9975a10372cfbfc682f08a6829cc2/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d31322532422d726564)](https://laravel.com)[![Laravel AI SDK 0.6+](https://camo.githubusercontent.com/9e6679e57d9ee3203b85065fc7ae3bcf1a6950b73d4102ea3dab28f604888dd6/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c61726176656c25324661692d302e362532422d6f72616e6765)](https://github.com/laravel/ai)[![License MIT](https://camo.githubusercontent.com/f8df3091bbe1149f398a5369b2c39e896766f9f6efba3477c63e9b4aa940ef14/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d677265656e)](LICENSE)

> **Experimental RFC infrastructure.** This package validates the Skills concept in real production use before it is proposed upstream to [`laravel/ai`](https://github.com/laravel/ai). The goal is to gather real-world feedback and edge cases that make the proposal persuasive to maintainers.

---

The Problem: Knowledge vs. Action
---------------------------------

[](#the-problem-knowledge-vs-action)

The Laravel AI SDK models agent capabilities as **tools** — PHP classes that perform an action: look up a record, send a message, call an API. This works perfectly for actions.

But many agents also need **procedural knowledge** — guidance on *how to behave* in a given situation:

- *"Here is how to handle a refund request."*
- *"Here is the tone guide for customer support replies."*
- *"Here is the escalation policy when a user reports data loss."*

Today you have two bad options:

OptionProblemBake it into `instructions()`System prompt grows unboundedly. Every token is charged on every request, even guidance that's only relevant in one scenario out of ten.Use a regular `Tool` with empty schemaWorks mechanically, but it's an abuse of the `Tool` abstraction. Tools are for actions, not knowledge retrieval. No convention, no scaffold command, no first-class type.**A Skill is the missing first-class concept:** a callable knowledge object with no input schema, whose sole purpose is to return guidance to the model when it decides that guidance is relevant.

---

Features
--------

[](#features)

- **Three delivery modes** — OnDemand (one tool per skill), Full (injected into instructions), and Lite (meta-tool pair for high-skill-count agents)
- **`Prompt` value object** — load skill content from inline text or Markdown files (`%{key}` or `{{ key }}` substitution) or Blade views (native Blade syntax: `{{ $key }}`)
- **Runtime context injection** — pass job-specific or conversation-specific data into skills via `withContext()`
- **Database-driven skills** — `guide()` is plain PHP; return an Eloquent query result for fully editable, admin-managed content
- **Content caching** — per-prompt or global config; disabled automatically in tests
- **Full testing support** — `Skill::fake()`, `Skill::assertInvoked()`, `Skill::assertNotInvoked()`
- **`php artisan make:skill`** — scaffolding that mirrors `make:tool` and `make:agent`
- **`#[WithSkills]` attribute** — declarative, IDE-navigable skill registration on agent classes
- **`#[AsSkill]` attribute** — name, description, mode, and cache in one place without override methods
- **`withSkillInstructions(static, dynamic)`** — prefix-cache-friendly Static → Skills → Dynamic prompt ordering
- **Events** — `InvokingSkill` and `SkillInvoked` for observability

---

Requirements
------------

[](#requirements)

- PHP 8.3+
- Laravel 12+
- `laravel/ai ^0.6`

---

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

[](#installation)

```
composer require foodlz/laravel-ai-skills
```

The service provider is auto-discovered. Publish the config file if you need to customise discovery paths or cache settings:

```
php artisan vendor:publish --tag=ai-skills-config
```

---

Quick Start
-----------

[](#quick-start)

### 1. Scaffold a skill

[](#1-scaffold-a-skill)

```
php artisan make:skill SigningSkill
# or with a companion Markdown file:
php artisan make:skill SigningSkill --markdown
```

This creates `app/Ai/Skills/SigningSkill.php` (and optionally `resources/skills/signing.md`):

```
