home / skills / a5c-ai / babysitter / csp
This skill helps you implement Content Security Policy hardening, nonces, and reporting across apps to prevent XSS and enforce secure scripting.
npx playbooks add skill a5c-ai/babysitter --skill cspReview the files below or copy the command above to add this skill to your agents.
---
name: csp
description: Content Security Policy configuration, nonces, and reporting.
allowed-tools: Read, Write, Edit, Bash, Glob, Grep
---
# CSP Skill
Expert assistance for Content Security Policy implementation.
## Capabilities
- Configure CSP headers
- Implement nonces
- Set up reporting
- Handle inline scripts
- Configure strict CSP
## CSP Configuration
```typescript
// Next.js middleware
const cspHeader = `
default-src 'self';
script-src 'self' 'nonce-${nonce}' 'strict-dynamic';
style-src 'self' 'nonce-${nonce}';
img-src 'self' blob: data:;
font-src 'self';
connect-src 'self';
frame-ancestors 'none';
base-uri 'self';
form-action 'self';
report-uri /api/csp-report;
`;
```
## Target Processes
- security-hardening
- csp-implementation
- xss-prevention
This skill helps implement and maintain Content Security Policy (CSP) for web applications, including header configuration, nonces, and reporting. It provides practical guidance and templates to reduce XSS risk and enable structured violation reporting. The goal is a defendable, developer-friendly CSP that supports modern app patterns like dynamic scripts and inline styles when safe.
The skill inspects application entry points and suggests CSP header values tailored to your runtime (server middleware, static headers, or frameworks like Next.js). It recommends nonce generation and injection patterns for per-request nonces and shows how to wire up a reporting endpoint to collect violation data. It also explains strict directives such as strict-dynamic and frame-ancestors and trade-offs when permitting inline code.
Do I need nonces for every request?
Yes — generate a fresh, unpredictable nonce per response so attackers cannot reuse values across requests.
Can I use report-only while transitioning?
Absolutely. Use report-only to collect real-world violations, then iterate on the policy before enforcing it.