К основному содержанию
скилл CX Codex

astro · oakoss — скилл для Claude Code: что делает и как установить

Скилл Claude Code объясняет агенту Astro: коллекции контента, островную гидратацию, view transitions и режимы рендеринга. Описывает статичные сайты с вкраплениями интерактива.

MIT 111 установок ★ 29 обновлён 2026-08-17

Установить в Claude Code · Через Skills CLI (Vercel) Все способы и платформы ↓
npx skills add oakoss/agent-skills --skill astro -a claude-code
Открыть на GitHub

Что делает astro

Скилл даёт агенту справочник по Astro: content collections со схемами Zod и лоадерами, островная гидратация (client:load, client:idle, client:visible, client:only), view transitions через <ClientRouter />, режимы output: 'static' и output: 'server', server islands, Astro DB и middleware onRequest. Внутри — таблица паттернов с API и список типичных ошибок: например, client:-директиву можно ставить только на компоненты React, Svelte или Vue, а конфигурация коллекций обязана лежать в src/content.config.ts.

Скилл не вызывается вручную: в нём стоит user-invocable: false, поэтому агент подхватывает его сам, когда задача касается контентного сайта. Для дашбордов и SPA с общим состоянием на всех экранах он не годится, и автор прямо относит такие проекты к другой категории.

Ставится одной командой npx skills add oakoss/agent-skills --skill astro -a claude-code, файл окажется в ~/.claude/skills/astro/SKILL.md.

Какие задачи решает

  • описать схему коллекции blog в src/content.config.ts с проверкой полей через Zod
  • выбрать директиву гидратации для одного интерактивного виджета на статичной странице
  • вставить компонент React в .astro-страницу
  • сгенерировать маршруты из записей коллекции через getStaticPaths()
  • проверять авторизацию в middleware onRequest до выполнения маршрута

Примеры запросов агенту

  • Заведи коллекцию blog со схемой Zod и выведи список постов через getCollection.
  • Оставь сайт на output: 'static', а страницу /dashboard переведи на prerender = false.
  • Добавь <ClientRouter /> в общий layout, чтобы включить view transitions.

Как установить astro

1Через Skills CLI (Vercel)

npx skills add oakoss/agent-skills --skill astro -a claude-code

2Вручную: положить файлы

~/.claude/skills/astro/SKILL.md

Папка скилла целиком; для одного проекта — .claude/skills/astro/

По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов

Вопросы об astro

Как установить скилл astro в Claude Code?

Выполните npx skills add oakoss/agent-skills --skill astro -a claude-code. Файл скилла появится по пути ~/.claude/skills/astro/SKILL.md.

Что делает скилл astro?

Даёт агенту паттерны Astro: коллекции контента со схемами Zod, директивы гидратации островов, view transitions, режимы рендеринга, Astro DB и middleware. Отдельным списком идут частые ошибки.

Чем гибридный режим отличается от output: 'server'?

В гибридном проекте остаётся output: 'static', а на серверный рендеринг переводится отдельная страница через prerender = false. При output: 'server' рендерятся все страницы, и нужные возвращают в статику через prerender = true.

Исходный текст

SKILL.md · MIT
---
name: astro
description: |
  Astro web framework patterns for content-driven sites. Covers content collections with Zod schemas and loaders, island architecture with selective hydration directives, view transitions with ClientRouter, server-side and hybrid rendering modes, server islands, Astro DB with astro:db, middleware with onRequest, and framework integrations (React, Svelte, Vue).

  Use when building content-driven websites, configuring island hydration strategies, setting up view transitions, choosing between static and server rendering, integrating UI framework components, defining content collection schemas, or adding middleware.
license: MIT
metadata:
  author: oakoss
  version: '1.0'
  source: 'https://docs.astro.build'
user-invocable: false
---

# Astro

## Overview

Astro is an **all-in-one web framework** for building fast, content-focused websites. It uses an islands architecture that ships zero JavaScript by default, hydrating only interactive components on demand. Components from React, Svelte, Vue, Solid, and Preact can coexist in a single project.

**When to use:** Content-driven sites (blogs, docs, marketing), portfolios, e-commerce storefronts, any site where most pages are primarily static with isolated interactive regions.

**When NOT to use:** Highly interactive single-page applications (dashboards, real-time collaboration tools), apps requiring full client-side routing with shared global state across all components.

## Quick Reference

