/superpowers-laravel:laravel:debugging-promptsfrom superpowers-laravel
Guides Laravel developers on writing structured debugging prompts with error messages, stack traces, expected vs actual behavior, logs, and attempted solutions.
Claude never picks this skill on its own
Typing /superpowers-laravel:laravel:debugging-prompts runs it, but /superpowers-laravel:debugging-prompts (a command, or a skill Claude Code finds first) takes the same name in Claude Code, so Claude gets that one when it chooses a skill.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Debugging with AI requires complete information. Missing context means generic suggestions that don't solve your specific problem.
"Getting an error in the payment controller"
"Getting error when processing payment:
Error:
Illuminate\Database\QueryException: SQLSTATE[23000]:
Integrity constraint violation: 1452 Cannot add or update a child row:
a foreign key constraint fails (`app`.`payments`, CONSTRAINT `payments_order_id_foreign`
FOREIGN KEY (`order_id`) REFERENCES `orders` (`id`) ON DELETE CASCADE)
Stack trace:
#0 app/Services/PaymentService.php(45): Payment::create()
#1 app/Http/Controllers/PaymentController.php(28): PaymentService->process()
#2 vendor/laravel/framework/src/Illuminate/Routing/Controller.php(54)
Context:
['order_id' => 999, 'amount' => 5000, 'status' => 'pending']Why it works: Complete error, stack trace, context, and the specific data causing the issue.
"The API isn't returning the right data"
"Product API returning incorrect data:
Expected behavior:
{
"data": {
"id": 1,
"name": "Widget",
"price": "29.99",
"category": {
"id": 5,
"name": "Tools"
}
}
}
Actual behavior:
{
"data": {
"id": 1,
"name": "Widget",
"price": 2999,
"category": null
}
}
Issues:
Code:
// ProductController@show
return new ProductResource($product);
Product has category_id = 5 in database, but relationship not loading."
Why it works: Shows exact expected vs actual output, identifies specific issues, includes relevant code.
"Something's wrong with the queue"
"Job failing in queue:
Log entries:
[2024-01-15 10:30:15] local.ERROR: Job failed: ProcessOrderJob
{"order_id":123,"exception":"Stripe\\Exception\\InvalidRequestException:
No such customer: cus_invalid","attempts":3}
[2024-01-15 10:30:15] local.INFO: Order state before job
{"id":123,"status":"pending","stripe_customer_id":"cus_invalid"}
Job code:
public function handle()
{
$customer = $this->stripe->customers->retrieve(
$this->order->stripe_customer_id
);
// ...
}
State:
stripe_customer_id = "cus_invalid"Why it works: Includes logs, state information, relevant code, and context about retries.
"I think it's a caching issue"
"Suspect Redis cache is stale:
Hypothesis: Product prices are cached but not invalidating on update.
Evidence:
UPDATE products SET price = 3999 WHERE id = 1SELECT price FROM products WHERE id = 1 → 3999GET /api/products/1 → "price": "29.99"php artisan cache:clear, API returns correct price: "price": "39.99"Caching code:
public function show(Product $product)
{
$cached = Cache::remember("product.{$product->id}", 3600, function () use ($product) {
return new ProductResource($product);
});
return $cached;
}
Problem: Cache key doesn't invalidate when product updates. Need cache invalidation in ProductObserver or remove caching from show method."
Why it works: Clear hypothesis, concrete evidence, relevant code, proposed solution.
"I tried some things but nothing worked"
"Attempted solutions and results:
Attempt 1: Added eager loading
$products = Product::with('category')->get();
Result: Still getting N+1 queries. Debugbar shows 101 queries (1 for products, 100 for categories).
Attempt 2: Used load() after fetching
$products = Product::all();
$products->load('category');
Result: Same issue, still 101 queries.
Attempt 3: Checked relationship definition
// In Product model
public function category()
{
return $this->belongsTo(Category::class);
}
Result: Relationship looks correct. Foreign key category_id exists in products table.
Current state: Eager loading syntax seems correct but not working. Using Laravel 13.x. What am I missing?"
Why it works: Shows what was tried, exact code used, results observed, helps avoid suggesting already-tried solutions.
**Error:** [Full error message]
**Stack trace:** [Complete stack trace]
**File/Line:** [Where error occurs]
**Context:** [Laravel version, packages, environment]
**Data:** [Input data causing error]
**Expected:** [What should happen]
**Expected:** [Describe expected behavior with example]
**Actual:** [Describe actual behavior with example]
**Code:** [Relevant code snippet]
**State:** [Database state, variable values]
**Environment:** [Laravel version, Sail/host, packages]
**Problem:** [Describe slow operation]
**Metrics:** [Response time, query count, memory usage]
**Query log:** [Slow queries from Debugbar/Telescope]
**Code:** [Code causing performance issue]
**Dataset size:** [Number of records involved]
**Attempted:** [Optimizations already tried]
Debug effectively with AI:
More information = faster solutions. When debugging, over-communicate.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
None: SKILL.md is the whole skill.
npx claudepluginhub jpcaparas/superpowers-laravel --plugin superpowers-laravel57 skills in this plugin
/laravel:ai-sdkBuild AI features with the first-party Laravel AI SDK (Laravel 13+); agents, embeddings, images, audio, and tool calling with provider-agnostic APIs/laravel:api-resources-and-paginationUse API Resources with pagination and conditional fields; keep response shapes stable and cache-friendly/laravel:api-surface-evolutionEvolve APIs safely using versioned DTOs/transformers, deprecations, and compatibility tests/laravel:blade-components-and-layoutsCompose UIs with Blade components, slots, and layouts; keep templates pure and testable/laravel:bootstrap-checkDetect Sail/non‑Sail and print the right command pairs for your environment; verify dependencies and key services are reachable/laravel:brainstormingInteractive design refinement tailored to Laravel projects; clarify domain, data, interfaces, testing, and quality gates while accounting for Sail/non‑Sail environmentsOther plugins' skills for the same job