code-security
Security guidelines for writing secure code. Use when writing code, reviewing code for vulnerabilities, or asking about secure coding practices like 'check for SQL injection' or 'review security'. IMPORTANT: Always consult this skill when writing or reviewing any code that handles user input, authentication, file operations, database queries, network requests, cryptography, or infrastructure configuration (Terraform, Kubernetes, Docker, GitHub Actions) — even if the user doesn't explicitly menti
Security Assessment
About code-security
Code Security is a defensive secure-coding reference for Claude, contributed by Semgrep, that supplies security rules for writing and reviewing code across 15+ languages. It addresses the common failure where code that handles user input, authentication, database queries, file operations, network requests, cryptography, or infrastructure configuration ships with well-known vulnerability classes. The skill is designed to be consulted proactively while writing code, not only when a user explicitly asks about security, mapping the OWASP Top 10 and infrastructure hardening into 28 rule categories.
The skill organizes rules by impact level and by language priority. A SKILL.md index routes to per-category rule files under rules/ covering critical issues (SQL injection, command injection, XSS, XXE, path traversal, insecure deserialization, code injection, hardcoded secrets, memory safety), high-impact issues (weak crypto, insecure transport, SSRF, JWT verification, CSRF, prototype pollution, unsafe functions), and infrastructure misconfigurations for Terraform on AWS/Azure/GCP, Kubernetes, Docker, and GitHub Actions, plus medium and low categories for ReDoS, race conditions, correctness, best practices, performance, and maintainability. Each rule file provides vulnerable-versus-secure code examples and CWE references so the guidance can be applied while writing or used to flag issues during review.
It targets developers and code reviewers who want defensive security folded into everyday coding, and is well suited to language-specific hardening, pre-commit review, and infrastructure-as-code audits. Although it enumerates vulnerability classes, the intent and framing are entirely protective — teaching secure patterns and how to avoid the insecure ones.
FAQ
Which languages and platforms does it cover?
It provides priority rule sets for Python, JavaScript/TypeScript, Java, Go, C/C++, Ruby, and PHP, plus infrastructure-as-code for Terraform (AWS, Azure, GCP), Kubernetes, Docker, and GitHub Actions.
Is this an offensive or defensive skill?
Defensive. It teaches secure coding patterns and how to spot and fix vulnerable ones, referencing OWASP Top 10 and CWE identifiers; it does not provide exploit code.
How is it meant to be used during a task?
In proactive mode it checks for relevant vulnerabilities automatically based on the language and what the code does; in reactive mode it locates the relevant rule file and reads its detailed examples when you ask about security.
How are the rules prioritized?
By impact: Critical categories (like SQL injection and hardcoded secrets) are addressed first, followed by High, then Medium and Low categories such as ReDoS, correctness, and performance.
Does it run any scanning tools itself?
The provided content is guidance and rule references with code examples; it directs secure patterns and flags vulnerable ones rather than executing a scanner as part of the skill.
All Files
34 filesInstall code-security
Quick Setup:
- Copy the skill folder to
.claude/skills/ - Claude will automatically detect and use the skill
Repository
semgrep/skills