# Detection as code

> Detection as code is an open-source agent skill for security. Guides writing tested, versioned Sigma, YARA, KQL or SPL detection rules. It is available on Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose.

- **Kind:** Skill
- **Pricing:** Open source
- **Platforms:** Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf, Goose
- **Website:** https://github.com/mtarcure/claude-vibe-squad/tree/main/.agents/skills/detection-as-code
- **Repository:** https://github.com/mtarcure/claude-vibe-squad
- **GitHub stars:** 227
- **License:** MIT
- **Skill name:** detection-as-code
- **Collection:** https://github.com/mtarcure/claude-vibe-squad
- **Categories:** [security](https://ai-powered.com/categories/security)
- **Listing updated:** 2026-12-02

## About

This skill walks an agent through authoring a SIEM or EDR detection rule for a named attacker technique, covering Sigma, YARA, KQL and SPL. It starts by pinning the target technique, the detection platform and its schema version, and confirming that the needed telemetry is available. The rule is then written against real field names, with positive fixtures that must trigger it and negative fixtures that must not.

Before rollout, the workflow calls for syntax validation, a backtest or replay against representative history, and a note of the expected false positive and false negative surface along with rule cost and cardinality. It also asks the agent to record an owner, a version and a rollback plan. Deployment is treated as an operator-gated step, so the agent should not push a live change without approval.

The skill expects a detection engineer to supply the technique, the target platform and access to sample telemetry or history. It is scoped away from incident triage and from scanning source code for defects.

## When your agent uses it

> Use when a detection engineer must author a Sigma, YARA, KQL, or SPL SIEM/EDR rule for a named TTP—pin the telemetry schema, add must-fire and must-not-fire fixtures, and replay representative history before any gated rollout. Not for incident triage or source-code defect scanning.

## What it can access

From a static check of the files on GitHub; nothing was run.

- [Instructions only, no scripts](https://github.com/mtarcure/claude-vibe-squad/tree/HEAD/.agents/skills/detection-as-code)
- [License: MIT](https://github.com/mtarcure/claude-vibe-squad/tree/HEAD/.agents/skills/detection-as-code)

## Features

- **Telemetry prerequisite check:** Confirms the required log sources and schema version exist before a rule is written.
- **Fixture-based rule testing:** Requires positive and negative fixtures so a rule is checked both for firing and for over-firing.
- **Syntax validation step:** Includes validating rule syntax before the rule moves toward any deployment.
- **Historical replay and backtesting:** Replays the rule against representative history and records its false positive and false negative surface.
- **Gated rollout guidance:** Sets rollout mode, ownership, versioning and rollback, with deployment held for operator approval.

## Good for

- Write a Sigma rule for a specific attacker technique and test it against sample logs
- Draft a KQL query for a Microsoft Sentinel detection and check it against known benign activity
- Create a YARA rule for a malware family with matching and non-matching sample files
- Convert a detection idea into a SPL search and record its expected false positive rate
- Prepare a versioned detection rule with an owner and rollback plan before rollout

## Install

### Claude Code

Copy the skill folder to `~/.claude/skills/detection-as-code` to use it in all your projects:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/mtarcure/claude-vibe-squad.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/detection-as-code &&
cp -R "$tmp/.agents/skills/detection-as-code" ~/.claude/skills/detection-as-code &&
rm -rf "$tmp"
```

For one project only, put the folder in `.claude/skills/detection-as-code` inside it instead.

### Codex

Copy the skill folder to `~/.agents/skills/detection-as-code` to use it in every repository:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/mtarcure/claude-vibe-squad.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/detection-as-code &&
cp -R "$tmp/.agents/skills/detection-as-code" ~/.agents/skills/detection-as-code &&
rm -rf "$tmp"
```

For one repository only, put the folder in `.agents/skills/detection-as-code` inside it instead.

### Cursor

Copy the skill folder to `~/.cursor/skills/detection-as-code` to use it in every project:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/mtarcure/claude-vibe-squad.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/detection-as-code &&
cp -R "$tmp/.agents/skills/detection-as-code" ~/.cursor/skills/detection-as-code &&
rm -rf "$tmp"
```

For one project only, put the folder in `.cursor/skills/detection-as-code` inside it instead.

### Gemini CLI

Run in a terminal (add `--scope workspace` to install it for the current workspace only):

```sh
gemini skills install https://github.com/mtarcure/claude-vibe-squad.git --path .agents/skills/detection-as-code
```

Or copy the folder to `~/.gemini/skills/detection-as-code` yourself.

### VS Code

For GitHub Copilot in VS Code, copy the skill folder to `~/.copilot/skills/detection-as-code`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/mtarcure/claude-vibe-squad.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/detection-as-code &&
cp -R "$tmp/.agents/skills/detection-as-code" ~/.copilot/skills/detection-as-code &&
rm -rf "$tmp"
```

For one project only, put the folder in `.github/skills/detection-as-code` inside it instead.

### Other agents

Get the folder:

```sh
git clone --depth 1 https://github.com/mtarcure/claude-vibe-squad.git
```

Then copy `claude-vibe-squad/.agents/skills/detection-as-code` into your agent's skills folder as `detection-as-code`. Agents that support SKILL.md read one folder per skill.

## FAQ

### What platforms and rule languages does Detection as code cover?

It covers Sigma, YARA, KQL and SPL rules for SIEM and EDR platforms.

### Will the skill deploy rules to production?

No. Deployment is operator-gated, and the skill requires approval before any live change.

### What does Detection as code need before writing a rule?

The target technique, the detection platform and schema version, and confirmation that the required telemetry exists.

### Is Detection as code meant for incident response or code scanning?

No. It is explicitly not for incident triage or for scanning source code for defects.

### How do I install Detection as code in Claude Code?

Copy the skill folder from GitHub to ~/.claude/skills/detection-as-code to use it in all your projects, or to .claude/skills/detection-as-code in one project.

### Does Detection as code run scripts?

No. It is instructions only, with no scripts. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.

### Which AI agents can use Detection as code?

Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose. Each reads skills in the SKILL.md format from its own folder; the install steps on this page list them.

### What are the best alternatives to Detection as code?

The closest alternatives to Detection as code are Secops detection engineering, Semgrep rule author, Detection engineering coverage evaluation, Semgrep rule creator and Yara rule authoring.

## Where this comes from

- Description: from the skill's own SKILL.md.

## Alternatives

- [Secops detection engineering](https://ai-powered.com/skills/secops-detection-engineering): Secops detection engineering is an open-source agent skill for security.
- [Semgrep rule author](https://ai-powered.com/skills/semgrep-rule-author): Semgrep rule author is an open-source agent skill for security.
- [Detection engineering coverage evaluation](https://ai-powered.com/skills/detection-engineering-coverage-evaluation): Detection engineering coverage evaluation is an open-source agent skill for ai models and llm tooling.
- [Semgrep rule creator](https://ai-powered.com/skills/semgrep-rule-creator): Semgrep rule creator is an open-source agent skill for security.
- [Yara rule authoring](https://ai-powered.com/skills/yara-rule-authoring): Yara rule authoring is an open-source agent skill for security.
- [Diff aware semgrep scan](https://ai-powered.com/skills/diff-aware-semgrep-scan): Diff aware semgrep scan is an open-source agent skill for security.
- [Cloud defense](https://ai-powered.com/skills/cloud-defense): Cloud defense is an open-source agent skill for security.
- [Incident response runbook](https://ai-powered.com/skills/incident-response-runbook): Incident response runbook is an open-source agent skill for security.

---
Source: https://ai-powered.com/skills/detection-as-code
