astro

Implements Astro page, layout, and routing conventions for server-rendered public pages.

Updated Sep 6, 2026
One-click install
npx skills add https://github.com/malikkotb/shellpluscore --skill astro-malikkotb
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: astro
Source: https://github.com/malikkotb/shellpluscore/tree/main/.agents/skills/astro
Command: npx skills add https://github.com/malikkotb/shellpluscore --skill astro-malikkotb

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? It enforces consistent Astro page architecture in this repository: every public page composes the single Web.astro shell, logic stays in the frontmatter, and dynamic routes fetch Sanity data on demand without getStaticPaths or prerendering. ## Core Features & Use Cases - Layout composition: Routes pass typed SEO Props (title, canonical, robots, noindex) to Web.astro and inject per-page meta through the head slot. - On-demand dynamic routing: Pages read Astro.params, fetch with loadQuery, and return a 404 Response when no document matches. - Draft mode and URL safety: Draft state is read per request via the sanity-preview-perspective cookie, and all absolute URLs are built with absoluteUrl instead of concatenating PUBLIC_SITE_URL. - Use Case: When adding a new blog route under src/pages/, apply this Skill to compose Web.astro, fetch the post with loadQuery, set canonical and og tags via the head slot, and gate preview behavior on the draft-mode cookie. ## Quick Start Use the astro skill to add a new dynamic route under src/pages that composes Web.astro and fetches its Sanity document with loadQuery.

Frequently Asked Questions about astro

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create a dynamic route in Astro with on-demand rendering?

Create a file like src/pages/[...uri].astro, read Astro.params in the frontmatter, fetch data with loadQuery, and return a 404 Response when nothing matches. This repo uses output: "server", so no getStaticPaths or prerendering is needed.

How do I add SEO meta tags to an Astro page layout?

Pass typed Props such as title, description, canonical, and robots to the Web.astro layout, and inject per-page tags through the named head slot using a Fragment. Defaults like og:type and twitter:card live in the layout itself.

Does Astro draft mode work with Sanity preview content?

Yes. Draft state is read per request from the sanity-preview-perspective cookie via the src/sanity/lib/draft-mode.ts helpers, and the perspective is passed into loadQuery so it fetches the drafts perspective with stega overlays.

Why should I avoid concatenating PUBLIC_SITE_URL in Astro pages?

PUBLIC_SITE_URL is a hand-edited env value that may carry a trailing slash, producing double slashes in canonicals and share links. The absoluteUrl helper in src/lib/env.ts normalizes and joins paths, and a guard test fails builds that concatenate the raw value.

When should logic go in the Astro frontmatter instead of the template?

Branching and data fetching belong in the frontmatter with early returns and named constants. Templates stay thin, limited to conditional rendering, a short ternary, or a map, with no nested ternaries in markup.