Laravel Development Workflow
Make the requested Laravel behavior correct, maintainable within the existing application, and supported by evidence that matches the change's risk.
Establish the Contract
Before editing:
- Read the repository instructions and inspect the relevant routes, models, controllers, actions or services, requests, policies, jobs, events, tests, and schema.
- Trace the current behavior far enough to identify the actual change boundary and existing conventions.
- Turn the request into a compact set of scenarios, important edge cases, and verifiable acceptance criteria. Keep this analysis in the working notes unless the user requests a separate artifact.
- Identify authorization, validation, transaction, queue, cache, and concurrency concerns only where they can affect this behavior.
Scale the analysis to the task. A focused validation fix does not need the same ceremony as a new multi-role workflow.
Fix Bugs at the Cause
For a bug:
- Reproduce the failure through the narrowest reliable path.
- Trace the data and control flow to the actionable root cause.
- Add or update a regression test that fails for that cause when practical.
- Implement the smallest fix that restores the intended invariant.
- Demonstrate that the regression test passes and that nearby behavior still works.
Do not substitute retries, broad exception handling, disabled validation, extra timeouts, or error suppression for a root-cause fix. If the failure cannot be reproduced locally, state what evidence is missing and use the strongest available static or targeted verification.
Build Features in the Existing Shape
- Reuse the application's established patterns and naming.
- Keep business rules in the layer where this codebase already places comparable rules.
- Use Eloquent relationships, form requests, policies, actions, services, events, or jobs when they improve this change or match local conventions—not as mandatory ceremony.
- Treat authorization and validation as explicit behavior at the system boundary.
- Preserve backwards compatibility unless the request requires a breaking change.
- Keep migrations reversible and safe for the application's supported database engines.
Create factories, seeders, fixtures, or a disposable command only when realistic data is needed for development or durable test coverage. Do not leave one-off scaffolding in the product solely to exercise a small change.
Verify Proportionately
Discover the project's supported commands from its configuration and documentation. Prefer this order:
- Run the narrowest affected test or reproduce the original failure.
- Run the relevant feature, unit, or integration test group.
- Run static analysis, formatting, and linting configured by the repository.
- Run the broader suite when the change's reach or project policy warrants it.
Cover the critical observable behavior, including the happy path and whichever edge cases, validation rules, permissions, database effects, events, notifications, jobs, or API contracts are actually affected. Avoid tests that only mirror implementation details.
Common commands may include:
php artisan test --filter=RelevantTest
vendor/bin/pest --filter=RelevantTest
vendor/bin/phpstan analyse
vendor/bin/pint --dirty
Use the commands the project provides; do not install or configure tools merely because they appear in this example.
Preserve the User's Environment
- Keep the change inside the requested application behavior and preserve unrelated working-tree changes.
- Do not run destructive database operations, production commands, deployments, credential changes, or external account actions unless the user or repository instructions explicitly place them in scope.
- Avoid exposing secrets in commands, logs, test output, or completion evidence.
- Prefer local, reversible verification and narrowly targeted data changes.
Completion Evidence
Before handing off, verify each acceptance criterion against current behavior. Report:
- what changed and why it fixes or implements the requested behavior;
- the scenarios and important edge cases covered;
- the exact checks run and their results;
- any check that could not run, with the concrete reason and remaining risk.
Do not claim completion from code inspection alone when executable verification is available.
1---2name: laravel-development-workflow-23description: Build features and diagnose or fix bugs in existing Laravel applications with proportionate scenario analysis, regression coverage, and verification. Use when a coding task touches Laravel application behavior; follow the repository's architecture and test tooling instead of imposing a new structure.4---56# Laravel Development Workflow78Make the requested Laravel behavior correct, maintainable within the existing application, and supported by evidence that matches the change's risk.910## Establish the Contract1112Before editing:1314- Read the repository instructions and inspect the relevant routes, models, controllers, actions or services, requests, policies, jobs, events, tests, and schema.15- Trace the current behavior far enough to identify the actual change boundary and existing conventions.16- Turn the request into a compact set of scenarios, important edge cases, and verifiable acceptance criteria. Keep this analysis in the working notes unless the user requests a separate artifact.17- Identify authorization, validation, transaction, queue, cache, and concurrency concerns only where they can affect this behavior.1819Scale the analysis to the task. A focused validation fix does not need the same ceremony as a new multi-role workflow.2021## Fix Bugs at the Cause2223For a bug:24251. Reproduce the failure through the narrowest reliable path.262. Trace the data and control flow to the actionable root cause.273. Add or update a regression test that fails for that cause when practical.284. Implement the smallest fix that restores the intended invariant.295. Demonstrate that the regression test passes and that nearby behavior still works.3031Do not substitute retries, broad exception handling, disabled validation, extra timeouts, or error suppression for a root-cause fix. If the failure cannot be reproduced locally, state what evidence is missing and use the strongest available static or targeted verification.3233## Build Features in the Existing Shape3435- Reuse the application's established patterns and naming.36- Keep business rules in the layer where this codebase already places comparable rules.37- Use Eloquent relationships, form requests, policies, actions, services, events, or jobs when they improve this change or match local conventions—not as mandatory ceremony.38- Treat authorization and validation as explicit behavior at the system boundary.39- Preserve backwards compatibility unless the request requires a breaking change.40- Keep migrations reversible and safe for the application's supported database engines.4142Create factories, seeders, fixtures, or a disposable command only when realistic data is needed for development or durable test coverage. Do not leave one-off scaffolding in the product solely to exercise a small change.4344## Verify Proportionately4546Discover the project's supported commands from its configuration and documentation. Prefer this order:47481. Run the narrowest affected test or reproduce the original failure.492. Run the relevant feature, unit, or integration test group.503. Run static analysis, formatting, and linting configured by the repository.514. Run the broader suite when the change's reach or project policy warrants it.5253Cover the critical observable behavior, including the happy path and whichever edge cases, validation rules, permissions, database effects, events, notifications, jobs, or API contracts are actually affected. Avoid tests that only mirror implementation details.5455Common commands may include:5657```bash58php artisan test --filter=RelevantTest59vendor/bin/pest --filter=RelevantTest60vendor/bin/phpstan analyse61vendor/bin/pint --dirty62```6364Use the commands the project provides; do not install or configure tools merely because they appear in this example.6566## Preserve the User's Environment6768- Keep the change inside the requested application behavior and preserve unrelated working-tree changes.69- Do not run destructive database operations, production commands, deployments, credential changes, or external account actions unless the user or repository instructions explicitly place them in scope.70- Avoid exposing secrets in commands, logs, test output, or completion evidence.71- Prefer local, reversible verification and narrowly targeted data changes.7273## Completion Evidence7475Before handing off, verify each acceptance criterion against current behavior. Report:7677- what changed and why it fixes or implements the requested behavior;78- the scenarios and important edge cases covered;79- the exact checks run and their results;80- any check that could not run, with the concrete reason and remaining risk.8182Do not claim completion from code inspection alone when executable verification is available.