astro
БесплатноБез исполняемых скриптовНе проверенAstro web framework for content-focused websites with Islands architecture, partial hydration, content collections, and multi-framework support
Об этом скилле
Astro Skill
Comprehensive assistance with Astro web framework development, including components, Islands architecture, content collections, routing, SSR/SSG, and deployment.
When to Use This Skill
This skill should be triggered when:
- Creating new Astro projects or components
- Working with Islands architecture and partial hydration
- Managing content collections and Markdown/MDX
- Implementing file-based routing and dynamic routes
- Configuring SSR adapters and deployment
- Adding integrations (React, Vue, Svelte, Tailwind)
- Optimizing images and assets
- Setting up view transitions
Quick Start
Create a New Project
# Interactive project creation
npm create astro@latest
# Create with template
npm create astro@latest my-project -- --template blog
npm create astro@latest my-project -- --template portfolio
# Skip prompts with defaults
npm create astro@latest my-project -- --yes
CLI Commands
# Development server (hot reload)
npm run dev
# or: astro dev --port 3000 --open
# Build for production
npm run build
# or: astro build
# Preview production build
npm run preview
# or: astro preview
# Add integrations
npx astro add react
npx astro add tailwind
npx astro add netlify
# Type checking
astro check
# Generate TypeScript types
astro sync
# Environment info
astro info
CLI Hotkeys
During development:
s + enter- Sync content collectionso + enter- Open in browserq + enter- Quit server
Project Structure
my-astro-project/
├── src/
│ ├── pages/ # File-based routing (required)
│ │ ├── index.astro
│ │ ├── about.astro
│ │ └── blog/
│ │ ├── [slug].astro
│ │ └── index.astro
│ ├── components/ # Reusable UI components
│ │ ├── Header.astro
│ │ └── Card.astro
│ ├── layouts/ # Page templates
│ │ ├── BaseLayout.astro
│ │ └── BlogLayout.astro
│ ├── content/ # Content collections
│ │ └── blog/
│ │ └── post-1.md
│ ├── styles/ # Global styles
│ │ └── global.css
│ └── content.config.ts # Collection schemas
├── public/ # Static assets (unprocessed)
│ ├── favicon.ico
│ └── robots.txt
├── astro.config.mjs # Astro configuration
├── tsconfig.json # TypeScript config
└── package.json
Key Directories:
src/pages/- Required. Each file becomes a routesrc/components/- Reusable Astro and framework componentssrc/layouts/- Shared page templates with slotssrc/content/- Type-safe content collectionspublic/- Static files copied as-is (no optimization)
Astro Components
Basic Component Structure
---
// Component Script (runs on server)
import Header from './Header.astro';
import { getCollection } from 'astro:content';
// Props with TypeScript
interface Props {
title: string;
description?: string;
}
const { title, description = "Default description" } = Astro.props;
// Fetch data
const posts = await getCollection('blog');
---
<!-- Component Template (HTML output) -->
<Header />
<main>
<h1>{title}</h1>
<p>{description}</p>
<ul>
{posts.map(post => (
<li>
<a href={`/blog/${post.slug}`}>{post.data.title}</a>
</li>
))}
</ul>
</main>
<style>
/* Scoped by default */
h1 {
color: navy;
}
</style>
Props and Slots
---
// Card.astro
interface Props {
title: string;
variant?: 'default' | 'featured';
}
const { title, variant = 'default' } = Astro.props;
---
<article class:list={['card', variant]}>
<h2>{title}</h2>
<!-- Default slot -->
<div class="content">
<slot />
</div>
<!-- Named slots -->
<footer>
<slot name="footer">
<p>Default footer content</p>
</slot>
</footer>
</article>
<!-- Usage -->
<Card title="My Card" variant="featured">
<p>Card content goes here</p>
<div slot="footer">
<button>Learn More</button>
</div>
</Card>
Dynamic Classes and Styles
---
const isActive = true;
const theme = 'dark';
const accentColor = '#ff6600';
---
<!-- class:list for conditional classes -->
<div class:list={[
'base-class',
{ 'is-active': isActive },
theme === 'dark' && 'dark-mode'
]}>
Content
</div>
<!-- CSS variables from props -->
<div class="themed">
<slot />
</div>
<style define:vars={{ accentColor }}>
.themed {
border-color: var(--accentColor);
}
</style>
Pages and Routing
File-Based Routing
src/pages/
├── index.astro → /
├── about.astro → /about
├── blog/
│ ├── index.astro → /blog
│ └── [slug].astro → /blog/:slug
├── [category]/
│ └── [id].astro → /:category/:id
└── [...path].astro → /* (catch-all)
Static Pages
---
// src/pages/about.astro
import Layout from '../layouts/Layout.astro';
---
<Layout title="About Us">
<h1>About Us</h1>
<p>Welcome to our site.</p>
</Layout>
Dynamic Routes (Static Generation)
---
Установить astro в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл astro?
Astro web framework for content-focused websites with Islands architecture, partial hydration, content collections, and multi-framework support
Как установить скилл 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