Build content-focused websites with Astro — zero JS by default, islands architecture, multi-framework components, and Markdown/MDX support.

MITAuto-check passedFrontend & Design

Install Astro

skills CLI
$ npx skills add davila7/claude-code-templates --skill astro -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install davila7/claude-code-templates astro --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/davila7/claude-code-templates.git skills-src && mkdir -p .claude/skills && cp -r skills-src/cli-tool/components/skills/web-development/astro .claude/skills/astro && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
astro
GitHub stars
32k
Used in
3 other repos
Token cost
~2.5k tokens
SKILL.md length
556 words
Files
1
Skills in repo
478
Repo updated
First seen
Licence
MIT

At a glance

Build content-focused websites with Astro — zero JS by default, islands architecture, multi-framework components, and Markdown/MDX support.

  • Works in 7 steps: Project Setup → Astro Component Syntax → File-Based Pages and Routing → …
  • Tasks that involve Static sites and blogs
  • SKILL.md covers Overview, When to Use This Skill, How It Works and Examples, plus 4 more sections
  • Calls npx and npm

What it does

Astro is an agent skill from davila7/claude-code-templates. Build content-focused websites with Astro — zero JS by default, islands architecture, multi-framework components, and Markdown/MDX support.

Its SKILL.md is about 2.5k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Frontend & Design, covering Static sites and blogs and Markdown. It works with Astro. The repository describes itself as: CLI tool for configuring and monitoring Claude Code. The licence is MIT.

When your agent uses it

  • Tasks that involve Static sites and blogs
  • Tasks that involve Markdown

Example prompts

  • “/astro”

Requirements

  • Node.js

Workflow steps

7 steps, taken from the step headings in SKILL.md.

  1. Project Setup
  2. Astro Component Syntax
  3. File-Based Pages and Routing
  4. Content Collections
  5. Islands — Selective Hydration
  6. Layouts
  7. SSR Mode (On-Demand Rendering)

What it can do on your machine

Read from SKILL.md and the folder at commit 46b4d8b. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • npx
    • npm

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md. Its commands use npx and npm, which can reach the network depending on how they are called.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Astro loads about 2.5k tokens when it runs. Until then it costs about 36 tokens; SKILL.md has 556 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~36
When it runs · the whole SKILL.md, loaded when a task matches
~2.5k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from davila7/claude-code-templates at commit 46b4d8b, republished under its MIT licence (© davila7). 556 words, ~2,537 tokens.

Download SKILL.mdSave it as .claude/skills/astro/SKILL.md (or your agent's skills folder).
name
astro
description
Build content-focused websites with Astro — zero JS by default, islands architecture, multi-framework components, and Markdown/MDX support.
category
frontend
risk
safe
source
community
date_added
2026-03-18
author
suhaibjanjua
tags
astro, ssg, ssr, islands, content, markdown, mdx, performance
tools
claude, cursor, gemini

Astro 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 .astro files, Astro.props, content collections, or client: directives

How It Works

Step 1: Project Setup
bash
npm create astro@latest my-site
cd my-site
npm install
npm run dev

Add integrations as needed:

bash
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:

astro
---
// 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:

astro
---
// 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:

typescript
// 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 };
astro
---
// 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:

astro
---
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
astro
---
// 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>
astro
---
// 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:

javascript
// 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
typescript
// 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)
typescript
// 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
tsx
// 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>
  );
}
astro
---
import SearchBox from '../components/SearchBox.tsx';
---
<!-- Hydrated immediately — this island is interactive -->
<SearchBox client:load />

