/astro:astro-view-transitionsfrom astro
Implements smooth page transitions and SPA-like navigation in Astro via ClientRouter, transition directives (name/animate/persist), data-astro-reload, and lifecycle events.
Ships in astro. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Patterns for smooth page transitions and SPA-like navigation in Astro.
Add the <ClientRouter /> component to your layout:
---
import { ClientRouter } from 'astro:transitions';
---
<html>
<head>
<ClientRouter />
</head>
<body><slot /></body>
</html>
Legacy (Astro 4):
ViewTransitionsis the pre-5.0 name for this same component; if you inherit a project still importing it, this skill's directives and lifecycle events apply unchanged.
With View Transitions enabled:
transition:name - Identify Elements<header transition:name="header">...</header>
<h1 transition:name={`title-${post.id}`}>{post.data.title}</h1>
transition:animate - Animation Type| Animation | Description |
|---|---|
fade | Crossfade (default) |
slide | Slide in from side |
none | No animation |
initial | Only animate on first load |
transition:persist - Keep Elements Across Navigations<audio transition:persist id="player">...</audio>
<Counter client:load transition:persist initialCount={0} />
data-astro-reloadUse data-astro-reload to force a full page reload on specific links. Use cases: language switching, theme changes, auth state changes.
<a href="/en" data-astro-reload>EN</a>
When implementing custom animations, persist patterns, or loading indicators, read
references/transition-patterns.mdfor complete examples with CSS keyframes and lifecycle events.
| Event | When |
|---|---|
astro:before-preparation | Navigation started |
astro:after-preparation | New page fetched |
astro:before-swap | Before DOM swap |
astro:after-swap | After DOM swap |
astro:page-load | Fully complete |
Use astro:page-load to re-initialize scripts after navigation.
View Transitions degrade gracefully to full page loads in unsupported browsers.
| Directive/Attribute | Purpose |
|---|---|
transition:name | Identify element for morphing |
transition:animate | Set animation type |
transition:persist | Keep element across navigations |
data-astro-reload | Force full page reload |
data-astro-prefetch | Prefetch on hover/view |
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
Other plugins' skills for the same job
11 skills in this plugin
/astro-basicsACTIVATE when creating Astro components, layouts, pages, or setting up Astro project structure. ACTIVATE for 'Astro component', 'slot', 'layout', 'Astro.props', 'class:list'. Covers: component anatomy (frontmatter/template/style/script), layout pattern with slot, props patterns, scoped vs global styles, script patterns (build-time vs client-side), path aliases. DO NOT use for: content collections (see astro-content-collections), routing (see astro-routing), React islands (see astro-react)./astro-content-collectionsACTIVATE when working with Astro content collections, markdown/MDX files, YAML frontmatter, Zod schemas for content, or content-driven pages. ACTIVATE for 'getCollection', 'getEntry', 'defineCollection', 'content collection', 'content.config.ts'. Covers: collection schema definition with Zod, loader-based collections, querying/filtering collections, dynamic routes with getStaticPaths, YAML meta files, MDX with components, collection references. DO NOT use for: routing logic (see astro-routing), general Astro components (see astro-basics)./astro-envACTIVATE when working with environment variables, feature flags, or runtime configuration in Astro. ACTIVATE for 'import.meta.env', '.env', 'PUBLIC_', 'feature flag'. Covers: server vs client variables (PUBLIC_ prefix), feature flags pattern with centralized config, TypeScript env declarations, build-time vs runtime variables, Netlify/Vercel deployment vars. DO NOT use for: general Astro setup, content configuration.npx claudepluginhub fabiensalles/claude-marketplace --plugin astro