security-audit
Audit codebases, infrastructure, AND agentic AI systems for security issues. Covers traditional security (dependencies, secrets, OWASP web top 10, SSL/TLS, file permissions) PLUS agentic security (prompt injection scanning, identity spoofing detection, memory poisoning checks, multi-agent communication audit, OWASP Agentic Top 10). Use when scanning for vulnerabilities, detecting hardcoded secrets, reviewing agent workspace configuration, checking prompt injection vectors, or auditing agent permissions and boundaries.
What this skill does
# Security Audit
Scan, detect, and fix security issues in codebases and infrastructure. Covers dependency vulnerabilities, secret detection, OWASP top 10, SSL/TLS verification, file permissions, and secure coding patterns.
## When to Use
- Scanning project dependencies for known vulnerabilities
- Detecting hardcoded secrets, API keys, or credentials in source code
- Reviewing code for OWASP top 10 vulnerabilities (injection, XSS, CSRF, etc.)
- Verifying SSL/TLS configuration for endpoints
- Auditing file and directory permissions
- Checking authentication and authorization patterns
- Preparing for a security review or compliance audit
## Dependency Vulnerability Scanning
### Node.js
```bash
# Built-in npm audit
npm audit
npm audit --json | jq '.vulnerabilities | to_entries[] | {name: .key, severity: .value.severity, via: .value.via[0]}'
# Fix automatically where possible
npm audit fix
# Show only high and critical
npm audit --audit-level=high
# Check a specific package
npm audit --package-lock-only
# Alternative: use npx to scan without installing
npx audit-ci --high
```
### Python
```bash
# pip-audit (recommended)
pip install pip-audit
pip-audit
pip-audit -r requirements.txt
pip-audit --format=json
# safety (alternative)
pip install safety
safety check
safety check -r requirements.txt --json
# Check a specific package
pip-audit --requirement=- <<< "requests==2.25.0"
```
### Go
```bash
# Built-in vuln checker
go install golang.org/x/vuln/cmd/govulncheck@latest
govulncheck ./...
# Check specific binary
govulncheck -mode=binary ./myapp
```
### Rust
```bash
# cargo-audit
cargo install cargo-audit
cargo audit
# With fix suggestions
cargo audit fix
```
### Universal: Trivy (scans any project)
```bash
# Install: https://aquasecurity.github.io/trivy
# Scan filesystem
trivy fs .
# Scan specific language
trivy fs --scanners vuln --severity HIGH,CRITICAL .
# Scan Docker image
trivy image myapp:latest
# JSON output
trivy fs --format json -o results.json .
```
## Secret Detection
### Manual grep patterns
```bash
# AWS keys
grep -rn 'AKIA[0-9A-Z]\{16\}' --include='*.{js,ts,py,go,java,rb,env,yml,yaml,json,xml,cfg,conf,ini}' .
# Generic API keys and tokens
grep -rn -i 'api[_-]\?key\|api[_-]\?secret\|access[_-]\?token\|auth[_-]\?token\|bearer ' \
--include='*.{js,ts,py,go,java,rb,env,yml,yaml,json}' .
# Private keys
grep -rn 'BEGIN.*PRIVATE KEY' .
# Passwords in config
grep -rn -i 'password\s*[:=]' --include='*.{env,yml,yaml,json,xml,cfg,conf,ini,toml}' .
# Connection strings with credentials
grep -rn -i 'mongodb://\|mysql://\|postgres://\|redis://' --include='*.{js,ts,py,go,env,yml,yaml,json}' . | grep -v 'localhost\|127.0.0.1\|example'
# JWT tokens (three base64 segments separated by dots)
grep -rn 'eyJ[A-Za-z0-9_-]*\.eyJ[A-Za-z0-9_-]*\.' --include='*.{js,ts,py,go,log,json}' .
```
### Automated scanning with git
```bash
# Scan git history for secrets (not just current files)
# Using git log + grep
git log -p --all | grep -n -i 'api.key\|password\|secret\|token' | head -50
# Check staged files before commit
git diff --cached --name-only | xargs grep -l -i 'api.key\|password\|secret\|token' 2>/dev/null
```
### Pre-commit hook for secrets
```bash
#!/bin/bash
# .git/hooks/pre-commit - Block commits containing potential secrets
PATTERNS=(
'AKIA[0-9A-Z]{16}'
'BEGIN.*PRIVATE KEY'
'password\s*[:=]\s*["\x27][^"\x27]+'
'api[_-]?key\s*[:=]\s*["\x27][^"\x27]+'
'sk-[A-Za-z0-9]{20,}'
'ghp_[A-Za-z0-9]{36}'
'xox[bpoas]-[A-Za-z0-9-]+'
)
STAGED_FILES=$(git diff --cached --name-only --diff-filter=ACM)
[ -z "$STAGED_FILES" ] && exit 0
EXIT_CODE=0
for pattern in "${PATTERNS[@]}"; do
matches=$(echo "$STAGED_FILES" | xargs grep -Pn "$pattern" 2>/dev/null)
if [ -n "$matches" ]; then
echo "BLOCKED: Potential secret detected matching pattern: $pattern"
echo "$matches"
EXIT_CODE=1
fi
done
if [ $EXIT_CODE -ne 0 ]; then
echo ""
echo "To proceed anyway: git commit --no-verify"
echo "To remove secrets: replace with environment variables"
fi
exit $EXIT_CODE
```
### .gitignore audit
```bash
# Check if sensitive files are tracked
echo "--- Files that should probably be gitignored ---"
for pattern in '.env' '.env.*' '*.pem' '*.key' '*.p12' '*.pfx' 'credentials.json' \
'service-account*.json' '*.keystore' 'id_rsa' 'id_ed25519'; do
found=$(git ls-files "$pattern" 2>/dev/null)
[ -n "$found" ] && echo " TRACKED: $found"
done
# Check if .gitignore exists and has common patterns
if [ ! -f .gitignore ]; then
echo "WARNING: No .gitignore file found"
else
for entry in '.env' 'node_modules' '*.key' '*.pem'; do
grep -q "$entry" .gitignore || echo " MISSING from .gitignore: $entry"
done
fi
```
## OWASP Top 10 Code Patterns
### 1. Injection (SQL, Command, LDAP)
```bash
# SQL injection: string concatenation in queries
grep -rn "query\|execute\|cursor" --include='*.{py,js,ts,go,java,rb}' . | \
grep -i "f\"\|format(\|%s\|\${\|+ \"\|concat\|sprintf" | \
grep -iv "parameterized\|placeholder\|prepared"
# Command injection: user input in shell commands
grep -rn "exec(\|spawn(\|system(\|popen(\|subprocess\|os\.system\|child_process" \
--include='*.{py,js,ts,go,java,rb}' .
# Check for parameterized queries (good)
grep -rn "\\$[0-9]\|\\?\|%s\|:param\|@param\|prepared" --include='*.{py,js,ts,go,java,rb}' .
```
### 2. Broken Authentication
```bash
# Weak password hashing (MD5, SHA1 used for passwords)
grep -rn "md5\|sha1\|sha256" --include='*.{py,js,ts,go,java,rb}' . | grep -i "password\|passwd"
# Hardcoded credentials
grep -rn -i "admin.*password\|password.*admin\|default.*password" \
--include='*.{py,js,ts,go,java,rb,yml,yaml,json}' .
# Session tokens in URLs
grep -rn "session\|token\|jwt" --include='*.{py,js,ts,go,java,rb}' . | grep -i "url\|query\|param\|GET"
# Check for rate limiting on auth endpoints
grep -rn -i "rate.limit\|throttle\|brute" --include='*.{py,js,ts,go,java,rb}' .
```
### 3. Cross-Site Scripting (XSS)
```bash
# Unescaped output in templates
grep -rn "innerHTML\|dangerouslySetInnerHTML\|v-html\|\|html(" \
--include='*.{js,ts,jsx,tsx,vue,html}' .
# Template injection
grep -rn "{{{.*}}}\|<%=\|<%-\|\$\!{" --include='*.{html,ejs,hbs,pug,erb}' .
# Document.write
grep -rn "document\.write\|document\.writeln" --include='*.{js,ts,html}' .
# eval with user input
grep -rn "eval(\|new Function(\|setTimeout.*string\|setInterval.*string" \
--include='*.{js,ts}' .
```
### 4. Insecure Direct Object References
```bash
# Direct ID usage in routes without authz check
grep -rn "params\.id\|params\[.id.\]\|req\.params\.\|request\.args\.\|request\.GET\." \
--include='*.{py,js,ts,go,java,rb}' . | \
grep -i "user\|account\|profile\|order\|document"
```
### 5. Security Misconfiguration
```bash
# CORS wildcard
grep -rn "Access-Control-Allow-Origin.*\*\|cors({.*origin.*true\|cors()" \
--include='*.{py,js,ts,go,java,rb}' .
# Debug mode in production configs
grep -rn "DEBUG\s*=\s*True\|debug:\s*true\|NODE_ENV.*development" \
--include='*.{py,js,ts,yml,yaml,json,env}' .
# Verbose error messages exposed to clients
grep -rn "stack\|traceback\|stackTrace" --include='*.{py,js,ts,go,java,rb}' . | \
grep -i "response\|send\|return\|res\."
```
## SSL/TLS Verification
### Check endpoint SSL
```bash
# Full SSL check
openssl s_client -connect example.com:443 -servername example.com < /dev/null 2>/dev/null | \
openssl x509 -noout -subject -issuer -dates -fingerprint
# Check certificate expiry
echo | openssl s_client -connect example.com:443 -servername example.com 2>/dev/null | \
openssl x509 -noout -enddate
# Check supported TLS versions
for v in tls1 tls1_1 tls1_2 tls1_3; do
result=$(openssl s_client -connect example.com:443 -$v < /dev/null 2>&1)
if echo "$result" | grep -q "Cipher is"; then
echo "$v: SUPPORTED"
else
echo "$v: NOT SUPPORTED"
fi
done
# Check cipher suites
openssl s_client -connect example.Related in AI Agents
skill-development
IncludedComprehensive meta-skill for creating, managing, validating, auditing, and distributing Claude Code skills and slash commands (unified in v2.1.3+). Provides skill templates, creation workflows, validation patterns, audit checklists, naming conventions, YAML frontmatter guidance, progressive disclosure examples, and best practices lookup. Use when creating new skills, validating existing skills, auditing skill quality, understanding skill architecture, needing skill templates, learning about YAML frontmatter requirements, progressive disclosure patterns, tool restrictions (allowed-tools), skill composition, skill naming conventions, troubleshooting skill activation issues, creating custom slash commands, configuring command frontmatter, using command arguments ($ARGUMENTS, $1, $2), bash execution in commands, file references in commands, command namespacing, plugin commands, MCP slash commands, Skill tool configuration, or deciding between skills vs slash commands. Delegates to docs-management skill for official documentation.
reprompter
IncludedTransform messy prompts into well-structured, effective prompts — single or multi-agent. Use when: "reprompt", "reprompt this", "clean up this prompt", "structure my prompt", rough text needing XML tags and best practices, "reprompter teams", "repromptception", "run with quality", "smart run", "smart agents", multi-agent tasks, audits, parallel work, anything going to agent teams. Don't use when: simple Q&A, pure chat, immediate execution-only tasks. See "Don't Use When" section for details. Outputs: Structured XML/Markdown prompt, quality score (before/after), optional team brief + per-agent sub-prompts, agent team output files. Success criteria: Single mode quality score ≥ 7/10; Repromptception per-agent prompt quality score 8+/10; all required sections present, actionable and specific.
adaptive-compaction
IncludedAdaptive add-on policy and recovery layer that decides WHEN to compact, prune, snapshot, or fork -- replacing fixed-percent auto-compaction across Claude Code, Codex, and MCP-capable hosts. Trigger on auto-compact timing or damage: "when should I compact", "is it safe to compact now or start a fresh session", "auto-compact fires too early/mid-task", "switching to an unrelated task but the window still has space", "context rot", "answers get worse the longer the session runs", "the agent forgot the plan or my decisions after it summarized", "add a layer on top that manages context without changing the agent", raising autoCompactWindow to give the policy room, or installing/tuning a cross-tool compaction policy or PreCompact hook -- even when "compaction" is never said but the problem is context-window pressure or post-summarization memory loss. Do NOT use to summarize a conversation, build RAG, write a summarization prompt (decides WHEN not HOW), or answer max-context-length trivia.
agent-skill-creator
IncludedCreate cross-platform agent skills from workflow descriptions. Activates when users ask to create an agent, automate a repetitive workflow, create a custom skill, or need advanced agent creation. Triggers on phrases like create agent for, automate workflow, create skill for, every day I have to, daily I need to, turn process into agent, need to automate, create a cross-platform skill, validate this skill, export this skill, migrate this skill. Supports single skills, multi-agent suites, transcript processing, template-based creation, interactive configuration, cross-platform export, and spec validation.
llm-wiki
IncludedUse when building or maintaining a persistent personal knowledge base (second brain) in Obsidian where an LLM incrementally ingests sources, updates entity/concept pages, maintains cross-references, and keeps a synthesis current. Triggers include "second brain", "Obsidian wiki", "personal knowledge management", "ingest this paper/article/book", "build a research wiki", "compound knowledge", "Memex", or whenever the user wants knowledge to accumulate across sessions instead of being re-derived by RAG on every query.
skill-master
IncludedAgent Skills authoring, evaluation, and optimization. Create, edit, validate, benchmark, and improve skills following the agentskills.io specification. Use when designing SKILL.md files, structuring skill folders (references, scripts, assets), ingesting external documentation into skills, running trigger evals, benchmarking skill quality, optimizing descriptions, or performing blind A/B comparisons. Keywords: agentskills.io, SKILL.md, skill authoring, eval, benchmark, trigger optimization.