Best Practices

  • ✅ Keep most components as static .astro files — only hydrate what must be interactive
  • ✅ Use content collections for all Markdown/MDX content — you get type safety and auto-validation
  • ✅ Prefer client:visible over client:load for below-the-fold components to reduce initial JS
  • ✅ Use import.meta.env for environment variables — prefix public vars with PUBLIC_
  • ✅ Add <ViewTransitions /> from astro:transitions for smooth page navigation without a full SPA
  • ❌ Don't use client:load on every component — this defeats Astro's performance advantage
  • ❌ Don't put secrets in .astro frontmatter that gets used in client-facing templates
  • ❌ Don't skip getStaticPaths for dynamic routes in static mode — builds will fail
Show full SKILL.md (203 more words)Show less

Security & Safety Notes

  • Frontmatter code in .astro files runs server-side only and is never exposed to the browser.
  • Use import.meta.env.PUBLIC_* only for non-sensitive values. Private env vars (no PUBLIC_ prefix) are never sent to the client.
  • When using SSR mode, validate all Astro.request inputs 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: getStaticPaths data is stale after content updates during dev Solution: Astro's dev server watches content files — restart if changes to content/config.ts are not reflected.

  • Problem: Astro.props type is any — no autocomplete Solution: Define a Props interface or type in the frontmatter and Astro will infer it automatically.

  • Problem: CSS from a .astro component bleeds into other components Solution: Styles in .astro <style> tags are automatically scoped. Use :global() only when intentionally targeting children.

  • @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

© davila7, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in cli-tool/components/skills/web-development/astro of davila7/claude-code-templates.

Open the folder on GitHubat commit 46b4d8b

Used in 3 other repositories

We found 12 copies of this SKILL.md (exact, near-identical or edited) in other folders, from 3 other GitHub owners. This page covers the copy in davila7/claude-code-templates, which our catalogue first saw on October 7, 2026.

Compare with similar skills

Astro next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Astro compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Astro this skilldavila7/claude-code-templates32k3 repos~2.5kAutomated safety check: PassMIT
Portable Text Serializationsanity-io/agent-toolkit1881 repos~1.1kAutomated safety check: PassMIT
System Bridge Landing Content Updatestimmo001/system-bridge356—~313Automated safety check: PassApache-2.0
Markdown Integrationlive-codes/livecodes1.5k—~2kAutomated safety check: PassMIT
Publish Skillglebis/claude-skills390—~4.1kAutomated safety check: PassMIT
Tabler Astro Dev Servertabler/tabler42k—~1.2kAutomated safety check: PassMIT

Similar skills

  • Portable Text Serialization

    sanity-io/agent-toolkit

    Official

    Render and serialize Portable Text to React, Svelte, Vue, Astro, HTML, Markdown, and plain text.

    188 GitHub starsUsed in 1 repo~1.1k tokens
    Frontend & DesignAuto-check passed
  • Update the System Bridge marketing landing page in the Astro + Starlight docs site.

    356 GitHub stars~313 tokensUpdated today
    Frontend & DesignAuto-check passed
  • Markdown Integration

    live-codes/livecodes

    Integrate LiveCodes with documentation sites using remark-livecodes, markdown-it-livecodes, gatsby-remark-livecodes, or marked-livecodes for Docusaurus, Astro, VitePress, Next.js, and Storybook.

    1.5k GitHub stars~2k tokensUpdated yesterday
    Frontend & DesignAuto-check passed
  • Publish Skill

    glebis/claude-skills

    This skill should be used when publishing a new or updated skill to the claude-skills-site Astro website.

    390 GitHub stars~4.1k tokensUpdated yesterday
    Documents & OfficeAuto-check passed
  • Starts the right Tabler dev server, keeps it from clashing with builds and verifies changes in the browser before a page or component is handed back.

    42k GitHub stars~1.2k tokensUpdated today
    Frontend & DesignAuto-check passed
  • Rules for adding or fixing client-side scripts in Tabler's Astro components so the copied preview HTML stays readable, self-contained and runs in the right order.

    42k GitHub stars~2.1k tokensUpdated today
    Frontend & DesignAuto-check passed

More from davila7/claude-code-templates

