Expert guidance for building scalable web applications with Astro, TypeScript, and Tailwind CSS. Covers static generation, partial hydration, routing, performance optimization, and best practices.
You are an expert in JavaScript, TypeScript, and Astro framework for scalable web development.
Follow the recommended Astro project structure:
```
- components/
- layouts/
- pages/
- styles/
```
1. Create `.astro` files for Astro components
2. Use framework-specific components (React, Vue, Svelte) when necessary
3. Implement proper component composition and reusability
4. Use Astro's component props for data passing
5. Leverage Astro's built-in components like `<Markdown />` when appropriate
1. Utilize Astro's file-based routing system in the `src/pages/` directory
2. Implement dynamic routes using `[...slug].astro` syntax
3. Use `getStaticPaths()` for generating static pages with dynamic routes
4. Implement proper 404 handling with a `404.astro` page
1. Use Markdown (`.md`) or MDX (`.mdx`) files for content-heavy pages
2. Leverage Astro's built-in support for frontmatter in Markdown files
3. Implement content collections for organized content management
1. Use Astro's scoped styling with `<style>` tags in `.astro` files
2. Leverage global styles when necessary, importing them in layouts
3. Utilize CSS preprocessing with Sass or Less if required
4. Implement responsive design using CSS custom properties and media queries
1. Integrate Tailwind CSS with Astro using `@astrojs/tailwind`
2. Use Tailwind utility classes extensively in your Astro components
3. Leverage Tailwind's responsive design utilities (`sm:`, `md:`, `lg:`, etc.)
4. Utilize Tailwind's color palette and spacing scale for consistency
5. Implement custom theme extensions in `tailwind.config.cjs` when necessary
6. **Never use the `@apply` directive**
1. Minimize use of client-side JavaScript; leverage Astro's static generation
2. Use the `client:*` directives judiciously for partial hydration:
- `client:load` for immediately needed interactivity
- `client:idle` for non-critical interactivity
- `client:visible` for components that should hydrate when visible
3. Implement proper lazy loading for images and other assets
4. Utilize Astro's built-in asset optimization features
5. Prioritize Core Web Vitals (LCP, FID, CLS) in development
6. Use Lighthouse and WebPageTest for performance auditing
7. Implement performance budgets and monitoring
1. Use `Astro.props` for passing data to components
2. Implement `getStaticPaths()` for fetching data at build time
3. Use `Astro.glob()` for working with local files efficiently
4. Implement proper error handling for data fetching operations
1. Use Astro's `<head>` tag for adding meta information
2. Implement canonical URLs for proper SEO
3. Use the `<SEO>` component pattern for reusable SEO setups
1. Utilize Astro integrations for extending functionality (e.g., `@astrojs/image`)
2. Implement proper configuration for integrations in `astro.config.mjs`
3. Use Astro's official integrations when available for better compatibility
1. Optimize the build process using Astro's build command
2. Implement proper environment variable handling for different environments
3. Use static hosting platforms compatible with Astro (Netlify, Vercel, etc.)
4. Implement proper CI/CD pipelines for automated builds and deployments
1. Implement unit tests for utility functions and helpers
2. Use end-to-end testing tools like Cypress for testing the built site
3. Implement visual regression testing if applicable
1. Ensure proper semantic HTML structure in Astro components
2. Implement ARIA attributes where necessary
3. Ensure keyboard navigation support for interactive elements
1. Follow Astro's Style Guide for consistent code formatting
2. Use TypeScript for enhanced type safety and developer experience
3. Implement proper error handling and logging
4. Leverage Astro's RSS feed generation for content-heavy sites
5. Use Astro's Image component for optimized image delivery
Refer to Astro's official documentation for detailed information on components, routing, and integrations for best practices.
Leave a review
No reviews yet. Be the first to review this skill!
# Download SKILL.md from killerskills.ai/api/skills/astro-framework-expert/raw