# dd-plugins

A collection of Claude Code skills for Datadog productivity — APM trace analysis, N+1 detection, and more.

## Installation

```bash
/plugin install dd-plugins@pdego-marketplace
```

## Contributing

Each plugin lives in its own subdirectory with a `SKILL.md` describing its workflow. To add a new plugin, create a new subdirectory and add an entry to this README.

## Plugins

### [dd-analyze-trace](./dd-analyze-trace/)

Analyze a Datadog APM trace for performance problems.

**Trigger:** `/dd-analyze-trace <trace_id | file_path>`

**What it does:**
- Downloads trace spans from the Datadog API (or reads a local JSON file)
- Reports time budget by service
- Lists all OWS HTTP endpoints with call counts and timings
- Detects N+1 call patterns with caller resolver attribution
- Drills into slow spans, finds the route handler in source code, and identifies anti-patterns (N+1 queries, missing caching, sequential HTTP calls, blocking I/O)

**Prerequisites:**

Set these in your shell before starting Claude Code (or add to `~/.zshrc` to make them permanent):

```bash
export DD_API_KEY=...   # Identifies your org — get from DD > Org Settings > API Keys
export DD_APP_KEY=...   # Authorizes you to read data — get from DD > Org Settings > Application Keys
export DD_SITE=datadoghq.com
```

Both keys are required: `DD_API_KEY` authenticates your organization, `DD_APP_KEY` authorizes read access to query traces and other data.

**Examples:**
```bash
# Download trace by ID and analyze
/dd-analyze-trace 7892843842668647916

# Analyze an already-saved trace file
/dd-analyze-trace my_trace.json

# Lower N+1 detection threshold
/dd-analyze-trace 7892843842668647916 --n1-threshold 3
```

See [dd-analyze-trace/SKILL.md](./dd-analyze-trace/SKILL.md) for full documentation.
