بنقرة واحدة
laravel-specifying-constraints
// Define clear constraints—performance, security, testing, architecture, dependencies—so AI generates code that meets your project standards
// Define clear constraints—performance, security, testing, architecture, dependencies—so AI generates code that meets your project standards
Request effective code reviews—specify focus areas, provide context, ask for architectural feedback, reference Laravel conventions
Create effective debugging prompts—include error messages, stack traces, expected vs actual behavior, logs, and attempted solutions
Provide comprehensive context in prompts—files, errors, Laravel version, dependencies, and monorepo details—for accurate AI responses
Refine AI-generated code through specific feedback—point out errors, identify gaps, show desired changes, reference style guides
Use Laravel-specific vocabulary—Eloquent patterns, Form Requests, API resources, jobs/queues—to get idiomatic framework code
Structure prompts for clarity—separate concerns, prioritize requests, specify acceptance criteria, and break work into testable increments
| name | laravel:specifying-constraints |
| description | Define clear constraints—performance, security, testing, architecture, dependencies—so AI generates code that meets your project standards |
Constraints guide the AI toward solutions that fit your project. Without them, you get generic code that may not meet your requirements.
"Make it fast"
"Optimize product search:
name, category_id, published_at"Query orders with performance constraints:
select() to load only needed columnsitems, customer, shipping_address in one query(user_id, created_at, status)chunk() for batch processing > 1000 records"Make it secure"
"Implement user profile update with security requirements:
ProfilePolicy@updateProfileUpdateRequest$fillable""Secure the payment API:
auth:sanctum middlewareprocess-payments ability"Add tests"
"Test the order processing feature:
"Testing requirements for authentication:
RefreshDatabase trait"Implement payment processing following our architecture:
PaymentRepository for data accessPaymentService for business logicProcessPaymentJobPaymentProcessed, PaymentFailed"Implement user management with these constraints:
"Add image processing feature:
intervention/image ^3.0 (Laravel 11.x compatible)spatie/laravel-medialibrary ^11.0"Choose a package for PDF generation:
barryvdh/laravel-dompdf or spatie/laravel-pdf"- Response time: < X ms
- Throughput: Y requests/second
- Cache strategy: Redis, TTL Z minutes
- Database: indexes on [columns], eager load [relationships]
- Pagination: max X per page
- Authentication: [Sanctum/Passport/Session]
- Authorization: [Policy/Gate]
- Validation: [Form Request class]
- Rate limiting: X requests per Y minutes
- Data protection: [encryption/hashing requirements]
- Audit logging: [what to log]
- Coverage: X% on business logic
- Test types: [feature/unit/integration]
- Mocking: [external services to mock]
- Factories: [models to factory]
- Performance: tests complete in < X seconds
- Edge cases: [specific scenarios to test]
Specify constraints clearly:
Clear constraints = code that fits your project.