Content Security Policy
Design and deploy Content-Security-Policy (CSP) to prevent XSS attacks and unauthorized resource loading.
Install
/plugin marketplace add sethdford/claude-skillsThe repo is a Claude Code plugin marketplace. Run /plugin afterwards to pick the plugin that includes this skill.
npx skills add sethdford/claude-skills --skill content-security-policygit 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-policyPersonal 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)
Details
- Skill name
content-security-policy- Repository
- sethdford/claude-skills
- 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
A B Test Design
48sethdford/claude-skills
Design rigorous A/B tests with hypotheses, variants, metrics, and sample size calculations.
A B Test Design Pm
48sethdford/claude-skills
Analytics and experimentation skill for product managers.
Abuse Case Design
48sethdford/claude-skills
Design abuse cases (negative use cases) showing how attackers misuse system features. Use when identifying attacks that exploit intended functionality or business logic flaws.
Data Flow Diagram Security
48sethdford/claude-skills
Create and analyze DFDs (Data Flow Diagrams) with security focus, identifying data flows across trust boundaries, storage, and processing points. Use when modeling system architecture for threat analysis.
Container Security Review
48sethdford/claude-skills
Review container security including image scanning, runtime policies, and supply chain integrity.
Dependency Governance
48sethdford/claude-skills
Manage and optimize system dependencies (libraries, services, data). Reduce coupling, track vulnerabilities, plan deprecation. Use when managing dependency sprawl or improving system modularity.
Browse the most popular Claude skills, all security skills, or write your own with the skills generator.