ui/.ai/skills/laravel-debugging-prompts/SKILL.md
Create effective debugging prompts—include error messages, stack traces, expected vs actual behavior, logs, and attempted solutions
npx skillsauth add noartem/kawa laravel-debugging-promptsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
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 11.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.
development
Use this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved.
tools
Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.
development
Review UI code for Web Interface Guidelines compliance. Use when asked to "review my UI", "check accessibility", "audit design", "review UX", or "check my site against best practices".
tools
Suite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn/ui). Use for complex artifacts requiring state management, routing, or shadcn/ui components - not for simple single-file HTML/JSX artifacts.