---
name: "astro-view-transitions-morph"
description: "Create app-like SPA page transitions and shared element persistence using Astro View Transitions."
metadata:
  author: "Astro"
  version: "1.0.0"
  runtime_compatibility:
    - "codex"
    - "claude-code"
    - "cursor"
    - "windsurf"
triggers:
  - "enable astro view transitions"
  - "transition:name shared element"
  - "transition:persist audio player"
permissions:
  fs_read: true
  fs_write: "workspace"
  shell_exec: false
  net_access: false
---

# Astro View Transitions & Shared Element Morphing

Configures Astro <ViewTransitions />: enabling seamless MPA transitions, persistent islands (transition:persist), custom CSS animation morphs (transition:name), and fallback support for unsupported browsers.

## When to Invoke
Invoke this skill whenever you need to:
- enable astro view transitions
- transition:name shared element
- transition:persist audio player

## Execution SOP & Rules
1. Import { ViewTransitions } from 'astro:transitions' and place in <head> of root layout.
2. Assign identical transition:name='hero-img-${slug}' to elements on both listing and detail pages.
3. Add transition:persist on interactive stateful components to prevent re-initialization during navigation.
4. Listen to astro:page-load and astro:before-swap events for custom navigation logic.

## 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.
