agentleFS
hereshecodeshereshecodes/secureskills/skills/security-headers/SKILL.md

security-headers

Skill0 starsChanged 8 months agoMITView on GitHub

Use when configuring HTTP responses, middleware, or server settings

7 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

1 rule. 0 are common, 1 is distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 6 edited versions we read keep these.

  • 1

    Distinctive

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Every HTTP response should include security headers.

    line 8

“Common” is measured: kept by at least 6 in 10 of the 6 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Security Headers

Every HTTP response should include security headers. They're your last line of defense and take minutes to add.

Related: xss-csrf, api-security, security-context

Rule 1: Content Security Policy (CSP)

Blocks inline scripts, unauthorized sources, and most XSS attacks.

// WRONG — no CSP (any script from anywhere can run)

// RIGHT — restrictive CSP
Content-Security-Policy: default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data: https:; font-src 'self'; connect-src 'self'; frame-ancestors 'none';

Rule 2: Strict-Transport-Security (HSTS)

Forces HTTPS. Prevents downgrade attacks.

// WRONG — no HSTS (browser may request HTTP first)

// RIGHT — enforce HTTPS for 1 year, include subdomains
Strict-Transport-Security: max-age=31536000; includeSubDomains; preload

Rule 3: X-Content-Type-Options

Prevents MIME type sniffing. Browser respects the declared Content-Type.

X-Content-Type-Options: nosniff

Rule 4: X-Frame-Options

Prevents clickjacking by blocking your site from being embedded in iframes.

// Block all framing
X-Frame-Options: DENY

// Or allow only same-origin framing
X-Frame-Options: SAMEORIGIN

Rule 5: Referrer-Policy

Controls how much URL information is sent to other sites.

// WRONG — sends full URL including query params
Referrer-Policy: no-referrer-when-downgrade

// RIGHT — only sends origin, not full path
Referrer-Policy: strict-origin-when-cross-origin

Rule 6: Permissions-Policy

Restricts which browser features your site can use.

Permissions-Policy: camera=(), microphone=(), geolocation=(), payment=()

Implementation Examples

// Node.js / Express — use helmet
const helmet = require('helmet');
app.use(helmet());

// Or set manually
app.use((req, res, next) => {
  res.setHeader('X-Content-Type-Options', 'nosniff');
  res.setHeader('X-Frame-Options', 'DENY');
  res.setHeader('Referrer-Policy', 'strict-origin-when-cross-origin');
  res.setHeader('Permissions-Policy', 'camera=(), microphone=(), geolocation=()');
  res.setHeader('Strict-Transport-Security', 'max-age=31536000; includeSubDomains');
  next();
});
# Django — use django-csp and SecurityMiddleware
SECURE_HSTS_SECONDS = 31536000
SECURE_HSTS_INCLUDE_SUBDOMAINS = True
SECURE_CONTENT_TYPE_NOSNIFF = True
X_FRAME_OPTIONS = 'DENY'

Quick Reference

HeaderValuePurpose
Content-Security-Policydefault-src 'self'Blocks unauthorized scripts/resources
Strict-Transport-Securitymax-age=31536000Forces HTTPS
X-Content-Type-OptionsnosniffPrevents MIME sniffing
X-Frame-OptionsDENYPrevents clickjacking
Referrer-Policystrict-origin-when-cross-originLimits referrer info
Permissions-Policycamera=(), microphone=()Restricts browser features

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.