/astro-security
Use when configuring Content Security Policy (CSP) in Astro 7 — security headers, script/style hashes, nonces, or experimentalStaticHeaders.
$ npx -y skills add fusengine/agents --skill astro-security --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
- Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.
- You can call itInvoke it directly when you want it.
- Slash command
/astro-security
Context preview
The summary Claude sees to decide when to auto-load this skill.
Use when configuring Content Security Policy (CSP) in Astro 7 — security headers, script/style hashes, nonces, or experimentalStaticHeaders.
SKILL.md
astro-security.SKILL.mdname: astro-security
description: Use when configuring Content Security Policy (CSP) in Astro 7 — security headers, script/style hashes, nonces, or experimentalStaticHeaders.
versions:
astro: "7"
user-invocable: true
references: references/csp-overview.md, references/csp-config.md, references/script-directive.md, references/style-directive.md, references/nonces.md, references/static-headers.md, references/templates/csp-basic.md, references/templates/csp-advanced.md
related-skills: astro-7, astro-deployment, solid-astro
<objective> Configures Astro 7's stable Content Security Policy support (`security.csp` in `astro.config.mjs`): automatic SHA-256/384/512 hash generation for bundled scripts and styles, the injected `<meta http-equiv="content-security-policy">` tag, manual hash configuration for external scripts/styles, and nonces for dynamic script injection.
Also covers `experimentalStaticHeaders` for emitting CSP as adapter-based HTTP headers instead of a meta tag. States the known limitations: CSP is inactive in `dev` mode (test with `build` + `preview`), incompatible with `<ClientRouter />` view transitions, and unsupported for Shiki's inline styles. Does not cover general deployment adapter setup beyond the CSP header wiring (astro-deployment). </objective>
Astro Security
Agent Workflow (MANDATORY)
Before ANY implementation, use `TeamCreate` to spawn 3 agents:
1. **fuse-ai-pilot:explore-codebase** - Analyze existing security config, adapters, headers 2. **fuse-ai-pilot:research-expert** - Verify latest Astro 7 CSP docs via Context7/Exa 3. **mcp__context7__query-docs** - Check CSP compatibility with deployment adapter
After implementation, run **fuse-ai-pilot:sniper** for validation.
---
Overview
When to Use
- Enabling CSP in an Astro project (stable in v6.0.0)
- Configuring `security.csp` in `astro.config.mjs`
- Adding SHA-256/384/512 hashes for external scripts or styles
- Using nonces for dynamic script injection
- Setting up `experimentalStaticHeaders` for adapter-based CSP headers
CSP in Astro
Astro 6 ships Content Security Policy as a **stable** feature (previously experimental). When enabled:
- Astro automatically generates SHA hashes for all bundled scripts and styles
- Injects a `<meta http-equiv="content-security-policy">` in each page's `<head>`
- Supports `script-src` and `style-src` directives by default
**Limitations:**
- Not supported in `dev` mode — test with `build` + `preview`
- External scripts and styles require manual hash configuration
- Incompatible with `<ClientRouter />` view transitions (use native View Transition API)
- Shiki syntax highlighter (inline styles) not currently supported
---
Reference Guide
Concepts
| Topic | Reference | When to Consult | |-------|-----------|-----------------| | CSP overview | [csp-overview.md](references/csp-overview.md) | Understanding CSP in Astro | | Configuration | [csp-config.md](references/csp-config.md) | All config options | | Script directive | [script-directive.md](references/script-directive.md) | script-src configuration | | Style directive | [style-directive.md](references/style-directive.md) | style-src configuration | | Nonces | [nonces.md](references/nonces.md) | Dynamic script injection | | Static headers | [static-headers.md](references/static-headers.md) | Adapter-based CSP headers |
Templates
| Template | When to Use | |----------|-------------| | [csp-basic.md](references/templates/csp-basic.md) | Basic CSP enable with algorithm | | [csp-advanced.md](references/templates/csp-advanced.md) | Full config with directives + static headers |
---
Best Practices
1. **Always test with build + preview** — CSP is inactive in dev mode 2. **Start with SHA-512** — strongest hash algorithm 3. **Use `'self'` explicitly** — not included by default in resources 4. **Hash external scripts manually** — compute SHA hashes for CDN resources 5. **Combine with adapter headers** — use `experimentalStaticHeaders` for Vercel/Netlify
---
Forbidden
- Testing CSP in `dev` mode (doesn't work — always use `build + preview`)
- Using `<ClientRouter />` with CSP enabled
- Forgetting to add `'self'` when using `resources` array
- Adding `unsafe-inline` (defeats purpose of CSP)
Read more
name: astro-security description: Use when configuring Content Security Policy (CSP) in Astro 7 — security headers, script/style hashes, nonces, or experimentalStaticHeaders. versions: astro: "7" user-invocable: true references: references/csp-overview.md, references/csp-config.md, references/script-directive.md, references/style-directive.md, references/nonces.md, references/static-headers.md, references/templates/csp-basic.md, references/templates/csp-advanced.md related-skills: astro-7, astro-deployment, solid-astro
<objective> Configures Astro 7's stable Content Security Policy support (`security.csp` in `astro.config.mjs`): automatic SHA-256/384/512 hash generation for bundled scripts and styles, the injected `<meta http-equiv="content-security-policy">` tag, manual hash configuration for external scripts/styles, and nonces for dynamic script injection.
Also covers `experimentalStaticHeaders` for emitting CSP as adapter-based HTTP headers instead of a meta tag. States the known limitations: CSP is inactive in `dev` mode (test with `build` + `preview`), incompatible with `<ClientRouter />` view transitions, and unsupported for Shiki's inline styles. Does not cover general deployment adapter setup beyond the CSP header wiring (astro-deployment). </objective>
Astro Security
Agent Workflow (MANDATORY)
Before ANY implementation, use `TeamCreate` to spawn 3 agents:
1. **fuse-ai-pilot:explore-codebase** - Analyze existing security config, adapters, headers 2. **fuse-ai-pilot:research-expert** - Verify latest Astro 7 CSP docs via Context7/Exa 3. **mcp__context7__query-docs** - Check CSP compatibility with deployment adapter
After implementation, run **fuse-ai-pilot:sniper** for validation.
---
Overview
When to Use
- Enabling CSP in an Astro project (stable in v6.0.0)
- Configuring `security.csp` in `astro.config.mjs`
- Adding SHA-256/384/512 hashes for external scripts or styles
- Using nonces for dynamic script injection
- Setting up `experimentalStaticHeaders` for adapter-based CSP headers
CSP in Astro
Astro 6 ships Content Security Policy as a **stable** feature (previously experimental). When enabled:
- Astro automatically generates SHA hashes for all bundled scripts and styles
- Injects a `<meta http-equiv="content-security-policy">` in each page's `<head>`
- Supports `script-src` and `style-src` directives by default
**Limitations:**
- Not supported in `dev` mode — test with `build` + `preview`
- External scripts and styles require manual hash configuration
- Incompatible with `<ClientRouter />` view transitions (use native View Transition API)
- Shiki syntax highlighter (inline styles) not currently supported
---
Reference Guide
Concepts
| Topic | Reference | When to Consult | |-------|-----------|-----------------| | CSP overview | [csp-overview.md](references/csp-overview.md) | Understanding CSP in Astro | | Configuration | [csp-config.md](references/csp-config.md) | All config options | | Script directive | [script-directive.md](references/script-directive.md) | script-src configuration | | Style directive | [style-directive.md](references/style-directive.md) | style-src configuration | | Nonces | [nonces.md](references/nonces.md) | Dynamic script injection | | Static headers | [static-headers.md](references/static-headers.md) | Adapter-based CSP headers |
Templates
| Template | When to Use | |----------|-------------| | [csp-basic.md](references/templates/csp-basic.md) | Basic CSP enable with algorithm | | [csp-advanced.md](references/templates/csp-advanced.md) | Full config with directives + static headers |
---
Best Practices
1. **Always test with build + preview** — CSP is inactive in dev mode 2. **Start with SHA-512** — strongest hash algorithm 3. **Use `'self'` explicitly** — not included by default in resources 4. **Hash external scripts manually** — compute SHA hashes for CDN resources 5. **Combine with adapter headers** — use `experimentalStaticHeaders` for Vercel/Netlify
---
Forbidden
- Testing CSP in `dev` mode (doesn't work — always use `build + preview`)
- Using `<ClientRouter />` with CSP enabled
- Forgetting to add `'self'` when using `resources` array
- Adding `unsafe-inline` (defeats purpose of CSP)
A plugin ecosystem that turns Claude Code into a supervised, multi-agent development environment.
Repo: fusengine/agents
Other skills on fusengine-agents.
- /agent-creator
Use when creating expert agents. Generates agent.md with frontmatter, hooks, required sections, and skill references.
Open skill - /apex-methodology
Use when starting ANY development task -- feature, bug fix, refactor, hotfix (triggers: implement, create, build, fix, add feature, refactor, develop).
Open skill - /brainstorming
Use when creating a feature/component or adding functionality. Fires BEFORE APEX Analyze to refine requirements via structured questioning.
Open skill - /challenge
Use before a root-cause, done/verified claim, irreversible action, or 2nd-time fix reaches the owner (APEX or plain conversation); also fires at every eLicit/Verify gate. Not for code correctness (use sniper).
Open skill - /code-quality
Use when validating code quality after modifications -- SOLID compliance, DRY duplication, linter errors, architecture violations. Do NOT use for functional verification (run verification FIRST, then code-quality).
Open skill - /elicitation
Use when an expert agent self-reviews and self-corrects code after the Execute phase, before sniper validation (BMAD-METHOD elicitation techniques).
Open skill

