Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

astro

БесплатноБез исполняемых скриптовНе проверен

Astro web framework for content-focused websites with Islands architecture, partial hydration, content collections, and multi-framework support

enunoот enuno★ 17 звёзд на GitHub16 установок в других каталогах

Об этом скилле

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 collections
  • o + enter - Open in browser
  • q + 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 route
  • src/components/ - Reusable Astro and framework components
  • src/layouts/ - Shared page templates with slots
  • src/content/ - Type-safe content collections
  • public/ - 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)

---
Полный SKILL.md на GitHub

Установить 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), без исполняемых скриптов.

Похожие скиллы

Сравнить astro с