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.
npx skills add latestaiagents/agent-skills --skill xss-preventiongit clone --depth 1 https://github.com/latestaiagents/agent-skillsWrote 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.
[](https://agentmods.dev/skills/latestaiagents/agent-skills/xss-prevention)<a href="https://agentmods.dev/skills/latestaiagents/agent-skills/xss-prevention"><img src="https://agentmods.dev/badge/skills/latestaiagents/agent-skills/xss-prevention/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.
<a href="https://agentmods.dev/skills/latestaiagents/agent-skills/xss-prevention"><img src="https://agentmods.dev/badge/skills/latestaiagents/agent-skills/xss-prevention.svg" alt="Reviewed on agentmods" width="80" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00075 | $0.02428 |
| Opus 5.5 | $0.00030 | $0.00971 |
| Sonnet 5.5 | $0.00015 | $0.00486 |
| Haiku 4.5 | $0.00007 | $0.00243 |
Grade A, and why
xss-prevention 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 26d 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.
How it starts
The opening of the file, as written. The whole thing — 348 lines — stays where its author put it; the contents beside it link to each section on GitHub.
XSS Prevention (OWASP Top 10:2017 A07)
OWASP numbering: "A07" is the OWASP Top 10:2017 category number. In the current OWASP Top 10:2025, this topic falls under A05:2025 Injection (which includes CWE-79, XSS).
Prevent Cross-Site Scripting attacks by properly encoding output and sanitizing user input.
When to Use
- Displaying user-generated content
- Building dynamic HTML
- Implementing rich text editors
- Rendering markdown or HTML
- Working with URL parameters in pages
- Building search results pages
XSS Types
| Type | Vector | Example |
|---|---|---|
| Reflected | URL parameters | ?search=<script>alert(1)</script> |
| Stored | Database content | Comment with malicious script |
| DOM-based | Client-side JS | document.write(location.hash) |
Vulnerable Patterns
Server-Side
// VULNERABLE - Direct interpolation
app.get('/search', (req, res) => {
res.send(`<h1>Results for: ${req.query.q}</h1>`);
});
// VULNERABLE - Template without escaping
res.render('profile', { bio: user.bio }); // If template doesn't auto-escape
Client-Side
// VULNERABLE - innerHTML with user data
element.innerHTML = userInput;
document.getElementById('output').innerHTML = data;
// VULNERABLE - document.write
document.write(location.search);
// VULNERABLE - eval with user data
eval(userCode);
// VULNERABLE - jQuery html()
$('#output').html(userData);
// VULNERABLE - React dangerouslySetInnerHTML
<div dangerouslySetInnerHTML={{__html: userContent}} />
Secure Implementation
1. Output Encoding
// HTML entity encoding
function escapeHtml(text) {
const map = {
'&': '&',
'<': '<',
'>': '>',
'"': '"',
"'": ''',
'/': '/'
};
return text.replace(/[&<>"'/]/g, char => map[char]);
}
// Usage
app.get('/search', (req, res) => {
const safeQuery = escapeHtml(req.query.q);
res.send(`<h1>Results for: ${safeQuery}</h1>`);
});
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.
- 26d ago Changed · +2 lines 93f460bc8681
- 2mo ago First seen · 346 lines · 75 tokens per session scan A 5dfc5159b606
xss-prevention is a skill published in the GitHub repository latestaiagents/agent-skills (6 stars, last pushed 26d ago), licensed MIT. It adds 75 tokens to every session and 2,428 once invoked, about $0.0003 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-09-03.
xss-prevention compared with skills from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| xss-preventionlatestaiagents/agent-skills | Skill | 6 | 26d ago | MIT | A | 75 | Claude Code |
| ai-core-web-vitalsskillsaiagent/aiskills | Skill | 5 | 5mo ago | none | A | 72 | Codex |
| ai-design-taste-frontendskillsaiagent/aiskills | Skill | 5 | 5mo ago | none | A | 80 | Codex |
| ai-extract-design-systemskillsaiagent/aiskills | Skill | 5 | 5mo ago | none | A | 73 | Codex |
| ai-frontend-designskillsaiagent/aiskills | Skill | 5 | 5mo ago | none | A | 72 | Codex |
| nexent-daily-testModelEngine-Group/nexent | Skill | 6.3k | yesterday | MIT | A | 78 | Claude Code, Codex |
| moai-design-toolsmodu-ai/moai-adk | Skill | 1.3k | today | Apache-2.0 | A | 45 | Claude Code |