Skip to content
Skills Library
Programming · Learning & explanation

astro

/astro

Astro 5+ knowledge base - Content Collections, Islands, SSG/SSR, integrations. Use when working on an Astro project, building static sites, or migrating from Next.js to Astro.

Repository
Synapse ↗
Licence
AGPL-3.0
Last repository change
15.09.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
4
Scripts
0
HTML comments
5
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 15.09.2026, without references to retired models or APIs.

Licence

AGPL-3.0, copyleft: przeróbki udostępniane innym muszą mieć tę samą licencję.

What to check before installing
  • SKILL.md zawiera komentarze HTML (5). Nie widać ich w podglądzie Markdown, a model je czyta.

What it does and when to use it

Astro 5+ knowledge base - Content Collections, Islands, SSG/SSR, integrations. Use when working on an Astro project, building static sites, or migrating from Next.js to Astro.

Original author description

Astro 5+ knowledge base - Content Collections, Islands, SSG/SSR, integrations. Use when working on an Astro project, building static sites, or migrating from Next.js to Astro.

How it works

  1. Setup
  2. Project Structure
  3. Pages
  4. Layouts
  5. Content Collections
  6. Islands Architecture (React)
  7. API Endpoints
  8. Image Optimization
  9. Integrations
  10. SSR Mode
Original SKILL.md headings · 229 lines, 513 words
SKILL.md preview
---
name: astro
description: Astro 5+ knowledge base - Content Collections, Islands, SSG/SSR, integrations. Use when working on an Astro project, building static sites, or migrating from Next.js to Astro.
version: 1.0.0
---

# Astro 5+ Knowledge Base

## Setup

```bash
npm create astro@latest -- --template minimal --typescript strict
```

## Project Structure

```
src/
├── pages/
│   ├── [locale]/
│   │   ├── index.astro
│   │   └── [...slug].astro
│   ├── api/
│   │   └── contact.ts
│   └── robots.txt.ts
├── layouts/
│   └── BaseLayout.astro
├── components/
│   ├── Header.astro
│   └── Footer.astro
├── content/
│   ├── config.ts
│   └── blog/
│       └── post-1.md
├── i18n/
│   ├── it.json
│   └── en.json
├── styles/
│   └── global.css
└── lib/
    └── utils.ts
```

## Pages

```astro
---
// src/pages/[locale]/index.astro
import BaseLayout from '../../layouts/BaseLayout.astro';
import { getTranslations } from '../../i18n';

const { locale } = Astro.params;
const t = getTranslations(locale);
---

<BaseLayout title={t.home.title}>
  <main>
    <h1>{t.home.heading}</h1>
    <p>{t.home.description}</p>
  </main>
</BaseLayout>
```

## Layouts

```astro
---
// src/layouts/BaseLayout.astro
interface Props {
  title: string;
  description?: string;
}

const { title, description = 'Default description' } = Astro.props;
---

<!DOCTYPE html>
<html lang={Astro.currentLocale || 'it'}>
<head>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width" />
  <meta name="description" content={description} />
  <title>{title}</title>
</head>
<body>
  <slot />
</body>
</html>
```

## Content Collections

```typescript
// src/content/config.ts
import { defineCollection, z } from 'astro:content';

const blog = defineCollection({
  type: 'content',
  schema: z.object({
    title: z.string(),
    description: z.string(),
    pubDate: z.date(),
    author: z.string(),
    image: z.string().optional(),
    tags: z.array(z.string()).default([]),
  }),
});

export const collections = { blog };
```

```astro
---
// src/pages/[locale]/blog/[slug].astro
import { getCollection } from 'astro:content';
import BaseLayout from '../../../layouts/BaseLayout.astro';

export async function getStaticPaths() {
  const posts = await getCollection('blog');
  return posts.map(post => ({
    params: { slug: post.slug, locale: 'it' },
    props: { post },
  }));
}

const { post } = Astro.props;
const { Content } = await post.render();
---

<BaseLayout title={post.data.title}>
  <article>
    <h1>{post.data.title}</h1>
    <Content />
  </article>
</BaseLayout>
```

