agentsclimarketplace

Vercel harden

Skill edfenton/claude-skills/mern/vercel-harden

Harden a Vercel deployment with security headers, CSP, bot protection, and deployment configurationFrom its SKILL.md

Install
npx -y skills add edfenton/claude-skills --skill vercel-harden

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 2 stars2 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

SKILL.md

3.4 KB, 769 tokens by cl100k_base, as published. Nobody here has run it

Vercel Deployment Hardening

Purpose

Audit and harden a Next.js project deployed on Vercel. Applies security headers at the edge, configures CSP, blocks malicious bots, and provides a dashboard checklist for manual Vercel settings.

Arguments

  • --check-only — Audit current security posture without making changes
  • --plan hobby|pro — Target Vercel plan (default: pro). Controls which features are available (WAF rules, bot protection, etc.)

Workflow

1. Audit current posture

Scan the project for existing security configuration:

- next.config.ts: poweredByHeader, headers() (static headers only — NOT CSP)
- proxy.ts: CSP header, bot blocking, honeypot paths
- vercel.json: edge-level headers
- robots.ts: bot disallow rules

Report findings as a checklist with pass/fail for each item.

2. Apply code-level hardening

If not --check-only, apply these changes:

Static headers (next.config.ts)

  • Set poweredByHeader: false
  • Add headers() function applying non-CSP security headers to /:path*
  • Required headers: see reference/vercel-harden-reference.md
  • CSP must NOT go here — static headers cannot handle Next.js inline scripts

CSP configuration (proxy.ts)

WARNING: Nonce-based CSP and 'strict-dynamic' are incompatible with Next.js. Next.js generates inline <script> tags for hydration, routing, and RSC payloads that cannot receive nonces. Using nonces or 'strict-dynamic' will break the app (white page, broken navigation, non-functional interactive elements).

  • CSP must be applied in proxy.ts (not next.config.ts headers()) so it runs per-request
  • Use script-src 'self' 'unsafe-inline' — this is the only approach compatible with Next.js
  • Build remaining directives from project's actual dependencies (check for analytics, embeds, fonts, etc.)
  • Add Vercel Analytics sources if @vercel/analytics or @vercel/speed-insights are installed
  • Non-executable script types like application/ld+json must NOT receive nonces
  • See reference doc for base directives and third-party allowlists

Bot protection (proxy.ts)

  • Add blocked user agent check and honeypot path check in proxy.ts
  • Update robots.ts to block AI scrapers and SEO bots
  • See reference doc for recommended patterns

3. Verify headers

After changes, verify with:

curl -I https://<deployment-url>

Check for presence of all security headers and absence of X-Powered-By.

Also run:

pnpm test
pnpm build
pnpm test:e2e

After deployment, open the browser console and check for CSP violation errors. If any appear, update the CSP directives to allow the blocked resource.

4. Output Vercel dashboard checklist

Print actionable checklist for manual Vercel dashboard configuration. Include only items relevant to the --plan argument.

TDD requirement

All code changes must follow red-green-refactor:

  1. Write failing tests for new headers/bot protection
  2. Implement to make tests pass
  3. Refactor

Reference

See reference/vercel-harden-reference.md for:

  • Full header reference with recommended values
  • CSP directive guide and third-party allowlists
  • WAF rule templates
  • Bot protection patterns
  • Vercel plan feature matrix

What ships with it: 1 file

8.1 KB alongside SKILL.md

Keep looking

Skills are one crate of 326,861. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.