/agent-skills-collection:security-expertfrom Agent Skills Collection
Use when analyzing security vulnerabilities, conducting security reviews, checking for common vulnerabilities, or when the user mentions "security", "vulnerability", "CVE", "OWASP", or "penetration test".
Ships in Agent Skills Collection. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Security Expert provides a systematic approach to identifying and preventing security vulnerabilities in code. It covers OWASP Top 10, common vulnerability patterns, secure coding practices, and remediation strategies for building secure applications.
Use this skill when:
Before writing code, understand potential threats:
Identify Assets
Map Attack Surface
Identify Attack Vectors
All user input is evil until proven otherwise.
The Problem:
-- User input directly concatenated
SELECT * FROM users WHERE id = ${userId}
-- Attacker input: 1; DROP TABLE users;--
The Solution - Parameterized Queries:
// ❌ BAD: String concatenation
const query = `SELECT * FROM users WHERE id = ${userId}`;
// ✅ GOOD: Parameterized query
const query = "SELECT * FROM users WHERE id = ?";
db.query(query, [userId]);
# ❌ BAD: String formatting
cursor.execute(f"SELECT * FROM users WHERE id = {user_id}")
# ✅ GOOD: Parameterized query
cursor.execute("SELECT * FROM users WHERE id = %s", (user_id,))
// ❌ BAD: User input in shell command
const cmd = `ls ${userDirectory}`;
exec(cmd);
// ✅ GOOD: Avoid shell when possible, or use safe alternatives
const files = fs.readdirSync(userDirectory);
# ❌ BAD: shell=True with user input
subprocess.run(f"ls {directory}", shell=True)
# ✅ GOOD: list form without shell
subprocess.run(["ls", directory])
// ❌ BAD: User input in file path
const file = path.join uploadsDir, req.body.filename;
fs.readFile(file);
// ✅ GOOD: Validate and sanitize
const filename = req.body.filename;
if (!isValidFilename(filename)) {
throw new Error('Invalid filename');
}
const file = path.join(uploadsDir, filename);
if (!file.startsWith(uploadsDir)) {
throw new Error('Path traversal detected');
}
// ❌ BAD: Plain text or weak hashing
const hash = crypto.createHash("md5").update(password).digest("hex");
// ✅ GOOD: Strong hashing with bcrypt/argon2
const hash = await bcrypt.hash(password, 12);
const match = await bcrypt.compare(password, hash);
# ❌ BAD: md5 or sha1
import hashlib
hash = hashlib.md5(password.encode()).hexdigest()
# ✅ GOOD: bcrypt or argon2
from passlib.context import CryptContext
pwd_context = CryptContext(schemes=["bcrypt"], deprecated="auto")
hash = pwd_context.hash(password)
// ❌ BAD: Weak session ID
const sessionId = user.id; // Using user ID as session!
// ✅ GOOD: Cryptographically random session
const sessionId = crypto.randomBytes(32).toString("hex");
// ❌ BAD: Client-side only authorization
if (user.role === "admin") {
showAdminPanel();
}
// ✅ GOOD: Server-side authorization check
async function adminHandler(req, res) {
const user = await getUser(req.session.userId);
if (user.role !== "admin") {
return res.status(403).json({ error: "Forbidden" });
}
// Proceed with admin operation
}
// ❌ BAD: No authorization check
app.get("/orders/:orderId", async (req, res) => {
const order = await db.orders.findById(req.params.orderId);
res.json(order);
});
// ✅ GOOD: Verify ownership
app.get("/orders/:orderId", async (req, res) => {
const order = await db.orders.findById(req.params.orderId);
if (order.userId !== req.session.userId) {
return res.status(403).json({ error: "Forbidden" });
}
res.json(order);
});
// ❌ BAD: Logging sensitive data
logger.info(`User login: ${email} password: ${password}`);
// ✅ GOOD: Never log sensitive data
logger.info(`User login attempt for: ${email}`);
# ❌ BAD: Returning all fields including sensitive
def get_user(user_id):
return db.users.find_one(id=user_id)
# ✅ GOOD: Select only needed fields
def get_user(user_id):
return db.users.find_one(
id=user_id,
projection={'password_hash': 0, 'ssn': 0}
)
// ❌ BAD: No encryption for sensitive data
const userData = { ssn: "123-45-6789" };
localStorage.setItem("user", JSON.stringify(userData));
// ✅ GOOD: Encrypt sensitive data
const encrypted = crypto
.createCipher("aes-256-gcm")
.update(JSON.stringify(userData), "utf8", "hex");
localStorage.setItem("user", encrypted);
// ❌ BAD: Hardcoded secrets
const API_KEY = "sk_live_abc123";
const DB_PASSWORD = "secret123";
// ✅ GOOD: Environment variables or secret manager
const API_KEY = process.env.API_KEY;
const DB_PASSWORD = await secretManager.get("db_password");
<!-- ❌ BAD: Unescaped user input -->
<div>{{ userBio }}</div>
<!-- If userBio = "<script>stealCookies()</script>" -->
<!-- ✅ GOOD: Context-aware escaping -->
<div>{{ userBio | escape }}</div>
// ❌ BAD: InnerHTML with user input
element.innerHTML = userComment;
// ✅ GOOD: Text content or sanitization
element.textContent = userComment;
// Or sanitize with DOMPurify
element.innerHTML = DOMPurify.sanitize(userComment);
<!-- ✅ GOOD: Strict CSP header -->
<meta
http-equiv="Content-Security-Policy"
content="default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'"
/>
// ❌ BAD: No rate limiting
app.post("/login", async (req, res) => {
const user = await authenticate(req.body);
res.json(user);
});
// ✅ GOOD: Rate limiting
const rateLimit = require("express-rate-limit");
const limiter = rateLimit({
windowMs: 15 * 60 * 1000, // 15 minutes
max: 5, // 5 attempts per window
message: "Too many attempts, please try again later",
});
app.post("/login", limiter, async (req, res) => {
const user = await authenticate(req.body);
res.json(user);
});
// ❌ BAD: Permissive CORS
app.use(cors({ origin: "*" }));
// ✅ GOOD: Restrictive CORS
app.use(
cors({
origin: ["https://trusted-domain.com"],
credentials: true,
}),
);
// ❌ BAD: Basic auth in URL
// GET /api/data?api_key=sk_live_abc123
// ✅ GOOD: Bearer token in header
// GET /api/data
// Authorization: Bearer sk_live_abc123
# npm audit
npm audit
# yarn audit
yarn audit
# Python safety
pip audit
# Docker scan
docker scan image:latest
# Check outdated packages
npm outdated
# Update specific package
npm update lodash@latest
# Update all packages
npm update
| Vulnerability | Attack | Impact | Fix |
|---|---|---|---|
| SQL Injection | Manipulate queries | Data breach | Parameterized queries |
| XSS | Inject scripts | Session hijacking | Escape output |
| CSRF | Forge requests | Unauthorized actions | CSRF tokens |
| IDOR | Access others' resources | Data exposure | Authorization checks |
| SSRF | Abuse server resources | Internal access | URL validation |
| Path Traversal | Access system files | System compromise | Path sanitization |
| Command Injection | Execute commands | System compromise | Avoid shell, sanitize |
| Category | Key Actions |
|---|---|
| Input | Validate, sanitize, parameterized queries |
| Auth | Strong hashing, MFA, session security |
| Access | Server-side checks, least privilege |
| Data | Encrypt, minimize exposure, secure storage |
| APIs | Rate limit, CORS, authentication |
| Dependencies | Scan, update, remove unused |
Security must be built in from the start, not bolted on at the end. Always validate input, encode output, use proper authentication and authorization, protect sensitive data, and keep dependencies updated. When in doubt, err on the side of caution.
What SKILL.md sets; muted values are Claude Code's defaults
Generated from the plugin's indexed repository (ntk148v/skills) — no native marketplace selected
npx claudepluginhub p/ntk148v-utility-skillsOther plugins' skills for the same job
14 skills in this plugin
/cavemanUltra-compressed communication mode. Cuts token usage ~75% by dropping filler, articles, and pleasantries while keeping full technical accuracy. Use when user says "caveman mode", "talk like caveman", "use caveman", "less tokens", "be brief", or invokes /caveman.
/code-reviewerUse when reviewing code, conducting code reviews, analyzing pull requests, or when the user mentions "code review", "PR review", "code quality", or "static analysis"./conventional-commitsUse when creating git commits, writing commit messages, or when the user mentions conventional commits, semantic versioning, or automated changelog generation.