astro-standards
Use when building an Astro 5 content site in a touchstone repo — islands, zero-JS-by-default, .astro components, client directives, content collections, rendering modes, view transitions, astro:env. Triggers on .astro files, `astro`/`@astrojs/*` in package.json, astro.config.mjs, src/content.config.ts. For the interactive framework inside an island use the react/svelte/vue skills; language-level TS rules live in the typescript skill.
- License 许可
- MIT
- 最近更新
- 2026-08-26
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- astro-standards
- license
- MIT
- metadata
- { "author": "touchstone", "version": "0.2.0" }
- description
- Use when building an Astro 5 content site in a touchstone repo — islands, zero-JS-by-default, .astro components, client directives, content collections, rendering modes, view transitions, astro:env. Triggers on .astro files, `astro`/`@astrojs/*` in package.json, astro.config.mjs, src/content.config.ts. For the interactive framework inside an island use the react/svelte/vue skills; language-level TS rules live in the typescript skill.
03 SKILL.md 正文
Astro (framework)
Full standard: standards/frameworks/astro.md (layers on standards/languages/typescript.md).
Load-bearing rules:
Always
- Zero JS by default —
.astrocomponents render to HTML and ship nothing; an island only hydrates when a framework component carries aclient:*directive. Frontmatter is server-only: secrets, DB calls, heavy imports stay there and never reach the browser. - Choose the minimum directive:
client:visibleis the house default,client:idle/client:mediafor low priority,client:loadonly for critical above-the-fold UI (justify it),client:onlyonly for genuinely browser-only widgets (names the framework, ships no SSR HTML). - Content collections get a Zod
schema+ aloader(Content Layer API,src/content.config.ts); frontmatter is untrusted input parsed once at build. Query viagetCollection/getEntry, never rawfs/import.meta.glob. output: 'static'is the default; opt routes into on-demand rendering per-page withexport const prerender = falseand a concreteadapterpinned — don't flip the whole site to a server, and don't ship SSR without an adapter.
Defer
- Island internals →
../../standards/frameworks/react.md/../../standards/frameworks/svelte.md/../../standards/frameworks/vue.md; language/tsconfig/test-runner →../../standards/languages/typescript.md; a11y (astro check warnings + axe gate) →../../standards/practices/accessibility.md; Core Web Vitals budgets →../../standards/practices/performance.md; secrets/auth →../../standards/practices/security.md.
Don't get burned
- Whole-page interactivity means you picked the wrong tool — Astro is for content; a single stateful UI graph spanning the page wants a SPA framework. Don't render an
.astrocomponent inside a client island, and don't ship two UI frameworks without cause (two runtimes). - A prerendered route reading cookies/
Astro.requestis a bug — keep static routes pure or move per-request reads behindprerender = false/ a server island.astro:envaccess: 'public'is inlined plaintext — no secrets; server vars in an island is a build error. Use<Image />/<Picture />(not raw<img>) with dimensions set.
Done
astro check (a11y warnings fail) · tsc · biome ci · vitest · playwright green; zero unjustified client JS; collections schema-validated; secrets out of public env. See standards/frameworks/astro.md.
04 同仓库更多 Skills
ok-standards
Use when writing shell, per standards/languages/shell.md.
demo-standards
Use when editing demo code in a touchstone fixture repo, a deliberately ordinary description that is long enough to clear the forty character minimum.
demo-standards
Use when editing demo code in a touchstone fixture repo, a deliberately ordinary description that is long enough to clear the forty character minimum.
demo-standards
Use when editing demo code in a touchstone fixture repo, a deliberately ordinary description that is long enough to clear the forty character minimum.
demo-standards
Use when editing demo code in a touchstone fixture repo, a deliberately ordinary description that is long enough to clear the forty character minimum.
demo-standards
Use when editing demo code in a touchstone fixture repo, a deliberately ordinary description that is long enough to clear the forty character minimum.