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…
от AsyrafHussin★ 112 звёзд на GitHub
Установить laravel-ai-sdk в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Laravel AI SDK
Comprehensive guide for building AI-powered features with the Laravel AI SDK (laravel/ai). Contains 19 rules across 7 categories covering agents, tools, tool approval, media generation, embeddings, vector stores, and testing.
Version 1.1.0 (November 2026). Targets laravel/ai ^1.0, tested on 1.4 (1.4.2).
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
- Writing step middleware, stopping runs, or tracking token usage and cost
- Requiring human approval before a tool runs
- 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 configurationagent-prompting- Prompt agents, conversation context, RemembersConversations, ownership check beforecontinue()agent-structured-output- Structured output with JSON schemaagent-streaming-async- Streaming, broadcasting, and queueing responsesagent-middleware- Step middleware (PendingStep),then()onStepResponse,Stop::when()/Stop::unless()agent-caching-usage-#[CacheInstructions]/#[CacheToolDefinitions],inputTokens/outputTokens, cost per token categoryagent-anonymous- Anonymous agents for quick interactions
2. Tools (HIGH)
tool-create- Create custom tools with schema andhandle(Request $request); dependencies via the constructortool-provider- Provider tools: WebSearch, WebFetch, FileSearch, SimilaritySearch, and which providers run themtool-approval- Human approval withApprovable,InteractsWithApprovals,Decisions, and a conversation ownership check
3. Embeddings & Search (HIGH)
embed-generate-cache- Generate, store, and cache vector embeddingsembed-rerank- Rerank documents and collections by relevance
4. Media Generation (MEDIUM)
media-images- Generate, store, and queue imagesmedia-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- Failover onFailoverableExceptiononly, model per provider
7. Testing (HIGH)
test-agents- Fake agents, assert prompts, prevent stray promptstest-media- Fake images, audio, and transcriptionstest-data- Fake embeddings, reranking, files, and vector stores
Essential Patterns
Creating an Agent
<?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
use App\Ai\Agents\SalesCoach;
$response = SalesCoach::make()->prompt('Analyze this sales transcript...');
return (string) $response;
Generating Images
use Laravel\Ai\Image;
$image = Image::of('A donut sitting on the kitchen counter')
->landscape()
->generate();
$path = $image->store();
Generating Embeddings
use Illuminate\Support\Str;
$embeddings = Str::of('Napa Valley has great wine.')->toEmbeddings();
Testing
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
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
- AGENTS.md
- README.md
- metadata.json
- rules/agent-anonymous.md
- rules/agent-caching-usage.md
- rules/agent-create-configure.md
- rules/agent-middleware.md
- rules/agent-prompting.md
- rules/agent-streaming-async.md
- rules/agent-structured-output.md
- rules/embed-generate-cache.md
- rules/embed-rerank.md
- rules/files-vector-stores.md
- rules/infra-failover.md
- rules/media-audio-transcription.md
- rules/media-images.md
- rules/test-agents.md
- rules/test-data.md
- rules/test-media.md
- rules/tool-approval.md
- rules/tool-create.md
- rules/tool-provider.md
FAQ
Что делает скилл 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.
Как установить скилл laravel-ai-sdk?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл laravel-ai-sdk запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
AnthropicGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
claude-api
AnthropicReference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
algorithmic-art
AnthropicCreating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
mcp-integration
AnthropicThis skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…