agentsclimarketplace

Astro

Skill ianshk/astro-skills/skills/astro

Agent Skill for building static sites with Astro

Install
npx -y skills add ianshk/astro-skills --skill astro

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 2 stars2 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its author says it does

Copied from the file, not written here

Skill for building static sites with the Astro web framework. Helps create Astro components and pages, set up content collections, optimize images, configure SEO, and deploy static builds. Use when the user needs to work with Astro, mentions .astro files, asks about static site generation (SSG), islands architecture, content collections, or deploying an Astro project.

The file declares its own license as MIT. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.

SKILL.md

4.8 KB, as published. Nobody here has run it

Astro Skill

Reference for building static Astro sites (output: 'static'). Covers architecture decisions, content collections, SEO, image optimization, pagination, and deployment patterns.

Consult docs.astro.build and llms.txt for latest APIs when needed.


References

Read these files for detailed patterns and templates:

ReferenceWhat it covers
content-collections.mdSchemas (z.image, z.enum, reference()), querying, dynamic routes, entry.body
image-optimizations.md<Image /> component, downscaling tip, SVG components, aspect ratios
seo-checklist.mdHead component, per-page checklist, structured data (JSON-LD), hreflang, content rules
pagination.mdpaginate(), nested pagination, page prop

Architecture Rules

1. Astro-first

  • .astro files for everything presentational — zero JS shipped to client.
  • Framework components (.tsx, .svelte, .vue, etc.) only when interactivity is needed.

2. Minimal hydration

Use the lightest client:* directive that works:

DirectiveUse case
client:loadCritical above-the-fold interactivity
client:idleNon-critical (modals, popovers)
client:visibleBelow-the-fold widgets
client:mediaScreen-size-specific UI (e.g. mobile sidebar toggle)
client:only="<framework>"Browser-only APIs (e.g. localStorage, WebGL)

3. Keep islands small

  • Wrap only the interactive subtree in a framework component. Surrounding static markup stays in .astro.
  • Pass data via props from the .astro parent — never refetch inside islands.

4. Fonts via Fontsource

Always install fonts locally via Fontsource npm packages — never Google Fonts CDN links.

Example if using Inter

npm install @fontsource-variable/inter

Key Patterns

Layout & Head

Use src/layouts/Layout.astro as the base layout. Import with @/layouts/Layout.astro.

Use src/components/Head.astro for SEO meta tags, Open Graph, Twitter Cards, canonical URLs, and JSON-LD structured data. Import it inside your layout — see seo-checklist.md for the full component and per-page checklist.

Sitemap

Always include @astrojs/sitemap — it auto-generates sitemap-index.xml at build time. Install and add it to integrations in astro.config.mjs:

npx astro add sitemap

Exclude admin pages, API routes, and utility pages from the sitemap.

robots.txt

Create src/pages/robots.txt.ts — Astro will build it into a static robots.txt file at the site root. It dynamically references the sitemap URL using Astro.site:

import type { APIRoute } from 'astro';

const getRobotsTxt = (sitemapURL: URL) => `\
User-agent: *
Allow: /

Sitemap: ${sitemapURL.href}
`;

export const GET: APIRoute = ({ site }) => {
  const sitemapURL = new URL('sitemap-index.xml', site);
  return new Response(getRobotsTxt(sitemapURL));
};

This requires site to be set in astro.config.mjs so the sitemap URL resolves correctly.

Image optimization

Always use <Image /> from astro:assets — not <img> tags. Set explicit width/height to downscale large source images (e.g., 10000×10000 → 1024×1024 = smaller WebP output).

Content collections (v5+)

  • Config at src/content.config.ts (NOT src/content/config.ts)
  • Every collection needs a loader (use glob from astro/loaders)
  • Use z.image() for validated, optimized image fields
  • Use z.enum() for constrained values instead of booleans
  • Use reference() for relations between collections

Static output

  • Always use output: 'static' (the default) — all pages are pre-rendered to HTML at build time.
  • Do NOT use output: 'hybrid' — removed in Astro v5.
  • Do NOT use output: 'server' or SSR adapters.

Trailing slashes

  • Set trailingSlash: 'always' in astro.config.mjs to enforce trailing slashes on all generated URLs.
  • Always use trailing slashes in internal links (/about/ not /about) to avoid duplicate content issues.

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.