Token导航 LogoToken导航TokenDH.com
开发规范需要联网github未标认证来源可访问clear审计通过

laravel-best-practicesLaravel 最佳实践

Agent Skill

laravel-best-practices 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

214

周安装

9

GitHub Stars

1

下载量

75
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

3

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:laravel-best-practices(Laravel 最佳实践)
来源仓库:https://github.com/masterfermin02/laravel-agent-skill
仓库路径:skills/laravel-best-practices
安装命令:
npx skills add https://github.com/masterfermin02/laravel-agent-skill --skill laravel-best-practices
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/masterfermin02/laravel-agent-skill --skill laravel-best-practices

简介

laravel-best-practices 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息。

  • 适合在 Codex、Claude、Cursor、Gemini CLI 中围绕仓库状态、代码变更或协作事项进行整理时使用。
  • 通过 npx skills add 命令从指定 GitHub 仓库安装,需确认权限和维护状态。
  • 使用前建议核实是否会触发联网、命令执行或文件读写操作。
  • 适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

SKILL.md

Purpose

This skill guides an AI coding agent to:

  1. generate Laravel code aligned with established best practices,
  2. review Laravel code (or diffs) and propose refactors aligned to those practices,
  3. propose and scaffold tests (Pest preferred; PHPUnit supported).

Use when

  • Implementing or refactoring controllers, FormRequests, service/action classes, jobs, events/listeners, policies, observers
  • Reviewing PRs, diffs, or entire files in a Laravel application
  • Designing maintainable application layering and test strategy
  • Working on Inertia + React or Inertia + Vue frontends within a Laravel project

Rulebook

Use references/rulebook.json as the source of truth for:

  • rule ids
  • detection signals
  • recommended refactor patterns
  • expected outputs

When you flag an issue, always include:

  • rule_id
  • evidence (file + line numbers or excerpt)
  • minimal refactor steps first
  • test impact plan

Core principles (high-level)

  • Single Responsibility: one reason to change per class; one main concern per method.
  • Thin controllers: controllers orchestrate; business logic lives elsewhere.
  • Validation in FormRequests: move validation and authorization there.
  • Business logic in services/actions: extract workflows into testable units.
  • DRY: centralize repeated logic (Eloquent scopes, value objects/DTOs, helpers).
  • Prefer Eloquent + Collections: use expressive domain modeling where practical.
  • No queries in Blade: views must not query the database; eager load to avoid N+1.
  • Chunk/stream large datasets: avoid loading large tables into memory.
  • Policies for authorization: use Policy classes per model; keep authorize() calls in the HTTP layer, never inside services.
  • No env() outside config files: access environment values via config() throughout the app; env() only in config/*.php.
  • Follow naming conventions: singular PascalCase models and controllers, camelCase methods, snake_case config/migration keys, kebab-case route slugs.

Frontend / Inertia principles

Inertia + React

When reviewing or generating Inertia React code, apply rules INRT-001INRT-010 from the rulebook. See references/inertia-react-summary.md for a quick-reference cheat sheet, or references/inertia-react.md for the full annotated directory structure and examples.

  • Directory structure: common (shared primitives), modules (feature code), pages (Inertia-rendered), shadcn (generated components).
  • Page components: suffix with Page, use a default export (e.g. PostsIndexPage.tsx).
  • Component files: one component per .tsx file, PascalCase filenames, function declarations.
  • Type page props: define a TypeScript interface per page; use usePage<SharedProps>() for globally shared data.
  • Form submissions: use useForm from @inertiajs/react; avoid raw fetch/axios for Inertia-driven forms.
  • Shared data: access via usePage() rather than prop-drilling auth/flash data through every component layer.
  • Internal navigation: use <Link> from @inertiajs/react; reserve plain <a> tags for external URLs.
  • Partial reloads: use router.reload({only: [...]}) to refresh a subset of props instead of a full page visit.

Inertia + Vue

When reviewing or generating Inertia Vue code, apply rules INRT-VUE-001INRT-VUE-005 from the rulebook. See references/inertia-vue.md for the annotated directory structure and conventions.

  • Directory structure: common (shared UI primitives), modules (feature code), pages (Inertia-rendered), lib (third-party/generated).
  • Page components: suffix with Page, use <script setup> or export default (e.g. PostsIndexPage.vue).
  • Component files: one component per .vue file, PascalCase filenames, prefer <script setup> + Composition API.
  • Third-party UI: keep in resources/js/lib; wrap in common for a project-friendly API — don't modify sources directly.

Workflow: Review

When asked to review code:

  1. Identify the layer (Controller, Request, Model, Service/Action, Blade, etc.).
  2. Apply rules from rulebook.json; emit findings with rule ids.
  3. Provide a patch outline (what files to create/change) and a test plan.

Recommended output (JSON)

Return a JSON object:

  • summary: score, counts
  • findings[]: rule_id, severity, evidence, rationale, recommendations, patch outline
  • tests: a short matrix or list of impacted tests

Workflow: Generate code

When asked to implement a feature:

  1. Propose file layout first (Controller + FormRequest + Service/Action + Model scopes, etc.).
  2. Generate code using Laravel idioms: dependency injection, FormRequests, policies, resources.
  3. Include a minimal test plan (Feature + Unit tests).

Workflow: Generate tests

Prefer Pest if repository uses Pest (presence of pestphp/pest in composer.json); otherwise PHPUnit.

  • FormRequest validation/authorization
  • Service/action business rules (unit)
  • Feature tests for endpoints (happy path + validation + authz)
  • Mock external systems (HTTP, queues, notifications) as needed

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

04

需要参考平台分布和安装热度时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

能力 5

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Claude Code

75.22%
按下载量换算56

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。

来源信息

继续浏览同类 Skills