Livewire

From event4u-app/agent-config · View interactive version

Livewire is an AI agent skill from the GitHub repository event4u-app/agent-config. Use when the project's frontend stack is Livewire — dispatched by `directives/ui/{apply,review,polish}.ts`. Covers reactive state, events, lifecycle hooks, and component/view separation.

How to use this skill

Skill file

livewire

Grounded stack guidance: pull idiomatic Blade/UI Do/Don't + docs URLs

via `node <skills-root>/corpus-grounding/scripts/ground.mjs search

--manifest <skills-root>/design-intelligence/data/manifest.json

--stack laravel "<topic>"` (UI-scoped corpus). See

CODE0.

Positioning — dispatched, not standalone

livewire is the apply-step executor for the Livewire stack. It is

invoked by CODE0

once the design brief is locked, and revisited by review.ts /

polish.ts during the design-review loop. It does not own the

flow, does not drive the audit, and does not lock the design.

| Concern | Owner |

|---|---|

| Audit + token inventory (mandatory pre-step) | CODE0 |

| Design brief (layout / states / microcopy) | CODE0 |

| Universal design heuristics | CODE0 |

| Static Blade partials inside the view | CODE0 |

| Flux primitives inside the view | CODE0 |

When to use

Cite this skill when:

Do NOT use when:

Procedure: Create a Livewire component

Step 0: Inspect

  1. Detect Livewire version — composer.json for livewire/livewire.
  1. Check existing components — app/Livewire/ or app/Http/Livewire/.
  2. Check views — resources/views/livewire/.
  3. Control roles. For every control you add, look up its role in the control_roles of agent-config ui:audit (re-run it when the artifact is older than your last UI edit): use the canonical implementation and the siblings' box metrics. Role missing or tied → ask before inventing a control kind; a native control beside an existing primitive needs a stated native_control_reason.

Step 1: Create component class

  1. declare(strict_types=1), final class.
  2. Typed public properties for state — keep minimal.
  3. #[Locked] for tamper-proof properties.
  4. #[Url] for URL-synced properties.

Step 2: Implement actions

  1. Public methods callable from frontend.
  2. Validate before processing: $this->validate().
  3. $this->dispatch() for cross-component communication (v3).

Step 3: Create view

  1. One root element (<div>).
  2. wire:key on dynamic lists.
  3. wire:loading for user feedback.
  4. wire:model.live for real-time updates (v3 default is deferred).

Step 4: Test

Conventions

→ See guideline php/livewire.md for state management, forms, performance, Alpine.js, templates.

Output format

  1. Livewire component class with typed properties and actions
  2. Blade view with wire: bindings and Flux components

Review pass — a11y findings + preview envelope

When this skill is dispatched by directives/ui/review.ts (test slot)

or directives/ui/polish.ts (verify slot) — i.e. a review/polish run,

not the initial apply — it also emits:

severity_floor?, accepted_violations?}. Use the same (rule, selector)`

shape as state.ui_audit.a11y_baseline so the engine's de-dup matches

pre-existing entries on replay. Omit the envelope on apply passes; the

engine's _apply_a11y_gate only fires when a baseline is present.

dom_dump_path?, error?, skipped?}. render_ok: false with error`

populated triggers the preview_render_failed halt; render_ok: true

with screenshot_path threads the screenshot into the delivery

report's artifacts list. Browser tooling (Playwright/Cypress/…) is

a consumer-project dependency — this package does not ship one.

Polish dispatch: when the dispatcher skips review because a previous

review pass already returned SUCCESS, this skill MUST itself

synthesise the updated state.ui_review.findings (including any

remaining a11y_violation entries) so the engine's gate sees the

current state on the next polish round.

Gotcha

Do NOT

Anti-slop

When a Livewire component renders UI, pull

CODE0

for the Visual / Layout / Motion checks (loading states that animate layout

properties — M2 — are a common Livewire wire:loading pitfall). Stack styling

bans: CODE0.

Auto-trigger keywords

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.