Claude Code Plugins

Community-maintained marketplace

Feedback

laravel-exceptions

@leeovery/claude-laravel
3
1

Custom exceptions with static factories and HTTP responses. Use when working with error handling, custom exceptions, or when user mentions exceptions, custom exception, error handling, HTTP exceptions.

Install Skill

1Download skill
2Enable skills in Claude

Open claude.ai/settings/capabilities and find the "Skills" section

3Upload to Claude

Click "Upload skill" and select the downloaded ZIP file

Note: Please verify skill by going through its instructions before using it.

SKILL.md

name laravel-exceptions
description Custom exceptions with static factories and HTTP responses. Use when working with error handling, custom exceptions, or when user mentions exceptions, custom exception, error handling, HTTP exceptions.

Laravel Exceptions

Custom exceptions with static factory methods and HTTP integration.

Core Concept

exceptions.md - Exception patterns:

  • Static factory methods for creation
  • HTTP status code integration
  • Descriptive error messages
  • HttpExceptionInterface for HTTP responses
  • When to throw vs return results

Pattern

final class InsufficientInventoryException extends Exception implements HttpExceptionInterface
{
    public static function forProduct(Product $product, int $requested): self
    {
        return new self(
            "Insufficient inventory for product {$product->name}. ".
            "Requested: {$requested}, Available: {$product->stock}"
        );
    }

    public function getStatusCode(): int
    {
        return 422;
    }

    public function getHeaders(): array
    {
        return [];
    }
}

// Usage
throw InsufficientInventoryException::forProduct($product, $quantity);

Use static factories for context-rich exception creation. Implement HttpExceptionInterface for automatic HTTP responses.