security-headers-configuration · secondsky — Claude Code skill: HTTP security
Sets up HTTP security headers against XSS, clickjacking and MIME sniffing. Useful when hardening an app or preparing for an audit.
npx skills add secondsky/claude-skills --skill security-headers-configuration -a claude-codeWhat security-headers-configuration does
This skill walks through the headers a browser checks on every request. It lists four core ones: HSTS with max-age=31536000; includeSubDomains, CSP default-src 'self', X-Frame-Options: DENY and X-Content-Type-Options: nosniff. Then come the configs.
For Express it shows wiring up helmet and setting CSP directives: defaultSrc, scriptSrc, styleSrc, imgSrc, connectSrc, fontSrc, frameAncestors. For Nginx there is an add_header block covering HSTS, Referrer-Policy, Permissions-Policy and CSP. A six-item checklist closes the main file, and references/python-apache.md adds Flask, Flask-Talisman, .htaccess and a header testing script.
One thing to watch: the Express CSP sample puts 'unsafe-inline' in both scriptSrc and styleSrc, which weakens XSS protection. In production that value is a reason to rewrite the policy around your own scripts. The skill points to Security Headers, Mozilla Observatory and CSP Evaluator for verification.
What it helps with
- set HSTS, CSP and X-Frame-Options on an Express app
- add security headers to Nginx with add_header
- roll out a Content Security Policy and test it before deploy
- block MIME sniffing and clickjacking before a security audit
- configure headers for Flask or Apache via .htaccess
Example prompts for the agent
- set up HTTP security headers for my Express app
- add CSP and HSTS to my Nginx config
- check my security headers and tell me what's too permissive
How to install security-headers-configuration
1Skills CLI (Vercel)
npx skills add secondsky/claude-skills --skill security-headers-configuration -a claude-code2Manually: put the files in place
~/.claude/skills/security-headers-configuration/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/security-headers-configuration/
1Skills CLI (Vercel)
npx skills add secondsky/claude-skills --skill security-headers-configuration -a codex2Manually: put the files in place
.agents/skills/security-headers-configuration/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add secondsky/claude-skills --skill security-headers-configuration -a cursor2Manually: put the files in place
.cursor/skills/security-headers-configuration/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install secondsky/claude-skills security-headers-configuration2Manually: put the files in place
.github/skills/security-headers-configuration/SKILL.md1Skills CLI (Vercel)
npx skills add secondsky/claude-skills --skill security-headers-configuration -a gemini-cli2Platform CLI
gemini skills install https://github.com/secondsky/claude-skills --path plugins/security-headers-configuration/skills/security-headers-configurationManually: put the files in place
.devin/skills/security-headers-configuration/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add secondsky/claude-skills --skill security-headers-configuration -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about security-headers-configuration
How do I install security-headers-configuration in Claude?
Run npx skills add secondsky/claude-skills --skill security-headers-configuration -a claude-code. The skill lands in ~/.claude/skills/security-headers-configuration/SKILL.md.
What does security-headers-configuration do?
It explains which HTTP headers defend against XSS, clickjacking and MIME sniffing, and ships ready configs for Express and Nginx plus a verification checklist.
Does it need extra libraries?
The Express example uses helmet, and the Python reference uses Flask-Talisman. The Nginx and Apache configs need neither.
Source text
SKILL.md · MIT
---
name: security-headers-configuration
description: Configures HTTP security headers to protect against XSS, clickjacking, and MIME sniffing attacks. Use when hardening web applications, passing security audits, or implementing Content Security Policy.
license: MIT
---
# Security Headers Configuration
Implement HTTP security headers to defend against common browser-based attacks.
## Essential Headers
| Header | Purpose | Value |
|--------|---------|-------|
| HSTS | Force HTTPS | `max-age=31536000; includeSubDomains` |
| CSP | Restrict resources | `default-src 'self'` |
| X-Frame-Options | Prevent clickjacking | `DENY` |
| X-Content-Type-Options | Prevent MIME sniffing | `nosniff` |
## Express Implementation
```javascript
const helmet = require('helmet');
app.use(helmet());
// Custom CSP
app.use(helmet.contentSecurityPolicy({
directives: {
defaultSrc: ["'self'"],
scriptSrc: ["'self'", "'unsafe-inline'"],
styleSrc: ["'self'", "'unsafe-inline'"],
imgSrc: ["'self'", "data:", "https:"],
connectSrc: ["'self'", "https://api.example.com"],
fontSrc: ["'self'", "https://fonts.gstatic.com"],
frameAncestors: ["'none'"]
}
}));
```
## Nginx Configuration
```nginx
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" always;
add_header X-Frame-Options "DENY" always;
add_header X-Content-Type-Options "nosniff" always;
add_header X-XSS-Protection "1; mode=block" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
add_header Permissions-Policy "geolocation=(), microphone=(), camera=()" always;
add_header Content-Security-Policy "default-src 'self'; script-src 'self'" always;
```
## Verification Tools
- [Security Headers](https://securityheaders.com/)
- [Mozilla Observatory](https://observatory.mozilla.org/)
- [CSP Evaluator](https://csp-evaluator.withgoogle.com/)
## Security Headers Checklist
- [ ] HSTS enabled with long max-age
- [ ] CSP configured and tested
- [ ] X-Frame-Options set to DENY
- [ ] X-Content-Type-Options set to nosniff
- [ ] Referrer-Policy configured
- [ ] Permissions-Policy disables unused features
## Additional Implementations
See [references/python-apache.md](references/python-apache.md) for:
- Python Flask security headers middleware
- Flask-Talisman library configuration
- Apache .htaccess configuration
- Header testing script
## Common Mistakes
- Setting CSP to report-only permanently
- Using overly permissive policies
- Forgetting to test after changes
- Not including all subdomains in HSTS
© secondsky · MIT · secondsky/claude-skills
Similar skills
All skills for Security →security-headers-configuration by other authors comes first.