PHP
These are the rules a reviewer checks first. The PHP skill and the Laravel skill are the full version, and AI agents follow them.
- Start every new file with
declare(strict_types=1);. - Type every parameter and return. The code must pass PHPStan level 8 without ignoring errors that a type fix would solve.
- Use constructor promotion and inject dependencies. Resolve from the container only in static factories.
- Always use braces for control structures. Prefer
matchover nested ternaries. - Prefer
Arr,StrandCollectionover hand written helpers. - Value objects and DTOs are immutable. Mark each promoted property
readonly. - Throw a domain exception for an expected failure. Do not return
nullto signal it. - Do not mark an Action
final. Use a/** @final */docblock so tests can spy on it. - Use a Strategy class for interchangeable behavior such as extraction. Do not add a new branch to a growing
if. - Never run host code during extraction. Read source through the AST modules.
- Do not call
env()outsideconfig/nimbus.php. - Add no abstraction for a single use case. Add no dependency without agreement.
- Use Laravel APIs and the existing
NimbusServiceProviderbefore you add a new layer. - Do not use another module's internals. See module boundaries.
- Let
composer style:fixformat the code. Do not format by hand.
One operation, one Action
A single operation is an Action with one public execute(). A Service wraps a set of operations around one third party or technical need. Pass plain typed parameters when the input has a few values. Add a DTO when the input has many fields or several callers. The create action skill has the details.
Controllers
A controller takes a Form Request, calls one Action and returns a resource. It holds no logic.