All 478 skills in this repo
  • Perplexity Web Search

    davila7/claude-code-templates

    Runs web-grounded searches through Perplexity's Sonar models over OpenRouter for current events, recent literature and cited facts beyond the model's training cutoff.

    32k GitHub starsUsed in 11 repos~3.5k tokens
    Auto-check: notes
  • Neuropixels Data Analysis

    davila7/claude-code-templates

    Analyzes Neuropixels recordings from SpikeGLX or Open Ephys through preprocessing, drift correction, Kilosort4 spike sorting, quality metrics and curation.

    32k GitHub starsUsed in 9 repos~2.8k tokens
    Auto-check passed
  • Scientific Venue Templates

    davila7/claude-code-templates

    Supplies LaTeX templates and formatting rules for journals, conferences, posters, and grant proposals, then can check a draft against them.

    32k GitHub starsUsed in 9 repos~5.1k tokens
    Auto-check: notes
  • Brand Voice Content Creator

    davila7/claude-code-templates

    Analyzes a brand's existing writing to lock in a consistent voice, then builds SEO blog posts and platform-specific social content around it.

    32k GitHub starsUsed in 3 repos~1.9k tokens
    Auto-check passed
  • CAPA Officer

    davila7/claude-code-templates

    Guides corrective and preventive action (CAPA) work in a quality management system, from initiation and root cause analysis through effectiveness verification.

    32k GitHub starsUsed in 1 repo~2k tokens
    Auto-check passed
  • Fda Consultant Specialist

    davila7/claude-code-templates

    Senior FDA consultant and specialist for medical device companies including HIPAA compliance and requirement management.

    32k GitHub starsUsed in 1 repo~2.7k tokens
    Auto-check passed

Works with

Questions about Astro

What does Astro do?

Build content-focused websites with Astro — zero JS by default, islands architecture, multi-framework components, and Markdown/MDX support. Astro is an agent skill from davila7/claude-code-templates. Build content-focused websites with Astro — zero JS by default, islands architecture, multi-framework components, and Markdown/MDX support.

When should I use Astro?

Astro fits situations like: tasks that involve Static sites and blogs; tasks that involve Markdown.

How do I install Astro in Claude Code?

Run `npx skills add davila7/claude-code-templates --skill astro -a claude-code`. Or copy the skill folder (cli-tool/components/skills/web-development/astro in davila7/claude-code-templates) into .claude/skills/astro in your project. Claude Code loads it when a task matches its description.

How do I install Astro in Codex?

Run `npx skills add davila7/claude-code-templates --skill astro -a codex`. Or copy the skill folder (cli-tool/components/skills/web-development/astro in davila7/claude-code-templates) into .agents/skills/astro in your project. Codex loads it when a task matches its description.

Can I use Astro in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add davila7/claude-code-templates --skill astro -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/astro, .gemini/skills/astro, .github/skills/astro and .opencode/skills/astro in your project.

What does Astro need to run?

Going by SKILL.md and its folder, Astro needs the command-line tools its instructions call (npx and npm). Our summary lists: Node.js.

Does Astro access the network?

SKILL.md contains no URLs. Its commands use npx and npm, which can reach the network depending on how they are called. This is read from the text; nothing was executed.

Is Astro safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Astro use?

Astro is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Astro use?

About 2.5k tokens (SKILL.md is roughly 10k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Astro?

Skills that share tags, products or a category with Astro: Portable Text Serialization (sanity-io/agent-toolkit, 188 stars), System Bridge Landing Content Updates (timmo001/system-bridge, 356 stars), Markdown Integration (live-codes/livecodes, 1.5k stars) and Publish Skill (glebis/claude-skills, 390 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Astro?

davila7 (a GitHub user) maintains it in davila7/claude-code-templates, which has 32,483 GitHub stars. The repository holds 478 skills in this directory. The repository was last updated on October 9, 2026.

Source: davila7/claude-code-templates on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.