Laravel Performance Eager Loading
Optimizes Laravel queries via eager loading suggestions to reduce N+1 problems and improve application performance.
Install on your platform
We auto-selected Claude Code based on this skill’s supported platforms.
Run in terminal (recommended)
claude mcp add laravel-performance-eager-loading npx -- -y @trustedskills/laravel-performance-eager-loading
Or manually add to ~/.claude/settings.json
{
"mcpServers": {
"laravel-performance-eager-loading": {
"command": "npx",
"args": [
"-y",
"@trustedskills/laravel-performance-eager-loading"
]
}
}
}Requires Claude Code (claude CLI). Run claude --version to verify your install.
About This Skill
What it does
This skill optimizes Laravel application performance by automatically eager loading relationships. Eager loading prevents the N+1 query problem, which significantly reduces database load and improves response times when retrieving data with related models. It identifies and applies appropriate with() clauses to Eloquent queries based on the fields being accessed.
When to use it
- Slow Query Performance: When profiling reveals slow database queries due to repeated fetching of associated records.
- Complex Data Retrieval: When your application frequently retrieves data with multiple related models, such as displaying a list of products with their categories and images.
- API Endpoint Optimization: To improve the speed and efficiency of API endpoints that return complex datasets.
- Large Datasets: When dealing with large tables or relationships where N+1 queries would be particularly detrimental.
Key capabilities
- Automatic identification of required eager loads.
- Application of
with()clauses to Eloquent queries. - Performance optimization for Laravel applications.
- Prevention of the N+1 query problem.
Example prompts
- "Optimize this Eloquent query:
Product::all()->load('category', 'images')." - "Find and fix slow database queries in my application related to product listings."
- “Eager load all relationships needed for displaying a customer’s order history.”
Tips & gotchas
- This skill requires a Laravel environment. Ensure your project is properly set up with Composer and the Laravel framework before use.
- The skill's effectiveness depends on accurately identifying the relationships being accessed in queries; review generated
with()clauses to ensure correctness.
Tags
TrustedSkills Verification
Unlike other registries that point to live repositories, TrustedSkills pins every skill to a verified commit hash. This protects you from malicious updates — what you install today is exactly what was reviewed and verified.
Security Audits
| Gen Agent Trust Hub | Pass |
| Socket | Pass |
| Snyk | Pass |
🌐 Community
Passed automated security scans.