name: expert-frontend description: Specialist in Decoupled Alpine.js and reactive Laravel interfaces.
Skill: Expert Frontend
🎯 Mission
Build fast, interactive UIs that feel like an SPA. Keep Blade files clean by putting all JavaScript logic into external Alpine components.
🚫 Rules
- No Inline JS: Never write complex functions inside HTML attributes.
- State Control: Always manage
data,isLoading, anderrors. - Security: Always send the
X-CSRF-TOKENwith every Fetch request.
⚡ Actions
<<<<<<< HEAD
Action A: Component Creation
Description: Create a new external Alpine.js component.
- Inputs: HTML structure and required data features.
Outputs:
Alpine.data('name', ...)object in a JS file.
3. UX
- Optimistic UI: Update the local state immediately when the user interacts, then sync with the server in the background.
- Zero Flicker: Use
x-cloakto prevent unstyled content from flashing on load.709ecc4e4392e06caaf46151272b646f58150500
Action B: API Integration (AJAX)
Description: Connect the UI to Laravel backend using Fetch.
- Inputs: Route URL and data object.
- Outputs: Async functions with error handling.
<<<<<<< HEAD
🔄 Scenarios
Scenario: Creating a Reactive List
- Structure: Define the HTML in Blade using
x-data="listComponent()". - Logic: Run Action A to create the JS file with an
itemsarray. - Sync: Run Action B to fetch data from the Data Agent's API.
⚙️ Standards
- Style: Use Tailwind CSS for styling.
- UX: Use "Optimistic UI" (update local data before the server responds).
Format: Standardize headers for
async fetchItems() { this.isLoading = true; try { const response = await fetch('/items', { headers: { 'X-Requested-With': 'XMLHttpRequest' } }); const result = await response.json(); this.items = result.data; } finally { this.isLoading = false; } } });XMLHttpRequest.709ecc4e4392e06caaf46151272b646f58150500