# detection-as-code-and-testing

detection-as-code-and-testing is a Claude Code skill for managing detection rules as code and validating them in CI. It comes into play when teams build rule tests and deployment checks.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf (Devin Desktop), Claude.ai · ★ 73 repo stars
- Author: W4L33Dx
- License: not stated · policy=link-only · description only; the file stays with the author
- Source: https://github.com/W4L33Dx/Cyber-Monster/tree/HEAD/blue-team/detection-and-monitoring/detection-as-code-and-testing/SKILL.md
- Updated: 2026-11-15
- Security check: automated, 2026-11-17 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/skills/detection-as-code-and-testing

## What it does

The skill lays out a workflow that keeps rule sources in a repository, compiles them for target systems, and tests the resulting queries. Linting, compilation, and event replay are separate checks, so each stage has its own failure signal.

Tests use events that should match and near-misses that should not; rules with numeric thresholds also get a boundary case. Correlation rules need event pairs both inside and outside their time window. If telemetry for fixture fields is missing or not collected, the result is `INCONCLUSIVE (Telemetry Gap)`, not `Clean/Benign`.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add W4L33Dx/Cyber-Monster --skill detection-as-code-and-testing -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/detection-as-code-and-testing/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/detection-as-code-and-testing/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add W4L33Dx/Cyber-Monster --skill detection-as-code-and-testing -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/detection-as-code-and-testing/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add W4L33Dx/Cyber-Monster --skill detection-as-code-and-testing -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/detection-as-code-and-testing/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install W4L33Dx/Cyber-Monster blue-team/detection-and-monitoring/detection-as-code-and-testing
```

2. **Manually: put the files in place**
- File: `.github/skills/detection-as-code-and-testing/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add W4L33Dx/Cyber-Monster --skill detection-as-code-and-testing -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/W4L33Dx/Cyber-Monster --path blue-team/detection-and-monitoring/detection-as-code-and-testing
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/detection-as-code-and-testing/SKILL.md` — The legacy .windsurf/skills/ path still works

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/W4L33Dx/Cyber-Monster/tree/HEAD/blue-team/detection-and-monitoring/detection-as-code-and-testing/SKILL.md

## When to use it
- keep detection rule sources under version control
- validate rule compilation in CI
- catch false positives with near-miss event tests
- test numeric thresholds and correlation windows
- trace deployed rules back to their source commit

## Example prompts
- Set up CI checks for detection rules managed as code.
- Add matching and near-miss events to test this rule.
- Test the correlation rule with event pairs inside and outside its time window.

## Similar
- [application-security-testing](https://affpapa.org/en/nevibecode/skills/application-security-testing.md) — skill · 17000 installs
- [security-detection-rule-management](https://affpapa.org/en/nevibecode/skills/security-detection-rule-management.md) — skill · 4300 installs
- [security-testing](https://affpapa.org/en/nevibecode/skills/security-testing.md) — skill · 1500 installs
- [bats-testing-patterns](https://affpapa.org/en/nevibecode/skills/bats-testing-patterns.md) — skill · 11000 installs
- [godot-gdscript-headless-testing](https://affpapa.org/en/nevibecode/skills/godot-gdscript-headless-testing.md) — skill · 9300 installs
- [contract-testing](https://affpapa.org/en/nevibecode/skills/contract-testing.md) — skill · 1400 installs

From the same set: [w4l33dx/cyber-monster](https://affpapa.org/en/nevibecode/by/w4l33dx/cyber-monster.md) — 61 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
