# add-and-validate-guardian-developer-semgrep-rule

> Claude/Codex skill by [@semgrep](https://omgskills.com/library/semgrep/index.md) · 18 stars · Updated 2026-10-22

write a custom semgrep rule with the user, add it to guardian in either user or repo scope, and prove it fires by writing a file that should trip it. use when someone wants guardian to catch something it currently misses, asks to write or add a semgrep rule, or wants a project convention enforced on the code claude writes.

## Install

```sh
git clone https://github.com/semgrep/guardian /tmp/guardian && ln -s /tmp/guardian/plugin/skills/add-and-validate-guardian-developer-semgrep-rule ~/.claude/skills/add-and-validate-guardian-developer-semgrep-rule
```

## From README

write a semgrep rule and add it to guardian guardian scans every file claude writes or edits. a custom rule makes it catch something the deployment's ruleset does not — a project convention, a deprecated internal api, a footgun this team keeps hitting. rules live in two places, both read on every scan: /.semgrep/guardian-rules/ — user scope, follows the user into every repository /.semgrep/guardian-rules/ — repo scope, follows the code, so everyone who clones it gets the rule add rules with adddevelopersemgreprule rather than writing into those directories by hand: it resolves the scope's directory and will not write over a rule already there. it does not check the rule itself or count it against the deployment's limit — that happens when a scan reads the rules, and step 5 is how you find out. a file can hold one rule or a rules: list. a file that fails to parse is rejected whole, so rules kept in one file are sent together or not at all.

## Links

- HTML page: https://omgskills.com/library/semgrep/guardian/plugin/skills/add-and-validate-guardian-developer-semgrep-rule/
- GitHub: https://github.com/semgrep/guardian
- Author: [@semgrep](https://omgskills.com/library/semgrep/index.md)

## More from this repo

- [install-mfw](https://omgskills.com/library/semgrep/guardian/plugin/skills/install-mfw/index.md) — Used to install the mfw (Semgrep Malware Firewall) CLI via the curl|sh installer and walk the user through setup —...
   - [@semgrep](https://omgskills.com/library/semgrep/index.md) · 18 stars
- [remove-guardian-developer-semgrep-rule](https://omgskills.com/library/semgrep/guardian/plugin/skills/remove-guardian-developer-semgrep-rule/index.md) — Remove a custom Semgrep rule from Guardian — list what is installed, work out which file holds the rule, and delete or...
   - [@semgrep](https://omgskills.com/library/semgrep/index.md) · 18 stars

## More skills by this author

- [code-security](https://omgskills.com/library/semgrep/agent-skills/code-security/index.md) — Security guidelines for writing secure code.
   - [@semgrep](https://omgskills.com/library/semgrep/index.md) · 330 stars
