> ## Documentation Index
> Fetch the complete documentation index at: https://docs.squasher.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Check detection coverage

> List the detection rule packs of a project and count the rules that cover each MITRE ATT&CK tactic and technique.

Detection rules match events as they arrive, and each match is a security finding. This recipe lists
the rule packs of a project, then counts the enabled rules for each tactic and technique of the
MITRE ATT\&CK Enterprise matrix, so that an agent can find the techniques with no rule. Both steps
need `findings:read`.

Coverage counts rules that are configured. It does not prove that a log source sends the data a
rule reads.

## List the rule packs

Each project has the `builtin` pack, which is always on, and up to 20 packs of its own.

> [tab] CLI
>
> ```bash theme={null}
> squasher detections list --project "$SQUASHER_PROJECT_ID"
> ```

> [tab] MCP
>
> ```javascript theme={null}
> const projectId = "YOUR_PROJECT_ID";
> const { packs } = await squasher.request({
>   method: "GET",
>   path: `/v1/projects/${projectId}/detections`,
> });
> return packs.map((pack) => ({
>   id: pack.id,
>   name: pack.name,
>   builtin: pack.builtin,
>   enabled: pack.enabled,
>   rules: pack.rules.length,
> }));
> ```

> [tab] REST API
>
> ```bash theme={null}
> curl "https://api.squasher.ai/v1/projects/$SQUASHER_PROJECT_ID/detections" \
>   -H "x-squasher-key: $SQUASHER_API_KEY"
> ```

The response is `{ "packs": [pack] }`, the built-in pack first:

```json theme={null}
{
  "packs": [
    {
      "id": "builtin",
      "name": "Squasher built-in rules",
      "builtin": true,
      "enabled": true,
      "version": 0,
      "rules": [
        {
          "id": "<rule id>",
          "title": "<rule title>",
          "level": "high",
          "source": "github_audit",
          "origin": "sigma_hq",
          "author": "<author>",
          "license": "<license>",
          "path": "<rule file>"
        }
      ]
    }
  ]
}
```

## Read the coverage

> [tab] CLI
>
> ```bash theme={null}
> squasher detections coverage --project "$SQUASHER_PROJECT_ID"
> ```

> [tab] MCP
>
> ```javascript theme={null}
> const projectId = "YOUR_PROJECT_ID";
> const coverage = await squasher.request({
>   method: "GET",
>   path: `/v1/projects/${projectId}/detections/coverage`,
> });
> return coverage.tactics.map((tactic) => ({
>   tactic: tactic.name,
>   techniques: tactic.techniques.length,
>   covered: tactic.techniques.filter((technique) => technique.enabled_rules > 0).length,
> }));
> ```

> [tab] REST API
>
> ```bash theme={null}
> curl "https://api.squasher.ai/v1/projects/$SQUASHER_PROJECT_ID/detections/coverage" \
>   -H "x-squasher-key: $SQUASHER_API_KEY"
> ```

The response has the ATT\&CK version, the rule totals, and every tactic with its techniques:

```json theme={null}
{
  "attack_version": "<ATT&CK version>",
  "rule_count": { "enabled": 120, "available": 140 },
  "tactics": [
    {
      "id": "TA0001",
      "name": "Initial Access",
      "techniques": [
        { "id": "T1078", "name": "Valid Accounts", "enabled_rules": 3, "available_rules": 4 }
      ]
    }
  ]
}
```

`enabled_rules` counts the rules of turned-on packs. `available_rules` also counts the rules of
turned-off packs. Each rule counts once for a technique, even when a pack installs it twice. A
technique with `enabled_rules: 0` and `available_rules` above `0` needs only a pack turned on.

## Next steps

> [card] [Detection rules](https://docs.squasher.ai/features/detection-rules.md)
>
> Write, validate, and backtest your own rules.

> [card] [Dry-run a destructive change](https://docs.squasher.ai/agent-workflows/dry-run-destructive-change.md)
>
> Preview a pack change before you save it.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.