본문으로 건너뛰기
cccskills
무료GitHub에 공개

astro

Astro framework patterns and best practices for content-focused sites. Trigger: When working with .astro files, content collections, or Astro routing.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

설치 방법 보기

포함된 파일(1)

  • SKILL.md6.7 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

Astro Framework Skill

Conventions for building content-focused, high-performance websites with Astro.

When to Use

  • Creating or modifying .astro components
  • Working with content collections (blog, articles, resume)
  • Configuring Astro routing and layouts
  • Optimizing performance with island architecture
  • Integrating Vue components as islands

Critical Patterns

1. Island Architecture - Server First

ALWAYS minimize client-side JavaScript. Astro ships zero JS by default.

Compare these patterns: Static vs Interactive

Static component – No JavaScript shipped to the client:

---
import Header from '../components/Header.astro';
---
<Header title="Welcome" />

Interactive island – JavaScript loaded only for this component (uses client:visible):

---
import Counter from '../components/Counter.vue';
---
<Counter client:visible />

2. Hydration Directives

DirectiveWhen to Use
client:loadCritical interactivity needed immediately
client:idleNon-critical, can wait for browser idle
client:visibleBelow the fold, hydrate on scroll
client:media="(max-width: 768px)"Mobile-only interactivity
client:only="vue"No SSR, client-only rendering (see note)

Default choice: client:visible unless there's a reason otherwise.

[!WARNING] client:only trade-offs Components using client:only skip server-side rendering entirely, which increases the client JS payload and can harm SEO since no HTML is rendered initially. Use only for:

  • Third-party widgets that cannot render on the server
  • Complex client-only UI (e.g., canvas, WebGL, maps)
  • Non-SEO-critical parts of the page (modals, admin dashboards)

3. Component Structure

Props typing options: Astro supports both runtime access via Astro.props and compile-time typing.

---
// 1. Type definitions FIRST
type Props = {
  title: string;
  description?: string;
  isActive?: boolean;
};

// 2. Props destructuring with defaults (runtime access)
const { title, description, isActive = false } = Astro.props;

// 3. Imports and logic
import { getCollection } from 'astro:content';
const posts = await getCollection('articles');
---

<!-- 4. Template -->
<section class:list={["hero", { active: isActive }]}>
  <h1>{title}</h1>
  {description && <p>{description}</p>}
  <slot />
</section>

<!-- 5. Scoped styles -->
<style>
  .hero {
    padding: var(--space-8);
  }
</style>

4. Content Collections

ALWAYS define schemas for type safety (see src/content.config.ts):

// src/content.config.ts
import {defineCollection, z, reference} from 'astro:content';
import {glob} from 'astro/loaders';

const articles = defineCollection({
  loader: glob({pattern: '**/*.{md,mdx}', base: './src/data/articles'}),
  schema: ({image}) => z.object({
    title: z.string(),
    description: z.string(),
    date: z.coerce.date(),
    cover: image().optional(),
    author: reference('authors'),
    tags: z.array(reference('tags')),
    category: reference('categories'),
    draft: z.boolean().optional().default(false),
  }),
});

export const collections = {articles};

5. Image Optimization

ALWAYS use Astro's Image component:

---
import { Image } from 'astro:assets';
import heroImage from '../assets/hero.jpg';
---

<!-- ✅ Optimized, responsive -->
<Image
  src={heroImage}
  alt="Hero banner"
  width={1200}
  height={600}
  format="webp"
/>

<!-- ❌ NEVER use raw img for local images -->
<img src="/hero.jpg" alt="Hero" />

Project Structure (This Portfolio)

apps/portfolio/
├── src/
│ ├── pages/ # File-based routing
│ ├── components/
│ │ ├── atoms/ # Smallest elements
│ │ ├── molecules/ # Atom combinations
│ │ └── organisms/ # Full sections
│ ├── layouts/ # BaseLayout.astro, etc.
│ ├── data/ # Content collections
│ │ ├── articles/ # Blog posts (MDX)
│ │ ├── resume/ # Resume JSON by locale
│ │ ├── tags/ # Tag definitions
│ │ └── authors/ # Author profiles
│ ├── core/ # Business logic (domain)
│ ├── lib/ # Utilities
│ ├── i18n/ # Internationalization
│ └── styles/ # Global CSS (Tailwind)
├── public/ # Static assets
└── astro.config.mjs

