security-headers

Configure HTTP security headers including CSP, HSTS, and X-Frame-Options for web applications.

1|Updated Mar 21, 2026
One-click install
npx skills add https://github.com/kalilurrahman/kr-claudiator-skills-original-prompts --skill security-headers-kalilurrahman
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: security-headers
Source: https://github.com/kalilurrahman/kr-claudiator-skills-original-prompts/tree/main/05-security/security-headers
Command: npx skills add https://github.com/kalilurrahman/kr-claudiator-skills-original-prompts --skill security-headers-kalilurrahman

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Web applications without proper HTTP security headers remain exposed to XSS, clickjacking, MIME sniffing, and protocol downgrade attacks even when application code is otherwise sound. This Skill produces a complete, phased security header configuration that protects users at the browser layer. ## Core Features & Use Cases - Full Header Set Generation: Outputs Content-Security-Policy, HSTS, X-Frame-Options, X-Content-Type-Options, Referrer-Policy, Permissions-Policy, and cross-origin isolation headers. - Multi-Platform Configs: Provides ready-to-adapt configurations for Nginx, Apache, FastAPI/Starlette middleware, and CloudFront Lambda@Edge. - Safe CSP Rollout: Guides a report-only-first CSP deployment with nonce-based script policies and a violation report collection endpoint. - Use Case: A team launching a new web app uses this Skill to generate Nginx header rules, run CSP in report-only mode for two weeks, then enforce it and add header regression tests to CI targeting an A+ SecurityHeaders.com score. ## Quick Start Ask the AI to generate a complete security header configuration for your web application, including a report-only Content-Security-Policy and Nginx rules.

Frequently Asked Questions about security-headers

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I configure Content-Security-Policy without breaking my site?

Deploy CSP in report-only mode first using the Content-Security-Policy-Report-Only header, which logs violations without blocking resources. After two to four weeks of clean reports, switch to the enforcing Content-Security-Policy header.

What security headers should every website have?

Every site should set X-Content-Type-Options: nosniff, X-Frame-Options: DENY, Referrer-Policy, Strict-Transport-Security, and a Content-Security-Policy. Adding Permissions-Policy and cross-origin isolation headers further reduces browser attack surface.

How do I add security headers in Nginx?

Use the add_header directive in your server block with the always flag so headers apply to error responses too. Set server_tokens off to hide version information, and phase HSTS max-age from short values up to one year.

Can I use nonces instead of unsafe-inline in CSP?

Yes, generate a per-request cryptographic nonce and include it in script-src and style-src directives, then apply the same nonce to inline tags. This blocks injected scripts while allowing your own inline code, unlike unsafe-inline which defeats XSS protection.

Why does HSTS includeSubDomains break my subdomains?

The includeSubDomains directive forces HTTPS on all subdomains, so any subdomain still serving HTTP becomes unreachable. Only enable it after confirming every subdomain supports HTTPS, and start with a short max-age during rollout.

How do I test security headers in CI?

Write automated tests that fetch your staging URL and assert the presence and values of key headers like CSP, HSTS, and X-Frame-Options. Tools like curl, httpx with pytest, and Mozilla Observatory's API can validate configurations on every deploy.