agentleFS
soden46soden46/syarif-laravel-ai-skills/skills/livewire-development/SKILL.md

livewire-development

Skill4 starsChanged 5 months agoMITView on GitHub

Build, refactor, secure, optimize, and test Laravel Livewire v2-v4 components, including state, forms, events, uploads, pagination, Alpine, and v4 formats.

2 other projects use a version of this.

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

30 rules. About 0 are common, 21 are distinctive, and 9 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈21

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 9

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use this skill for Laravel Livewire implementation, refactoring, debugging, security review, performance work, and tests.

    line 11
  2. Very specific:

    When the Livewire work is primarily UI/UX design, visual browser iteration, frontend flow shaping, or backend contract alignment, also use …

    line 15
  3. Very specific:

    Read composer.json and composer.lock or run composer show livewire/livewire to confirm the installed major version.

    line 19
  4. Distinctive:

    Follow the project's Blade, Alpine, Tailwind, Flux, Filament, and testing conventions when present.

    line 22
  5. Distinctive:

    Use documentation for the installed major version.

    line 23
  6. Distinctive:

    Read references/livewire-4.md when the project uses Livewire v4 or the task involves v4 migration, component formats, directives, …

    line 25
  7. Distinctive:

    Add validation and authorization before persistence or external side effects.

    line 32
  8. Distinctive:

    Test validation, authorization, persistence, events, redirects, and browser-only behavior at the appropriate level.

    line 35
  9. Distinctive:

    call an Action or Service.

    line 43
  10. Distinctive:

    keep secrets, unbounded collections, or large serialized graphs in public state.

    line 52
  11. Distinctive:

    Treat every public property and action parameter as untrusted client input.

    line 58
  12. Distinctive:

    Prefer model binding or explicit model lookup followed by a Policy check.

    line 60
  13. Very specific:

    Use #[Locked] only where supported to prevent client mutation of identifiers, but keep authorization because locking is not access control.

    line 61
  14. Very specific:

    Keep helper methods protected or private when they must not be callable as component actions.

    line 62
  15. Distinctive:

    Read references/testing-and-security.md for a secure action pattern, testing matrix, and browser-test boundaries.

    line 66
  16. Distinctive:

    Use Livewire validation for component-local forms.

    line 70
  17. Distinctive:

    Use Form objects when a form has substantial state or rules.

    line 71
  18. Very specific:

    Use plain wire:model when synchronization on the next action is sufficient.

    line 73
  19. Very specific:

    Use .live, .blur, .change, debounce, or throttle deliberately.

    line 74
  20. Very specific:

    Keep render() and computed properties free of hidden repeated or unbounded queries.

    line 82
  21. Very specific:

    Add stable wire:key values to repeated components and dynamic list items.

    line 84
  22. Very specific:

    Prefer the project's existing loading-state pattern.

    line 87
  23. Distinctive:

    Prefer direct props and actions for parent-child relationships.

    line 91
  24. Distinctive:

    Keep event names local, intention-revealing, and payloads small.

    line 92
  25. Distinctive:

    Use reactive/modelable props only when the installed version supports them and the parent-child synchronization is necessary.

    line 93
  26. Distinctive:

    Use Alpine for truly client-local state such as disclosure, focus, or transitions.

    line 94
  27. Distinctive:

    Use Livewire JavaScript hooks or component scripts for browser APIs and third-party widgets.

    line 95
  28. Distinctive:

    Use browser tests for focus management, modals, uploads, previews, drag/drop, navigation, and third-party JavaScript integration.

    line 96
  29. Distinctive:

    Test the smallest behavior that proves the risk:

    line 100
  30. Distinctive:

    Use factories and Laravel fakes for files, queues, notifications, mail, and HTTP integrations.

    line 109

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

Livewire Development

Use this skill for Laravel Livewire implementation, refactoring, debugging, security review, performance work, and tests.

This is the canonical Livewire skill in this repository. It consolidates the former livewire-patterns guidance and the public laravel-livewire topic into one version-aware workflow.

When the Livewire work is primarily UI/UX design, visual browser iteration, frontend flow shaping, or backend contract alignment, also use ui-agent-browser. Use e2e-playwright when browser behavior needs durable Playwright coverage.

Detect The Project First

  1. Read composer.json and composer.lock or run composer show livewire/livewire to confirm the installed major version.
  2. Inspect existing components, routes, tests, layouts, and config/livewire.php before choosing syntax.
  3. Detect whether the project uses class-based components, Volt, Livewire v4 single-file components, multi-file components, or a mixture maintained for compatibility.
  4. Follow the project's Blade, Alpine, Tailwind, Flux, Filament, and testing conventions when present.
  5. Use documentation for the installed major version. Do not introduce v4-only attributes, directives, component paths, or routing into v2/v3 projects.