| Pattern                | API / Directive                                   | Key Points                                            |
| ---------------------- | ------------------------------------------------- | ----------------------------------------------------- |
| Content collection     | `defineCollection({ loader, schema })`            | Zod schemas, glob/file loaders, type-safe queries     |
| Query collection       | `getCollection('blog')`                           | Returns typed array, supports filter callback         |
| Single entry           | `getEntry('blog', 'my-post')`                     | Fetch by collection name and entry ID                 |
| Island (load)          | `<Component client:load />`                       | Hydrate immediately on page load                      |
| Island (idle)          | `<Component client:idle />`                       | Hydrate when browser is idle                          |
| Island (visible)       | `<Component client:visible />`                    | Hydrate when component enters viewport                |
| Island (media)         | `<Component client:media="(max-width: 768px)" />` | Hydrate on media query match                          |
| Island (client-only)   | `<Component client:only="react" />`               | Skip SSR, render only on client                       |
| View transitions       | `<ClientRouter />`                                | Add to `<head>`, enables SPA-like navigation          |
| Persist state          | `transition:persist`                              | Maintain island state across navigations              |
| Programmatic navigate  | `navigate(href)`                                  | Client-side navigation from scripts                   |
| Static output          | `output: 'static'`                                | Pre-render all pages at build time (default)          |
| Server output          | `output: 'server'`                                | Server-render all pages on demand                     |
| Hybrid (opt-in SSR)    | `output: 'static'` + per-page `prerender = false` | Static by default, opt individual pages into SSR      |
| Hybrid (opt-in static) | `output: 'server'` + per-page `prerender = true`  | SSR by default, opt individual pages into static      |
| Server islands         | `<Component server:defer />`                      | Defer server rendering for dynamic content in static  |
| Middleware             | `onRequest(context, next)`                        | Runs before every route, chain with `sequence()`      |
| Astro DB table         | `defineTable({ columns })`                        | Type-safe SQL with column definitions                 |
| Framework component    | Import `.jsx` / `.svelte` / `.vue`                | Auto-detected by file extension                       |
| Integration            | `astro add react`                                 | CLI to add framework adapters and tools               |
| Render content         | `const { Content } = await entry.render()`        | Compile Markdown/MDX to component                     |
| Dynamic routes         | `getStaticPaths()` + collection query             | Generate pages from collection entries                |
| API endpoint           | `export const GET: APIRoute`                      | Server-rendered REST endpoints                        |
| Shared island state    | `nanostores`                                      | Reactive state across framework boundaries            |
| Environment variables  | `import.meta.env.PUBLIC_*`                        | `PUBLIC_` prefix for client-accessible vars           |
| Transition animation   | `transition:animate="slide"`                      | `initial`, `fade`, `slide`, `none`                    |
| Prefetch links         | `data-astro-prefetch`                             | `hover`, `viewport`, `load`, or `false`               |
| Collection reference   | `reference('authors')`                            | Type-safe cross-collection relations                  |
| Script re-execution    | `data-astro-rerun`                                | Re-run `<script>` on every view transition navigation |
| Redirect               | `context.redirect(url, status)`                   | Redirect from middleware or server pages              |

## Common Mistakes

| Mistake                                           | Correct Pattern                                                           |
| ------------------------------------------------- | ------------------------------------------------------------------------- |
| Adding `client:` directive to `.astro` components | Only UI framework components (React, Svelte, Vue) accept `client:`        |
| Using `client:load` everywhere                    | Default to `client:idle` or `client:visible`; use `client:load` sparingly |
| Forgetting framework string with `client:only`    | Must specify framework: `client:only="react"`                             |
| Mixing framework components in non-Astro files    | Only `.astro` files can compose components from multiple frameworks       |
| Using `output: 'server'` for mostly static sites  | Use `output: 'static'` with per-page `prerender = false` for hybrid       |
| Omitting `<ClientRouter />` for view transitions  | Must be in `<head>` of every page (use shared layout)                     |
| Content config not at `src/content.config.ts`     | File must be named `content.config.ts` in `src/` root                     |
| Not awaiting `getCollection()` calls              | Always `await` collection queries in frontmatter                          |
| Importing from `astro:content` in client scripts  | Content APIs are server-only; pass data as props to client components     |
| Placing middleware outside `src/middleware.ts`    | Middleware must be at `src/middleware.ts` or `src/middleware/index.ts`    |
| Passing functions as props to islands             | Only serializable data crosses the server/client boundary                 |
| Using `transition:persist` without matching pages | Component must appear on both old and new page with same persist value    |
| Missing adapter for server/hybrid mode            | Install an adapter: `npx astro add vercel` (or node, netlify, etc.)       |

## Delegation

- **Pattern discovery**: Use `Explore` agent
- **Build configuration**: Use `Task` agent
- **Code review**: Delegate to `code-reviewer` agent

