一键导入
laravel-conventions
Personal Laravel conventions enforced when creating, modifying, or planning code that will touch code utilizing the Laravel framework.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Personal Laravel conventions enforced when creating, modifying, or planning code that will touch code utilizing the Laravel framework.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | laravel-conventions |
| description | Personal Laravel conventions enforced when creating, modifying, or planning code that will touch code utilizing the Laravel framework. |
These are non-negotiable personal conventions unless explicitly overridden by the user.
No model observers, ever — Never use Laravel model observers or listen for Eloquent model events (creating, saved, etc.). Dispatch explicit domain events instead. This is non-negotiable. If they already exist for a given model, mention it to the user, but keep building.
If you are adding timestamps with millisecond precision, make sure that you write a $dateFormat on the model or in the cast. Otherwise, the precision is silently discarded on DB writes.
Always set the $table value. This avoids Laravel having to compute the table name every time it's needed.
Use Context@scope() liberally if important contextual data exists in a parent but not within the children, and the children are writing logs. This allows for maintaining contextual information inside of function calls without needing to pass that data to child functions.
Context::scope(function() use ($user) {
Context::add('user', $user->id);
$this->somePrivateMethod($user);
// ...
});
Prefer new Collection() over collect(). This reduces both a stack frame and indirection.
Using tap() is rarely the right call for readability.
Prefer CarbonImmutable::now() over now().
Prefer dependency injection to using facades. For large projects, test suite time is always a concern, and using facades disallow writing pure PHPUnit tests.
Use Model::factory()->make() (or new Model(['property_1' => 'some-value'])) whenever possible. Database writes are often unnecessary inside of tests.
Personal PHP conventions enforced when creating or modifying PHP files. Covers strict types, function imports, testing philosophy, class design, and observability. Activate whenever working on PHP code.
Review code changes through multiple AI models before sending to human reviewers. Use when the user asks to review a branch with sub-agents, run a multi-model code review, get AI review feedback, or mentions "review my branch," "sub-agent review," or "iterate on the code."
Plan complex refactors and architectural changes by drafting a proposal and iterating through review rounds with multiple AI models via agentic CLIs (Cursor Agent, Claude Code, OpenAI Codex). Use when the user asks to plan a change with sub-agents, run a multi-model review, get consensus from different models, or mentions "planning session," "sub-agent review," or "iterate with models."
Personal conventions for planning software changes. Covers planning doc structure, failure scenario analysis, refactoring sequencing, observability planning, and multi-model review. Activate when planning features, writing design docs, or scoping technical work.