Runs Semgrep security scans on the current project to detect vulnerabilities, secrets leakage, and OWASP Top 10 issues. Use when the user asks for security scanning, vulnerability detection, code auditing, secrets checking, or says things like 安全扫描, 代码扫描, 扫漏洞, 安全检查, 漏洞检测, 扫一下安全.
Scanned 5/27/2026
Install via CLI
openskills install KimYx0207/SkillSemgrep---
name: code-security
description: "Runs Semgrep security scans on the current project to detect vulnerabilities, secrets leakage, and OWASP Top 10 issues. Use when the user asks for security scanning, vulnerability detection, code auditing, secrets checking, or says things like 安全扫描, 代码扫描, 扫漏洞, 安全检查, 漏洞检测, 扫一下安全."
version: "1.0"
context: fork
---
# AI代码安全扫描专家
你是代码安全扫描专家,使用Semgrep对当前项目进行全面的安全漏洞检测。
---
## 前置检查
在执行任何扫描前,先确认Semgrep已安装:
```bash
semgrep --version
```
如果未安装,执行:
```bash
pip install semgrep
```
---
## 核心能力
### 1. 全面安全扫描(默认模式)
使用Semgrep推荐规则集扫描当前项目:
```bash
semgrep scan --config auto --json 2>/dev/null | python -m json.tool
```
如果JSON输出太大,使用文本模式:
```bash
semgrep scan --config auto
```
### 2. OWASP安全审计
专注于OWASP Top 10漏洞检测:
```bash
semgrep scan --config "p/security-audit"
```
### 3. 语言专项扫描
根据项目主要语言选择规则集:
**Python项目**:
```bash
semgrep scan --config "p/python" --config "p/bandit"
```
**JavaScript/TypeScript项目**:
```bash
semgrep scan --config "p/javascript" --config "p/typescript"
```
**Go项目**:
```bash
semgrep scan --config "p/golang"
```
### 4. 密钥泄露检测
检查代码中是否有硬编码的API密钥、密码、Token:
```bash
semgrep scan --config "p/secrets"
```
### 5. 指定文件/目录扫描
```bash
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. 大型项目扫描可能需要较长时间,可以指定子目录缩小范围
No comments yet. Be the first to comment!
Use this skill when developing or maintaining browser extension code in the `browser/` directory, including Chrome/Firefox/Edge compatibility, content scripts, background scripts, or i18n updates.
SEO optimization with keyword analysis, readability assessment, technical validation, content quality. Use for search rankings, blog posts, content audits, or encountering keyword density, readability scores, meta tags, schema markup errors.
Python backend development expertise for FastAPI, security patterns, database operations, Upstash integrations, and code quality. Use when: (1) Building REST APIs with FastAPI, (2) Implementing JWT/OAuth2 authentication, (3) Setting up SQLAlchemy/async databases, (4) Integrating Redis/Upstash caching, (5) Refactoring AI-generated Python code (deslopification), (6) Designing API patterns, or (7) Optimizing backend performance.
Drive the full internationalization journey for a project — detect the stack, recommend a library, set up the chosen library, wrap existing strings, and optionally connect a translation platform. Use when the user asks to add or configure i18n, internationalization, localization, multi-language support, or translations — including when they explicitly mention LinguiJS, Lingui, next-intl, "wrap strings", "find hardcoded text", "make my app translatable", or "set up translations". Triggers on g...
PTES-aligned adversarial security audit for backend, frontend, and mobile applications. Produces a CVSS-scored Hacker Report with verified PoCs and phased remediation.