Set up a new Astro Starlight documentation site from scratch. Use when creating a new Starlight project, adding Starlight to an existing Astro project, or configuring core options like sidebar, logo, social links, and page layout.
87%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
Passed
No findings from the security scan
Starlight is a full-featured documentation theme built on Astro. It ships with routing, search, dark mode, i18n, and accessibility — configure features rather than build them.
starlight-theme insteadstarlight-custom-component insteadStarlight = Astro integration + file-based routing + content collections.
starlight({}) in astro.config.mjs. No separate config file..md / .mdx under src/content/docs/ becomes a URL. File path = URL route.autogenerate.npm create astro@latest -- --template starlight
npm run devTo add Starlight to an existing Astro project:
npx astro add starlightAll options live inside starlight({}). See configuration-reference.md for the full option table.
import { defineConfig } from 'astro/config';
import starlight from '@astrojs/starlight';
export default defineConfig({
site: 'https://mydocs.example.com', // Required for sitemap
integrations: [
starlight({
title: 'My Docs',
logo: { src: './src/assets/logo.svg' },
social: [
{ icon: 'github', label: 'GitHub', href: 'https://github.com/my-org/repo' },
],
sidebar: [
{
label: 'Guides',
items: [
{ label: 'Getting Started', slug: 'guides/getting-started' },
],
},
{ label: 'Reference', autogenerate: { directory: 'reference' } },
],
editLink: { baseUrl: 'https://github.com/my-org/repo/edit/main/docs/' },
customCss: ['./src/styles/custom.css'],
}),
],
});Create .md or .mdx files under src/content/docs/:
---
title: My Page Title
description: A short description for SEO.
---
Content goes here.Use template: splash for landing pages, draft: true to exclude from builds:
---
title: Home
template: splash
hero:
tagline: Welcome to my docs
---src/content/docs/WHY: Starlight's routing only picks up files inside src/content/docs/. Consequence: Pages silently won't appear.
BAD: Create .md in src/pages/.
GOOD: Create .md in src/content/docs/.
src inside logo alongside light/darkWHY: Mutually exclusive. src is for a single logo; light/dark are for variants. Consequence: Config error.
BAD: logo: { src: './logo.svg', light: './light.svg' }
GOOD:
logo: { light: './src/assets/light-logo.svg', dark: './src/assets/dark-logo.svg' }WHY: Slugs map to paths under src/content/docs/ with no leading slash and no .md extension. Consequence: Sidebar links 404.
BAD: slug: '/guides/setup.md'
GOOD: slug: 'guides/setup'
site inside starlight({}) for sitemapWHY: Sitemap generation requires site at the defineConfig level. Consequence: Sitemap not generated.
BAD: starlight({ site: 'https://...' })
GOOD: defineConfig({ site: 'https://...' })
autogenerate with items in the same sidebar groupWHY: A group uses either items or autogenerate, not both. Consequence: Build error.
BAD: { label: 'Guides', items: [...], autogenerate: { directory: 'guides' } }
GOOD: Choose one approach per group.
WHY: All options live inside starlight({}) in astro.config.mjs. Consequence: Options in another file are never read.
BAD: Create starlight.config.mjs with title and sidebar.
GOOD: Put title and sidebar inside starlight({}).
WHY: Sidebar and routing are independent unless you use autogenerate. Consequence: Reachable pages missing from navigation.
BAD: Add guides/setup.md and expect a sidebar entry.
GOOD: Add a slug: 'guides/setup' entry, or use autogenerate for the directory.
astro add starlight existsWHY: For an existing Astro project, npx astro add starlight installs the package and updates astro.config.mjs for you. Consequence: Manual edits risk a half-wired integration.
BAD: npm install @astrojs/starlight followed by manual config edits.
GOOD: npx astro add starlight
draft: trueWHY: draft: true excludes the page from production builds. Consequence: Unfinished pages go live.
BAD: Commit an unfinished page with only title in frontmatter.
GOOD: Add draft: true to its frontmatter until it is ready.
WHY: Those are separate concerns with their own skills. Consequence: Mixed guidance and wrong patterns.
BAD: Override Header here.
GOOD: Use starlight-theme for CSS variables and Tailwind and starlight-custom-component for component overrides.
| Topic | Reference | When to Use |
|---|---|---|
| Configuration options | Configuration Reference | Looking up the full option table |
| Getting started | Starlight Getting Started | Scaffolding a project |
| Configuration | Configuration Options | Checking option semantics |
| Frontmatter | Frontmatter Reference | Setting page fields such as template and draft |
| Sidebar | Sidebar Navigation Guide | Building navigation |
| Pages | Pages Guide | Adding content pages |
pantheon-org/tekhne
c8416e9
Also appears in
last in sync Aug 28, 2026
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.