starlight-conventions
Skill7 starsChanged 4 days agoMITView on GitHub
Astro Starlight documentation sites: setup, theme, links, versions, `llms.txt`. TRIGGER when: editing a Starlight site (`astro.config.*` with `@astrojs/starlight`, `src/content/docs/`); moving Markdown docs into a site; setting up GitHub or GitLab Pages for docs; user asks about a docs site, doc versions or `llms.txt`. SKIP when: plain Markdown with no site generator, or another generator (MkDocs, Docusaurus, …).
1 other project uses a version of this.
Adopted by
Most recently taken up by
- leroyguillaume/skillsword for word, first seen Nov 22, 2026
Other versions1 project uses a version of this.
Word for word · 1
- leroyguillaume/skills★ 7100% same
Edited · 0
None found.
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository54 other files it gives its agents.
- adr-conventionsSkill
- api-conventionsSkill
- architecture-conventionsSkill
- argocd-conventionsSkill
- ci-conventionsSkill
- config-conventionsSkill
- contributing-conventionsSkill
- councilSkill
- cryptography-conventionsSkill
- dependency-update-conventionsSkill
- diagram-conventionsSkill
- docker-conventionsSkill
- documentation-conventionsSkill
- frontend-conventionsSkill
- github-actions-conventionsSkill
- github-issue-conventionsSkill
- github-pr-conventionsSkill
- github-repo-settingsSkill
- gitlab-ci-conventionsSkill
- helm-conventionsSkill
- herdr-core-delegationSkill
- herdr-delegationSkill
- herdr-tui-delegationSkill
- kopf-conventionsSkill
- kubernetes-operator-conventionsSkill
- logging-conventionsSkill
- logo-conventionsSkill
- mise-conventionsSkill
- ollama-conventionsSkill
- openssf-conventionsSkill
- pr-conventionsSkill
- pre-commit-conventionsSkill
- project-metadata-conventionsSkill
- python-async-conventionsSkill
- python-conventionsSkill
- readme-conventionsSkill
- release-script-conventionsSkill
- release-supply-chain-conventionsSkill
- renovate-ci-conventionsSkill
- rest-conventionsSkill
- rust-build-conventionsSkill
- rust-conventionsSkill
- rust-http-conventionsSkill
- security-policy-conventionsSkill
- signal-handling-conventionsSkill
- sql-conventionsSkill
- systemd-conventionsSkill
- system-user-conventionsSkill
- task-conventionsSkill
- terraform-conventionsSkill
- topic-splittingSkill
- ui-copy-conventionsSkill
- web-layout-conventionsSkill
- yaml-conventionsSkill
The file
We split this skill into the rules it gives an agent
10 rules. About 0 are common, 6 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 37
Check what the Pages settings actually hold (gh api repos/{owner}/{repo}/pages --jq .cname, or the GitLab project's Pages page) rather than …
- Very specific: line 143
Run astro build --force --outDir <staging>/out/<label> from docs/ with the version passed through the environment, then copy the output …
- Very specific: line 176
Add starlight-llms-txt to every site.
- Distinctive: line 210
Never deploy from the tag's checkout.
- Very specific: line 220
Never set site/base without asking where the site is served.
- Distinctive: line 221
Never copy the logo into the site, and never pick theme colours that are not the logo's, or an accent under 4.5:1 on its background.
- Distinctive: line 223
Never write a relative link or a base-prefixed link in the content, and never put an internal link in the frontmatter.
- Distinctive: line 225
Never commit per-version snapshots of the content, and never build a version from outside the project directory.
- Distinctive: line 227
Never treat a pre-release tag as a documentation version.
- Distinctive: line 228
Never deploy the site from a tag pipeline's checkout.
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Starlight conventions
A documentation site is an Astro project in docs/ with its own
package.json and lockfile, on the Node.js the root mise.toml pins
(mise-conventions). frontend-conventions applies to its
TypeScript (strict tsconfig, Biome, no any), with two adjustments: UI is
.astro components, not React, and tsc --noEmit is astro check, which also
checks the content frontmatter.
Ask the public URL first
Before writing astro.config.ts, ask where the site will be served. site
and base follow from it, and a wrong base does not fail the build: it
produces a site whose every page, stylesheet and image URL answers 404. The
symptom is an unstyled "Skip to content" page with a broken image.
| Served at | site | base |
a custom domain (docs.example.com) | https://docs.example.com | / (omit it) |
| GitHub Pages without a custom domain | https://<owner>.github.io | /<repo>/ |
| GitLab Pages, unique domain | the unique domain URL | / |
GitLab Pages, <group>.<pages-domain>/<project> | https://<group>.<pages-domain> | /<project>/ |
Check what the Pages settings actually hold (gh api repos/{owner}/{repo}/pages
--jq .cname, or the GitLab project's Pages page) rather than assuming. A
custom domain added later means changing site and dropping base.
Theme from the logo
- Use the repository's logo file itself, never a copy:
logo: { src: "../logo.svg" }, anddocs/public/favicon.svgas a symlink to../../logo.svg(inside the repo, so allowed). No logo in the repo → ask for one before theming. - Read the colours from the logo and set Starlight's tokens in
src/styles/theme.css, listed incustomCss:--sl-color-accent-low,--sl-color-accent,--sl-color-accent-high,--sl-color-white,--sl-color-gray-1…-6(-7in light mode) and--sl-color-black, on:root(dark) and:root[data-theme="light"]. - Each theme takes as accent the logo colour that reads on its
background, at ≥ 4.5:1 contrast for link text: typically the dark
brand colour in light mode and the bright one in dark mode. Compute the
ratio; never pick by eye. In light mode
--sl-color-text-accentis the accent, in dark mode it is--sl-color-accent-high. - Tint the grays with the dominant brand hue instead of Starlight's default
blue-gray. Light mode inverts the scale (
whiteis the darkest). - Say in one comment at the top of
theme.csswhich logo colours these are.
Content and links
- Pages are Markdown under
src/content/docs/;guides/andreference/are autogenerated sidebar groups ({ label, items: [{ autogenerate: { directory } }] }), ordered bysidebar.orderin each page's frontmatter. - Moving a README into the site: the site becomes the home of every fact;
the README keeps the description, a minimal getting started and links to the
site (
readme-conventions,documentation-conventions). Extract sections by script rather than retyping them, then rewrite the anchors that crossed sections. Grep the repo for links into the old README (ARCHITECTURE.md,CONTRIBUTING.md, code comments) and repoint them. - Link pages by root-absolute path,
/guides/metrics/, without the base. A plugin adds the base (below). Links to repository files arehttps://URLs to the forge, since the site is served elsewhere. starlight-links-validatoris mandatory: the build fails on a broken internal link or anchor, and on a relative link. It also reads frontmatter links (heroactions), which are not base-prefixed: keep internal links out of the frontmatter and put them in the page body.- Astro 7's default Markdown processor is Sätteri:
markdown.remarkPluginsdo not run. Pass plugins throughmarkdown.processor: satteri({ mdastPlugins: [...] })from@astrojs/markdown-satteri(declare it andsatterias dependencies).
The base-prefixing plugin. An mdast plugin runs before the hast plugins, so the validator sees the prefixed links:
import { defineMdastPlugin } from "satteri";
export function prefixBase(url: string, base: string): string {
if (!url.startsWith("/") || url.startsWith("//") || base === "/") return url;
return base.replace(/\/$/, "") + url;
}
export function baseLinks(base: string) {
return defineMdastPlugin({
name: "base-links",
link(node, ctx) {
ctx.setProperty(node, "url", prefixBase(node.url, base));
},
definition(node, ctx) {
ctx.setProperty(node, "url", prefixBase(node.url, base));
},
});
}Versions
A versioned site serves:
| Path | Content |
/ | the latest stable release |
/next/ | the default branch, with a banner saying it is unreleased |
/vX.Y/ | each older minor release, at its last patch, with a banner |
Stable tags only (^v\d+\.\d+\.\d+$); a tag with a - is never a version.
Tags that predate the site (no docs/src/content/docs in their tree) are
skipped. With no release left, the default branch takes / and there is no
picker.
Every version is the current site around the pages of its tag: the config, theme and components of the default branch, the content of the tag. A site fix reaches every version; the pages of a release stay as released. Never commit snapshot copies of the content per version.
The build
npm run build:versions runs scripts/build.ts with Node's native type
stripping (node scripts/build.ts, imports with a .ts extension):
- List the stable tags that contain the content directory
(
git cat-file -e <tag>:docs/src/content/docs) and plan the builds with a pure, unit-tested function: tags in,{ label, path, latest, ref }out. - For a tag, stage the current
src/underdocs/.versions/<label>/, mirroring the repository (.versions/<label>/docs/src/,.versions/<label>/logo.svg) so the content's relative paths still resolve, and replace its content withgit archive <tag> docs/src/content/docs | tar -x. Staging stays inside the project: a copy elsewhere with a symlinkednode_modulesbreaks Astro's module resolution. - Run
astro build --force --outDir <staging>/out/<label>fromdocs/with the version passed through the environment, then copy the output intodist/<path>.--forceis required: the content-layer cache lives in the sharednode_modulesand would serve the previous version's pages. - Clean
.versions/in afinally. It is git-ignored and excluded fromtsconfig.json.
The environment is tooling's, so the variables carry the project prefix
(<PROJECT>_DOCS_VERSIONS: the JSON list, validated with zod on read;
<PROJECT>_DOCS_VERSION: the label being built; <PROJECT>_DOCS_SRC_DIR: the
staged sources). astro.config.ts reads them once through a small module and
derives base (the version's path) and srcDir (the staged sources, else
./src). Unset, the build is a plain single version at /, which is what
astro dev and astro build give.
Picker and banner
- Picker: override
SocialIcons(components:in the Starlight config) with a<select>rendered at build time from the version list, followed by the default component. Every version is rebuilt on each deployment, so the list is static; no runtimefetchof aversions.json. The client script swaps the current base for the target one inlocation.pathname, keeping the page. Keep that function in its own module so the client bundle doesn't pull zod. - Banner: override
Bannerto render, before the default one, a notice on every version that is not the latest ("unreleased development version" fornext, "an older release" otherwise) linking to/. - Biome only analyses an
.astrofile's frontmatter, so it flags imports used in the template. TurnnoUnusedImportsandnoUnusedVariablesoff for**/*.astroin abiome.jsonoverride.
llms.txt
Add starlight-llms-txt to every site. It is base-aware, so each version gets
its own llms.txt, llms-full.txt and llms-small.txt, and the root one, the
standard location, describes the latest release. On a versioned site pass
details: one sentence naming the version the file covers and the absolute
URLs of the other versions' llms.txt. A model reads the file outside the
site. Link /llms.txt from the README next to the documentation link.
Tests and checks
npm testrunsnode --test '{src,scripts}/**/*.test.ts': the version planning, the version-list parsing, the page-switching function and the base-prefixing plugin (throughmarkdownToHtmlfromsatteri, not a hand-built tree). It runs in thequalitypipeline, never in a hook (pre-commit-conventions).- Pre-commit hooks, as local
language: systemhooks onfiles: ^docs/,pass_filenames: false:npm --prefix docs run lint(biome check .) andnpm --prefix docs run check(astro check). Thequalityjob therefore runsnpm ci --prefix docsbeforepre-commit. check-added-large-filesalready skipsdocs/package-lock.jsonthrough the baseline lockfileexclude(pre-commit-conventions). A hook takes a singleexclude: extend that regex, never replace it.- The dependency bot tracks
npmin/docs. Pintypescriptwithin the peer range of@astrojs/check; a major it does not accept fails the install. - The build logs structured
key=valuelines on stderr, neverconsole.*.
The docs pipeline
Independent of the platform (syntax in github-actions-conventions and
gitlab-ci-conventions):
- Change proposal: build every version (validation, links included), deploy nothing.
- Push to the default branch: build every version and deploy.
- Stable release: rebuild and deploy from the default branch, since
the root now serves a new release and
/next/must stay the default branch. Never deploy from the tag's checkout. - Path filter:
docs/**, the logo, and the pipeline file. Releases and manual runs are not filtered. - A full clone with tags; a shallow one sees no version.
CONTRIBUTING.mddocuments the site: where pages live, how to link, the versioning model, and the commands (npm --prefix docs run dev,build,build:versionsaftergit fetch --tags,test).
Never
- Never set
site/basewithout asking where the site is served. - Never copy the logo into the site, and never pick theme colours that are not the logo's, or an accent under 4.5:1 on its background.
- Never write a relative link or a base-prefixed link in the content, and never put an internal link in the frontmatter.
- Never commit per-version snapshots of the content, and never build a version from outside the project directory.
- Never treat a pre-release tag as a documentation version.
- Never deploy the site from a tag pipeline's checkout.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

