diff --git a/.claude/skills/ai-sdk-development/SKILL.md b/.claude/skills/ai-sdk-development/SKILL.md index d74e342e..30320b09 100644 --- a/.claude/skills/ai-sdk-development/SKILL.md +++ b/.claude/skills/ai-sdk-development/SKILL.md @@ -1,6 +1,9 @@ --- name: ai-sdk-development -description: Builds AI agents, generates text and chat responses, produces images, synthesizes audio, transcribes speech, generates vector embeddings, reranks documents, and manages files and vector stores using the Laravel AI SDK (laravel/ai). Supports structured output, streaming, tools, conversation memory, middleware, queueing, broadcasting, and provider failover. Use when building, editing, updating, debugging, or testing any AI functionality, including agents, LLMs, chatbots, text generation, image generation, audio, transcription, embeddings, RAG, similarity search, vector stores, prompting, structured output, or any AI provider (OpenAI, Anthropic, Gemini, Cohere, Groq, xAI, ElevenLabs, Jina, OpenRouter). +description: TRIGGER when working with ai-sdk which is Laravel official first-party AI SDK. Activate when building, editing AI agents, chatbots, text generation, image generation, audio/TTS, transcription/STT, embeddings, RAG, vector stores, reranking, structured output, streaming, conversation memory, tools, queueing, broadcasting, and provider failover across OpenAI, Anthropic, Gemini, Azure, Groq, xAI, DeepSeek, Mistral, Ollama, ElevenLabs, Cohere, Jina, and VoyageAI. Invoke when the user references ai-sdk, the `Laravel\Ai\` namespace, or this project's AI features — not for Prism PHP or other AI packages used directly. +license: MIT +metadata: + author: laravel --- # Developing with the Laravel AI SDK @@ -53,6 +56,7 @@ ### Agents ```php use Laravel\Ai\Contracts\Agent; +use Laravel\Ai\Enums\Lab; use Laravel\Ai\Promptable; class SalesCoach implements Agent @@ -69,6 +73,17 @@ ### Agents $response = (new SalesCoach)->prompt('Analyze this transcript...'); echo $response->text; +// Container resolution with dependency injection +$agent = SalesCoach::make(user: $user); + +// Override provider, model, or timeout per-prompt +$response = (new SalesCoach)->prompt( + 'Analyze this transcript...', + provider: Lab::Anthropic, + model: 'claude-haiku-4-5-20251001', + timeout: 120, +); + // Streaming (returns SSE response from a route) return (new SalesCoach)->stream('Analyze this transcript...'); @@ -245,9 +260,11 @@ ## Agent Configuration ### PHP Attributes ```php -use Laravel\Ai\Attributes\{Provider, MaxSteps, MaxTokens, Temperature, Timeout}; +use Laravel\Ai\Attributes\{Provider, Model, MaxSteps, MaxTokens, Temperature, Timeout}; +use Laravel\Ai\Enums\Lab; -#[Provider('anthropic')] +#[Provider(Lab::Anthropic)] +#[Model('claude-haiku-4-5-20251001')] #[MaxSteps(10)] #[MaxTokens(4096)] #[Temperature(0.7)] @@ -313,7 +330,7 @@ ### Conversation Memory ### Failover ```php -$response = (new MyAgent)->prompt('Hello', provider: ['openai', 'anthropic']); +$response = (new MyAgent)->prompt('Hello', provider: [Lab::OpenAI, Lab::Anthropic]); ``` ## Testing and Faking @@ -370,6 +387,7 @@ ## Key Patterns - Agent pattern: Implement the `Agent` interface and use the `Promptable` trait - Optional interfaces: `HasTools`, `HasMiddleware`, `HasStructuredOutput`, `Conversational` - Entry-point classes: `Image`, `Audio`, `Transcription`, `Embeddings`, `Reranking`, `Stores` +- Provider enum: `Laravel\Ai\Enums\Lab` (prefer over plain strings) - Artisan commands: `php artisan make:agent`, `php artisan make:tool` - Global helper: `agent()` for anonymous agents @@ -400,14 +418,23 @@ ### Never Use Prism Directly ## Provider Support -| Provider | Text | Image | Audio | STT | Embeddings | Reranking | Files | Stores | -| ---------- | ---- | ----- | ----- | --- | ---------- | --------- | ----- | ------ | -| OpenAI | Y | Y | Y | Y | Y | - | Y | Y | -| Anthropic | Y | - | - | - | - | - | Y | - | -| Gemini | Y | Y | - | - | Y | - | Y | Y | -| xAI | Y | Y | - | - | - | - | - | - | -| Groq | Y | - | - | - | - | - | - | - | -| OpenRouter | Y | - | - | - | - | - | - | - | -| ElevenLabs | - | - | Y | Y | - | - | - | - | -| Cohere | - | - | - | - | Y | Y | - | - | -| Jina | - | - | - | - | Y | Y | - | - | \ No newline at end of file +| Feature | Providers | +| ---------- | --------------------------------------------------------------- | +| Text | OpenAI, Anthropic, Gemini, Azure, Groq, xAI, DeepSeek, Mistral, Ollama | +| Images | OpenAI, Gemini, xAI | +| TTS | OpenAI, ElevenLabs | +| STT | OpenAI, ElevenLabs, Mistral | +| Embeddings | OpenAI, Gemini, Azure, Cohere, Mistral, Jina, VoyageAI | +| Reranking | Cohere, Jina | +| Files | OpenAI, Anthropic, Gemini | + +Use the `Laravel\Ai\Enums\Lab` enum to reference providers in code instead of plain strings: + +```php +use Laravel\Ai\Enums\Lab; + +Lab::Anthropic; +Lab::OpenAI; +Lab::Gemini; +// ... +``` \ No newline at end of file diff --git a/.claude/skills/cashier-stripe-development/SKILL.md b/.claude/skills/cashier-stripe-development/SKILL.md index 3611b62e..355e8a92 100644 --- a/.claude/skills/cashier-stripe-development/SKILL.md +++ b/.claude/skills/cashier-stripe-development/SKILL.md @@ -33,9 +33,9 @@ ## Basic Usage ### Installation ```bash -vendor/bin/sail artisan vendor:publish --tag="cashier-migrations" -vendor/bin/sail artisan migrate -vendor/bin/sail artisan vendor:publish --tag="cashier-config" +php artisan vendor:publish --tag="cashier-migrations" +php artisan migrate +php artisan vendor:publish --tag="cashier-config" ``` ### Environment Variables diff --git a/.claude/skills/configuring-horizon/SKILL.md b/.claude/skills/configuring-horizon/SKILL.md index 112c0d13..bed1e74c 100644 --- a/.claude/skills/configuring-horizon/SKILL.md +++ b/.claude/skills/configuring-horizon/SKILL.md @@ -24,7 +24,7 @@ ## Basic Usage ### Installation ```bash -vendor/bin/sail artisan horizon:install +php artisan horizon:install ``` ### Supervisor Configuration @@ -70,7 +70,7 @@ ### Dashboard Authorization ## Verification -1. Run `vendor/bin/sail artisan horizon` and visit `/horizon` +1. Run `php artisan horizon` and visit `/horizon` 2. Confirm dashboard access is restricted as expected 3. Check that metrics populate after scheduling `horizon:snapshot` @@ -81,5 +81,5 @@ ## Common Pitfalls - Always check `config/horizon.php` before making changes to understand the current supervisor and environment configuration. - The `environments` array overrides only the keys you specify. It merges into `defaults` and does not replace it. - The timeout chain must be ordered: job `timeout` less than supervisor `timeout` less than `retry_after`. The wrong order can cause jobs to be retried before Horizon finishes timing them out. -- The metrics dashboard stays blank until `horizon:snapshot` is scheduled. Running `vendor/bin/sail artisan horizon` alone does not populate metrics. +- The metrics dashboard stays blank until `horizon:snapshot` is scheduled. Running `php artisan horizon` alone does not populate metrics. - Always use `search-docs` for the latest Horizon documentation rather than relying on this skill alone. \ No newline at end of file diff --git a/.claude/skills/mcp-development/SKILL.md b/.claude/skills/mcp-development/SKILL.md index fb38e649..f2f0ba48 100644 --- a/.claude/skills/mcp-development/SKILL.md +++ b/.claude/skills/mcp-development/SKILL.md @@ -28,13 +28,13 @@ ### Creating MCP Primitives Create MCP tools, resources, prompts, and servers using artisan commands: ```bash -vendor/bin/sail artisan make:mcp-tool ToolName # Create a tool +php artisan make:mcp-tool ToolName # Create a tool -vendor/bin/sail artisan make:mcp-resource ResourceName # Create a resource +php artisan make:mcp-resource ResourceName # Create a resource -vendor/bin/sail artisan make:mcp-prompt PromptName # Create a prompt +php artisan make:mcp-prompt PromptName # Create a prompt -vendor/bin/sail artisan make:mcp-server ServerName # Create a server +php artisan make:mcp-server ServerName # Create a server ``` diff --git a/.claude/skills/pest-testing/SKILL.md b/.claude/skills/pest-testing/SKILL.md index dc6f5d17..ba774e71 100644 --- a/.claude/skills/pest-testing/SKILL.md +++ b/.claude/skills/pest-testing/SKILL.md @@ -16,7 +16,7 @@ ## Basic Usage ### Creating Tests -All tests must be written using Pest. Use `vendor/bin/sail artisan make:test --pest {name}`. +All tests must be written using Pest. Use `php artisan make:test --pest {name}`. ### Test Organization @@ -35,9 +35,9 @@ ### Basic Test Structure ### Running Tests -- Run minimal tests with filter before finalizing: `vendor/bin/sail artisan test --compact --filter=testName`. -- Run all tests: `vendor/bin/sail artisan test --compact`. -- Run file: `vendor/bin/sail artisan test --compact tests/Feature/ExampleTest.php`. +- Run minimal tests with filter before finalizing: `php artisan test --compact --filter=testName`. +- Run all tests: `php artisan test --compact`. +- Run file: `php artisan test --compact tests/Feature/ExampleTest.php`. ## Assertions diff --git a/.claude/skills/wayfinder-development/SKILL.md b/.claude/skills/wayfinder-development/SKILL.md index 451995db..0b306459 100644 --- a/.claude/skills/wayfinder-development/SKILL.md +++ b/.claude/skills/wayfinder-development/SKILL.md @@ -18,11 +18,11 @@ ### Generate Routes Run after route changes if Vite plugin isn't installed: ```bash -vendor/bin/sail artisan wayfinder:generate --no-interaction +php artisan wayfinder:generate --no-interaction ``` For form helpers, use `--with-form` flag: ```bash -vendor/bin/sail artisan wayfinder:generate --with-form --no-interaction +php artisan wayfinder:generate --with-form --no-interaction ``` ### Import Patterns @@ -69,7 +69,7 @@ ## Wayfinder + Inertia ## Verification -1. Run `vendor/bin/sail artisan wayfinder:generate` to regenerate routes if Vite plugin isn't installed +1. Run `php artisan wayfinder:generate` to regenerate routes if Vite plugin isn't installed 2. Check TypeScript imports resolve correctly 3. Verify route URLs match expected paths diff --git a/.mcp.json b/.mcp.json index d33af9ab..e016a81d 100644 --- a/.mcp.json +++ b/.mcp.json @@ -1,7 +1,7 @@ { "mcpServers": { "laravel-boost": { - "command": "vendor/bin/sail", + "command": "php", "args": [ "artisan", "boost:mcp" diff --git a/CLAUDE.md b/CLAUDE.md index 4b4ce5a9..6b0fc9f1 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -44,12 +44,13 @@ ## Skills Activation - `cashier-stripe-development` — Handles Laravel Cashier Stripe integration including subscriptions, webhooks, Stripe Checkout, invoices, charges, refunds, trials, coupons, metered billing, and payment failure handling. Triggered when a user mentions Cashier, Billable, IncompletePayment, stripe_id, newSubscription, Stripe subscriptions, or billing. Also applies when setting up webhooks, handling SCA/3DS payment failures, testing with Stripe test cards, or troubleshooting incomplete subscriptions, CSRF webhook errors, or migration publish issues. - `laravel-best-practices` — Apply this skill whenever writing, reviewing, or refactoring Laravel PHP code. This includes creating or modifying controllers, models, migrations, form requests, policies, jobs, scheduled commands, service classes, and Eloquent queries. Triggers for N+1 and query performance issues, caching strategies, authorization and security patterns, validation, error handling, queue and job configuration, route definitions, and architectural decisions. Also use for Laravel code reviews and refactoring existing Laravel code to follow best practices. Covers any task involving Laravel backend PHP code patterns. - `configuring-horizon` — Use this skill whenever the user mentions Horizon by name in a Laravel context. Covers the full Horizon lifecycle: installing Horizon (horizon:install, Sail setup), configuring config/horizon.php (supervisor blocks, queue assignments, balancing strategies, minProcesses/maxProcesses), fixing the dashboard (authorization via Gate::define viewHorizon, blank metrics, horizon:snapshot scheduling), and troubleshooting production issues (worker crashes, timeout chain ordering, LongWaitDetected notifications, waits config). Also covers job tagging and silencing. Do not use for generic Laravel queues without Horizon, SQS or database drivers, standalone Redis setup, Linux supervisord, Telescope, or job batching. -- `mcp-development` — Use this skill for Laravel MCP development only. Trigger when creating or editing MCP tools, resources, prompts, or servers in Laravel projects. Covers: artisan make:mcp-* generators, mcp:inspector, routes/ai.php, Tool/Resource/Prompt classes, schema validation, shouldRegister(), OAuth setup, URI templates, read-only attributes, and MCP debugging. Do not use for non-Laravel MCP projects or generic AI features without MCP. +- `mcp-development` — Use this skill for Laravel MCP development only. Trigger when creating or editing MCP tools, resources, prompts, or servers in Laravel projects. Covers: artisan make:mcp-\* generators, mcp:inspector, routes/ai.php, Tool/Resource/Prompt classes, schema validation, shouldRegister(), OAuth setup, URI templates, read-only attributes, and MCP debugging. Do not use for non-Laravel MCP projects or generic AI features without MCP. - `socialite-development` — Manages OAuth social authentication with Laravel Socialite. Activate when adding social login providers; configuring OAuth redirect/callback flows; retrieving authenticated user details; customizing scopes or parameters; setting up community providers; testing with Socialite fakes; or when the user mentions social login, OAuth, Socialite, or third-party authentication. - `wayfinder-development` — Use this skill for Laravel Wayfinder which auto-generates typed functions for Laravel controllers and routes. ALWAYS use this skill when frontend code needs to call backend routes or controller actions. Trigger when: connecting any React/Vue/Svelte/Inertia frontend to Laravel controllers, routes, building end-to-end features with both frontend and backend, wiring up forms or links to backend endpoints, fixing route-related TypeScript errors, importing from @/actions or @/routes, or running wayfinder:generate. Use Wayfinder route functions instead of hardcoded URLs. Covers: wayfinder() vite plugin, .url()/.get()/.post()/.form(), query params, route model binding, tree-shaking. Do not use for backend-only task - `pest-testing` — Use this skill for Pest PHP testing in Laravel projects only. Trigger whenever any test is being written, edited, fixed, or refactored — including fixing tests that broke after a code change, adding assertions, converting PHPUnit to Pest, adding datasets, and TDD workflows. Always activate when the user asks how to write something in Pest, mentions test files or directories (tests/Feature, tests/Unit, tests/Browser), or needs browser testing, smoke testing multiple pages for JS errors, or architecture tests. Covers: it()/expect() syntax, datasets, mocking, browser testing (visit/click/fill), smoke testing, arch(), Livewire component tests, RefreshDatabase, and all Pest 4 features. Do not use for factories, seeders, migrations, controllers, models, or non-test PHP code. - `inertia-vue-development` — Develops Inertia.js v3 Vue client-side applications. Activates when creating Vue pages, forms, or navigation; using ,