Content Security Policy

Design and deploy Content-Security-Policy (CSP) to prevent XSS attacks and unauthorized resource loading.

48 stars 10 forksSecurity Plugin marketplace

Install

Claude Code plugin
/plugin marketplace add sethdford/claude-skills

The repo is a Claude Code plugin marketplace. Run /plugin afterwards to pick the plugin that includes this skill.

skills CLI (Claude Code, Cursor, Codex and more)
npx skills add sethdford/claude-skills --skill content-security-policy
Manual install
git clone --depth 1 https://github.com/sethdford/claude-skills.git /tmp/claude-skills
mkdir -p ~/.claude/skills
cp -r /tmp/claude-skills/security/application-security/skills/content-security-policy ~/.claude/skills/content-security-policy

Personal skills live in ~/.claude/skills. Use .claude/skills in a project folder to share a skill with your team.

From the SKILL.md

# Content-Security-Policy

Design and deploy CSP to prevent XSS and unauthorized resource loading.

## Context

You are a senior security engineer implementing CSP for $ARGUMENTS. CSP is the browser's defense against XSS by controlling which scripts, styles, and resources can load. A well-designed CSP blocks inline scripts and restricts external resources to trusted domains, making XSS significantly harder to exploit.

## Domain Context

- **CSP Directives**: `default-src`, `script-src`, `style-src`, `img-src`, `font-src`, `connect-src`, `frame-src`, `form-action`, `base-uri`
- **Values**: `'self'` (same origin), `'none'` (block all), domain whitelist, nonces (random tokens per request), hashes (SHA-256)
- **Violation Reporting**: `report-uri` or `report-to` for CSP violations; use to detect XSS attempts and policy issues
- **Browser Support**: Widely supported in modern browsers; older browsers ignore CSP (graceful degradation)

## Instructions

1. **Start with Report-Only Mode**:
   - Deploy CSP with `Content-Security-Policy-Report-Only` header first
   - Set `report-uri` to collect violations
   - Monitor for 1-2 weeks; fix legitimate violations (misconfigured resources)
   - Then enforce with `Content-Security-Policy` header (report-only + enforcement can coexist)

2. **Design Base Policy**:
   - `default-src 'self'` — allow same-origin resources by default
   - `script-src 'self'` — allow same-origin scripts only (no inline scripts)
Read the full skill on GitHub

Details

Skill name
content-security-policy
Path
security/application-security/skills/content-security-policy/SKILL.md
License
MIT
Repo updated
11 March 2026

FAQ

What does the Content Security Policy skill do?

Design and deploy Content-Security-Policy (CSP) to prevent XSS attacks and unauthorized resource loading.

How do I install the Content Security Policy skill?

Claude Code plugin: /plugin marketplace add sethdford/claude-skills. Skills go in ~/.claude/skills (personal) or .claude/skills (project), and Claude loads them automatically when a task matches the description.

Is Content Security Policy popular?

It lives in sethdford/claude-skills, which has 48 GitHub stars and 10 forks.

Related skills

Browse the most popular Claude skills, all security skills, or write your own with the skills generator.