
Astro Web Framework
FreeBuild fast, content-focused websites with zero JavaScript by default.
Free · Opens the source repo
What Astro Web Framework does
Astro is a modern web framework specifically designed for creating content-rich websites such as blogs, documentation sites, portfolios, and marketing pages. Its unique feature, the Islands Architecture, allows developers to ship zero JavaScript to the browser by default, enhancing performance and loading times. Interactive components can be selectively hydrated as needed, ensuring that only the necessary JavaScript is sent to the client. This results in faster page loads and a better user experience, making it an ideal choice for projects where performance is a priority.
Astro supports multiple UI frameworks simultaneously, including React, Vue, Svelte, and Solid. This flexibility allows developers to choose the best tool for each component, enabling a modular approach to building user interfaces. Additionally, Astro’s support for Markdown and MDX makes it easy to manage content-heavy sites, allowing for type-safe content collections and streamlined content management.
Setting up an Astro project is straightforward, requiring minimal configuration to get started. Developers can create a new site using a simple command, and the project structure is designed for easy navigation and organization. With built-in support for file-based routing, layouts, and content collections, Astro simplifies the development process while providing powerful features to enhance the final product.
Astro is particularly beneficial for developers focused on performance metrics like Core Web Vitals, as it allows for static site generation (SSG) with optional server-side rendering (SSR) for dynamic routes. This hybrid approach ensures that content is served quickly, while still allowing for dynamic features when necessary.
When to use it
Use Astro when developing blogs, documentation sites, or marketing pages that prioritize speed and performance. It is also suitable for projects that rely heavily on Markdown or MDX content.
When not to use it
Astro may not be the best choice for applications requiring extensive client-side interactivity or for projects that do not leverage static site generation or content collections.
What you can build with it
Creating a Blog
Use Astro to develop a blog that loads quickly and efficiently, utilizing Markdown for content management.
Building Documentation Sites
Leverage Astro's features to create a documentation site that is easy to navigate and fast to load.
Developing Marketing Pages
Utilize Astro to build marketing pages that prioritize performance and user engagement with minimal JavaScript.
How to install Astro Web Framework
View source1. Install with the skills CLI
npx skills add sickn33/agentic-awesome-skills/astro --agent claude-code2. Or install it manually
Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.
Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs
Inside SKILL.md
Written by sickn33Astro Web Framework
Overview
Astro is a web framework designed for content-rich websites — blogs, docs, portfolios, marketing sites, and e-commerce. Its core innovation is the Islands Architecture: by default, Astro ships zero JavaScript to the browser. Interactive components are selectively hydrated as isolated "islands." Astro supports React, Vue, Svelte, Solid, and other UI frameworks simultaneously in the same project, letting you pick the right tool per component.
When to Use This Skill
- Use when building a blog, documentation site, marketing page, or portfolio
- Use when performance and Core Web Vitals are the top priority
- Use when the project is content-heavy with Markdown or MDX files
- Use when you want SSG (static) output with optional SSR for dynamic routes
- Use when the user asks about
.astrofiles,Astro.props, content collections, orclient:directives
How It Works
Step 1: Project Setup
npm create astro@latest my-site
cd my-site
npm install
npm run dev
Add integrations as needed:
npx astro add tailwind # Tailwind CSS
npx astro add react # React component support
npx astro add mdx # MDX support
npx astro add sitemap # Auto sitemap.xml
npx astro add vercel # Vercel SSR adapter
Project structure:
src/
pages/ ← File-based routing (.astro, .md, .mdx)
layouts/ ← Reusable page shells
components/ ← UI components (.astro, .tsx, .vue, etc.)
content/ ← Type-safe content collections (Markdown/MDX)
styles/ ← Global CSS
public/ ← Static assets (copied as-is)
astro.config.mjs ← Framework config
Step 2: Astro Component Syntax
.astro files have a code fence at the top (server-only) and a template below:
---
// src/components/Card.astro
// This block runs on the server ONLY — never in the browser
interface Props {
title: string;
href: string;
description: string;
}
const { title, href, description } = Astro.props;
---
<article class="card">
<h2><a href={href}>{title}</a></h2>
<p>{description}</p>
</article>
<style>
/* Scoped to this component automatically */
.card { border: 1px solid #eee; padding: 1rem; }
</style>
Step 3: File-Based Pages and Routing
src/pages/index.astro → /
src/pages/about.astro → /about
src/pages/blog/[slug].astro → /blog/:slug (dynamic)
src/pages/blog/[...path].astro → /blog/* (catch-all)
Dynamic route with getStaticPaths:
---
// src/pages/blog/[slug].astro
export async function getStaticPaths() {
const posts = await getCollection('blog');
return posts.map(post => ({
params: { slug: post.slug },
props: { post },
}));
}
const { post } = Astro.props;
const { Content } = await post.render();
---
<h1>{post.data.title}</h1>
<Content />
Step 4: Content Collections
Content collections give you type-safe access to Markdown and MDX files:
// src/content/config.ts
import { z, defineCollection } from 'astro:content';
const blog = defineCollection({
type: 'content',
schema: z.object({
title: z.string(),
date: z.coerce.date(),
tags: z.array(z.string()).default([]),
draft: z.boolean().default(false),
}),
});
export const collections = { blog };
---
// src/pages/blog/index.astro
import { getCollection } from 'astro:content';
const posts = (await getCollection('blog'))
.filter(p => !p.data.draft)
.sort((a, b) => b.data.date.valueOf() - a.data.date.valueOf());
---
<ul>
{posts.map(post => (
<li>
<a href={`/blog/${post.slug}`}>{post.data.title}</a>
<time>{post.data.date.toLocaleDateString()}</time>
</li>
))}
</ul>
Step 5: Islands — Selective Hydration
By default, UI framework components render to static HTML with no JS. Use client: directives to hydrate:
---
import Counter from '../components/Counter.tsx'; // React component
import VideoPlayer from '../components/VideoPlayer.svelte';
---
<!-- Static HTML — no JavaScript sent to browser -->
<Counter initialCount={0} />
<!-- Hydrate immediately on page load -->
<Counter initialCount={0} client:load />
<!-- Hydrate when the component scrolls into view -->
<VideoPlayer src="/demo.mp4" client:visible />
<!-- Hydrate only when browser is idle -->
<Analytics client:idle />
<!-- Hydrate only on a specific media query -->
<MobileMenu client:media="(max-width: 768px)" />
Step 6: Layouts
---
// src/layouts/BaseLayout.astro
interface Props {
title: string;
description?: string;
}
const { title, description = 'My Astro Site' } = Astro.props;
---
<html lang="en">
<head>
<meta charset="utf-8" />
<title>{title}</title>
<meta name="description" content={description} />
</head>
<body>
<nav>...</nav>
<main>
<slot /> <!-- page content renders here -->
</main>
<footer>...</footer>
</body>
</html>
---
// src/pages/about.astro
import BaseLayout from '../layouts/BaseLayout.astro';
---
<BaseLayout title="About Us">
<h1>About Us</h1>
<p>Welcome to our company...</p>
</BaseLayout>
Step 7: SSR Mode (On-Demand Rendering)
Enable SSR for dynamic pages by setting an adapter:
// astro.config.mjs
import { defineConfig } from 'astro/config';
import vercel from '@astrojs/vercel/serverless';
export default defineConfig({
output: 'hybrid', // 'static' | 'server' | 'hybrid'
adapter: vercel(),
});
Opt individual pages into SSR with export const prerender = false.
Examples
Example 1: Blog with RSS Feed
// src/pages/rss.xml.ts
import rss from '@astrojs/rss';
import { getCollection } from 'astro:content';
export async function GET(context) {
const posts = await getCollection('blog');
return rss({
title: 'My Blog',
description: 'Latest posts',
site: context.site,
items: posts.map(post => ({
title: post.data.title,
pubDate: post.data.date,
link: `/blog/${post.slug}/`,
})),
});
}
Example 2: API Endpoint (SSR)
// src/pages/api/subscribe.ts
import type { APIRoute } from 'astro';
export const POST: APIRoute = async ({ request }) => {
const { email } = await request.json();
if (!email) {
return new Response(JSON.stringify({ error: 'Email required' }), {
status: 400,
headers: { 'Content-Type': 'application/json' },
});
}
await addToNewsletter(email);
return new Response(JSON.stringify({ success: true }), { status: 200 });
};
Example 3: React Component as Island
// src/components/SearchBox.tsx
import { useState } from 'react';
export default function SearchBox() {
const [query, setQuery] = useState('');
const [results, setResults] = useState([]);
async function search(e: React.FormEvent) {
e.preventDefault();
const data = await fetch(`/api/search?q=${query}`).then(r => r.json());
setResults(data);
}
return (
<form onSubmit={search}>
<input value={query} onChange={e => setQuery(e.target.value)} />
<button type="submit">Search</button>
<ul>{results.map(r => <li key={r.id}>{r.title}</li>)}</ul>
</form>
);
}
---
import SearchBox from '../components/SearchBox.tsx';
---
<!-- Hydrated immediately — this island is interactive -->
<SearchBox client:load />
Best Practices
- ✅ Keep most components as static
.astrofiles — only hydrate what must be interactive - ✅ Use content collections for all Markdown/MDX content — you get type safety and auto-validation
- ✅ Prefer
client:visibleoverclient:loadfor below-the-fold components to reduce initial JS - ✅ Use
import.meta.envfor environment variables — prefix public vars withPUBLIC_ - ✅ Add
<ViewTransitions />fromastro:transitionsfor smooth page navigation without a full SPA - ❌ Don't use
client:loadon every component — this defeats Astro's performance advantage - ❌ Don't put secrets in
.astrofrontmatter that gets used in client-facing templates - ❌ Don't skip
getStaticPathsfor dynamic routes in static mode — builds will fail
Security & Safety Notes
- Frontmatter code in
.astrofiles runs server-side only and is never exposed to the browser. - Use
import.meta.env.PUBLIC_*only for non-sensitive values. Private env vars (noPUBLIC_prefix) are never sent to the client. - When using SSR mode, validate all
Astro.requestinputs before database queries or API calls. - Sanitize any user-supplied content before rendering with
set:html— it bypasses auto-escaping.
Common Pitfalls
-
Problem: JavaScript from a React/Vue component doesn't run in the browser Solution: Add a
client:directive (client:load,client:visible, etc.) — without it, components render as static HTML only. -
Problem:
getStaticPathsdata is stale after content updates during dev Solution: Astro's dev server watches content files — restart if changes tocontent/config.tsare not reflected. -
Problem:
Astro.propstype isany— no autocomplete Solution: Define aPropsinterface or type in the frontmatter and Astro will infer it automatically. -
Problem: CSS from a
.astrocomponent bleeds into other components Solution: Styles in.astro<style>tags are automatically scoped. Use:global()only when intentionally targeting children.
Related Skills
@sveltekit— When you need a full-stack framework with reactive UI (vs Astro's content focus)@nextjs-app-router-patterns— When you need a React-first full-stack framework@tailwind-patterns— Styling Astro sites with Tailwind CSS@progressive-web-app— Adding PWA capabilities to an Astro site
Limitations
- Use this skill only when the task clearly matches the scope described above.
- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.
Frequently asked questions about Astro Web Framework
Similar skills
Playwright Component Testing
Test React and Vue components in isolation with Playwright.
Fluent UI Blazor
Integrate Fluent UI components in Blazor applications effortlessly.
Build MCP App
Create interactive UI widgets for MCP servers.
Web Design Reviewer
Identify and fix design issues in websites efficiently.
Markstream Install
Seamlessly integrate Markstream for Markdown rendering.
GSAP & Framer Scroll Animation
Create advanced scroll animations effortlessly.
