implementing-semgrep-for-custom-sast-rules
Write custom Semgrep SAST rules in YAML to detect application-specific vulnerabilities, enforce coding standards, and integrate into CI/CD pipelines.
Skill by Njones17
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/njones17-implementing-semgrep-for-custom-sast-rules
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: devops, security, writing
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/implementing-semgrep-for-custom-sast-rules
What's inside
- Skill name
implementing-semgrep-for-custom-sast-rules- Description
- Write custom Semgrep SAST rules in YAML to detect application-specific vulnerabilities, enforce coding standards, and integrate into CI/CD pipelines.
- License
- MIT
- Instructions
- 298 lines in SKILL.md · view on GitHub
Files (2)
- SKILL.md
- standards.md · references/
SKILL.md (first lines)
# Implementing Semgrep for Custom SAST Rules
## Overview
Semgrep is an open-source static analysis tool that uses pattern-matching to find bugs, enforce code standards, and detect security vulnerabilities. Custom rules are written in YAML using Semgrep's pattern syntax, making it accessible without requiring compiler knowledge. It supports 30+ languages including Python, JavaScript, Go, Java, and C.
## Prerequisites
- Python 3.8+ or Docker
- Semgrep CLI installed
- Target codebase in a supported language
## Installation
```bash
# Install via pip
pip install semgrep
# Install via Homebrew
brew install semgrep
# Run via Docker
docker run -v "${PWD}:/src" returntocorp/semgrep semgrep --config auto /src
# Verify
semgrep --version
```
## Running Semgrep
```bash
# Auto-detect rules for your code
semgrep --config auto .
# Use Semgrep registry rules
semgrep --config r/python.lang.security
# Use custom rule file
semgrep --config my-rules.yaml .
# Use multiple configs
semgrep --config auto --config ./custom-rules/ .
# JSON output
semgrep --config auto --json . > results.json
# SARIF output for GitHub
semgrep --config auto --sarif . > results.sarif
# Filter by severity
semgrep --config auto --severity ERROR .
```
## Writing Custom Rules
### Basic Pattern Matching
```yaml
# rules/sql-injection.yaml
rules:
- id: sql-injection-string-format
languages: [python]
severity: ERROR
message: |
Potential SQL injection via string formatting.
Use parameterized queries instead.
pattern: |
cursor.execute(f"..." % ...)
metadata:
cwe: ["CWE-89"]
owasp: ["A03:2021"]
category: security
fix: |
cursor.execute("SELECT * FROM users WHERE id = %s", (user_id,))
```
### Pattern Operators
```yaml
rules:
- id: hardcoded-secret-in-code
languages: [python, javascript, typescript]
severity: ERROR
message: Hardcoded secret detected in source code
patterns:
- pattern-either:
- pattern: $VAR = "..."
- pattern: $VAR = '...'
- metavariable-regex:
metavariable: $VAR
regex: (?i)(password|secret|api_key|token|aws_secret)
- pattern-not: $VAR = ""
- pattern-not: $VAR = "changeme"
- pattern-not: $VAR = "PLACEHOLDER"
metadata:
cwe: ["CWE-798"]
category: security
```
### Taint Analysis
```yaml
rules:
- id: xss-taint-tracking
languages: [python]
severity: ERROR
message: User input flows to HTML response without sanitization
mode: taint
pattern-sources:
- pattern: request.args.get(...)
- pattern: request.form.get(...)
- pattern: request.form[...]
pattern-sinks:
- pattern: return render_template_string(...)
- pattern: Markup(...)
pattern-sanitizers:
- pattern: bleach.clean(...)
- pattern: escape(...)
metadata:From Njones17/AI-agent-master-cyber-skills-list, MIT.
More from Njones17/AI-agent-master-cyber-skills-list
- 0.497score
dast-scanning
devops-skills
Perform dynamic application security testing with OWASP ZAP, Burp Suite, and Nikto.
SkillDFreshness: D★ 24Claude Code +9 - 0.497score
integrating-sast-into-github-actions-pipeline
Njones17
This skill covers integrating Static Application Security Testing (SAST) tools—CodeQL and Semgrep—into GitHub Actions CI/CD pipelines.
SkillDFreshness: D★ 24Claude Code +9 - 0.497score
performing-sca-dependency-scanning-with-snyk
Njones17
This skill covers implementing Software Composition Analysis (SCA) using Snyk to detect vulnerable open-source dependencies in CI/CD pipelines.
SkillDFreshness: D★ 24Claude Code +9 - 0.497score
integrating-dast-with-owasp-zap-in-pipeline
Njones17
This skill covers integrating OWASP ZAP (Zed Attack Proxy) for Dynamic Application Security Testing in CI/CD pipelines.
SkillDFreshness: D★ 24Claude Code +9 - 0.497score
sast-scanning
devops-skills
Perform static application security testing with tools like Semgrep, CodeQL, and SonarQube.
SkillDFreshness: D★ 24Claude Code +9 - 0.497score
ghost-scan-code
Njones17
Ghost Security - SAST code scanner.
SkillDFreshness: D★ 24Claude Code +9 - 0.494score
performing-cryptographic-audit-of-application
Njones17
A cryptographic audit systematically reviews an application's use of cryptographic primitives, protocols, and key management to identify vulnerabilities such…
SkillDFreshness: D★ 24Claude Code +9 - 0.494score
implementing-github-advanced-security-for-code-scanning
Njones17
Configure GitHub Advanced Security with CodeQL to perform automated static analysis and vulnerability detection across repositories at enterprise scale.
SkillDFreshness: D★ 24Claude Code +9 - 0.492score
implementing-api-key-security-controls
Njones17
Implements secure API key generation, storage, rotation, and revocation controls to protect API authentication credentials from leakage, brute force, and abuse.
SkillDFreshness: D★ 24Claude Code +9 - 0.492score
implementing-api-gateway-security-controls
Njones17
Implements security controls at the API gateway layer including authentication enforcement, rate limiting, request validation, IP allowlisting, TLS…
SkillDFreshness: D★ 24Claude Code +9 - 0.492score
implementing-api-rate-limiting-and-throttling
Njones17
Implements API rate limiting and throttling controls using token bucket, sliding window, and fixed window algorithms to protect against brute force attacks…
SkillDFreshness: D★ 24Claude Code +9 - 0.492score
ghost-repo-context
Njones17
Scans directory structure, detects projects, maps dependencies, and documents code organization into a repo.md file.
SkillDFreshness: D★ 24Claude Code +9
Signals
- Stars
- 24
- Forks
- 6
- Open issues
- 0
- Last commit (this folder)
- Mar 6, 2026 (7 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from Njones17
- 0.497score
performing-sca-dependency-scanning-with-snyk
Njones17
This skill covers implementing Software Composition Analysis (SCA) using Snyk to detect vulnerable open-source dependencies in CI/CD pipelines.
SkillDFreshness: D★ 24Claude Code +9 - 0.497score
ghost-scan-code
Njones17
Ghost Security - SAST code scanner.
SkillDFreshness: D★ 24Claude Code +9 - 0.497score
integrating-sast-into-github-actions-pipeline
Njones17
This skill covers integrating Static Application Security Testing (SAST) tools—CodeQL and Semgrep—into GitHub Actions CI/CD pipelines.
SkillDFreshness: D★ 24Claude Code +9 - 0.497score
integrating-dast-with-owasp-zap-in-pipeline
Njones17
This skill covers integrating OWASP ZAP (Zed Attack Proxy) for Dynamic Application Security Testing in CI/CD pipelines.
SkillDFreshness: D★ 24Claude Code +9 - 0.494score
performing-cryptographic-audit-of-application
Njones17
A cryptographic audit systematically reviews an application's use of cryptographic primitives, protocols, and key management to identify vulnerabilities such…
SkillDFreshness: D★ 24Claude Code +9 - 0.494score
implementing-github-advanced-security-for-code-scanning
Njones17
Configure GitHub Advanced Security with CodeQL to perform automated static analysis and vulnerability detection across repositories at enterprise scale.
SkillDFreshness: D★ 24Claude Code +9
Cite this page
implementing-semgrep-for-custom-sast-rules skill. Agent Mart. https://agentmart.dev/skills/njones17-implementing-semgrep-for-custom-sast-rules (last updated 2026-10-24)