agentleFS
rcdelfinrcdelfin/agentkit/skills/software-development/spatie-laravel-php/SKILL.md

spatie-laravel-php

Skill2 starsChanged 3 months agoMITView on GitHub

Use when writing, editing, reviewing, or formatting Laravel, PHP, Blade, routes, migrations, validation, or tests using Spatie conventions.

2 other projects use a version of this, 2 of them edited.

Adopted by

Most recently taken up by

The file

Show its rules and text

We split this skill into the rules it gives an agent

24 rules. About 0 are common, 13 are distinctive, and 11 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈13

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 11

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Read references/spatie-laravel-php-guidelines.md and focus on the relevant sections.

    line 29
  2. Distinctive:

    If a rule conflicts with existing project conventions, follow Laravel conventions and keep changes consistent.

    line 31
  3. Distinctive:

    Follow Laravel conventions first.

    line 35
  4. Distinctive:

    Follow PSR-1, PSR-2, and PSR-12.

    line 36
  5. Very specific:

    Prefer typed properties and explicit return types (including void).

    line 37
  6. Very specific:

    Use short nullable syntax like ?string.

    line 38
  7. Distinctive:

    Use constructor property promotion when all properties can be promoted.

    line 39
  8. Very specific:

    Prefer early returns and avoid else when possible.

    line 41
  9. Distinctive:

    Always use curly braces for control structures.

    line 42
  10. Distinctive:

    Use string interpolation over concatenation.

    line 43
  11. Distinctive:

    Use kebab-case URLs, camelCase route names, and camelCase route parameters.

    line 50
  12. Very specific:

    Use tuple notation for routes: [Controller::class, 'method'].

    line 51
  13. Very specific:

    Use plural resource names for controllers (PostsController).

    line 52
  14. Distinctive:

    Use array notation for validation rules.

    line 53
  15. Very specific:

    Use config() helper and avoid env() outside config files.

    line 54
  16. Very specific:

    Add service configs to config/services.php, not new files.

    line 55
  17. Very specific:

    Use __() for translations instead of @lang.

    line 56
  18. Distinctive:

    Use PascalCase for enum values.

    line 57
  19. Distinctive:

    Add docblocks when full type hints already exist.

    line 61
  20. Distinctive:

    Use fully qualified classnames in docblocks.

    line 62
  21. Very specific:

    Use final or readonly by default.

    line 63
  22. Very specific:

    Use else when early returns work.

    line 64
  23. Distinctive:

    Add spaces after Blade control structures.

    line 65
  24. Distinctive:

    Write down methods in migrations, only up methods.

    line 66

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Spatie Laravel & PHP Guidelines

Overview

Apply Spatie's Laravel and PHP guidelines to keep code style consistent and Laravel-native.

When to Activate

  • Activate this skill for any Laravel or PHP coding work, even if the user does not explicitly mention Spatie.
  • Activate this skill when asked to generate, edit, format, refactor, review, or align Laravel/PHP code.
  • Activate this skill when working on .php or .blade.php files, routes, controllers, models, config, validation, migrations, or tests.

Scope

  • In scope: .php, .blade.php, Laravel conventions (routes, controllers, config, validation, migrations, tests).
  • Out of scope: JS/TS, CSS, infrastructure, database schema design, non-Laravel frameworks.

Workflow

  1. Identify the artifact (controller, route, config, model, Blade, test, etc.).
  2. Read references/spatie-laravel-php-guidelines.md and focus on the relevant sections.
  3. Apply the core Laravel principle first, then PHP standards, then section-specific rules.
  4. If a rule conflicts with existing project conventions, follow Laravel conventions and keep changes consistent.

Core Rules (Summary)

  • Follow Laravel conventions first.
  • Follow PSR-1, PSR-2, and PSR-12.
  • Prefer typed properties and explicit return types (including void).
  • Use short nullable syntax like ?string.
  • Use constructor property promotion when all properties can be promoted.
  • One trait per line with separate use statements.
  • Prefer early returns and avoid else when possible.
  • Always use curly braces for control structures.
  • Use string interpolation over concatenation.
  • Happy path last: handle error conditions first.

Do and Don't

Do:

  • Use kebab-case URLs, camelCase route names, and camelCase route parameters.
  • Use tuple notation for routes: [Controller::class, 'method'].
  • Use plural resource names for controllers (PostsController).
  • Use array notation for validation rules.
  • Use config() helper and avoid env() outside config files.
  • Add service configs to config/services.php, not new files.
  • Use __() for translations instead of @lang.
  • Use PascalCase for enum values.

Don't:

  • Add docblocks when full type hints already exist.
  • Use fully qualified classnames in docblocks.
  • Use final or readonly by default.
  • Use else when early returns work.
  • Add spaces after Blade control structures.
  • Write down methods in migrations, only up methods.

Examples

// Happy path last with early returns
if (! $user) {
    return null;
}

if (! $user->isActive()) {
    return null;
}

// Process active user...

// Short ternary
$name = $isFoo ? 'foo' : 'bar';

// Constructor property promotion
class MyClass {
    public function __construct(
        protected string $firstArgument,
        protected string $secondArgument,
    ) {}
}
@if($condition)
    Something
@endif

References

  • references/spatie-laravel-php-guidelines.md

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.