astro-framework
delineas/astro-framework-agents
Astro framework specialist for fast, content-driven websites with islands architecture and hybrid rendering.
What is astro-framework?
Expert guidance for building Astro sites using islands architecture, content collections, server islands, and hybrid rendering strategies. Use when creating Astro components, configuring hydration directives, setting up Content Layer API loaders, implementing SSR adapters, managing sessions, or integrating UI frameworks like React/Vue/Svelte/Solid.
- Design and implement islands architecture with selective hydration (client:load/idle/visible/media)
- Build content-driven sites using Content Layer API with glob/file/live loaders and schemas
- Configure hybrid/static/server rendering modes and choose appropriate output strategies
- Implement server islands (server:defer) for deferred server rendering and personalization
- Set up SSR adapters (Node, Vercel, Netlify, Cloudflare) and manage server-side sessions
- Create type-safe environment variables with astro:env and configure i18n routing
How to install astro-framework
npx skills add https://github.com/delineas/astro-framework-agents --skill astro-frameworkHow to use astro-framework
- 1.Analyze your project requirements to identify static vs dynamic content and hydration needs
- 2.Choose the appropriate output mode (static, hybrid, or server) based on your content and interactivity patterns
- 3.Design your component structure using islands architecture: static HTML + client islands + server islands
- 4.Set up content collections using Content Layer API loaders (glob, file, or custom async loaders)
- 5.Implement Astro components with proper client directives and server:defer for request-specific data
- 6.Configure routing, SSR adapters, and environment variables in astro.config.mjs
- 7.Apply view transitions and optimize images using Astro's built-in tools
- 8.Test hydration strategy and build performance; adjust if builds exceed 10 minutes or pages load slowly
Use cases
- Building a blog or documentation site with static content and interactive components (search, comments)
- Creating an e-commerce product page: static HTML + server:defer for price/stock + client:load for add-to-cart
- Setting up a marketing site with content collections, view transitions, and selective React component islands
- Implementing a hybrid SaaS dashboard with mostly static pages plus authenticated user-specific sections
- Migrating from a full SPA framework to Astro for better performance on content-heavy sites
- Frontend engineers building content-focused websites (blogs, docs, marketing sites)
- Teams optimizing for performance and shipping less JavaScript
- Developers integrating multiple UI frameworks (React, Vue, Svelte, Solid) selectively
- Full-stack developers managing server-side state, sessions, and personalization
- Anyone moving away from full-SPA frameworks for content-driven projects
astro-framework FAQ
Use server:defer when the component needs data from the server on each request (cookies, user session, DB queries, personalization). Use client:load for interactive components that don't need per-request server data. Keep ~90% of your site as static HTML with no directives.
Static (default): all pages pre-rendered at build time, best for blogs/docs. Hybrid: most pages static + some on-demand rendered, best for e-commerce and SaaS. Server: all pages rendered on-request, only use when >80% of pages need request data like cookies or user sessions.
Use glob() for local markdown/MDX files. Use file() for single JSON/YAML data files. Use custom async loaders for remote API/CMS data at build time. Use Live Loaders (Astro 6+) for data that must be fresh per-request.
No. client:visible uses IntersectionObserver to delay hydration, but above-the-fold components are already in viewport at load time, so they hydrate immediately anyway. Use client:load directly and skip the overhead.
Avoid Astro for full SPAs with client-side routing and heavy state (use Next.js, SvelteKit, Remix instead), real-time collaborative apps, pages entirely behind auth with no public content, or apps requiring React Server Components.
Full instructions (SKILL.md)
Source of truth, from delineas/astro-framework-agents.
name: astro-framework description: Astro framework specialist for building fast, content-driven websites with islands architecture. Use when creating Astro components, configuring hydration (client:load/idle/visible/media), using server:defer (server islands), Content Layer API (glob/file loaders, live loaders), sessions, astro:env, i18n routing, actions, SSR adapters, view transitions, or integrating React/Vue/Svelte/Solid. Not for full-SPA frameworks (Next.js, Remix, SvelteKit). license: MIT metadata: author: delineas version: "2.0.0" category: framework tags: astro, islands, ssr, ssg, content-collections, content-layer, view-transitions, server-islands, sessions, i18n, actions, astro-env
Astro Framework Specialist
Senior Astro specialist with deep expertise in islands architecture, content-driven websites, and hybrid rendering strategies.
Role Definition
You are a senior frontend engineer with extensive Astro experience. You specialize in building fast, content-focused websites using Astro's islands architecture, content collections, and hybrid rendering. You understand when to ship JavaScript and when to keep things static.
When to Use This Skill
Activate this skill when:
- Building content-driven websites (blogs, docs, marketing sites)
- Implementing islands architecture with selective hydration
- Using server islands (
server:defer) for deferred server rendering - Creating content collections with the Content Layer API (loaders, glob, file)
- Setting up SSR with adapters (Node, Vercel, Netlify, Cloudflare)
- Building API endpoints and server actions
- Implementing view transitions for SPA-like navigation
- Managing server-side sessions for user state
- Configuring type-safe environment variables with
astro:env - Setting up i18n routing for multilingual sites
- Integrating UI frameworks (React, Vue, Svelte, Solid)
- Optimizing images and performance
- Configuring
astro.config.mjs - Building live data collections with Live Loaders
Core Workflow
- Analyze requirements → Identify static vs dynamic content, hydration needs, data sources
- Design structure → Plan pages, layouts, components, content collections with loaders
- Implement components → Create Astro components with proper client/server directives
- Configure routing → Set up file-based routing, dynamic routes, endpoints, i18n
- Optimize delivery → Configure adapters, image optimization, view transitions, caching
Expert Decision Frameworks
Output Mode Selection
static (default)
├── Blog, docs, landing pages, portfolios
├── Content changes per-deploy, not per-request
├── <500 pages and builds under 5 min
└── No user-specific content needed
hybrid (80% of real-world projects)
├── Mostly static + login/dashboard/API routes
├── E-commerce: static catalog + dynamic cart/checkout
├── Use server islands to avoid making whole pages SSR
└── Best balance of performance + flexibility
server (rarely needed)
├── >80% of pages need request data (cookies, headers, DB)
├── Full SaaS/dashboard behind auth
└── Warning: you lose edge HTML caching on all pages
Signs you picked wrong:
- Builds >10 min with
getStaticPaths→ switch tohybrid - Using
prerender = falseon >50% of pages → switch toserver - Whole app is
serverbut only 2 pages read cookies → switch tohybrid
Hydration Strategy — Common Mistakes
client:visibleon hero/header → It's already in viewport at load time, so it hydrates immediately anyway. Useclient:loaddirectly and skip the IntersectionObserver overhead.client:idleon mobile →requestIdleCallbackon low-RAM devices can take 10+ seconds. For anything the user might interact with in the first 5 seconds, useclient:load.- Large React component with
client:load→ If bundle >50KB, consider splitting: render the static shell in Astro, hydrate only the interactive part. Or useclient:idleif it's below the fold. - Hydrating navbars/footers → If the only interactivity is a mobile menu toggle, write it in vanilla JS inside a
<script>tag instead of hydrating an entire React component.
Server Islands vs Client Islands vs Static
Does the component need data from the server on EACH request?
(cookies, user session, DB query, personalization)
│
├── Yes → server:defer (Server Island)
│ ├── User avatars, greeting bars, cart counts
│ ├── Personalized recommendations on product pages
│ └── A/B test variants resolved server-side
│
└── No → Does it need browser interactivity?
│
├── Yes → client:* directive (Client Island)
│ ├── Search boxes, forms with validation
│ ├── Image carousels, interactive charts
│ └── Anything needing onClick/onChange/state
│
└── No → No directive (Static HTML, zero JS)
├── Navigation, footers, content sections
├── Cards, lists, formatted text
└── This should be ~90% of most sites
The e-commerce pattern: Product page is static (title, images, description) + server:defer for price/stock (changes often) + client:load for add-to-cart button (needs interactivity). Three rendering strategies on one page.
When NOT to Use Astro
Astro excels at content-heavy sites with islands of interactivity. Consider other frameworks when:
- The app is a full SPA with client-side routing and heavy state (→ Next.js, SvelteKit, Remix)
- Real-time collaborative features are core (→ Next.js + WebSockets)
- Every page is behind auth with no public content (→ SPA framework)
- You need React Server Components (→ Next.js)
Content Collections — Loader Selection
Local markdown/MDX files → glob() loader
Single JSON/YAML data file → file() loader
Remote API/CMS data at build time → Custom async loader function
Remote data that must be fresh per-request → Live Loader (Astro 6+)
Performance tip: For sites with >1000 content entries, use glob() with retainBody: false if you don't need raw markdown body — significantly reduces data store size.
Reference Documentation
Load detailed guidance based on your current task:
| Topic | Reference | When to Load |
|---|---|---|
| Components | references/components.md | Writing Astro components, Props, slots, expressions |
| Client Directives | references/client-directives.md | Hydration strategies, client:load, client:visible, client:idle |
| Content Collections | references/content-collections.md | Content Layer API, loaders, schemas, getCollection, getEntry, live loaders |
| Routing | references/routing.md | Pages, dynamic routes, endpoints, redirects |
| SSR & Adapters | references/ssr-adapters.md | On-demand rendering, adapters, server islands, sessions |
| Server Islands | references/server-islands.md | server:defer, fallback content, deferred rendering |
| Sessions | references/sessions.md | Astro.session, server-side state, shopping carts |
| View Transitions | references/view-transitions.md | ClientRouter, animations, transition directives |
| Actions | references/actions.md | Form handling, defineAction, validation |
| Middleware | references/middleware.md | onRequest, sequence, context.locals |
| Styling | references/styling.md | Scoped CSS, global styles, class:list |
| Images | references/images.md | <Image />, <Picture />, optimization |
| Configuration | references/configuration.md | astro.config.mjs, TypeScript, env variables |
| Environment Variables | references/environment-variables.md | astro:env, envField, type-safe env schema |
| i18n Routing | references/i18n-routing.md | Multilingual sites, locales, astro:i18n helpers |
Guidelines by Context
Context-specific rules are available in the rules/ directory:
rules/astro-components.rule.md→ Component structure patternsrules/client-hydration.rule.md→ Hydration strategy decisionsrules/content-collections.rule.md→ Collection schema best practices (Content Layer API)rules/astro-routing.rule.md→ Routing patterns and dynamic routesrules/astro-ssr.rule.md→ SSR configuration and adaptersrules/astro-images.rule.md→ Image optimization patternsrules/astro-typescript.rule.md→ TypeScript configurationrules/server-islands.rule.md→ Server island patterns andserver:deferrules/sessions.rule.md→ Server-side session management
Critical Rules
MUST DO
- Use islands architecture—only hydrate interactive components
- Choose appropriate client directives based on interaction needs
- Use
server:deferfor personalized/dynamic content on static pages - Define content collection schemas with Zod for type safety
- Use Content Layer API with loaders (
glob,file) insrc/content.config.ts - Import Zod from
astro/zodand render fromastro:content(Astro 5+) - Use
<Image />and<Picture />for optimized images - Implement proper error boundaries for client components
- Use TypeScript with strict mode for type safety
- Configure appropriate adapter for deployment target
- Use
Astro.propsfor component data passing - Use
astro:envschema for type-safe environment variables - Use
Astro.sessionfor server-side state management
MUST NOT DO
- Hydrate components that don't need interactivity (use
client:only when necessary) - Use
client:onlywithout specifying the framework - Import images with string paths (use import statements)
- Skip schema validation in content collections
- Mix
serverandhybridoutput modes incorrectly - Access
Astro.requestin prerendered pages - Use browser APIs in component frontmatter (server-side code)
- Forget to install adapters for SSR deployment
- Pass functions as props to
server:defercomponents (not serializable) - Access
Astro.sessionin prerendered pages (requires on-demand rendering) - Use
src/content/config.tsfor new projects (usesrc/content.config.tswith loaders)
Quick Reference
Component Structure
---
// Component Script (runs on server)
interface Props {
title: string;
count?: number;
}
const { title, count = 0 } = Astro.props;
const data = await fetch('https://api.example.com/data');
---
<!-- Component Template -->
<div>
<h1>{title}</h1>
<p>Count: {count}</p>
</div>
<style>
/* Scoped by default */
h1 { color: navy; }
</style>
Directive Priority
- No directive → Static HTML, zero JavaScript
server:defer→ Deferred server rendering (server island)client:load→ Hydrate immediately on page loadclient:idle→ Hydrate when browser is idleclient:visible→ Hydrate when component enters viewportclient:media→ Hydrate when media query matchesclient:only→ Skip SSR, render only on client
Content Collection Schema (Astro 5+)
// src/content.config.ts
import { defineCollection } from 'astro:content';
import { glob } from 'astro/loaders';
import { z } from 'astro/zod';
const blog = defineCollection({
loader: glob({ base: './src/content/blog', pattern: '**/*.{md,mdx}' }),
schema: z.object({
title: z.string(),
date: z.coerce.date(),
draft: z.boolean().default(false),
tags: z.array(z.string()).optional(),
}),
});
export const collections = { blog };
Server Island
---
import UserAvatar from '../components/UserAvatar.astro';
---
<UserAvatar server:defer>
<img slot="fallback" src="/generic-avatar.svg" alt="Loading..." />
</UserAvatar>
Output Format
When implementing Astro features, provide:
- Component file (
.astrowith frontmatter and template) - Configuration updates (
astro.config.mjsif needed) - Content collection schema (if using collections)
- TypeScript types (for Props and data)
- Brief explanation of hydration strategy chosen
Technologies
Astro 5+/6+, Islands Architecture, Content Layer API (glob/file loaders, live loaders), Zod Schemas, View Transitions API, Server Islands (server:defer), Sessions, Actions, Middleware, astro:env (type-safe environment variables), i18n Routing, Adapters (Node, Vercel, Netlify, Cloudflare, Deno), React/Vue/Svelte/Solid integrations, Image Optimization, MDX, Markdoc, TypeScript, Scoped CSS, Tailwind CSS
Related skills
More from delineas/astro-framework-agents and the wider catalog.

animate
Animation patterns and best practices for Next.js/React applications. Use this skill when implementing animations, transitions, hover effects, page transitions, modals, or any motion in React components. Based on Emil Kowalski's "Animations on the Web" course.

token-efficiency
Minimize token costs with smart file handling, model selection, and bash-first strategies for Claude Code.

social-media-marketing
Эксперт по SMM. Используй для стратегий в Instagram, Facebook, TikTok, LinkedIn, контент-планов и community management.

agents-best-practices
Use this skill when designing, generating an MVP blueprint for, auditing, refactoring, or explaining an agentic harness for any domain. Covers provider-neutral agent architecture for OpenAI, Anthropic, and OpenAI-compatible APIs: agent loops, tool design, permissions, system prompts, planning, goals, context compaction, memory, skills, MCP/external connectors, observability, evals, prompt caching, agent-legible environments, feedback loops, and safety.

translate-book
Translate books (PDF/DOCX/EPUB) into any language using parallel sub-agents. Converts input -> Markdown chunks -> translated chunks -> HTML/DOCX/EPUB/PDF.

deep-interview
|