agentleFS
dafaalzdafaalz/agent-skills/skills/laravel/SKILL.md

laravel

Skill2 starsChanged 53 days agoMITView on GitHub

Use when building, modifying, reviewing, testing, or debugging Laravel applications, Eloquent queries, Artisan commands, Blade or Livewire components, Inertia adapters, Form Requests, migrations, or queue jobs. Don't use for non-PHP stacks (author stack-specific code directly), static sites (use frontend-design), or plain WordPress themes (author WordPress theme code directly).

  • Reads credentials

14 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use wordpress and nextjs.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • iamandrewpetersSkill

    wordpress

    Use this skill when working on WordPress development tasks including plugins, themes, shortcodes, hooks, WP-CLI commands, multisite, custom post types, meta boxes, the REST API, or debugging WordPress issues.

    Also in 3 projects that use this

  • OpenAISkill

    nextjs

    Next.js App Router expert guidance. Use when building, debugging, or architecting Next.js applications — routing, Server Components, Server Actions, Cache Components, layouts, middleware/proxy, data fetching, rendering strategies, and deployment on Vercel.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

10 rules. 0 are common, 6 are distinctive, and 4 are very specific to this project.

  • 0

    Common

    Most of the 12 edited versions we read keep these.

  • 6

    Distinctive

    This author's own choices. Worth a look.

  • 4

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  • could be automatic: a setting could enforce it
  1. Very specific:

    Write-Target Boundary. Write only inside the Laravel application tree (app/, routes/, resources/, database/, tests/, config/).

    line 11
  2. Distinctive:

    Follow these four steps in sequence:

    line 26
  3. Distinctive:

    Check the Laravel version and PHP runtime:

    line 32
  4. Very specific:

    When search-docs is present, query it for version-specific documentation and package contracts.

    line 37
  5. Very specific:

    When search-docs is absent, inspect framework behavior with native Artisan commands in references/cli-introspection.md or read vendor …

    line 38
  6. Distinctive:

    Run automated verification commands before finishing work:

    line 75
  7. Distinctive:

    Check code style with Laravel Pint when installed in the repository:

    line 81
  8. Very specific:

    If vendor/bin/pint does not exist, record pint: absent in .agents/state/laravel/verification.txt and skip the style check.

    line 85
  9. Distinctive:

    Prefer native framework utilities over custom helper functions or external packages.

    line 93
  10. Distinctive:

    Keep vendor packages, generated migration timestamps, Composer lock files, and core Laravel framework files untouched.

    line 101

“Common” is measured: kept by at least 6 in 10 of the 12 edited versions of this file we could read. “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

Laravel

Deterministic, test-driven workflows for Laravel applications.

<HARD-GATE> Write-Target Boundary. Write only inside the Laravel application tree (`app/`, `routes/`, `resources/`, `database/`, `tests/`, `config/`). Never modify `vendor/`, `composer.lock`, generated migration timestamps, or framework core files. Never run `php artisan migrate` against non-local databases without explicit user approval recorded in `.agents/state/laravel/migrate-approval.md`. </HARD-GATE>

Overview

Build, refactor, and debug Laravel applications using native Artisan inspection and established repository conventions. Delegate architectural scoping to superpower skills, write tests before implementation, and verify changes with automated test suites and Pint formatting.

Modes

Select an execution mode before Step 1:

  • Feature mode (default). Follow test-driven development to build new routes, Eloquent models, and components.
  • Diagnostic mode. Inspect logs, reproduce exceptions with minimal scripts, and resolve failures without adding architectural scaffolding.

Workflow

Follow these four steps in sequence:

Step 1. Environment and runtime probe

Probe framework version, configuration, and database state before modifying application files:

  1. Check the Laravel version and PHP runtime:
    php artisan --version
  2. Detect the laravel/boost MCP server in available tools:
    • When search-docs is present, query it for version-specific documentation and package contracts.
    • When search-docs is absent, inspect framework behavior with native Artisan commands in references/cli-introspection.md or read vendor source directly.
  3. Inspect affected database tables and route definitions:
    php artisan model:show <ModelName>
    php artisan route:list --name=<routeName>

Completion criterion. Command output confirms Laravel version, runtime settings, affected database schemas, and route mappings.

Step 2. Convention mapping and reference selection

Audit sibling controllers, models, migrations, and test files for established project patterns. Match affected application layers to the reference index below:

ConcernReference guide
CLI introspection, runtime discovery, logsreferences/cli-introspection.md
Eloquent queries, N+1 prevention, migrations, castsreferences/eloquent-and-database.md
Controllers, Form Requests, route binding, resourcesreferences/routing-and-controllers.md
Pest and PHPUnit tests, HTTP assertions, service fakesreferences/testing-patterns.md
Authorization policies, SQL injection safety, mass assignmentreferences/security-and-hardening.md

Completion criterion. .agents/state/laravel/edit-plan.md exists on disk and lists every file to create or modify with its matching reference guide and section anchor.

Step 3. Implementation and boundary isolation

Apply minimal, isolated modifications using test-first development:

  1. For new features or bug fixes, coordinate with the testing-patterns skill to establish failing tests before writing production code.
  2. For error diagnosis, coordinate with the systematic-debugging skill to inspect storage/logs/laravel.log and verify reproducing steps first.
  3. Confine database queries to Eloquent models, repositories, or query scopes, and leave Blade templates, Inertia controllers, and JsonResource classes free of direct queries.
  4. Extract validation into Form Request classes and pass only $request->validated() into models.
  5. Eager load relationships using with() or loadMissing() to eliminate N+1 queries.

Completion criterion. Implementation passes input validation, eagerly loads database relations, keeps business logic separated from HTTP controllers, and records targeted test failure command in .agents/state/laravel/red-test.txt.

Step 4. Verification pass

Run automated verification commands before finishing work:

  1. Execute the narrowest relevant test suite:
    php artisan test --filter=<TestClassOrMethod>
  2. Check code style with Laravel Pint when installed in the repository:
    vendor/bin/pint --test
    If vendor/bin/pint does not exist, record pint: absent in .agents/state/laravel/verification.txt and skip the style check.
  3. Inspect the git diff of modified files. Confirm that input passes through validation, migrations declare explicit constraints, and queries load relationships eagerly.

Completion criterion. Targeted tests pass with exit code 0. If Pint is present, Pint reports zero style violations. If Pint is absent, .agents/state/laravel/verification.txt contains pint: absent and the test exit code.

Decision rules

  • Audit sibling files before introducing patterns. Consistent project conventions take precedence over alternate architectures.
  • Prefer native framework utilities over custom helper functions or external packages.
  • Pass raw SQL through parameterized bindings with positional placeholders.
  • Maintain CSRF protection, route middleware, and model authorization policies during tests. Fix test fixtures rather than disabling security middleware.
  • Store credentials and private keys in .env and config/ files, and never hardcode secrets in application code.

Boundary isolation

Confine framework modifications strictly to application architecture and test assertions:

  • Keep vendor packages, generated migration timestamps, Composer lock files, and core Laravel framework files untouched.
  • Preserve database column names, environment variable keys, and CLI command signatures in their exact schema formats.

Quick audit checklist

Review this table before completing Laravel tasks:

CheckPassing condition
Query confinementQueries confined to Eloquent models, scopes, or repositories
ValidationRequest input extracted via Form Requests and validated
N+1 preventionRelations eager-loaded via with() or loadMissing()
SecurityInput parameterized, policies enforced, zero hardcoded secrets
Code styleAutomated tests pass and Laravel Pint passes with zero violations

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.