Anti-Patterns

❌ Shipping unnecessary JS - Use .astro for static content ❌ Using client:load everywhere - Most components don't need immediate hydration ❌ Raw <img> tags - Use <Image> for optimization ❌ Inline styles for everything - Use scoped <style> blocks ❌ Hardcoded meta tags - Use a reusable BaseHead.astro

SEO Pattern

---
// BaseHead.astro
type Props = {
  title: string;
  description: string;
  image?: string;
};

const { title, description, image } = Astro.props;
const canonicalURL = new URL(Astro.url.pathname, Astro.site);
---

<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="canonical" href={canonicalURL} />
<title>{title}</title>
<meta name="description" content={description} />
<meta property="og:title" content={title} />
<meta property="og:description" content={description} />
<meta property="og:url" content={canonicalURL} />
{image && <meta property="og:image" content={new URL(image, Astro.site)} />}

Commands

Astro CLI Usage: Use pnpm exec astro or pnpm --filter portfolio exec astro

# Development
pnpm --filter=portfolio dev

# Build
pnpm --filter=portfolio build

# Preview production build
pnpm --filter=portfolio preview

# Running Astro CLI commands directly
pnpm --filter=portfolio exec astro check      # Type-check .astro files
pnpm --filter=portfolio exec astro add vue    # Add integrations

Integration with Vue

When using Vue components as islands:

---
import InteractiveWidget from '../components/InteractiveWidget.vue';
---

<!-- Pass props, use appropriate hydration -->
<InteractiveWidget
  client:visible
  title="Dashboard"
  :items={data.items}
/>

Resources

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Audit and improve web accessibility following WCAG 2.1 guidelines. Use when the task involves `improve accessibility`, `a11y audit`, `WCAG compliance`, `screen reader support`, `keyboard navigation`, or `make accessible`.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

yacosta738/yacosta738.github.io472026년 10월 19일 업데이트

astro

무료

Skill for building with the Astro web framework. Helps create Astro components and pages, configure SSR adapters, set up content collections, deploy static sites, and manage project structure and CLI commands. Use when the user needs to work with Astro, mentions .astro files, asks about static site generation (SSG), islands architecture, content collections, or deploying an Astro project.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

yacosta738/yacosta738.github.io472026년 10월 19일 업데이트

Apply modern web development best practices for security, compatibility, and code quality. Use when the task involves `apply best practices`, `security audit`, `modernize code`, `code quality review`, or `check for vulnerabilities`.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

yacosta738/yacosta738.github.io472026년 10월 19일 업데이트

Comprehensive Cloudflare platform skill covering Workers, Pages, storage (KV, D1, R2), AI (Workers AI, Vectorize, Agents SDK), networking (Tunnel, Spectrum), security (WAF, DDoS), and infrastructure-as-code (Terraform, Pulumi). Use for any Cloudflare development task. Biases towards retrieval from Cloudflare docs over pre-trained knowledge.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

yacosta738/yacosta738.github.io472026년 10월 19일 업데이트

Deploy applications and infrastructure to Cloudflare using Workers, Pages, and related platform services. Use when the user asks to deploy, host, publish, or set up a project on Cloudflare.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

yacosta738/yacosta738.github.io472026년 10월 19일 업데이트

Optimize Core Web Vitals (LCP, INP, CLS) for better page experience and search ranking. Use when the task involves `improve Core Web Vitals`, `fix LCP`, `reduce CLS`, `optimize INP`, `page experience optimization`, or `fix layout shifts`.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

yacosta738/yacosta738.github.io472026년 10월 19일 업데이트

yacosta738의 스킬 모두 보기

이 스킬의 문제 신고