> If the `tailwind` skill is available, delegate styling and Tailwind CSS configuration to it.
> If the `vitest` skill is available, delegate unit testing patterns to it.
> If the `playwright` skill is available, delegate end-to-end testing patterns to it.
> If the `vite` skill is available, delegate build configuration and Vite plugin setup to it.
> If the `drizzle` skill is available, delegate advanced database query patterns to it.
> If the `sentry` skill is available, delegate error monitoring and observability setup to it.
> If the `pino-logging` skill is available, delegate server-side logging configuration to it.
> If the `tanstack-query` skill is available, delegate client-side data fetching and caching to it.

## References

- [Content collections, schemas, loaders, and querying](references/content-collections.md)
- [Island architecture and hydration directives](references/island-architecture.md)
- [View transitions and client-side navigation](references/view-transitions.md)
- [Rendering modes: static, server, and hybrid](references/rendering-modes.md)
- [Middleware patterns and request handling](references/middleware.md)
- [Framework component integration (React, Svelte, Vue)](references/framework-integration.md)
- [Astro DB schema, seeding, and queries](references/astro-db.md)

© oakoss · MIT · oakoss/agent-skills

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

Все скиллы по теме «Фронтенд и UI» →

Сначала — astro от других авторов.

astro astrolicious Страницы, компоненты, адаптеры SSR, коллекции контента и деплой на Astro. Покрывает старт проекта и работу с существующим. CX Codex +1 20 000установок astro Mindrally Скилл задаёт агенту правила работы с Astro: статическая генерация, частичная гидратация, файловый роутинг и минимум клиентского JavaScript. CX Codex +1 933установок astro suhaibjanjua Помогает создавать сайты на Astro с контентом в Markdown или MDX и выборочной гидратацией. Поддерживает блоги, документацию и портфолио. CX Codex +1 157установок astro-framework delineas Скилл astro-framework для Claude Code и других агентов: разбирается в islands architecture, гидратации и Content Layer API. Решает, что рендерить на сервере, а что в браузере, когда проект на Astro растёт. CX Codex +1 2 200установок clerk-astro-patterns clerk Скилл clerk-astro-patterns для Claude Code подсказывает правила интеграции аутентификации Clerk в проекты на Astro 5. Помогает настроить middleware, серверный рендеринг и островные компоненты. CX Codex +1 15 000установок integration-astro-ssr PostHog Скилл integration-astro-ssr встраивает аналитику PostHog в SSR-проекты на Astro с API-роутами. Помогает связать клиентские и серверные события. CX Codex +1 109установок astro-sites-manager ft.ia.br Скилл astro-sites-manager помогает создавать и обновлять проекты на Astro v7, настраивать фоновый dev-сервер для агентов и связываться с MCP-сервером astro-docs. CX Codex +1 ★ 141звёзд репо astro-expert 0xfurai Субагент astro-expert помогает проектировать сайты на Astro, настраивать коллекции контента и ускорять сборку страниц. CX Codex ★ 1 029звёзд репо islands-architecture patterns.dev Скилл islands-architecture для Claude Code, который обучает агента паттерну islands-архитектуры. Помогает собирать контентные сайты, где страница в основном статична, а интерактивность нужна только в отдельных зонах. CX Codex +1 646установок

Из того же набора106

Весь набор →
meta-skill-creator Скилл meta-skill-creator помогает создавать и проверять агентские скиллы по открытому стандарту Agent Skills. Он пригодится при подготовке SKILL.md, структуры папок и файлов для распространения. CX Codex +1 114установок figma-developer Скилл figma-developer для Claude Code получает из Figma цвета, шрифты и иконки через REST API и собирает CSS-переменные и React-компоненты. Автоматизирует перенос изменений макета в код. CX Codex +1 114установок tanstack-store Объясняет агенту устройство TanStack Store: стор, производные значения, батчи и эффекты. Описывает общее состояние нескольких компонентов. CX Codex +1 113установок hono Скилл по веб-фреймворку Hono для создания API и edge-функций на Cloudflare Workers, Bun, Deno и Node.js. CX Codex +1 112установок db-enforcer Скилл db-enforcer для Claude Code проверяет целостность PostgreSQL-схем и согласованность с Prisma. Включается при проектировании схем, подготовке миграций и настройке RLS. CX Codex +1 109установок electricsql Скилл для ИИ-кодинга по ElectricSQL: как стримить строки Postgres в клиент через Shapes, фильтровать их и не пускать запись мимо своего API. CX Codex +1 109установок trpc trpc — скилл для Claude Code, который помогает строить типобезопасные API на TypeScript с tRPC v11. Он подключается к задачам с роутерами, процедурами, React-клиентом и тестами. CX Codex +1 109установок tauri Помогает собирать приложения на Tauri v2 с веб-интерфейсом и бэкендом на Rust. Подключается при настройке проекта, IPC, разрешений или выпуска приложения. CX Codex +1 108установок

Спонсоры проекта

Компании, которые помогают держать аналитику открытой