spatie-guidelines

Applies Spatie's PHP, Laravel, JavaScript, and Vue coding conventions when writing or reviewing code.

999|201|Updated May 6, 2014
One-click install
npx skills add https://github.com/freekmurze/dotfiles --skill spatie-guidelines
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: spatie-guidelines
Source: https://github.com/freekmurze/dotfiles/tree/main/config/claude/skills/spatie-guidelines
Command: npx skills add https://github.com/freekmurze/dotfiles --skill spatie-guidelines

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

When writing or reviewing code for Spatie projects and packages, developers need to consistently apply Spatie's specific coding standards across PHP, Laravel, JavaScript, and Vue. This Skill encodes those conventions so code reviews and new code follow the same rules without memorizing the full guidelines.

Core Features & Use Cases

  • PHP and Laravel style enforcement: Covers type declarations, docblocks, control flow (happy path last, avoid else), naming conventions for controllers, jobs, events, and mailables, routing, validation, Blade, and migrations.
  • Package development guidance: Details Spatie package architecture including service providers with laravel-package-tools, contracts, config conventions, and Pest-based testing with Orchestra Testbench.
  • JavaScript and Vue style rules: Defines spacing, quotes, arrow functions, destructuring, and Vue template formatting aligned with eslint-config-spatie.
  • Use Case: When reviewing a pull request for a Spatie Laravel package, activate this Skill to check that validation rules use array notation, controllers stick to CRUD keywords, tests use Pest with descriptive names, and no private constants or down migrations were introduced.

Quick Start

Review this Laravel controller code and fix any violations of the Spatie coding guidelines.

Frequently Asked Questions about spatie-guidelines

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write code that follows Spatie Laravel guidelines?

Follow Laravel's documented defaults first, then apply Spatie specifics: type all properties and returns, use early returns instead of else, array notation for validation rules, kebab-case URLs and config files, and plural resource controllers limited to CRUD actions.

What testing framework do Spatie packages use?

Spatie packages use Pest with Orchestra Testbench for Laravel integration. Tests use descriptive names with the it() syntax, follow arrange-act-assert, never contain comments, and keep helper classes at the bottom of the test file or in tests/TestSupport.

How should validation rules be written in Spatie projects?

Always use array notation such as ['required', 'email'] instead of the pipe form 'required|email'. Array notation makes it easier to combine rules with custom rule classes, and custom rule names must use snake_case.

Does the Spatie style guide allow private constants in PHP?

No, private const is avoided. Constants used once are inlined or assigned to a descriptively named local variable, and constants used multiple times become private properties, or private static properties when used from static methods.

What are the branch naming rules for Spatie repositories?

Branches use lowercase letters and hyphens only, such as feature-mailchimp or fix-deliverycosts. Once a project is live, master must always be stable and changes arrive through feature branches, typically squash-merged.