ui/.ai/skills/laravel-iterating-on-code/SKILL.md
Refine AI-generated code through specific feedback—point out errors, identify gaps, show desired changes, reference style guides
npx skillsauth add noartem/kawa laravel-iterating-on-codeInstall 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.
AI-generated code rarely perfect on first try. Effective iteration gets you from "close" to "exactly right."
"This doesn't work"
"The validation is incorrect:
Current code:
'email' => 'required|email|unique:users'
Problem: This allows updating a user's email to another user's existing email. The unique rule needs to ignore the current user.
Fix:
'email' => [
'required',
'email',
Rule::unique('users')->ignore($this->user()->id)
]
This allows the user to keep their own email but prevents duplicates with other users."
Why it works: Identifies the specific problem, explains why it's wrong, shows the correct solution.
"Something's missing"
"The OrderService is missing error handling:
Current implementation:
public function createOrder(array $data): Order
{
$order = Order::create($data);
$this->processPayment($order);
return $order;
}
Missing:
Add:
DB::transaction(function () use ($data) {
$this->validateInventory($data['items']);
$order = Order::create($data);
$this->processPayment($order);
event(new OrderCreated($order));
return $order;
});
Plus add try/catch for payment failures."
Why it works: Lists specific missing pieces with context and shows how to add them.
"Make it better"
"Refine the query for better performance:
Current:
$products = Product::all()->filter(function ($product) {
return $product->isActive() && $product->inStock();
});
Issues:
Refined:
$products = Product::query()
->where('active', true)
->where('stock_quantity', '>', 0)
->get();
Move filtering to database, use indexed columns, avoid loading unnecessary data."
Why it works: Explains what needs refinement and why, shows the improved version.
"Follow our style guide"
"Update to match our coding standards:
Current:
public function get_user_orders($userId) {
return Order::where('user_id', $userId)->get();
}
Style issues:
getUserOrders$userId ✓ (already correct)Corrected:
/**
* Get all orders for a specific user.
*/
public function getUserOrders(int $userId): Collection
{
return Order::where('user_id', $userId)->get();
}
See our style guide: docs/coding-standards.md"
Why it works: Points to specific style violations, shows corrections, references the style guide.
"Change the validation, add error handling, refactor the service, update the tests, and add logging"
"Let's iterate step by step:
Step 1: Fix the validation issue first
'email' => Rule::unique('users')->ignore($this->user()->id)
Let's verify this works before moving on."
[After validation confirmed working]
"Step 2: Now add error handling for the payment processing
try {
$this->processPayment($order);
} catch (PaymentException $e) {
Log::error('Payment failed', ['order' => $order->id]);
throw new OrderProcessingException('Payment failed', previous: $e);
}
Test this before we continue."
Why it works: One change at a time, validate each step, build confidence incrementally.
"The relationship is incorrect:
**Current:** `return $this->hasMany(Post::class);`
**Problem:** A User has many Posts, but you're defining this in the Post model. This creates a circular relationship.
**Fix:** Move this to the User model, or if you meant Post belongs to User:
```php
// In Post model
public function user(): BelongsTo
{
return $this->belongsTo(User::class);
}
```"
"Missing authorization check:
**Why it matters:** Any authenticated user can delete any order, not just their own.
**Add this to OrderController@destroy:**
```php
$this->authorize('delete', $order);
And create the policy method:
// In OrderPolicy
public function delete(User $user, Order $order): bool
{
return $user->id === $order->user_id;
}
```"
"Current implementation has issues:
**Current:**
```php
foreach ($orders as $order) {
$order->load('items', 'customer', 'shipping');
}
Issues:
Improved:
$orders = Order::with(['items', 'customer', 'shipping'])->get();
Single query with eager loading."
## Quick Reference
Iterate effectively:
- **Be specific** - Point to exact lines, explain exact problems
- **Show, don't just tell** - Provide corrected code
- **Explain why** - Help the AI understand the reasoning
- **One change at a time** - Validate incrementally
- **Reference standards** - Point to style guides, docs, examples
Specific feedback = better iterations = code that fits your needs.
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.