---
name: "astro-island-architecture-hydration"
description: "Deliver 0kB JavaScript by default and selectively hydrate interactive UI components with islands."
metadata:
  author: "Astro"
  version: "1.0.0"
  runtime_compatibility:
    - "codex"
    - "claude-code"
    - "cursor"
    - "windsurf"
triggers:
  - "astro client directives"
  - "client:visible vs client:load"
  - "embed react in astro"
permissions:
  fs_read: true
  fs_write: "workspace"
  shell_exec: false
  net_access: false
---

# Astro Islands Architecture & Partial Hydration Directives

Implements Astro Island Architecture: embedding React, Vue, and Svelte components into Astro pages, configuring client hydration directives (client:load, client:idle, client:visible, client:media), and minimizing JS payloads.

## When to Invoke
Invoke this skill whenever you need to:
- astro client directives
- client:visible vs client:load
- embed react in astro

## Execution SOP & Rules
1. Default components render to pure HTML/CSS with 0kB client JavaScript.
2. Use client:load for critical above-the-fold interactive components (e.g. navigation menus).
3. Use client:visible for below-the-fold widgets to drastically boost Lighthouse performance scores.
4. Share client state across islands using lightweight nanostores (@nanostores/react / @nanostores/vue).

## Verification Checklist
- Run local linting, syntax validation, and type-checks before reporting completion.
- Ensure all created or modified files adhere to workspace boundaries and avoid uncommitted secrets.
- Verify tests or build commands exit cleanly with return code 0.
