Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Creates custom Semgrep rules for detecting security vulnerabilities, bug patterns, and code patterns. Use when writing Semgrep rules or building custom static analysis detections.
.claude/skills/lingxling-semgrep-rule-creator/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-12 | ✗→✓ | ▲ Improved | 47% | 0% |
| case-08 | ✗→✓ | ▲ Improved | 43% | 0% |
| case-09 | ✗→✓ | ▲ Improved | 63% | 0% |
| case-13 | ✗→✓ | ▲ Improved | 57% | 0% |
| case-17 | ✗→✓ | ▲ Improved | 342% | 0% |
Create production-quality Semgrep rules with proper testing and validation.
Ideal scenarios:
Do NOT use this skill for:
static-analysis skill)When writing Semgrep rules, reject these common shortcuts:
semgrep --test --config <rule-id>.yaml <rule-id>.<ext> to verify. Untested rules have hidden false positives/negatives.Too broad - matches everything, useless for detection:
yaml# BAD: Matches any function call pattern: $FUNC(...) # GOOD: Specific dangerous function pattern: eval(...)
Missing safe cases in tests - leads to undetected false positives:
python# BAD: Only tests vulnerable case # ruleid: my-rule dangerous(user_input) # GOOD: Include safe cases to verify no false positives # ruleid: my-rule dangerous(user_input) # ok: my-rule dangerous(sanitize(user_input)) # ok: my-rule dangerous("hardcoded_safe_value")
Overly specific patterns - misses variations:
yaml# BAD: Only matches exact format pattern: os.system("rm " + $VAR) # GOOD: Matches all os.system calls with taint tracking mode: taint pattern-sinks: - pattern: os.system(...)
This workflow is strict - do not skip steps:
languages: generic)todook and todoruleid test annotations: todoruleid: <rule-id> and todook: <rule-id> annotations in tests files for future rule improvements are forbiddenThis skill guides creation of Semgrep rules that detect security vulnerabilities and code patterns. Rules are created iteratively: analyze the problem, write tests first, analyze AST structure, write the rule, iterate until all tests pass, optimize the rule.
Approach selection:
Why prioritize taint mode? Pattern matching finds syntax but misses context. A pattern eval($X) matches both eval(user_input) (vulnerable) and eval("safe_literal") (safe). Taint mode tracks data flow, so it only alerts when untrusted data actually reaches the sink—dramatically reducing false positives for injection vulnerabilities.
Iterating between approaches: It's okay to experiment. If you start with taint mode and it's not working well (e.g., taint doesn't propagate as expected, too many false positives/negatives), switch to pattern matching. Conversely, if pattern matching produces too many false positives on safe cases, try taint mode instead. The goal is a working rule—not rigid adherence to one approach.
Output structure - exactly 2 files in a directory named after the rule-id:
<rule-id>/
├── <rule-id>.yaml # Semgrep rule
└── <rule-id>.<ext> # Test file with ruleid/ok annotationsyamlrules: - id: insecure-eval languages: [python] severity: HIGH message: User input passed to eval() allows code execution mode: taint pattern-sources: - pattern: request.args.get(...) pattern-sinks: - pattern: eval(...)
Test file (insecure-eval.py):
python# ruleid: insecure-eval eval(request.args.get('code')) # ok: insecure-eval eval("print('safe')")
Run tests (from rule directory): semgrep --test --config <rule-id>.yaml <rule-id>.<ext>
Copy this checklist and track progress:
Semgrep Rule Progress:
- [ ] Step 1: Analyze the Problem
- [ ] Step 2: Write Tests First
- [ ] Step 3: Analyze AST structure
- [ ] Step 4: Write the rule
- [ ] Step 5: Iterate until all tests pass (semgrep --test)
- [ ] Step 6: Optimize the rule (remove redundancies, re-test)
- [ ] Step 7: Final RunREQUIRED: Before writing any rule, use WebFetch to read all of these 4 links with Semgrep documentation:
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-12 | fail→pass | 15,607 | 10,147 | -35% | 1 | 1 | 0% | 2,144 | 3,154 | +47% | 0 | 0 | — |
case-01 | fail→fail | 29,199 | 16,071 | -45% | 1 | 1 | 0% | 4,948 | 2,197 | -56% | 0 | 0 | — |
case-02 | fail→fail | 97,444 | 37,617 | -61% | 1 | 1 | 0% | 6,570 | 2,257 | -66% | 0 | 0 | — |
case-03 | fail→fail | 27,325 | 51,486 | +88% | 1 | 1 | 0% | 4,339 | 9,881 | +128% | 0 | 0 | — |
case-04 | pass→pass | 14,670 | 8,246 | -44% | 1 | 1 | 0% | 2,134 | 2,610 | +22% | 0 | 0 | — |
case-05 | pass→pass | 11,316 | 8,870 | -22% | 1 | 1 | 0% | 2,179 | 3,230 | +48% | 0 | 0 | — |
case-06 | pass→pass | 7,879 | 6,607 | -16% | 1 | 1 | 0% | 1,125 | 2,552 | +127% | 0 | 0 | — |
case-07 | fail→fail | 13,269 | 7,723 | -42% | 1 | 1 | 0% | 1,882 | 2,544 | +35% | 0 | 0 | — |
case-08 | fail→pass | 13,305 | 166,451 | +1151% | 1 | 1 | 0% | 1,843 | 2,630 | +43% | 0 | 0 | — |
case-09 | fail→pass | 9,938 | 11,880 | +20% | 1 | 1 | 0% | 1,400 | 2,277 | +63% | 0 | 0 | — |
case-10 | fail→fail | 9,753 | 5,500 | -44% | 1 | 1 | 0% | 1,622 | 2,578 | +59% | 0 | 0 | — |
case-11 | pass→pass | 12,598 | 30,383 | +141% | 1 | 1 | 0% | 1,702 | 5,470 | +221% | 0 | 0 | — |
case-13 | fail→pass | 9,631 | 6,865 | -29% | 1 | 1 | 0% | 1,660 | 2,605 | +57% | 0 | 0 | — |
case-14 | pass→pass | 14,382 | 17,114 | +19% | 1 | 1 | 0% | 1,867 | 4,132 | +121% | 0 | 0 | — |
case-15 | pass→pass | 12,365 | 14,007 | +13% | 1 | 1 | 0% | 1,422 | 4,454 | +213% | 0 | 0 | — |
case-16 | pass→pass | 19,640 | 7,854 | -60% | 1 | 1 | 0% | 2,638 | 2,727 | +3% | 0 | 0 | — |
case-17 | fail→pass | 13,009 | 50,651 | +289% | 1 | 1 | 0% | 2,110 | 9,333 | +342% | 0 | 0 | — |
case-18 | fail→fail | 44,761 | 43,330 | -3% | 1 | 1 | 0% | 6,907 | 9,863 | +43% | 0 | 0 | — |
case-19 | fail→pass | 7,282 | 5,439 | -25% | 1 | 1 | 0% | 1,266 | 2,407 | +90% | 0 | 0 | — |
case-20 | fail→pass | 29,996 | 12,960 | -57% | 1 | 1 | 0% | 1,170 | 3,486 | +198% | 0 | 0 | — |
case-21 | pass→pass | 13,777 | 5,469 | -60% | 1 | 1 | 0% | 1,957 | 2,260 | +15% | 0 | 0 | — |
case-22 | fail→fail | 14,592 | 9,811 | -33% | 1 | 1 | 0% | 2,358 | 2,320 | -2% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted, and 18 counted toward the lift figure. The other 4 produced results that are not comparable between the two arms, so they are excluded from the headline rather than averaged into it. The headline lift of +32 percentage points is the difference between those two pass rates over the 18 comparable cases. 2 cases got worse with the skill loaded, and they are included in that figure.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.