astro-setup
Astro project initialization and configuration patterns. Use when setting up new Astro projects or configuring Astro features.
When & Why to Use This Skill
This Claude skill streamlines the initialization and configuration of Astro web projects. It provides standardized patterns for project scaffolding, essential integrations like React and Tailwind CSS, and optimized configuration for static site hosting on platforms like GitHub Pages. By automating the boilerplate setup and best-practice configurations, it ensures a robust foundation for modern web development.
Use Cases
- Rapid Scaffolding: Quickly initialize new Astro projects with strict TypeScript settings and minimal templates to jumpstart development.
- Integration Management: Seamlessly add and configure popular frameworks and tools including React, MDX, and Tailwind CSS using verified configuration patterns.
- Deployment Optimization: Automatically configure 'astro.config.mjs' for static site generation (SSG) and GitHub Pages, including proper site, base path, and image optimization settings.
- Content Modeling: Implement type-safe content collections using Zod schemas to manage Markdown and MDX content with high reliability.
| name | astro-setup |
|---|---|
| description | Astro project initialization and configuration patterns. Use when setting up new Astro projects or configuring Astro features. |
Astro Setup Skill
Project Initialization
npm create astro@latest project-name -- --template minimal --typescript strict
cd project-name
Essential Integrations
npx astro add react
npx astro add mdx
npx astro add tailwind
Configuration Pattern
// astro.config.mjs
import { defineConfig } from 'astro/config';
import react from '@astrojs/react';
import mdx from '@astrojs/mdx';
import tailwind from '@astrojs/tailwind';
export default defineConfig({
site: 'https://username.github.io',
base: '/repo-name', // or '/' for user pages
integrations: [react(), mdx(), tailwind()],
output: 'static', // Required for GitHub Pages
image: {
service: {
entrypoint: 'astro/assets/services/sharp'
}
}
});
Content Collections
Content collections go in src/content/ with a config.ts file defining schemas using Zod.
Best Practices
- Use
output: 'static'for GitHub Pages - Configure
siteandbasefor proper asset paths - Enable image optimization
- Keep integrations minimal