Skip to main content
skill CX Codex

input-validation-sanitization-auditor — Claude Code skill

The input-validation-sanitization-auditor skill for Claude Code audits untrusted inputs and addresses XSS, SQL injection, and command injection with schema validation and safe coding patterns.

MIT 292 installs ★ 64 updated 2026-01-12

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add patricio0312rev/skills --skill input-validation-sanitization-auditor -a claude-code
Open on GitHub

What input-validation-sanitization-auditor does

This skill guides coding agents through auditing untrusted inputs across handlers and templates. It replaces risky string concatenation inside database queries with parameterized statements or ORM calls such as Prisma. For web responses, it introduces output escaping with libraries like html-escaper or template engines with built-in protections.

Input verification relies on zod schemas to enforce strict types, string lengths, and input constraints on incoming payloads. The inspection checklist covers command injection risks, output encoding, sanitizers, and dedicated security tests.

Applying these patterns directly to an existing codebase requires adding validation libraries such as zod to package dependencies.

What it helps with

  • detect potential XSS vulnerabilities in HTTP route handlers
  • convert string-concatenated SQL queries to parameterized calls
  • generate Zod validation schemas for incoming requests
  • audit code for command injection risks

Example prompts for the agent

  • Audit routes/users.ts for SQL injection and cross-site scripting flaws
  • Create a Zod schema to validate inputs on the /register endpoint
  • Refactor raw database queries in db.ts to use parameterized queries

How to install input-validation-sanitization-auditor

1Skills CLI (Vercel)

npx skills add patricio0312rev/skills --skill input-validation-sanitization-auditor -a claude-code

2Manually: put the files in place

~/.claude/skills/input-validation-sanitization-auditor/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/input-validation-sanitization-auditor/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about input-validation-sanitization-auditor

How to install input-validation-sanitization-auditor in Claude Code?

Run npx skills add patricio0312rev/skills --skill input-validation-sanitization-auditor -a claude-code in your terminal.

What does this skill do?

It spots injection flaws in application code and applies defensive patterns like Zod schemas, HTML escaping, and parameterized database queries.

Which libraries are featured in the skill instructions?

The skill provides patterns designed around zod, html-escaper, and Prisma ORM.

Source text

SKILL.md · MIT
---
name: input-validation-sanitization-auditor
description: Identifies and fixes XSS, SQL injection, and command injection vulnerabilities with validation schemas, sanitization libraries, and safe coding patterns. Use for "input validation", "XSS prevention", "SQL injection", or "sanitization".
---

# Input Validation & Sanitization Auditor

Prevent injection attacks through proper input handling.

## XSS Prevention

```typescript
// ❌ DANGEROUS: Direct HTML injection
app.get("/search", (req, res) => {
  res.send(`<h1>Results for: ${req.query.q}</h1>`); // XSS!
});

// ✅ SAFE: Properly escaped
import { escape } from "html-escaper";

app.get("/search", (req, res) => {
  res.send(`<h1>Results for: ${escape(req.query.q)}</h1>`);
});

// ✅ BETTER: Template engine with auto-escaping
res.render("search", { query: req.query.q }); // EJS/Pug escape by default
```

## SQL Injection Prevention

```typescript
// ❌ DANGEROUS: String concatenation
const userId = req.params.id;
const query = `SELECT * FROM users WHERE id = '${userId}'`; // SQL Injection!
db.query(query);

// ✅ SAFE: Parameterized queries
db.query("SELECT * FROM users WHERE id = $1", [userId]);

// ✅ BEST: ORM (Prisma)
await prisma.user.findUnique({ where: { id: userId } });
```

## Input Validation Schema

```typescript
import { z } from "zod";

const userSchema = z.object({
  email: z.string().email().max(255),
  password: z.string().min(12).max(128),
  age: z.number().int().min(13).max(120),
  website: z.string().url().optional(),
});

app.post("/register", async (req, res) => {
  try {
    const validated = userSchema.parse(req.body);
    await createUser(validated);
    res.json({ success: true });
  } catch (error) {
    res.status(400).json({ error: error.errors });
  }
});
```

## Output Checklist

- [ ] XSS prevention (escaping, CSP)
- [ ] SQL injection prevention (parameterized queries)
- [ ] Command injection prevention
- [ ] Input validation schemas
- [ ] Output encoding
- [ ] Sanitization libraries
- [ ] Security tests
      ENDFILE

© patricio0312rev · MIT · patricio0312rev/skills

Similar skills

All skills for Security →

From the same set148

The whole set →
cors-configuration cors-configuration sets up CORS for an API: allowed origins, response headers, preflight handling and credentials, with worked Express and Next.js examples. CX Codex +1 294installs api-endpoint-generator api-endpoint-generator builds CRUD REST APIs with request checks, TypeScript types, shared response shapes, error handling, and docs. Use it for backend routes and API work. CX Codex +1 294installs table-builder table-builder generates data tables in React with sorting, filtering, pagination, and server or client rendering modes. CX Codex +1 293installs event-driven-architect event-driven-architect guides event-driven system design, from domain events and payload schemas to buses and handlers. Useful when shaping a CQRS or event-sourcing design. CX Codex +1 292installs prompt-template-builder prompt-template-builder turns a one-off prompt into a reusable template: system and user parts, variables, a fixed answer format, examples. Useful when the model's output has to look the same every run. CX Codex +1 291installs modal-drawer-system modal-drawer-system generates accessible React dialogs, side drawers, and bottom sheets with focus trapping, portal rendering, and body scroll lock. CX Codex +1 291installs env-secrets-manager env-secrets-manager keeps API keys and environment variables where they belong: placeholders in .env.example, real values out of git, config checked at boot. CX Codex +1 289installs api-security-hardener api-security-hardener — a skill that hardens Express APIs: Zod validation, Redis-backed rate limits, and JWT authentication with role checks. CX Codex +1 289installs

Project sponsors

Companies that keep this analytics open