Read references/livewire-4.md when the project uses Livewire v4 or the task involves v4 migration, component formats, directives, attributes, or routing.

Implementation Workflow

  1. Define one interactive surface and its user-visible states.
  2. Choose the component format already used by the project; change formats only for a concrete maintenance benefit.
  3. Model the smallest public state needed by the template.
  4. Add validation and authorization before persistence or external side effects.
  5. Delegate reusable domain workflows to Actions or Services.
  6. Shape queries deliberately, add loading and error feedback, and keep DOM identity stable.
  7. Test validation, authorization, persistence, events, redirects, and browser-only behavior at the appropriate level.

Component Boundaries

A component may:

  • hold UI and request-shaped state;
  • validate input and authorize actions;
  • call an Action or Service;
  • dispatch focused events;
  • coordinate rendering, pagination, uploads, and browser feedback.

A component should not:

  • contain long multi-model workflows;
  • build provider payloads inline;
  • duplicate model-state authorization that belongs in Policies;
  • keep secrets, unbounded collections, or large serialized graphs in public state;
  • perform slow external calls during rendering;
  • bypass a transaction for atomic writes.

State And Security

  • Treat every public property and action parameter as untrusted client input.
  • Validate input and authorize the resolved model or operation inside every mutating action.
  • Prefer model binding or explicit model lookup followed by a Policy check; never trust a submitted identifier by itself.
  • Use #[Locked] only where supported to prevent client mutation of identifiers, but keep authorization because locking is not access control.
  • Keep helper methods protected or private when they must not be callable as component actions.
  • Store secrets and service credentials in configuration or injected services, never component state.
  • Restrict mass-assignment payloads to validated, explicitly selected fields.

Read references/testing-and-security.md for a secure action pattern, testing matrix, and browser-test boundaries.

Forms And Data Binding

  • Use Livewire validation for component-local forms.
  • Use Form objects when a form has substantial state or rules; move reusable domain rules to shared rule objects or services.
  • Normalize localized numbers, dates, booleans, and text before applying validation rules.
  • Use plain wire:model when synchronization on the next action is sufficient.
  • Use .live, .blur, .change, debounce, or throttle deliberately; avoid extra requests without a UX requirement.
  • Reset or pull state after successful submission when the interaction should return to a clean form.
  • Show field-level errors and disable or style in-flight actions to prevent accidental duplicate submissions.

Queries, Rendering, And Performance

  • Eager load relationships used by the view and select only required columns on hot paths.
  • Paginate lists instead of storing unbounded Eloquent collections in public properties.
  • Keep render() and computed properties free of hidden repeated or unbounded queries.
  • Cache computed results across requests only when keys, authorization scope, invalidation, and staleness are understood.
  • Add stable wire:key values to repeated components and dynamic list items.
  • Re-key dependent controls when their available options depend on another field.
  • Lazy-load below-the-fold or expensive components only when the installed Livewire version supports the chosen API.
  • Prefer the project's existing loading-state pattern; Livewire v4 can style automatic data-loading attributes, while wire:loading remains useful for targeted visibility.

Events, Nesting, And JavaScript

  • Prefer direct props and actions for parent-child relationships; use events for decoupled UI coordination.
  • Keep event names local, intention-revealing, and payloads small.
  • Use reactive/modelable props only when the installed version supports them and the parent-child synchronization is necessary.
  • Use Alpine for truly client-local state such as disclosure, focus, or transitions.
  • Use Livewire JavaScript hooks or component scripts for browser APIs and third-party widgets; isolate initialization and cleanup so DOM morphing does not duplicate handlers.
  • Use browser tests for focus management, modals, uploads, previews, drag/drop, navigation, and third-party JavaScript integration.

Testing And Handoff

Test the smallest behavior that proves the risk:

  • component rendering and initial state;
  • validation failures and normalized input;
  • authorization denial for properties and action parameters;
  • successful database changes and transaction boundaries;
  • dispatched events, redirects, pagination, uploads, and query-string state;
  • loading, focus, modal, navigation, and JavaScript behavior in a browser test when component tests cannot prove it.

Use factories and Laravel fakes for files, queues, notifications, mail, and HTTP integrations. Run targeted tests, formatting, static analysis, and frontend checks supported by the project before handoff.

Related Skills

  • actions-and-services for reusable workflows and integrations.
  • database-transactions for atomic multi-write actions.
  • filesystem-uploads for storage and file lifecycle rules.
  • policies-and-authorization for model access decisions.
  • ui-agent-browser for stack-aware UI/UX implementation and browser inspection.
  • e2e-playwright for durable browser workflow coverage.
  • responsive-ui-testing for viewport and browser-state coverage.
  • testing for test selection and handoff verification.

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.