Back to Skills

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

266stars28forksUpdated 8/13/2026

Security Assessment

Safe(94/100)
Security Score94/100

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 files
metadata.json0.2 KB
View
rules/_sections.md6.9 KB
View
rules/csrf.md5.4 KB
View
AGENTS.md112.7 KB
View
rules/code-injection.md4.7 KB
View
rules/insecure-deserialization.md6.7 KB
View
rules/prototype-pollution.md2.8 KB
View
rules/terraform-azure.md9.8 KB
View
rules/best-practice.md3.1 KB
View
rules/insecure-crypto.md4.5 KB
View
rules/performance.md3.4 KB
View
rules/terraform-aws.md4.8 KB
View
README.md2.6 KB
View
rules/correctness.md3.7 KB
View
rules/authentication-jwt.md2.9 KB
View
rules/github-actions.md5.3 KB
View
rules/path-traversal.md5.6 KB
View
rules/ssrf.md5.0 KB
View
SKILL.md4.9 KB
View
rules/_template.md0.6 KB
View
rules/docker.md2.8 KB
View
rules/memory-safety.md3.1 KB
View
rules/sql-injection.md5.3 KB
View
rules/command-injection.md3.4 KB
View
rules/insecure-transport.md6.6 KB
View
rules/race-condition.md6.9 KB
View
rules/terraform-gcp.md8.5 KB
View
rules/kubernetes.md4.4 KB
View
rules/regex-dos.md3.7 KB
View
rules/unsafe-functions.md5.3 KB
View
rules/maintainability.md1.8 KB
View
rules/secrets.md4.1 KB
View
rules/xss.md5.2 KB
View
rules/xxe.md4.5 KB
View

Install code-security

Download and extract the skill files to your .claude/skills/ directory.

Quick Setup:

  1. Copy the skill folder to .claude/skills/
  2. Claude will automatically detect and use the skill

Repository

semgrep/skills