laravel-ai-sdk
Laravel AI SDK for building AI-powered features. Use when creating agents, generating images or audio, working with embeddings, vector search, or testing AI features. Triggers on tasks involving laravel/ai, AI agents, tool-calling, structured output, streaming, embeddings, reranking, or AI faking in tests.
What this skill does
# Laravel AI SDK
Comprehensive guide for building AI-powered features with the Laravel AI SDK (`laravel/ai`). Contains 17 rules across 7 categories covering agents, tools, media generation, embeddings, vector stores, and testing.
## When to Apply
Reference these guidelines when:
- Creating AI agents with instructions, tools, and structured output
- Prompting agents with conversation context
- Streaming or queueing agent responses
- Generating images, audio, or transcriptions
- Creating and querying vector embeddings
- Building RAG (retrieval-augmented generation) features
- Testing AI features with fakes and assertions
## Rule Categories by Priority
| Priority | Category | Impact | Prefix |
|----------|----------|--------|--------|
| 1 | Agents | CRITICAL | `agent-` |
| 2 | Tools | HIGH | `tool-` |
| 3 | Embeddings & Search | HIGH | `embed-` |
| 4 | Media Generation | MEDIUM | `media-` |
| 5 | Files & Storage | MEDIUM | `files-` |
| 6 | Infrastructure | MEDIUM | `infra-` |
| 7 | Testing | HIGH | `test-` |
## Quick Reference
### 1. Agents (CRITICAL)
- `agent-create-configure` - Create agents with artisan, PHP attribute configuration
- `agent-prompting` - Prompt agents, conversation context, RemembersConversations
- `agent-structured-output` - Structured output with JSON schema
- `agent-streaming-async` - Streaming, broadcasting, and queueing responses
- `agent-middleware` - Agent middleware pipeline
- `agent-anonymous` - Anonymous agents for quick interactions
### 2. Tools (HIGH)
- `tool-create` - Create custom tools with schema and handle method
- `tool-provider` - Provider tools: WebSearch, WebFetch, FileSearch, SimilaritySearch
### 3. Embeddings & Search (HIGH)
- `embed-generate-cache` - Generate, store, and cache vector embeddings
- `embed-rerank` - Rerank documents and collections by relevance
### 4. Media Generation (MEDIUM)
- `media-images` - Generate, store, and queue images
- `media-audio-transcription` - Text-to-speech and speech-to-text
### 5. Files & Storage (MEDIUM)
- `files-vector-stores` - File storage and vector stores for RAG
### 6. Infrastructure (MEDIUM)
- `infra-failover` - Automatic provider failover for resilience
### 7. Testing (HIGH)
- `test-agents` - Fake agents, assert prompts, prevent stray prompts
- `test-media` - Fake images, audio, and transcriptions
- `test-data` - Fake embeddings, reranking, files, and vector stores
## Essential Patterns
### Creating an Agent
```php
<?php
namespace App\Ai\Agents;
use Laravel\Ai\Contracts\Agent;
use Laravel\Ai\Promptable;
class SalesCoach implements Agent
{
use Promptable;
public function instructions(): string
{
return 'You are a sales coach, analyzing transcripts and providing feedback.';
}
}
```
### Prompting
```php
use App\Ai\Agents\SalesCoach;
$response = SalesCoach::make()->prompt('Analyze this sales transcript...');
return (string) $response;
```
### Generating Images
```php
use Laravel\Ai\Image;
$image = Image::of('A donut sitting on the kitchen counter')
->landscape()
->generate();
$path = $image->store();
```
### Generating Embeddings
```php
use Illuminate\Support\Str;
$embeddings = Str::of('Napa Valley has great wine.')->toEmbeddings();
```
### Testing
```php
use App\Ai\Agents\SalesCoach;
SalesCoach::fake(['First response', 'Second response']);
SalesCoach::make()->prompt('Analyze this...');
SalesCoach::assertPrompted('Analyze this...');
```
## How to Use
Read individual rule files for detailed explanations and code examples.
Each rule file contains:
- YAML frontmatter with metadata (title, impact, tags)
- Brief explanation of why it matters
- Bad Example with explanation
- Good Example with explanation
- Laravel 13 and PHP 8.3 specific context and references
## Full Compiled Document
For the complete guide with all rules expanded: `AGENTS.md`
Related in Image & Video
watch
IncludedWatch a video (URL or local path). Downloads with yt-dlp, extracts auto-scaled frames with ffmpeg, pulls the transcript from captions (or Whisper API fallback), and hands the result to Claude so it can answer questions about what's in the video.
physical-ai-defect-image-generation
IncludedUse when the user wants to orchestrate defect image generation, run associated setup, or handle outputs on OSMO. The Day 0 path handles cold-start with USD-to-ROI, image-edit augmentation, and AnomalyGen to create initial PCBA datasets. The Day 1 path performs inference and labeling on real images. This skill helps with first-time asset setup, creation of finetuning checkpoints, and configuring deployment. Trigger keywords: defect image generation, dig workflow, dig pipeline, defect image detection workflow, aoi pipeline, aoi anomalygen, usd2roi anomalygen, day 0 pcba, day 1 pcba, day 1 real-photo alignment, day 1 manual roi, metal surface anomaly, glass defect, anomalygen finetune, setup_pcb, setup_metal, setup_glass, setup_pretrained, dig setup, dig datasets, dig pretrained checkpoint, dig image-edit endpoint.
accelint-react-best-practices
IncludedReact performance optimization and best practices. ALWAYS use this skill when working with any React code - writing components, hooks, JSX; refactoring; optimizing re-renders, memoization, state management; reviewing for performance; fixing hydration mismatches; debugging infinite re-renders, stale closures, input focus loss, animations restarting; preventing remounting; implementing transitions, lazy initialization, effect dependencies. Even simple React tasks benefit from these patterns. Covers React 19+ (useEffectEvent, Activity, ref props). Triggers - useEffect, useState, useMemo, useCallback, memo, inline components, nested components, components inside components, re-render, performance, hydration, SSR, Next.js, useDeferredValue, combined hooks.
elevenlabs-agents
IncludedBuild conversational AI voice agents with ElevenLabs Platform using React, JavaScript, React Native, or Swift SDKs. Configure agents, tools (client/server/MCP), RAG knowledge bases, multi-voice, and Scribe real-time STT. Use when: building voice chat interfaces, implementing AI phone agents with Twilio, configuring agent workflows or tools, adding RAG knowledge bases, testing with CLI "agents as code", or troubleshooting deprecated @11labs packages, Android audio cutoff, CSP violations, dynamic variables, or WebRTC config. Keywords: ElevenLabs Agents, ElevenLabs voice agents, AI voice agents, conversational AI, @elevenlabs/react, @elevenlabs/client, @elevenlabs/react-native, @elevenlabs/elevenlabs-js, @elevenlabs/agents-cli, elevenlabs SDK, voice AI, TTS, text-to-speech, ASR, speech recognition, turn-taking model, WebRTC voice, WebSocket voice, ElevenLabs conversation, agent system prompt, agent tools, agent knowledge base, RAG voice agents, multi-voice agents, pronunciation dictionary, voice speed control, elevenlabs scribe, @11labs deprecated, Android audio cutoff, CSP violation elevenlabs, dynamic variables elevenlabs, case-sensitive tool names, webhook authentication
humanizer
IncludedHumanize AI-generated text by detecting and removing patterns typical of LLM output. Rewrites text to sound natural, specific, and human. Uses 28 pattern detectors, 560+ AI vocabulary terms across 3 tiers, and statistical analysis (burstiness, type-token ratio, readability) for comprehensive detection. Use when asked to humanize text, de-AI writing, make content sound more natural/human, review writing for AI patterns, score text for AI detection, or improve AI-generated drafts. Covers content, language, style, communication, and filler categories.
generating-mermaid-diagrams
IncludedSalesforce architecture diagrams using Mermaid with ASCII fallback. Use this skill when generating text-based diagrams for Salesforce architecture, OAuth flows, ERDs, integration sequences, or Agentforce structure. TRIGGER when: user says "diagram", "visualize", "ERD", or asks for sequence diagrams, flowcharts, class diagrams, or architecture visualizations in Mermaid. DO NOT TRIGGER when: user wants PNG/SVG image output (use generating-visual-diagrams), or asks about non-Salesforce systems.