
Code Security
- 10 installs
- 37 repo stars
- Updated July 15, 2026
- kimyx0207/skillsemgrep
Helps with security tasks.
About
code-security is a Claude Code skill for security. It helps solo builders move faster with AI-assisted development.
- code-security
- Security
- AI-coding skill
Code Security by the numbers
- 10 all-time installs (skills.sh)
- Ranked #1,669 of 2,203 Security skills by installs in the Skillselion catalog
- Data as of Aug 2, 2026 (Skillselion catalog sync)
npx skills add https://github.com/kimyx0207/skillsemgrep --skill code-securityAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 10 |
|---|---|
| repo stars | ★ 37 |
| Last updated | July 15, 2026 |
| Repository | kimyx0207/skillsemgrep ↗ |
What it does
Helps with security tasks.
Files
AI代码安全扫描专家
你是代码安全扫描专家,使用Semgrep对当前项目进行全面的安全漏洞检测。
---
前置检查
在执行任何扫描前,先确认Semgrep已安装:
semgrep --version如果未安装,执行:
pip install semgrep---
核心能力
1. 全面安全扫描(默认模式)
使用Semgrep推荐规则集扫描当前项目:
semgrep scan --config auto --json 2>/dev/null | python -m json.tool如果JSON输出太大,使用文本模式:
semgrep scan --config auto2. OWASP安全审计
专注于OWASP Top 10漏洞检测:
semgrep scan --config "p/security-audit"3. 语言专项扫描
根据项目主要语言选择规则集:
Python项目:
semgrep scan --config "p/python" --config "p/bandit"JavaScript/TypeScript项目:
semgrep scan --config "p/javascript" --config "p/typescript"Go项目:
semgrep scan --config "p/golang"4. 密钥泄露检测
检查代码中是否有硬编码的API密钥、密码、Token:
semgrep scan --config "p/secrets"5. 指定文件/目录扫描
semgrep scan --config auto <目标路径>---
扫描流程
收到用户请求后,按以下流程执行:
1. 确认环境:检查Semgrep版本,确认已安装 2. 识别项目语言:检查项目中的文件类型,确定主要语言 3. 选择扫描策略:根据用户需求选择合适的规则集 4. 执行扫描:运行Semgrep命令 5. 分析结果:解读扫描结果,按严重程度分类 6. 输出报告:生成结构化的安全报告
---
报告格式
扫描完成后,输出以下格式的报告:
扫描摘要
| 项目 | 结果 |
|---|---|
| 扫描工具 | Semgrep [版本] |
| 规则集 | [使用的规则集] |
| 扫描文件数 | [数量] |
| 发现问题数 | [数量] |
问题分类
按严重程度分类(高危 > 中危 > 低危 > 信息):
高危(必须修复)
- [文件:行号] 问题描述 + 修复建议
中危(建议修复)
- [文件:行号] 问题描述 + 修复建议
低危/信息
- [文件:行号] 问题描述
修复建议
针对每个高危和中危问题,提供: 1. 问题原因说明 2. 具体修复代码 3. 预防建议
---
使用示例
用户可以这样触发本Skill:
- "帮我安全扫描一下这个项目"
- "扫一下漏洞"
- "代码扫描"
- "检查一下有没有安全问题"
- "扫一下有没有密钥泄露"
- "对src目录做个安全检查"
---
注意事项
1. Semgrep是规则匹配工具,能发现已知模式的漏洞,但无法像Claude Code Security那样理解代码逻辑 2. 扫描结果可能有误报,需要结合上下文判断 3. 密钥泄露检测(p/secrets)建议每次提交前都跑一遍 4. 大型项目扫描可能需要较长时间,可以指定子目录缩小范围
# claude-code-security-skill installer for Windows
# Run: powershell -ExecutionPolicy Bypass -File install.ps1
$ErrorActionPreference = "Stop"
$SKILL_DIR = "$env:USERPROFILE\.claude\skills\code-security"
$SCRIPT_DIR = Split-Path -Parent $MyInvocation.MyCommand.Path
Write-Host ""
Write-Host "==================================" -ForegroundColor Cyan
Write-Host " Claude Code Security Skill"
Write-Host " One-Click Installer (Windows)"
Write-Host "==================================" -ForegroundColor Cyan
Write-Host ""
# Step 1: Check Python
Write-Host "[1/4] Checking Python..." -ForegroundColor Yellow
$pyCmd = $null
try {
$pyVer = & python --version 2>&1
if ($pyVer -match "Python") {
$pyCmd = "python"
Write-Host " OK $pyVer" -ForegroundColor Green
}
} catch {}
if (-not $pyCmd) {
try {
$pyVer = & python3 --version 2>&1
if ($pyVer -match "Python") {
$pyCmd = "python3"
Write-Host " OK $pyVer" -ForegroundColor Green
}
} catch {}
}
if (-not $pyCmd) {
Write-Host " FAIL Python not found" -ForegroundColor Red
Write-Host ""
Write-Host " Please install Python 3.8+ first:"
Write-Host " https://www.python.org/downloads/"
exit 1
}
# Step 2: Check/Install Semgrep
Write-Host "[2/4] Checking Semgrep..." -ForegroundColor Yellow
$sgInstalled = $false
try {
$sgVer = & semgrep --version 2>&1
if ($LASTEXITCODE -eq 0) {
$sgInstalled = $true
Write-Host " OK Semgrep $sgVer" -ForegroundColor Green
}
} catch {}
if (-not $sgInstalled) {
Write-Host " NOT FOUND Installing Semgrep..." -ForegroundColor Yellow
& $pyCmd -m pip install semgrep --quiet
try {
$sgVer = & semgrep --version 2>&1
if ($LASTEXITCODE -eq 0) {
Write-Host " OK Semgrep $sgVer installed" -ForegroundColor Green
} else {
throw "Install failed"
}
} catch {
Write-Host " FAIL Semgrep installation failed" -ForegroundColor Red
Write-Host ""
Write-Host " Try manually: pip install semgrep"
Write-Host " Then add Python Scripts folder to PATH"
exit 1
}
}
# Step 3: Install Skill
Write-Host "[3/4] Installing Skill..." -ForegroundColor Yellow
$skillFile = Join-Path $SCRIPT_DIR "SKILL.md"
if (-not (Test-Path $skillFile)) {
Write-Host " FAIL SKILL.md not found in $SCRIPT_DIR" -ForegroundColor Red
exit 1
}
if (-not (Test-Path $SKILL_DIR)) {
New-Item -ItemType Directory -Path $SKILL_DIR -Force | Out-Null
}
Copy-Item $skillFile -Destination (Join-Path $SKILL_DIR "SKILL.md") -Force
Write-Host " OK Copied to $SKILL_DIR\SKILL.md" -ForegroundColor Green
# Step 4: Verify
Write-Host "[4/4] Verifying..." -ForegroundColor Yellow
if (Test-Path (Join-Path $SKILL_DIR "SKILL.md")) {
Write-Host " OK Skill file exists" -ForegroundColor Green
} else {
Write-Host " FAIL Skill file not found after copy" -ForegroundColor Red
exit 1
}
Write-Host ""
Write-Host "==================================" -ForegroundColor Cyan
Write-Host " Installation Complete!" -ForegroundColor Green
Write-Host "==================================" -ForegroundColor Cyan
Write-Host ""
Write-Host " Skill location: $SKILL_DIR\SKILL.md"
Write-Host " Hot Reloading: No restart needed"
Write-Host ""
Write-Host " Usage in Claude Code:"
Write-Host " - Say: 安全扫描一下这个项目"
Write-Host " - Say: 扫一下有没有漏洞"
Write-Host " - Or: /code-security"
Write-Host ""
#!/usr/bin/env bash
# claude-code-security-skill installer
# One command to install Semgrep + Claude Code Skill
set -e
GREEN='\033[0;32m'
RED='\033[0;31m'
YELLOW='\033[1;33m'
NC='\033[0m'
SKILL_DIR="$HOME/.claude/skills/code-security"
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
echo ""
echo "=================================="
echo " Claude Code Security Skill"
echo " One-Click Installer"
echo "=================================="
echo ""
# Step 1: Check Python
echo -e "${YELLOW}[1/4]${NC} Checking Python..."
if command -v python3 &>/dev/null; then
PY_CMD="python3"
PY_VER=$($PY_CMD --version 2>&1)
echo -e " ${GREEN}OK${NC} $PY_VER"
elif command -v python &>/dev/null; then
PY_CMD="python"
PY_VER=$($PY_CMD --version 2>&1)
echo -e " ${GREEN}OK${NC} $PY_VER"
else
echo -e " ${RED}FAIL${NC} Python not found"
echo ""
echo " Please install Python 3.8+ first:"
echo " https://www.python.org/downloads/"
exit 1
fi
# Step 2: Check/Install Semgrep
echo -e "${YELLOW}[2/4]${NC} Checking Semgrep..."
if command -v semgrep &>/dev/null; then
SG_VER=$(semgrep --version 2>&1)
echo -e " ${GREEN}OK${NC} Semgrep $SG_VER"
else
echo -e " ${YELLOW}NOT FOUND${NC} Installing Semgrep..."
$PY_CMD -m pip install semgrep --quiet
if command -v semgrep &>/dev/null; then
SG_VER=$(semgrep --version 2>&1)
echo -e " ${GREEN}OK${NC} Semgrep $SG_VER installed"
else
echo -e " ${RED}FAIL${NC} Semgrep installation failed"
echo ""
echo " Try manually: pip install semgrep"
echo " If 'command not found', add Python Scripts to PATH"
exit 1
fi
fi
# Step 3: Install Skill
echo -e "${YELLOW}[3/4]${NC} Installing Skill..."
if [ ! -f "$SCRIPT_DIR/SKILL.md" ]; then
echo -e " ${RED}FAIL${NC} SKILL.md not found in $SCRIPT_DIR"
exit 1
fi
mkdir -p "$SKILL_DIR"
cp "$SCRIPT_DIR/SKILL.md" "$SKILL_DIR/SKILL.md"
echo -e " ${GREEN}OK${NC} Copied to $SKILL_DIR/SKILL.md"
# Step 4: Verify
echo -e "${YELLOW}[4/4]${NC} Verifying..."
if [ -f "$SKILL_DIR/SKILL.md" ]; then
echo -e " ${GREEN}OK${NC} Skill file exists"
else
echo -e " ${RED}FAIL${NC} Skill file not found after copy"
exit 1
fi
echo ""
echo "=================================="
echo -e " ${GREEN}Installation Complete!${NC}"
echo "=================================="
echo ""
echo " Skill location: $SKILL_DIR/SKILL.md"
echo " Hot Reloading: No restart needed"
echo ""
echo " Usage in Claude Code:"
echo " - Say: 安全扫描一下这个项目"
echo " - Say: 扫一下有没有漏洞"
echo " - Or: /code-security"
echo ""
MIT License
Copyright (c) 2026
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
English | 中文
Claude Code Security Scanning Skill
<div align="center">
Just say "scan for vulnerabilities" in Claude Code — powered by Semgrep
</div>
---
Overview
A Semgrep-based code security scanning skill for Claude Code. After installation, trigger security scans with natural language — no commands to memorize.
Features
- Comprehensive Security Scanning: Auto-detect OWASP Top 10 vulnerabilities
- Secret Detection: Find hardcoded API keys, passwords, and tokens
- Multi-Language Support: Python, JavaScript/TypeScript, Go, and dozens more
- Structured Reports: Categorized by High/Medium/Low severity with fix suggestions
- Natural Language Triggers: Say "security scan" or "scan for vulnerabilities"
Prerequisites
- Claude Code installed
Python and Semgrep are auto-installed by the setup script.
Installation
Option 1: Clone + One-Click Install (Recommended)
git clone https://github.com/KimYx0207/SkillSemgrep.git
cd SkillSemgrepMac/Linux:
bash install.shWindows (PowerShell):
powershell -ExecutionPolicy Bypass -File install.ps1Windows (Git Bash):
bash install.shOption 2: Manual Installation
Mac/Linux:
pip install semgrep
mkdir -p ~/.claude/skills/code-security
curl -fsSL https://raw.githubusercontent.com/KimYx0207/SkillSemgrep/main/SKILL.md -o ~/.claude/skills/code-security/SKILL.mdWindows (PowerShell):
pip install semgrep
New-Item -ItemType Directory -Path ":USERPROFILE\.claude\skills\code-security" -Force
Invoke-WebRequest -Uri "https://raw.githubusercontent.com/KimYx0207/SkillSemgrep/main/SKILL.md" -OutFile ":USERPROFILE\.claude\skills\code-security\SKILL.md"No restart needed — Claude Code's Hot Reloading auto-loads the new Skill.
Usage
Natural Language
Scan this project for security issuesCheck for leaked secretsRun a security audit on the src directorySlash Command
/code-securityScan Modes
| Mode | Trigger | Ruleset |
|---|---|---|
| Full Scan | "security scan" | --config auto |
| OWASP Audit | "OWASP scan" | p/security-audit |
| Secret Detection | "scan for leaked keys" | p/secrets |
| Python | "scan Python code" | p/python + p/bandit |
| JS/TS | "check JS security" | p/javascript + p/typescript |
| Go | "Go security check" | p/golang |
Report Example
Scan Summary
├── Tool: Semgrep v1.152.0
├── Ruleset: auto
├── Files Scanned: 127
└── Issues Found: 5
High (Must Fix)
├── src/auth.py:42 SQL injection — use parameterized queries
└── config/db.js:15 Hardcoded DB password — move to env vars
Medium (Should Fix)
├── utils/http.py:88 SSL cert not verified — enable verify=True
└── api/upload.js:23 No file size limit — add size restriction
Low
└── tests/mock.py:5 Weak password in test — test env onlySemgrep vs Claude Code Security
| Dimension | Semgrep (This Skill) | Claude Code Security |
|---|---|---|
| Approach | Rule pattern matching | AI code understanding |
| Speed | Fast | Slower |
| False Positives | Medium | Low (multi-stage verification) |
| Detection | Known vulnerability patterns | Can find novel vulnerabilities |
| Price | Free & open source | Enterprise/Team only |
| Availability | Available now | Limited preview |
Background
On Feb 20, 2026, Anthropic launched Claude Code Security, finding 500+ zero-day vulnerabilities during testing. CrowdStrike dropped 8%, Okta dropped 9.2%.
But Claude Code Security is currently Enterprise/Team only. This Skill is the free alternative — Semgrep-based security scanning integrated into Claude Code, triggered by natural language.
License
MIT
中文 | English
Claude Code 安全扫描 Skill
<div align="center">
</div>
老金的开源知识库,实时更新群二维码:https://my.feishu.cn/wiki/OhQ8wqntFihcI1kWVDlcNdpznFf
📞 联系方式
<div align="center"> <img src="images/二维码基础款.png" alt="联系方式" width="600"/> <p><strong>获取更多AI资讯和技术支持</strong></p> <p>微信公众号:获取AI第一信息 | 个人微信号:备注'AI'加群交流</p> </div>
☕ 请我喝杯咖啡
<div align="center"> <p><strong>如果这个教程对你有帮助,欢迎打赏支持!</strong></p> <table align="center"> <tr> <td align="center"> <img src="images/微信.jpg" alt="微信收款码" width="300"/> <br/> <strong>微信支付</strong> </td> <td align="center"> <img src="images/支付宝.jpg" alt="支付宝收款码" width="300"/> <br/> <strong>支付宝</strong> </td> </tr> </table> </div>
---
概述
说句中文就能扫漏洞。
基于 Semgrep 的代码安全扫描技能,安装后在 Claude Code 里用自然语言触发安全扫描,无需记任何命令。
它能干什么
- 全面安全扫描:自动检测 OWASP Top 10 漏洞
- 密钥泄露检测:找出代码里硬编码的 API Key、密码、Token
- 多语言支持:Python、JavaScript/TypeScript、Go 等几十种语言
- 结构化报告:按高危/中危/低危分类,附带修复建议
- 中文触发:说"安全扫描"、"扫漏洞"就能用,也支持英文和斜杠命令
前置要求
- Claude Code 已安装
Python 和 Semgrep 不用你手动装,安装脚本会自动搞定。
安装
方式一:Clone + 一键安装(推荐)
git clone https://github.com/KimYx0207/SkillSemgrep.git
cd SkillSemgrepMac / Linux:
bash install.shWindows(PowerShell):
powershell -ExecutionPolicy Bypass -File install.ps1Windows(Git Bash):
bash install.sh脚本会自动: 1. 检测 Python(未安装会提示下载链接) 2. 检测并安装 Semgrep(未安装会自动 pip install) 3. 复制 SKILL.md 到 Skill 目录 4. 验证安装成功
方式二:手动安装
如果你不想跑脚本,三步搞定:
Mac / Linux:
pip install semgrep
mkdir -p ~/.claude/skills/code-security
curl -fsSL https://raw.githubusercontent.com/KimYx0207/SkillSemgrep/main/SKILL.md -o ~/.claude/skills/code-security/SKILL.mdWindows(PowerShell):
pip install semgrep
New-Item -ItemType Directory -Path "$env:USERPROFILE\.claude\skills\code-security" -Force
Invoke-WebRequest -Uri "https://raw.githubusercontent.com/KimYx0207/SkillSemgrep/main/SKILL.md" -OutFile "$env:USERPROFILE\.claude\skills\code-security\SKILL.md"安装完成,不需要重启 Claude Code。Hot Reloading 会自动加载新 Skill。
安装位置说明
| 位置 | 路径 | 作用域 |
|---|---|---|
| 全局(推荐) | ~/.claude/skills/code-security/SKILL.md | 所有项目可用 |
| 项目级 | .claude/skills/code-security/SKILL.md | 仅当前项目 |
使用方法
自然语言触发
在 Claude Code 里直接说:
安全扫描一下这个项目扫一下有没有漏洞检查一下密钥有没有泄露对 src 目录做个安全检查斜杠命令
/code-security扫描模式
| 模式 | 触发方式 | 规则集 |
|---|---|---|
| 全面扫描 | "安全扫描" | --config auto |
| OWASP审计 | "OWASP扫描" | p/security-audit |
| 密钥检测 | "扫密钥泄露" | p/secrets |
| Python专项 | "扫一下Python代码" | p/python + p/bandit |
| JS/TS专项 | "检查JS安全" | p/javascript + p/typescript |
| Go专项 | "Go代码安全检查" | p/golang |
报告示例
扫描完成后,Claude Code 会输出结构化报告:
扫描摘要
├── 扫描工具:Semgrep v1.152.0
├── 规则集:auto
├── 扫描文件数:127
└── 发现问题数:5
高危(必须修复)
├── src/auth.py:42 SQL注入风险 - 使用参数化查询替代字符串拼接
└── config/db.js:15 硬编码数据库密码 - 移到环境变量
中危(建议修复)
├── utils/http.py:88 未验证SSL证书 - 启用verify=True
└── api/upload.js:23 未限制上传文件大小 - 添加size限制
低危
└── tests/mock.py:5 测试文件中的弱密码 - 仅影响测试环境SKILL.md 官方格式说明
本项目遵循 Claude Code 官方 Skill 格式:
| 字段 | 说明 |
|---|---|
name | Skill 唯一标识,同时也是 /斜杠命令 名 |
description | Claude 靠这个做语义匹配,决定什么时候自动加载 |
version | 版本号 |
context: fork | 在隔离上下文执行,不影响主对话 |
description 是最关键的字段。Claude Code 用它做语义匹配——你说"安全扫描",它去匹配所有 Skill 的 description,找最相关的加载。所以 description 里要把触发条件写清楚,中英文都可以。
自定义
添加新的扫描规则
编辑 SKILL.md,在"核心能力"部分添加新的扫描命令:
### 6. Docker安全扫描
semgrep scan --config "p/docker-compose"
修改报告格式
编辑 SKILL.md 的"报告格式"部分,按你的需求调整输出模板。
修改后保存即可,Claude Code 的 Hot Reloading 会自动生效。
Semgrep vs Claude Code Security
| 维度 | Semgrep(本Skill) | Claude Code Security |
|---|---|---|
| 原理 | 规则模式匹配 | AI理解代码逻辑 |
| 速度 | 快 | 较慢 |
| 误报率 | 中等 | 低(多阶段自我验证) |
| 发现能力 | 已知漏洞模式 | 可发现全新类型漏洞 |
| 价格 | 免费开源 | Enterprise/Team客户 |
| 可用性 | 现在就能用 | 限量预览中 |
本 Skill 基于 Semgrep,适合日常开发的安全检查。等 Claude Code Security 开放后可以升级。
背景
2026年2月20日,Anthropic 发布 Claude Code Security,在测试阶段找出了 500 多个零日漏洞。消息一出,CrowdStrike 跌了 8%,Okta 跌了 9.2%。
但 Claude Code Security 目前只对 Enterprise 和 Team 客户开放。这个 Skill 是免费替代方案——用 Semgrep 做基础安全扫描,集成到 Claude Code 里,说句话就能用。
License
MIT