Home › Astro › Astro Starlight docs Windsurf rules

Astro Starlight docs Windsurf rules

Windsurf rules for documentation sites built with Astro Starlight: content structure, frontmatter, components, and links.

WindsurfAstro

How to use

Save this as .windsurf/rules/starlight.md in your repository root, commit it, and your agent will pick it up automatically. Edit the commands to match your project.

Note: Review and test before use. Provided as is, without warranty. See Terms.

.windsurf/rules/starlight.mdDownload  
---
trigger: glob
globs: src/content/docs/**,astro.config.mjs
---

# Astro Starlight docs

- Pages live in `src/content/docs/` as `.md`/`.mdx`. The file path is the URL; use lowercase kebab-case names.
- Every page has frontmatter with `title` and `description`; set `sidebar: { order, label, badge }` when ordering matters.
- Sidebar structure is configured in `astro.config.mjs` (`starlight({ sidebar: [...] })`), using `autogenerate: { directory: 'guides' }` for folders. Update it when adding sections.
- Use built-in components in `.mdx` from `@astrojs/starlight/components`: `<Aside type="tip|note|caution|danger">`, `<Tabs>`/`<TabItem>`, `<Steps>`, `<Card>`/`<CardGrid>`, `<LinkCard>`, `<FileTree>`, `<Code>`. Don't hand-build callouts with raw HTML.
- Code blocks have a language and, when useful, a title (```` ```ts title="src/env.ts" ````). Use Expressive Code features (line highlights, `ins`/`del`) instead of comments like "// changed".
- Internal links are root-relative without the file extension (`/guides/install/`); check that they resolve.
- Images go in `src/assets/` and are referenced relatively so Astro optimizes them; always include alt text.
- Structure: Getting started -> Guides (tasks) -> Reference (APIs/config) -> Concepts. One topic per page.
- For i18n sites, add translations under the locale folder with the same file path.

## Done
`npm run build` succeeds (it fails on broken internal links if link validation is configured) and the page appears in the sidebar where expected.

More: all Astro rules · all Windsurf rules

Related rules

Astro content site rules

Cursor rules for Astro 5 sites with content collections, islands, and zero-JS-by-default pages.

CursorAstro

Next.js Windsurf rules

Windsurf (Cascade) workspace rules for Next.js + shadcn/ui projects.

WindsurfNext.js

Svelte 5 runes Windsurf rules

Windsurf rules for Svelte 5 components with runes ($state, $derived, $props) in SvelteKit 2 apps.

WindsurfSvelteKit

Tailwind CSS v4 rules

Windsurf rules for clean, consistent, accessible Tailwind CSS v4 styling.

WindsurfTailwind CSS

Angular 20 Copilot instructions

Copilot instructions for Angular 20 apps using standalone components, signals, and the new control flow.

GitHub CopilotAngular

Chrome extension (Manifest V3) rules

Cursor rules for building Manifest V3 browser extensions with TypeScript and minimal permissions.

CursorChrome extensions

Get new rules weekly

One email a week: fresh rule files, agent tips, and what's changing in Cursor, Claude Code and Copilot. Free, unsubscribe anytime.

Opens the Rulestack Newsletter on beehiiv in a new tab. Or subscribe directly on beehiiv.