frontend-astro-patterns
Use when the user asks about Astro island patterns, client:load / client:visible / client:idle, server islands, view transitions, Astro integrations, content…
от j4flmao★ 47 звёзд на GitHub
Установить frontend-astro-patterns в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Astro Patterns
Purpose
Apply production patterns to Astro projects: island architecture with optimal hydration, type-safe content collections, view transitions, and static/dynamic hybrid rendering strategies.
Agent Protocol
Trigger
Exact user phrases: "Astro pattern", "Astro island", "Astro component pattern", "Astro integration", "Astro content collection", "Astro view transition", "Astro hybrid SSR/SSG", "client:load", "client:visible".
Input Context
Before activating, verify:
- package.json has astro dependency.
- Which integration(s) are configured (React, Vue, Svelte, Solid).
- Whether the project uses SSG, SSR, or hybrid mode (output config).
- Content collection structure in src/content/.
Output Artifact
No file output. Produces island strategy, content model, rendering approach as text.
Response Format
Island Strategy: {directive} — {rationale}
Content Model: {collection/type} — {schema summary}
Rendering: {static/server/hybrid} — {per-route rationale}
No preamble. No postamble. No explanations. No filler/hedging/transitions. Compress output — why use many token when few do trick.
Completion Criteria
- Island hydration chosen from most to least aggressive: load -> idle -> visible -> media -> only.
- Content collections have Zod schemas with validation.
- View transitions use and transition:name directives.
- Hybrid rendering: static for content, server for dynamic routes.
- Nested islands pass data via props, not shared JS state.
- Image optimization via astro:assets Image/Picture.
Max Response Length
2560 tokens.
Component Architecture / Decision Trees
Architecture Options
| Approach | Trade-off | When to Use |
|---|---|---|
| Pure .astro components | Zero JS output, fully static | Content display, headers, footers |
| Framework islands (React, Vue, Svelte) | JS bundle per island type | Interactive widgets, forms |
| client:load | Immediate hydration, eager | Hero search, auth buttons |
| client:visible | Delayed until viewport | Analytics widgets, below-fold chat |
| client:media | Responsive hydration | Desktop-only sidebars, mobile nav |
| client:only | No SSR, client-render only | Browser-API-dependent charts |
Decision Tree: Hydration Strategy
Is the component visible on load?
├── Yes and critical interactive (search, auth) -> client:load
├── Yes but not urgent -> client:idle
└── No (below fold) -> client:visible
Is interactivity needed only on certain screen sizes?
├── Yes -> client:media with appropriate media query
└── No -> use the least aggressive directive from above
Decision Tree: Multi-Framework Selection
Do you already have a framework in the project?
├── Yes -> use that framework for all islands
└── No -> Choose:
├── SSR performance critical -> SolidJS or Preact (smaller runtime)
├── Team familiarity -> React (larger ecosystem)
└── Design-heavy -> Vue or Svelte (template-based)
Decision Tree: Content Type Selection
What kind of content are you managing?
├── Markdown/MDX blog posts -> content collection with type: 'content'
├── Structured data (authors, products) -> data collection with type: 'data'
├── Remote CMS (Sanity, Contentful) -> fetch in page frontmatter
└── Database-backed -> endpoint + client:load island, or SSR fetch
Decision Tree: Rendering Per Route
Does this route need real-time data or auth?
├── Yes -> export const prerender = false (server-rendered)
└── No -> Does it have dynamic params?
├── Yes -> getStaticPaths (pre-rendered at build)
└── No -> static .astro page (pre-rendered)
Decision Tree: Cross-Island Communication
Do two islands need to share state?
├── Only initial data -> pass as props from page frontmatter
├── Need to sync after mount -> CustomEvent on window
├── Persistent across navigation -> localStorage + storage event
└── Complex real-time sync -> WebSocket in a single island that manages all state
Component Design Patterns
Slot-Based Layout with Named Slots
---
interface Props {
title: string
description?: string
}
const { title, description } = Astro.props
---
<div class="layout">
<header>
<h1>{title}</h1>
{description && <p>{description}</p>}
</header>
<aside>
<slot name="sidebar" />
</aside>
<main>
<slot />
</main>
<footer>
<slot name="footer" />
</footer>
</div>
Conditional Island Rendering
---
import HeavyChart from '../components/HeavyChart.tsx'
const showChart = Astro.props.showChart
---
{showChart && <HeavyChart client:visible />}
Island with Skeleton Fallback
---
import Comments from '../components/Comments.tsx'
---
<div class="comments-section" style="min-height: 200px">
<Comments client:idle />
</div>
<style>
.comments-section {
background: linear-gradient(90deg, #eee
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
- references/astro-component-strategies.md
- references/astro-content-collections.md
- references/astro-integration-patterns.md
- references/astro-performance.md
- references/astro-routing.md
- references/astro-ssg.md
- references/content-patterns.md
- references/island-patterns.md
FAQ
Что делает скилл frontend-astro-patterns?
Use when the user asks about Astro island patterns, client:load / client:visible / client:idle, server islands, view transitions, Astro integrations, content collection queries or per-route prerendering. Produces hydration and rendering patterns for an existing Astro site. Not for initial Astro project setup (use frontend-astro-architecture).
Как установить скилл frontend-astro-patterns?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл frontend-astro-patterns запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
doc-coauthoring
AnthropicGuide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
academy-guide
AnthropicStop 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…
internal-comms
AnthropicA 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…
skill-development
AnthropicThis 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…