What are Agent Skills in the context of the AI SDK in Laravel 13?

In the context of the Laravel 13 AI SDK, Agent Skills are a way to package specialized instructions and reference materials that your AI agent can load on-demand, only when a specific task requires them .

Think of them as modular "capability packs" for your AI. Instead of stuffing every possible instruction into one massive prompt, you organize them into separate folders. The agent then decides which skill to "learn" based on the user is request.

How Are Skills Structured?

Skills are stored as Markdown files in your resources/skills directory. Each skill gets its own folder containing a SKILL.md file with YAML frontmatter for metadata .

Here is what a basic skill structure looks like:

---
name: refund-policy
description: Use when a customer asks for a refund or a partial credit.
---

Check the order date first. Orders older than 30 days are not eligible…

The description is crucial because the AI reads it to decide if it needs to load that skill .

How Do You Attach Skills to an Agent?

To give your agent access to these skills, you implement the HasSkills contract on your agent class. You can point it to a directory, a specific Skill object, or even a closure if you want to load skills dynamically (like from a database) .

use LaravelAiContractsAgent;
use LaravelAiContractsHasSkills;
use LaravelAiPromptable;
use LaravelAiSkillsSkill;

class SupportAgent implements Agent, HasSkills
{
   use Promptable;

   public function instructions(): string
   {
       return You are a support agent. ;
   }

   public function skills(): iterable
   {
       return [
           resource_path( iskills ), // Loads from the folder
           new Skill(
               name: house-style ,
               description: Use when you write copy for a customer. ,
               instructions: Always use a friendly tone...
           ),
       ];
   }
}

How It Works Under the Hood?

When you attach skills, the SDK gives the agent a single LoadSkill tool. The AI sees a list of available skill names and descriptions. If it determines it needs more details to complete a task, it calls this tool to read the full instructions or any bundled reference files (like EDGE-CASES.md) .

This "progressive disclosure" keeps your context window lean and saves tokens, because the AI only loads the heavy instructions when absolutely necessary. It also has safety rails: it won not load binary files or files larger than 256 KB from the skill folder .

8 Views