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.
- Author
- PIXARTSeu ↗
- Repository
- Synapse ↗
- Licence
- AGPL-3.0
- Last repository change
- 15.09.2026
Assessment and security
- Files in this package
- 4
- Scripts
- 0
- HTML comments
- 5
- URLs in SKILL.md
- 0
No signals detected. Repository changed on 15.09.2026, without references to retired models or APIs.
AGPL-3.0, copyleft: przeróbki udostępniane innym muszą mieć tę samą licencję.
- 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
- Setup
- Project Structure
- Pages
- Layouts
- Content Collections
- Islands Architecture (React)
- API Endpoints
- Image Optimization
- Integrations
- SSR Mode
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
| Repository | Score | Licence |
|---|---|---|
| This page · PIXARTSeu/Synapse | 100 | AGPL-3.0 |
| ericrisco/rsc-harness | 100 | MIT |
| TerminalSkills/skills | 100 | Apache-2.0 |
| devantler-tech/ksail | 100 | MIT |
| claude-dev-suite/claude-dev-suite | 100 | MIT |
| lynricsy/hyperskills | 100 | MIT |
| G1Joshi/Agent-Skills | 100 | MIT |
| chrishuffman5/domain-expert | 100 | MIT |
| pingqLIN/skill-0 | 100 | MIT |
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…