Skip to content

Project Scaffolding

The skill can scaffold complete Astro projects tailored to specific use cases. Each recipe creates the right file structure, configuration, and patterns for Astro v5.

A typical blog includes content collections, dynamic routing, and layouts for posts.

Files created:

FilePurpose
astro.config.mjsSitemap, MDX integrations
src/content.config.tsBlog collection with glob loader
src/layouts/BaseLayout.astroHTML shell with nav
src/layouts/BlogPostLayout.astroPost layout with metadata
src/pages/index.astroHome with recent posts
src/pages/blog/index.astroAll posts listing
src/pages/blog/[...slug].astroDynamic post pages
src/content/blog/Markdown posts directory

Key patterns:

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", base: "./src/content/blog" }),
schema: z.object({
title: z.string(),
description: z.string(),
pubDate: z.coerce.date(),
updatedDate: z.coerce.date().optional(),
heroImage: z.string().optional(),
draft: z.boolean().default(false),
tags: z.array(z.string()).default([]),
})
});
export const collections = { blog };

Interactive product pages with cart functionality using framework islands.

Files created:

FilePurpose
astro.config.mjsReact + Tailwind integrations
src/content.config.tsProducts collection (remote loader)
src/layouts/ShopLayout.astroLayout with cart sidebar
src/pages/products/index.astroProduct grid
src/pages/products/[id].astroProduct detail page
src/components/CartButton.jsxInteractive cart (client:load)
src/pages/api/checkout.tsPayment API endpoint

Key pattern — remote data loader:

const products = defineCollection({
loader: async () => {
const response = await fetch("https://api.stripe.com/products");
const data = await response.json();
return data.map((item) => ({ id: item.id, ...item }));
},
schema: z.object({
name: z.string(),
price: z.number(),
images: z.array(z.string().url()),
})
});

See the dedicated Starlight guide for full details.

Terminal window
npm create astro@latest -- --template starlight

Image-heavy project showcase with view transitions.

Files created:

FilePurpose
astro.config.mjsImage optimization config
src/content.config.tsProjects collection
src/layouts/BaseLayout.astroWith ViewTransitions
src/pages/index.astroHero + featured projects
src/pages/projects/[...slug].astroProject detail
src/components/ProjectCard.astroCard with transition:name

Key pattern — view transitions:

---
import { ViewTransitions } from 'astro:transitions';
---
<head>
<ViewTransitions />
</head>
<!-- Elements with matching transition:name animate between pages -->
<img transition:name={`project-${id}`} src={image} alt={title} />

Static, performance-focused single page.

Files created:

FilePurpose
astro.config.mjsMinimal config, tailwind
src/pages/index.astroFull landing page
src/components/Hero.astroHero section
src/components/Features.astroFeature grid
src/components/CTA.astroCall-to-action
src/components/Footer.astroFooter