astro-architecturelisted
Install: claude install-skill casoon/ai-agent-config
# Astro architecture
## Goals
- Server-first, static-friendly by default.
- Minimize shipped client-side JavaScript.
- Use islands intentionally, not by default.
- Be explicit about SSG vs SSR vs hybrid per route.
## Structure
- `src/pages` for route entry points — keep files slim.
- `src/layouts` for page shells.
- `src/components` for reusable UI.
- `src/content` for structured editorial content.
- `public` for static assets that skip the module graph.
## Rules
- Prefer `.astro` components for presentational UI.
- Use framework components (Svelte, React, Vue) only where client-side interaction is actually needed.
- Move logic into utilities or domain modules — keep route files thin.
- Reuse layouts and content schemas instead of duplicating page logic.
- Cover SEO-critical metadata on every public page.
## Astro v6 API
### Content Collections — Loader API
```typescript
// src/content.config.ts (NOT src/content/config.ts)
import { defineCollection } from 'astro:content';
import { glob } from 'astro/loaders';
import { z } from 'astro/zod';
const blog = defineCollection({
loader: glob({ pattern: '**/*.{md,mdx}', base: './src/content/blog' }),
schema: z.object({
title: z.string(),
date: z.coerce.date(),
// Zod v4 top-level validators
email: z.email(), // not z.string().email()
website: z.url(), // not z.string().url()
}),
});
export const collections = { blog };
```
### Rendering content
```astro
---
import { getCollection, render } f