{"id":"4e9e079c-ca79-4975-9aae-d272a00588a4","shortId":"VQ9b3J","kind":"skill","title":"laravel-ai-sdk","tagline":"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, rerank","description":"# Laravel AI SDK\n\nComprehensive 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.\n\n## When to Apply\n\nReference these guidelines when:\n- Creating AI agents with instructions, tools, and structured output\n- Prompting agents with conversation context\n- Streaming or queueing agent responses\n- Generating images, audio, or transcriptions\n- Creating and querying vector embeddings\n- Building RAG (retrieval-augmented generation) features\n- Testing AI features with fakes and assertions\n\n## Rule Categories by Priority\n\n| Priority | Category | Impact | Prefix |\n|----------|----------|--------|--------|\n| 1 | Agents | CRITICAL | `agent-` |\n| 2 | Tools | HIGH | `tool-` |\n| 3 | Embeddings & Search | HIGH | `embed-` |\n| 4 | Media Generation | MEDIUM | `media-` |\n| 5 | Files & Storage | MEDIUM | `files-` |\n| 6 | Infrastructure | MEDIUM | `infra-` |\n| 7 | Testing | HIGH | `test-` |\n\n## Quick Reference\n\n### 1. Agents (CRITICAL)\n\n- `agent-create-configure` - Create agents with artisan, PHP attribute configuration\n- `agent-prompting` - Prompt agents, conversation context, RemembersConversations\n- `agent-structured-output` - Structured output with JSON schema\n- `agent-streaming-async` - Streaming, broadcasting, and queueing responses\n- `agent-middleware` - Agent middleware pipeline\n- `agent-anonymous` - Anonymous agents for quick interactions\n\n### 2. Tools (HIGH)\n\n- `tool-create` - Create custom tools with schema and handle method\n- `tool-provider` - Provider tools: WebSearch, WebFetch, FileSearch, SimilaritySearch\n\n### 3. Embeddings & Search (HIGH)\n\n- `embed-generate-cache` - Generate, store, and cache vector embeddings\n- `embed-rerank` - Rerank documents and collections by relevance\n\n### 4. Media Generation (MEDIUM)\n\n- `media-images` - Generate, store, and queue images\n- `media-audio-transcription` - Text-to-speech and speech-to-text\n\n### 5. Files & Storage (MEDIUM)\n\n- `files-vector-stores` - File storage and vector stores for RAG\n\n### 6. Infrastructure (MEDIUM)\n\n- `infra-failover` - Automatic provider failover for resilience\n\n### 7. Testing (HIGH)\n\n- `test-agents` - Fake agents, assert prompts, prevent stray prompts\n- `test-media` - Fake images, audio, and transcriptions\n- `test-data` - Fake embeddings, reranking, files, and vector stores\n\n## Essential Patterns\n\n### Creating an Agent\n\n```php\n<?php\n\nnamespace App\\Ai\\Agents;\n\nuse Laravel\\Ai\\Contracts\\Agent;\nuse Laravel\\Ai\\Promptable;\n\nclass SalesCoach implements Agent\n{\n    use Promptable;\n\n    public function instructions(): string\n    {\n        return 'You are a sales coach, analyzing transcripts and providing feedback.';\n    }\n}\n```\n\n### Prompting\n\n```php\nuse App\\Ai\\Agents\\SalesCoach;\n\n$response = SalesCoach::make()->prompt('Analyze this sales transcript...');\n\nreturn (string) $response;\n```\n\n### Generating Images\n\n```php\nuse Laravel\\Ai\\Image;\n\n$image = Image::of('A donut sitting on the kitchen counter')\n    ->landscape()\n    ->generate();\n\n$path = $image->store();\n```\n\n### Generating Embeddings\n\n```php\nuse Illuminate\\Support\\Str;\n\n$embeddings = Str::of('Napa Valley has great wine.')->toEmbeddings();\n```\n\n### Testing\n\n```php\nuse App\\Ai\\Agents\\SalesCoach;\n\nSalesCoach::fake(['First response', 'Second response']);\n\nSalesCoach::make()->prompt('Analyze this...');\n\nSalesCoach::assertPrompted('Analyze this...');\n```\n\n## How to Use\n\nRead individual rule files for detailed explanations and code examples.\n\nEach rule file contains:\n- YAML frontmatter with metadata (title, impact, tags)\n- Brief explanation of why it matters\n- Bad Example with explanation\n- Good Example with explanation\n- Laravel 13 and PHP 8.3 specific context and references\n\n## Full Compiled Document\n\nFor the complete guide with all rules expanded: `AGENTS.md`","tags":["laravel","sdk","agent","skills","asyrafhussin","agent-rules","agent-skills","ai-agents","ai-slop","claude-code","code-quality","code-review"],"capabilities":["skill","source-asyrafhussin","skill-laravel-ai-sdk","topic-agent-rules","topic-agent-skills","topic-ai-agents","topic-ai-slop","topic-claude-code","topic-code-quality","topic-code-review","topic-codex","topic-cursor","topic-laravel","topic-nodejs","topic-react"],"categories":["agent-skills"],"synonyms":[],"warnings":[],"endpointUrl":"https://skills.sh/AsyrafHussin/agent-skills/laravel-ai-sdk","protocol":"skill","transport":"skills-sh","auth":{"type":"none","details":{"cli":"npx skills add AsyrafHussin/agent-skills","source_repo":"https://github.com/AsyrafHussin/agent-skills","install_from":"skills.sh"}},"qualityScore":"0.469","qualityRationale":"deterministic score 0.47 from registry signals: · indexed on github topic:agent-skills · 39 github stars · SKILL.md body (3,865 chars)","verified":false,"liveness":"unknown","lastLivenessCheck":null,"agentReviews":{"count":0,"score_avg":null,"cost_usd_avg":null,"success_rate":null,"latency_p50_ms":null,"narrative_summary":null,"summary_updated_at":null},"enrichmentModel":"deterministic:skill-github:v1","enrichmentVersion":1,"enrichedAt":"2026-05-18T18:58:24.363Z","embedding":null,"createdAt":"2026-05-16T18:57:14.101Z","updatedAt":"2026-05-18T18:58:24.363Z","lastSeenAt":"2026-05-18T18:58:24.363Z","tsv":"'1':137,170 '13':510 '17':64 '2':141,224 '3':145,247 '4':150,270 '5':155,295 '6':160,310 '7':67,164,321 '8.3':513 'across':66 'agent':17,37,70,88,96,103,138,140,171,174,178,185,188,193,202,211,213,217,220,326,328,356,362,367,375,398,454 'agent-anonym':216 'agent-create-configur':173 'agent-middlewar':210 'agent-prompt':184 'agent-streaming-async':201 'agent-structured-output':192 'agents.md':529 'ai':3,6,11,29,36,47,54,60,87,123,361,365,370,397,416,453 'ai-pow':10,53 'analyz':388,404,465,469 'anonym':218,219 'app':360,396,452 'appli':81 'artisan':180 'assert':128,329 'assertprompt':468 'async':204 'attribut':182 'audio':21,107,284,339 'augment':119 'automat':316 'bad':501 'brief':495 'broadcast':206 'build':9,52,115 'cach':254,258 'call':40 'categori':68,130,134 'class':372 'coach':387 'code':482 'collect':267 'compil':519 'complet':523 'comprehens':49 'configur':176,183 'contain':63,487 'context':99,190,515 'contract':366 'convers':98,189 'counter':427 'cover':69 'creat':16,86,110,175,177,229,230,354 'critic':139,172 'custom':231 'data':344 'detail':479 'document':265,520 'donut':422 'emb':149,252,262 'embed':24,44,74,114,146,248,260,346,434,440 'embed-generate-cach':251 'embed-rerank':261 'essenti':352 'exampl':483,502,506 'expand':528 'explan':480,496,504,508 'failov':315,318 'fake':126,327,337,345,457 'featur':13,30,56,121,124 'feedback':392 'file':156,159,296,300,303,348,477,486 'files-vector-stor':299 'filesearch':245 'first':458 'frontmatt':489 'full':518 'function':379 'generat':18,73,105,120,152,253,255,272,277,411,429,433 'good':505 'great':446 'guid':50,524 'guidelin':84 'handl':236 'high':143,148,166,226,250,323 'illumin':437 'imag':19,106,276,281,338,412,417,418,419,431 'impact':135,493 'implement':374 'individu':475 'infra':163,314 'infra-failov':313 'infrastructur':161,311 'instruct':90,380 'interact':223 'involv':34 'json':199 'kitchen':426 'landscap':428 'laravel':2,5,46,59,364,369,415,509 'laravel-ai-sdk':1 'laravel/ai':35,62 'make':402,463 'matter':500 'media':72,151,154,271,275,283,336 'media-audio-transcript':282 'media-imag':274 'medium':153,158,162,273,298,312 'metadata':491 'method':237 'middlewar':212,214 'namespac':359 'napa':443 'output':42,94,195,197 'path':430 'pattern':353 'php':181,357,358,394,413,435,450,512 'pipelin':215 'power':12,55 'prefix':136 'prevent':331 'prioriti':132,133 'prompt':95,186,187,330,333,393,403,464 'promptabl':371,377 'provid':240,241,317,391 'public':378 'queri':112 'queue':102,208,280 'quick':168,222 'rag':116,309 'read':474 'refer':82,169,517 'relev':269 'remembersconvers':191 'rerank':45,263,264,347 'resili':320 'respons':104,209,400,410,459,461 'retriev':118 'retrieval-aug':117 'return':382,408 'rule':65,129,476,485,527 'sale':386,406 'salescoach':373,399,401,455,456,462,467 'schema':200,234 'sdk':4,7,48,61 'search':26,147,249 'second':460 'similaritysearch':246 'sit':423 'skill' 'skill-laravel-ai-sdk' 'source-asyrafhussin' 'specif':514 'speech':289,292 'speech-to-text':291 'storag':157,297,304 'store':76,256,278,302,307,351,432 'str':439,441 'stray':332 'stream':43,100,203,205 'string':381,409 'structur':41,93,194,196 'support':438 'tag':494 'task':33 'test':28,78,122,165,167,322,325,335,343,449 'test-ag':324 'test-data':342 'test-media':334 'text':287,294 'text-to-speech':286 'titl':492 'toembed':448 'tool':39,71,91,142,144,225,228,232,239,242 'tool-cal':38 'tool-creat':227 'tool-provid':238 'topic-agent-rules' 'topic-agent-skills' 'topic-ai-agents' 'topic-ai-slop' 'topic-claude-code' 'topic-code-quality' 'topic-code-review' 'topic-codex' 'topic-cursor' 'topic-laravel' 'topic-nodejs' 'topic-react' 'transcript':109,285,341,389,407 'trigger':31 'use':14,363,368,376,395,414,436,451,473 'valley':444 'vector':25,75,113,259,301,306,350 'webfetch':244 'websearch':243 'wine':447 'work':22 'yaml':488","prices":[{"id":"1432787a-3e05-4b3b-b574-cfa2712c8262","listingId":"4e9e079c-ca79-4975-9aae-d272a00588a4","amountUsd":"0","unit":"free","nativeCurrency":null,"nativeAmount":null,"chain":null,"payTo":null,"paymentMethod":"skill-free","isPrimary":true,"details":{"org":"AsyrafHussin","category":"agent-skills","install_from":"skills.sh"},"createdAt":"2026-05-16T18:57:14.101Z"}],"sources":[{"listingId":"4e9e079c-ca79-4975-9aae-d272a00588a4","source":"github","sourceId":"AsyrafHussin/agent-skills/laravel-ai-sdk","sourceUrl":"https://github.com/AsyrafHussin/agent-skills/tree/main/skills/laravel-ai-sdk","isPrimary":false,"firstSeenAt":"2026-05-16T18:57:14.101Z","lastSeenAt":"2026-05-18T18:58:24.363Z"}],"details":{"listingId":"4e9e079c-ca79-4975-9aae-d272a00588a4","quickStartSnippet":null,"exampleRequest":null,"exampleResponse":null,"schema":null,"openapiUrl":null,"agentsTxtUrl":null,"citations":[],"useCases":[],"bestFor":[],"notFor":[],"kindDetails":{"org":"AsyrafHussin","slug":"laravel-ai-sdk","github":{"repo":"AsyrafHussin/agent-skills","stars":39,"topics":["agent-rules","agent-skills","ai-agents","ai-slop","claude-code","code-quality","code-review","codex","cursor","laravel","nodejs","react","technical-debt","typescript","windsurf"],"license":"mit","html_url":"https://github.com/AsyrafHussin/agent-skills","pushed_at":"2026-05-16T19:24:02Z","description":"Agent skills for AI coding agents (Claude Code, Cursor, Codex, Windsurf) — Laravel, React, TypeScript, MySQL, code quality, technical debt, documentation, and security.","skill_md_sha":"75470bd6517ea7419cd576795d20b4aa7c66ea40","skill_md_path":"skills/laravel-ai-sdk/SKILL.md","default_branch":"main","skill_tree_url":"https://github.com/AsyrafHussin/agent-skills/tree/main/skills/laravel-ai-sdk"},"layout":"multi","source":"github","category":"agent-skills","frontmatter":{"name":"laravel-ai-sdk","license":"MIT","description":"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."},"skills_sh_url":"https://skills.sh/AsyrafHussin/agent-skills/laravel-ai-sdk"},"updatedAt":"2026-05-18T18:58:24.363Z"}}