dom-security-hardening

dom-security-hardening is a skill for Claude Code, Codex from KraitDev/skiLL.Md. It costs 25 tokens per session (1,886 once invoked), scanned A, original, MIT.

A set of rules for protecting web-page code, called the DOM, from cross-site scripting and injection attacks. It covers browser security policies, safer page-manipulation methods, and removing executable content from untrusted input.

In plain words
What is it for?
Use it when setting up or auditing a web application's HTML and JavaScript, handling forms, chat, rich text, or Markdown from users, and refactoring direct browser-page manipulation.
Why use it?
It reduces ways that submitted text, rich content, or legacy page code could run unwanted scripts in a user's browser.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: mentions Codex.

Good fit Use it when setting up or auditing a web application's HTML and JavaScript, handling forms, chat, rich text, or Markdown from users, and refactoring direct browser-page manipulation.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/kraitdev/skill.md/dom-security-hardening
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add KraitDev/skiLL.Md --skill dom-security-hardening
Clone the repo
git clone --depth 1 https://github.com/KraitDev/skiLL.Md

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for dom-security-hardening

README.md
[![agentmods](https://agentmods.dev/badge/skills/kraitdev/skill.md/dom-security-hardening/github.svg)](https://agentmods.dev/skills/kraitdev/skill.md/dom-security-hardening)
Your own site
<a href="https://agentmods.dev/skills/kraitdev/skill.md/dom-security-hardening"><img src="https://agentmods.dev/badge/skills/kraitdev/skill.md/dom-security-hardening/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for dom-security-hardening

Your own site · 80×15
<a href="https://agentmods.dev/skills/kraitdev/skill.md/dom-security-hardening"><img src="https://agentmods.dev/badge/skills/kraitdev/skill.md/dom-security-hardening.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 25 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,886 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00025 $0.01886
Opus 5.5 $0.00010 $0.00754
Sonnet 5.5 $0.00005 $0.00377
Haiku 4.5 $0.00003 $0.00189

Measured 1mo ago against content hash cd3db164094d, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

dom-security-hardening scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/frontend/dom-security-hardening/SKILL.md · 170 lines

How it starts

The opening of the file, as written. The whole thing — 170 lines — stays where its author put it; the contents beside it link to each section on GitHub.

DOM Security Hardening

Purpose

XSS attacks kill applications. This skill hardens the DOM attack surface by enforcing a strict Content Security Policy, eliminating unsafe DOM APIs, and stripping execution vectors like inline scripts and styles. Following this skill is MANDATORY for any user-facing web application handling user input.

When to use

  • Setting up the initial index.html or document root of a web application
  • Refactoring legacy code that relies on direct DOM manipulation
  • Auditing a frontend codebase for XSS vulnerabilities
  • Processing rich text or markdown input from untrusted users
  • Creating forms or chat systems that accept user input

When NOT to use

  • CSS framework design (separate concern)
  • React component prop validation (use React Component Design)
  • Backend input validation (different layer, still required)

Inputs required

  • HTML document structure
  • JavaScript files with DOM manipulation
  • Understanding of Content Security Policy basics
  • Sanitizer library decision (DOMPurify, sanitize-html, etc.)

Workflow

  1. Enforce CSP: Add strict <meta http-equiv="Content-Security-Policy"> tag in HTML <head> (or HTTP headers)
  2. Externalize Assets: Extract ALL inline <script> and <style> blocks into separate .js and .css files
  3. Remove Inline Events: Replace inline onclick="...", onchange="..." with standard addEventListener bindings
  4. Replace Unsafe DOM: Replace innerHTML, outerHTML, dangerouslySetInnerHTML with textContent or innerText
  5. Implement Sanitizer: If HTML rendering is REQUIRED, use DOMPurify or equivalent BEFORE insertion
  6. Test CSP: Verify policy blocks all unauthorized execution attempts
  7. Verify No Bypasses: Use security scanner (OWASP ZAP, Burp) to confirm XSS vectors are closed

Rules

  • MUST implement strict CSP: default-src 'self'; script-src 'self'; style-src 'self'; object-src 'none'
  • MUST NEVER use inline <script> blocks in HTML
  • MUST NEVER use inline style="..." attributes
  • MUST NEVER use eval(), setTimeout(string), new Function(string)
  • MUST NEVER use innerHTML, outerHTML, or dangerouslySetInnerHTML with user input
  • MUST use textContent or innerText for all dynamic text insertions
  • MUST sanitize user HTML with DOMPurify before any insertion
  • MUST NOT use 'unsafe-inline' or 'unsafe-eval' in CSP

Read the full file on GitHub · 170 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 170 lines · 25 tokens per session scan A cd3db164094d

Subscribe to this mod's changes

dom-security-hardening is a skill published in the GitHub repository KraitDev/skiLL.Md (6 stars, last pushed 4mo ago), licensed MIT. It adds 25 tokens to every session and 1,886 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

evaluate-pattern-adoption

Run or plan this repository's pattern-adoption evidence evaluation locally with signed-in Codex agents. Use when asked to refresh stale evidence, assess stable or exploratory patterns, evaluate one or all catalog patterns, discover possible new patterns, or prepare a reviewable evidence PR without model-backed GitHub…

PaulDuvall/ai-development-patterns · 68 tokens

secure-checkout

Harden your checkout against attacks with HTTPS enforcement, Content Security Policy headers, input sanitization, and card data tokenization.

finsilabs/awesome-ecommerce-skills · 28 tokens

security-patterns

Security patterns for Falcon Foundry apps including OAuth scopes, RBAC, input validation, UI security, and credential management. TRIGGER when user asks to "configure OAuth scopes", "secure a Foundry app", "handle secrets", "add input validation", or needs to review a Foundry app for security concerns (XSS, CSP…

CrowdStrike/foundry-skills · 84 tokens

contributing-to-awesome-claude

Use when writing, testing, or preparing ANY contribution or pull request to the JSONbored/awesome-claude (HeyClaude) repo — adding a community content entry (agent/MCP server/skill/hook/command/rule/guide/collection/statusline), or making a platform/code change (website, registry package, MCP package, scripts). The…

JSONbored/awesome-claude · 209 tokens

camerawesome-flutter

Use when integrating, configuring, optimizing, debugging, or migrating camera and video recording experiences in Flutter using the camerawesome package. Covers CameraAwesomeBuilder modes (.awesome, .custom, .previewOnly, .analysisOnly), CameraState lifecycle transitions, Android CameraX and iOS AVFoundation native…

ariaramin/flutter-skills · 120 tokens

document-scan-flutter

Expert guidance for integrating, configuring, debugging, optimizing, testing, and maintaining the documentscan Flutter package (headless document corner detection + perspective correction; Apple Vision on iOS, OpenCV on Android) across its officially supported platforms.

ariaramin/flutter-skills · 53 tokens