astro
БесплатноБез исполняемых скриптовНе проверенAssists with building content-driven websites using Astro's island architecture. Use when creating static sites, blogs, documentation, or marketing pages that…
Об этом скилле
Astro
Overview
Astro is a web framework for building content-driven websites that ships zero JavaScript by default. Its island architecture hydrates only interactive components, achieving excellent Lighthouse scores while supporting React, Vue, Svelte, or any UI framework where interactivity is needed.
Instructions
- When starting a project, run
npm create astro@latest, thennpx astro add react(orvue,svelte,tailwind,mdx) to install integrations. Astro 6 and 7 need a recent Node 22 (seecompatibility); set it in.nvmrcand in the host's build settings. - When creating pages, use file-based routing in
src/pages/with.astro,.md, or.mdxfiles, and organize shared structure insrc/layouts/. - When adding interactivity, use client directives on framework components: prefer
client:visibleorclient:idleoverclient:loadsince most components do not need immediate hydration. - When managing content, define collections in
src/content.config.ts(not the oldsrc/content/config.ts) with aloader(glob()orfile()fromastro/loaders) and a Zod schema (import { z } from 'astro/zod'), then query withgetCollection()andgetEntry(). Entries are identified byentry.id, and you render one withrender(entry)imported fromastro:content(the oldentry.slugandentry.render()no longer exist). - When choosing rendering modes, default to static (SSG) for marketing and content pages, add a server adapter (
npx astro add node,vercel,netlify,cloudflare) for on-demand pages, and mark individual pages withexport const prerender = false. There is nooutput: "hybrid"any more;output: "server"makes every page on-demand unless it setsprerender = true. - When optimizing images, use the
<Image>component fromastro:assetsfor automatic format conversion (WebP/AVIF), resizing, and lazy loading instead of raw<img>tags. - When adding page transitions, add
<ClientRouter />fromastro:transitionsto the shared<head>for SPA-like navigation.<ViewTransitions />was renamed in Astro 5 and no longer exists: a build that imports it fails with"ViewTransitions" is not exported. - When integrating UI frameworks, install the appropriate integration (
@astrojs/react,@astrojs/vue,@astrojs/svelte) and use Astro components for static content, reaching for framework components only when interactivity is required.
A minimal collection that builds on Astro 7 (verified):
// src/content.config.ts
import { defineCollection } from 'astro:content';
import { glob } from 'astro/loaders';
import { z } from 'astro/zod';
const blog = defineCollection({
loader: glob({ pattern: '**/*.md', base: './src/content/blog' }),
schema: z.object({ title: z.string(), date: z.coerce.date(), tags: z.array(z.string()).default([]) }),
});
export const collections = { blog };
---
// src/pages/blog/[id].astro
import { getCollection, render } from 'astro:content';
export async function getStaticPaths() {
const posts = await getCollection('blog');
return posts.map((post) => ({ params: { id: post.id }, props: { post } }));
}
const { post } = Astro.props;
const { Content } = await render(post);
---
<h1>{post.data.title}</h1>
<Content />
A shared layout with page transitions (verified to build on Astro 7):
---
// src/layouts/Base.astro
import { ClientRouter } from 'astro:transitions';
const { title } = Astro.props;
---
<html lang="en">
<head><title>{title}</title><ClientRouter /></head>
<body><slot /></body>
</html>
Examples
Example 1: Build a blog with Content Collections
User request: "Create an Astro blog with type-safe Markdown content"
Actions:
- Define a blog Content Collection with Zod schema for frontmatter (title, date, tags, author)
- Create dynamic route
src/pages/blog/[id].astrowithgetStaticPaths() - Build blog index page querying
getCollection("blog")with sorting - Add layout with SEO meta tags, navigation, and View Transitions
Output: A statically generated blog with validated content, clean URLs, and smooth page transitions.
Example 2: Add interactive components to a static site
User request: "Add a React search component to my Astro documentation site"
Actions:
- Install
@astrojs/reactintegration - Create the React search component with state and event handling
- Add the component to the page with
client:idledirective - Pass static data as props from the Astro page frontmatter
Output: A documentation site that is fully static except for the interactive search island.
Guidelines
- Use Astro components (
.astro) for static content; only use React/Vue/Svelte when interactivity is needed. - Default to
client:visibleorclient:idleoverclient:loadfor hydration directives. - Define Content Collections with strict Zod schemas to catch content errors at build time. Astro 6 moved to Zod 4:
.default()values must ma
Установить astro в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл astro?
Assists with building content-driven websites using Astro's island architecture. Use when creating static sites, blogs, documentation, or marketing pages that ship zero JavaScript by default. Trigger words: astro, static site, island architecture, content collections, SSG, hybrid rendering, astro components.
Как установить скилл astro?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл astro запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
doc-coauthoring
Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
от Anthropicacademy-guide
Stop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
от Anthropicinternal-comms
A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
от Anthropicskill-development
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…
от Anthropic