php-laravel
Skill43 starsChanged 2 months agoMITView on GitHub
Modern PHP 8.4 and Laravel patterns: architecture, Eloquent, migrations, queues, testing. Use when working with Laravel, Eloquent, Blade, artisan, or building/testing a framework-based PHP app. Not for php-src internals, standalone PHP libraries, or general PHP language discussion.
In this repository28 other files it gives its agents.
- agent-native-architectureSkill
- brainstormingSkill
- code-reviewSkill
- cpp-systemsSkill
- c-systemsSkill
- debuggingSkill
- document-reviewSkill
- frontend-designSkill
- git-worktreeSkill
- linux-bash-scriptingSkill
- md-docsSkill
- meta-promptingSkill
- nodejs-backendSkill
- orchestrating-swarmsSkill
- pinescriptSkill
- planningSkill
- postgresqlSkill
- python-servicesSkill
- react-frontendSkill
- receiving-code-reviewSkill
- reflectSkill
- rust-systemsSkill
- simplifying-codeSkill
- terraformSkill
- test-auditSkill
- verification-before-completionSkill
- writingSkill
- writing-testsSkill
The file
We split this skill into the rules it gives an agent
8 rules. About 0 are common, 6 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 18
Keep simple CRUD simple; extract cross-model orchestration only when it has a concrete use.
- Distinctive: line 21
Verify cache compilation, queue execution, and HTTP behavior through their real entrypoints when those paths change.
- Very specific: line 28
No single-letter variables: $exception not $e, $request not $r
- Distinctive: line 38
Only touch what's necessary.
- Distinctive: line 39
No hacky workarounds: if a fix feels wrong, step back and implement the clean solution
- Distinctive: line 41
No empty catch blocks: log or rethrow, never swallow
- Very specific: line 42
Verify before declaring done: ./vendor/bin/phpstan analyse --level=8 && ./vendor/bin/phpunit with zero warnings
- Distinctive: line 59
Read the relevant reference before implementing or reviewing the matching behavior:
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
PHP & Laravel Development
Scoped to framework-level PHP. Work on php-src internals or a native PHP extension is C, not PHP: the ia-c-systems skill covers it, including the Zend API conventions (gen_stub arginfo, the request-scoped allocator, custom object handlers, .phpt).
Working rules
- Keep simple CRUD simple; extract cross-model orchestration only when it has a concrete use.
- Validate and authorize at request boundaries; serialize through explicit resources and validate third-party responses.
- Preserve deployed migration history, queued payload compatibility, and concurrent writes.
- Verify cache compilation, queue execution, and HTTP behavior through their real entrypoints when those paths change.
Code Style
declare(strict_types=1)in every file- Happy path last: guards and errors first, success at the end. Early returns, no
else. - Comments explain why, never what. Never comment tests. If code needs a "what" comment, rename or restructure.
- No single-letter variables:
$exceptionnot$e,$requestnot$r ?stringnotstring|null. Always specifyvoid. Import classnames, never inline FQN.- Widening one parameter to
?Tobliges auditing every call site that forwards the same value: the sibling call still declaresstring, andnullthrows aTypeErrorthere even with nodeclare(strict_types=1), because coercive mode never coercesnullinto a scalar. Strictness is decided by the file the CALL is written in, never by the callee's file. Full mechanism in common-pitfalls.md. - Validation uses array notation
['required', 'email']for easier custom rule classes - PHPStan level 8+ (
phpstan analyse --level=8); aim for 9 on new projects.@phpstan-type/@phpstan-paramfor generic collection types. The missing-iterable-value-type check lands at level 6 (and every level above it), so any project at 8+ inherits it: use the generic form on every iterable (@return Collection<int, User>,@param array<int, MyObject>) and array-shape notationarray{first: SomeClass, second: SomeClass}for fixed-key returns; a bareCollectionorarraywill not clear it.
Discipline
- Simplicity first: every change as simple as possible, minimal code impact
- Only touch what's necessary; no unrelated changes
- No hacky workarounds: if a fix feels wrong, step back and implement the clean solution
- New abstraction requires 3+ usage sites; otherwise inline it
- No empty catch blocks: log or rethrow, never swallow
- Verify before declaring done:
./vendor/bin/phpstan analyse --level=8 && ./vendor/bin/phpunitwith zero warnings - Checkpoint per stage, not only at the end:
migrate:statusafter a migration,route:list --path=<prefix>after routing changes,queue:work --onceafter adding a job,pint --testbefore the PR. Each catches its failure class while the change is small
References
- laravel-ecosystem.md: Notifications, Task Scheduling, Custom Casts
- testing.md: PHPUnit essentials, data providers, running tests
- feature-testing.md: Auth, validation, API, console, DB assertions
- mocking-and-faking.md: Facade fakes, action mocking, Mockery
- factories.md: States, relationships, sequences, afterCreating hooks
- production-performance.md: OPcache, JIT, preloading, deploy caches
- common-pitfalls.md: event-layer bypasses, FK cascades, pivot writes, resource and request-shape traps
- pitfalls-deep.md: afterCommit alternatives, observer desync, jsonb race, savepoints, validation-rule internals
Task-specific references
Read the relevant reference before implementing or reviewing the matching behavior:
- For PHP features, controller/action design, routing, resources, or external APIs: framework-patterns.md.
- For migrations, Eloquent writes, casts, queues, job payloads, or production startup: persistence-and-jobs.md.
- For PHPUnit work or changes affecting events, serialization, validation, or lifecycle behavior: testing-and-pitfalls.md.
Existing specialized references, when the corresponding topic applies:
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

