Agent Skillsmtarcure/claude-vibe-squad › semgrep-rule-author

semgrep-rule-author

GitHub

将已确认的缺陷模式转化为可复用的 Semgrep 检测规则。通过编写语法或污点分析规则,结合项目特定清理器过滤误报,并测量仓库范围的误报率,确保规则精准有效且具备版本追溯能力。

.agents/skills/semgrep-rule-author/SKILL.md mtarcure/claude-vibe-squad

Trigger Scenarios

需要为已确认的安全漏洞编写自动化检测规则 需要将特定的代码缺陷模式转化为可复用的 Semgrep 规则

Install

npx skills add mtarcure/claude-vibe-squad --skill semgrep-rule-author -g -y
More Options

Non-standard path

npx skills add https://github.com/mtarcure/claude-vibe-squad/tree/main/.agents/skills/semgrep-rule-author -g -y

Use without installing

npx skills use mtarcure/claude-vibe-squad@semgrep-rule-author

指定 Agent (Claude Code)

npx skills add mtarcure/claude-vibe-squad --skill semgrep-rule-author -a claude-code -g -y

安装 repo 全部 skill

npx skills add mtarcure/claude-vibe-squad --all -g -y

预览 repo 内 skill

npx skills add mtarcure/claude-vibe-squad --list

SKILL.md

Frontmatter
{
    "name": "semgrep-rule-author",
    "audience": "specialist",
    "description": "Use after a defect pattern is confirmed and you need a reusable Semgrep detector for sibling instances: derive syntactic or taint rules from vulnerable and safe fixtures, encode project sanitizers, and measure repository-wide false positives. Not for choosing generic rulesets or scanning only a change."
}

Semgrep Rule Author

Turn a confirmed defect pattern into a Semgrep rule that finds its siblings without drowning the caller in false positives.

Steps

  1. Start from a confirmed instance, not from an idea. Write down the minimal vulnerable snippet and the minimal safe snippet that must not match.
  2. Decide the rule's shape: syntactic pattern for a fixed misuse, patterns with pattern-inside/pattern-not for context-dependent misuse, and mode: taint with pattern-sources/pattern-sinks when the defect is a data-flow problem rather than a shape.
  3. Prefer taint mode for injection classes. A syntactic rule for a data-flow bug produces the false-positive rate that gets rules disabled.
  4. Write pattern-not clauses for the sanitizers and safe wrappers this codebase actually uses; generic sanitizer lists miss project-specific ones.
  5. Use metavariables to bind the attacker-controlled value and metavariable-pattern to constrain it, so the rule expresses the condition rather than the syntax.
  6. Set severity and write a message that names the consequence and the fix, not the pattern. The message is what a reader acts on.
  7. Test against a corpus: the known instances must all match, the known-safe snippets must not, and a full run over the repo must have a triageable hit count.
  8. Measure and record the false-positive rate on that run. A rule shipped without a measured rate is unverified.
  9. Version the rule with the defect class it came from, so variant-analysis can reuse it and future reviewers know its provenance.

Acceptance

  • The rule was derived from a confirmed instance, with vulnerable and safe fixtures committed alongside.
  • Data-flow defects use taint mode rather than syntactic matching.
  • Project-specific sanitizers are excluded via pattern-not.
  • All known instances match, all safe fixtures do not, and the repo-wide false-positive rate is measured and recorded.
  • The message states consequence and fix, and the rule records its originating defect class.

Version History

  • d5262e2 Current 2026-09-11 11:38

Same Skill Collection

.agents/skills/accessible-media-authoring/SKILL.md
.agents/skills/agent-prompt-engineering/SKILL.md
.agents/skills/agentic-safety-audit/SKILL.md
.agents/skills/audio-event-map-authoring/SKILL.md
.agents/skills/auto-scaffold/SKILL.md
.agents/skills/claim-verification/SKILL.md
.agents/skills/code-reachability-audit/SKILL.md
.agents/skills/code-review-loop/SKILL.md
.agents/skills/color-theory/SKILL.md
.agents/skills/conversation-design/SKILL.md
.agents/skills/copy-refinement/SKILL.md
.agents/skills/cross-file-relationship-synthesis/SKILL.md
.agents/skills/dependency-cycle-audit/SKILL.md
.agents/skills/dependency-health-triage/SKILL.md
.agents/skills/detection-as-code/SKILL.md
.agents/skills/diff-aware-semgrep-scan/SKILL.md
.agents/skills/differential-review/SKILL.md
.agents/skills/dimensional-analysis-check/SKILL.md
.agents/skills/dual-level-retrieval/SKILL.md
.agents/skills/figma-implement-design/SKILL.md
.agents/skills/forensic-timeline-authoring/SKILL.md
.agents/skills/game-design-fundamentals/SKILL.md
.agents/skills/game-mechanics-balancing/SKILL.md
.agents/skills/head-tail/SKILL.md
.agents/skills/incident-response-runbook/SKILL.md
.agents/skills/interactive-audio-design/SKILL.md
.agents/skills/interface-ambiguity-check/SKILL.md
.agents/skills/keyword-clustering/SKILL.md
.agents/skills/knowledge-base-integration/SKILL.md
.agents/skills/layered-analysis-loop/SKILL.md
.agents/skills/level-design-patterns/SKILL.md
.agents/skills/locale-adaptation/SKILL.md
.agents/skills/narrative-structure/SKILL.md
.agents/skills/platform-compliance/SKILL.md
.agents/skills/player-engagement-psychology/SKILL.md
.agents/skills/requirements-elicitation/SKILL.md
.agents/skills/rule6-rights-gate/SKILL.md
.agents/skills/rule8-truth-gate/SKILL.md
.agents/skills/sandbox-provision-discipline/SKILL.md
.agents/skills/scope-decomposition/SKILL.md
.agents/skills/scope-estimation/SKILL.md
.agents/skills/security-ownership-map/SKILL.md
.agents/skills/security-threat-model/SKILL.md
.agents/skills/skill-description-trigger-authoring/SKILL.md
.agents/skills/sound-design-principles/SKILL.md
.agents/skills/structured-data-authoring/SKILL.md
.agents/skills/supply-chain-audit/SKILL.md
.agents/skills/take-over-resume/SKILL.md
.agents/skills/technical-seo-audit/SKILL.md

Metadata

Files
0
Version
d5262e2
Hash
e2ae1cde
Indexed
2026-09-11 11:38

Home - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-09-13 05:01
浙ICP备14020137号-1 $Map of visitor$