$npx -y skills add fusengine/agents --skill astro-7Expert Astro 7 framework (stable, 7.0.9) — routing, output modes, middleware, Vite Environment API, single Rust compiler, Content Security Policy, Live Collections, Fonts API. Use when building Astro sites, configuring output, or upgrading from Astro 5/6.
| 1 | # Astro 7 Expert |
| 2 | |
| 3 | Production-ready web framework for content-driven sites with unified dev runtime and Islands Architecture. |
| 4 | |
| 5 | ## Agent Workflow (MANDATORY) |
| 6 | |
| 7 | Before ANY implementation, use `TeamCreate` to spawn 3 agents: |
| 8 | |
| 9 | 1. **fuse-ai-pilot:explore-codebase** - Analyze existing routes, layouts, and config |
| 10 | 2. **fuse-ai-pilot:research-expert** - Verify latest Astro 7 docs via Context7/Exa |
| 11 | 3. **mcp__context7__query-docs** - Check breaking changes v6→v7 |
| 12 | |
| 13 | After implementation, run **fuse-ai-pilot:sniper** for validation. |
| 14 | |
| 15 | --- |
| 16 | |
| 17 | ## Overview |
| 18 | |
| 19 | ### When to Use |
| 20 | |
| 21 | - Building new content-driven websites or blogs |
| 22 | - Migrating from Astro 6 to version 7 |
| 23 | - Configuring static, server, or hybrid output modes |
| 24 | - Setting up middleware for auth or redirects |
| 25 | - Leveraging the new Rust compiler for large sites |
| 26 | - Implementing Content Security Policy (CSP) headers |
| 27 | |
| 28 | ### Why Astro 7 |
| 29 | |
| 30 | | Feature | Benefit | |
| 31 | |---------|---------| |
| 32 | | Unified Dev Runtime | Dev matches production — fewer "works in dev, breaks in prod" bugs | |
| 33 | | Vite Environment API (Vite 8) | Exact production runtime during development | |
| 34 | | Single Rust Compiler | Go compiler removed — one Rust compiler for `.astro` files, with strict HTML parsing (unclosed tags now error instead of being silently auto-corrected) | |
| 35 | | Live Content Collections | Real-time data from external sources | |
| 36 | | Built-in Fonts API (stable) | Zero-config font loading with performance optimization | |
| 37 | | CSP Support (stable) | Built-in Content Security Policy nonce management | |
| 38 | | Cloudflare Workers | First-class support with workerd runtime in dev | |
| 39 | |
| 40 | --- |
| 41 | |
| 42 | ## Core Concepts |
| 43 | |
| 44 | ### Output Modes |
| 45 | |
| 46 | | Mode | Description | Use Case | |
| 47 | |------|-------------|----------| |
| 48 | | `static` (default) | All pages prerendered at build | Blogs, docs, marketing | |
| 49 | | `server` | All pages rendered on demand | Apps, dashboards, auth | |
| 50 | | `hybrid` | Mix static + on-demand | Most production sites | |
| 51 | |
| 52 | ### Routing |
| 53 | |
| 54 | - **File-based routing** — `src/pages/` maps directly to URLs |
| 55 | - **Dynamic routes** — `[slug].astro`, `[...all].astro` |
| 56 | - **Per-route prerender** — `export const prerender = false/true` |
| 57 | - **Endpoints** — `.ts`/`.js` files in `src/pages/` for API routes |
| 58 | |
| 59 | --- |
| 60 | |
| 61 | ## Reference Guide |
| 62 | |
| 63 | | Need | Reference | |
| 64 | |------|-----------| |
| 65 | | Initial setup | [installation.md](references/installation.md) | |
| 66 | | Routing patterns | [routing.md](references/routing.md) | |
| 67 | | Output configuration | [output-modes.md](references/output-modes.md) | |
| 68 | | Middleware setup | [middleware.md](references/middleware.md) | |
| 69 | | astro.config.ts | [config.md](references/config.md) | |
| 70 | | New Astro 7 features | [new-features.md](references/new-features.md) | |
| 71 | | Full project setup | [templates/basic-setup.md](references/templates/basic-setup.md) | |
| 72 | | Config examples | [templates/config-example.md](references/templates/config-example.md) | |
| 73 | |
| 74 | --- |
| 75 | |
| 76 | ## Best Practices |
| 77 | |
| 78 | 1. **Use `output: 'static'` by default** — Add server only when needed |
| 79 | 2. **Per-route `prerender`** — Fine-grained control in hybrid mode |
| 80 | 3. **Middleware for cross-cutting concerns** — Auth, redirects, headers |
| 81 | 4. **No compiler flag needed** — the Rust compiler is the only compiler now (Go removed); watch for strict HTML parsing errors on unclosed tags |
| 82 | 5. **CSP nonces** — Use built-in stable support instead of custom headers |
| 83 | 6. **Node 22.12+ required** — odd-numbered Node versions are unsupported; stay on stable TypeScript tooling, the native `tsgo` compiler can make `astro check`/typecheck fail opaquely (see installation.md) |