## Islands Architecture (React)

```bash
npx astro add react
```

```astro
---
// Interactive React component
import Counter from '../components/Counter';
---

<!-- Static by default -->
<div>Static content</div>

<!-- Hydrate on load -->
<Counter client:load />

<!-- Hydrate when visible -->
<Counter client:visible />

<!-- Hydrate on idle -->
<Counter client:idle />

<!-- Hydrate on media query -->
<Counter client:media="(max-width: 768px)" />
```

## API Endpoints

```typescript
// src/pages/api/contact.ts
import type { APIRoute } from 'astro';

export const POST: APIRoute = async ({ request }) => {
  const data = await request.json();
  
  // Process...
  
  return new Response(JSON.stringify({ success: true }), {
    status: 200,
    headers: { 'Content-Type': 'application/json' },
  });
};
```

## Image Optimization

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

<Image
  src={heroImage}
  alt="Hero"
  widths={[400, 800, 1200]}
  sizes="(max-width: 800px) 100vw, 800px"
  format="webp"
/>
```

## Integrations

```bash
# Tailwind
npx astro add tailwind

# React
npx astro add react

# Sitemap
npx astro add sitemap

# MDX
npx astro add mdx
```

## SSR Mode

```javascript
// astro.config.mjs
export default defineConfig({
  output: 'server', // or 'hybrid'
  adapter: node({ mode: 'standalone' }),
});
```

## Best Practices

1. **Zero JS by default** - Only add client: when needed
2. **Content Collections** - Type-safe content management
3. **Islands** - Partial hydration for interactivity
4. **Image optimization** - Use astro:assets
5. **Static first** - Use SSG, SSR only when needed
Files in this package (4)
  • SKILL.md 4 KB
  • learnings.md 1 KB
  • evals/evals.json 2 KB
  • evals/trigger_evals.json 1 KB

Versions

RepositoryScoreLicence
This page · PIXARTSeu/Synapse100AGPL-3.0
ericrisco/rsc-harness100MIT
TerminalSkills/skills100Apache-2.0
devantler-tech/ksail100MIT
claude-dev-suite/claude-dev-suite100MIT
lynricsy/hyperskills100MIT
G1Joshi/Agent-Skills100MIT
chrishuffman5/domain-expert100MIT
pingqLIN/skill-0100MIT

Database snapshot: 13.11.2026 · package version e35cec38e6f3 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100astro-ops
    Astro framework patterns, islands architecture, content collections, rendering strategies, and deployment. Use for: astro, islands architecture, content collections, astro cloudflare, view transitions, partial hydration, astrojs, SSG, SSR, hybrid rendering, astro adapter.
  • 100astro-islands-architect
    Use when building content-heavy sites with Astro, deciding between SSG/SSR/hybrid, choosing client directives (idle/visible/load/media), structuring content collections with type-safe schemas, integrating React/Vue/Solid/Svelte components in the same project, or migrating from…
  • 90frontend-astro-architecture
    Use this skill when the user says 'Astro', 'Astro architecture', 'Astro islands', 'Astro component', 'Astro page', 'Astro content collection', 'Astro SSG', 'Astro SSR', '.astro file'. This skill enforces: zero-JS-by-default component model, island architecture with client:*…
  • 100astro-static-islands
    Use this skill when building content-focused websites using Astro static islands architecture to achieve near-zero client-side JavaScript.
  • 100ssr
    Server-Side Rendering, Static Site Generation, Incremental Static Regeneration, Islands Architecture, Streaming SSR, and React Server Components. Covers Next.js, Nuxt, Remix, SvelteKit, and Astro in depth. USE FOR: server-side rendering, SSG, ISR, Islands Architecture, streaming…
  • 90astro-guide
    Use when editing or scaffolding Astro sites with islands architecture. Triggers on `.astro` files, `astro:content` imports, `Astro.props`, `client:` hydration directives, content-collection schemas, and on prompts about pages, layouts, MDX, content collections, image…

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.