Works with the AI Agents you already use
Semgrep Custom Rule Engine
Generate high-precision Semgrep YAML rules for proprietary security patterns and architectural enforcement.
$15
Semgrep Custom Rule Engine
Example session with this skill installed
Create a Semgrep rule to detect and fix instances where developers use the insecure InternalLogger.logRaw() instead of InternalLogger.logSanitized(). It should ignore the tests/ directory.
- Read your context and instructions
- Compiled the semgrep custom rule
I have generated a custom Semgrep rule to enforce the use of sanitized logging across your project. This includes detection logic, a target fix, and a command for local verification.
Semgrep Custom Rule: enforce-sanitized-logging
rules:
- id: enforce-sanitized-logging
patterns:
- pattern: InternalLogger.logRaw($MSG)
- pattern-not-inside: |
void test_...(...) {
...
}
message: |
Insecure logging detected. Use 'InternalLogger.logSanitized()' to prevent
log injection and ensure compliance with internal security standards.
metadata:
category: security
severity: ERROR
technology:
- java
- python
- javascript
fix: InternalLogger.logSanitized($MSG)
languages:
- generic
Testing Command
Run this command in your terminal to verify the rule against your codebase:
semgrep --config enforce-sanitized-logging.yaml . --exclude='tests/'
Next steps
- Save the YAML block above to a file named
semgrep/rules/internal-logging.yaml. - Run the provided testing command to audit existing violations.
- Integrate this rule into your CI/CD pipeline to block PRs containing
logRawcalls.
Connects securely to your tools. The creator never sees your data.
About this skill
Static analysis often misses proprietary patterns and internal API misuse specific to your codebase. This skill generates precise, high-fidelity Semgrep YAML rules to enforce architectural standards and security constraints unique to your organization.
What it does
- Rule Construction: Writes YAML definitions using
pattern,pattern-inside, andmetavariable-regex. - Anti-pattern Analysis: Converts your specific code examples into generalized detection logic.
- Autofix Logic: Formulates automated transformation blocks to bridge the gap between detection and remediation.
- Severity Mapping: Assigns appropriate metadata and severity classifications based on organizational impact.
- Validation Commands: Provides exact CLI strings for local testing via ephemeral execution.
How it works
- Input Analysis: You provide a code snippet containing a security flaw or an architectural anti-pattern.
- Logic Synthesis: The agent maps these inputs to Semgrep's search syntax, filtering out noise with
pattern-notclauses. - Remediation Design: It generates an
autofixblock to suggest safe code replacements. - Verification: The agent outputs a complete YAML file along with a shell command to test the rule against your workspace.
Frameworks & tools
Built for the Semgrep CLI and compatible with polyglot codebases. It uses standard YAML schemas for SAST integration.
Why this beats prompting it yourself
Writing Semgrep rules requires deep knowledge of its domain-specific syntax and metavariable logic. This skill avoids the trial-and-error of broken YAML indentation or overly broad patterns that cause developer alert fatigue.
Use cases
- Internal API Security: Prevent developers from calling deprecated or dangerous internal functions.
- Compliance Enforcement: Ensure specific headers or encryption standards are used in every controller.
- Architecture Guardrails: Block circular dependencies or incorrect service layer abstractions.
Known limitations
Restricted to standard Semgrep YAML syntax. It does not perform cross-file taint analysis if the local Semgrep engine version does not support it.
Restricted to standard Semgrep YAML syntax and workspace-confined analysis. Cannot access system paths or global packages.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before any payment.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 4 days ago
Requires
Permissions
Target Use Cases: - Create a custom Semgrep rule to catch unvalidated user input. - Write a Semgrep YAML definition to ban raw SQL queries. - Build a company-specific security rule for Semgrep.