roninforge/roninforge-astro/astro-new-page

Claude Code and agent skill by roninforge/roninforge-astro

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Scaffold a new Astro 6 page in src/pages with optional dynamic [param] segment, optional export const prerender flag (true for SSG, false for SSR opt-in), and optional getStaticPaths skeleton when the route is dynamic + prerendered. Refuses lowercase HTTP method exports for endpoints, refuses output:'hybrid' references, refuses raw <img> tags, refuses <ViewTransitions> (use ClientRouter), and requires alt on all <Image> components. Pairs with the astro-routing-and-endpoints, astro-output-and-prerender, and astro-anti-patterns rules.

Install

npx vskill@latest install roninforge/roninforge-astro/astro-new-page

SKILL.md

The same SKILL.md was published earlier as roninforge/roninforge-astro/astro-new-page.

Scaffold a New Astro 6 Page

When to use

Use when:

  • Adding a new file under src/pages/ (static or dynamic)
  • Adding a new endpoint under src/pages/api/ (TypeScript file with APIRoute)
  • Converting a getStaticPaths route from Astro 4 to Astro 5+ (drop entry.slug, use entry.id)

Target: astro ^6.3.3. The companion astro-routing-and-endpoints, astro-output-and-prerender, and astro-anti-patterns rules cover the surrounding patterns.

Output

For a route /blog/[id] with prerendering, the scaffold writes one file.

src/pages/blog/[id].astro
astro
---
import { getCollection, getEntry, render } from 'astro:content'
import Base from '../../layouts/Base.astro'
export const prerender = true
export async function getStaticPaths() {
const posts = await getCollection('blog')
return posts.map(post => ({ params: { id: post.id }, props: { post } }))
}
const { post } = Astro.props
const { Content } = await render(post)
---
<Base title={post.data.title}>
<article>
<h1>{post.data.title}</h1>
<time datetime={post.data.publishedAt.toISOString()}>
{post.data.publishedAt.toLocaleDateString()}
</time>
<Content />
</article>
</Base>

For an SSR endpoint at /api/health:

src/pages/api/health.ts
ts
import type { APIRoute } from 'astro'
export const GET: APIRoute = async () => {
return new Response(JSON.stringify({ ok: true, ts: Date.now() }), {
headers: { 'Content-Type': 'application/json' },
})
}

Workflow

  1. Decide the route shape: static (/about.astro), dynamic (/blog/[id].astro), rest (/blog/[...slug].astro), or endpoint (/api/x.ts).
  2. Decide rendering: prerendered (export const prerender = true) or per-request. In output: 'static', prerendered is the default; in output: 'server', you must opt in.
  3. For prerendered dynamic routes, write getStaticPaths returning { params, props }. Pull entries from a content collection or other build-time source.
  4. For SSR routes, read Astro.params.id and Astro.locals.user directly; getStaticPaths is silently ignored (anti-pattern #13).
  5. Use the layout for the head + ClientRouter; do not duplicate the <head> per page.

Examples

Static page
astro
---
// src/pages/about.astro
import Base from '../layouts/Base.astro'
---
<Base title="About">
<h1>About</h1>
</Base>
Dynamic SSR page
astro
---
// src/pages/dashboard/[orgId].astro - in output: 'server'
import { getEntry } from 'astro:content'
const { user } = Astro.locals
if (!user) return Astro.redirect('/login')
const org = await db.orgs.byId(Astro.params.orgId!)
if (!org) return new Response('Not found', { status: 404 })
---
<h1>{org.name}</h1>

Common mistakes

  • getStaticPaths in an SSR route without prerender = true (silently ignored).
  • Lowercase HTTP method export (export function get); must be uppercase GET.
  • <img src="/src/..."> for a local image; use <Image> from astro:assets.
  • <ViewTransitions /> instead of <ClientRouter /> (renamed in 5.0).
  • Astro.glob('../content/*.md') (removed in 5.0; use a content collection).

Security

  • Security scanPassed, 100 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
5

Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/roninforge/roninforge-astro/astro-new-page/badge)](https://verified-skill.com/skills/roninforge/roninforge-astro/astro-new-page)

Something wrong with this skill or its page? Tell us.