Skills
Chapter 3 of 6
Analyze Trigger.dev tasks, schedules, and runs for cost optimization opportunities.
2 minutes · 525 words · 14 sections
Analyze task runs and configurations to find cost reduction opportunities.
This skill requires the Trigger.dev MCP server to analyze live run data.
Before analysis, verify these MCP tools are available:
list_runs — list runs with filters (status, task, time period, machine size)get_run_details — get run logs, duration, and statusget_current_worker — get registered tasks and their configurationsIf these tools are not available, instruct the user:
To analyze your runs, you need the Trigger.dev MCP server installed.
Run this command to install it:
npx trigger.dev@latest install-mcp
This launches an interactive wizard that configures the MCP server for your AI client.Do NOT proceed with run analysis without MCP tools. You can still review source code for static issues (see Static Analysis below).
Before giving recommendations, fetch the latest guidance:
WebFetch: https://trigger.dev/docs/how-to-reduce-your-spendUse the fetched content to ensure recommendations are current. If the fetch fails, fall back to the reference documentation in references/cost-reduction.md.
Scan task files in the project for these issues:
large-1x or large-2x without clear needmaxDuration — tasks without execution time limits (runaway cost risk)maxAttempts > 5 without AbortTaskRunError for known failuressetTimeout/setInterval/sleep loops instead of wait.for()wait.for() with < 5 seconds (not checkpointed, wastes compute)triggerAndWait() calls that could use batchTriggerAndWait()Use MCP tools to analyze actual usage patterns:
list_runs with filters:
- period: "30d" or "7d"
- Sort by duration or cost
- Check across different task IDsLook for:
list_runs with status: "FAILED" or "CRASHED"For high-failure tasks:
AbortTaskRunError for known non-retryable errorsget_run_details for sample runs of each taskCompare actual resource usage against machine preset:
large-2x consistently runs in < 1 second, it’s over-provisionedget_current_worker to list scheduled tasks and their cron patternsFlag schedules that may be too frequent for their purpose.
Present findings as a prioritized list with estimated impact:
## Cost Optimization Report
### High Impact
1. **Right-size `process-images` machine** — Currently `large-2x`, average run 2s.
Switching to `small-2x` could reduce this task's cost by ~16x.
```ts
machine: { preset: "small-2x" } // was "large-2x"sync-user-data — 847 runs/day, often triggered in bursts.
debounce: { key: `user-${userId}`, delay: "5s" }maxDuration to generate-report — No timeout configured.
maxDuration: 300 // 5 minutes
## Machine Preset Costs (relative)
Larger machines cost proportionally more per second of compute:
| Preset | vCPU | RAM | Relative Cost |
|--------|------|-----|---------------|
| micro | 0.25 | 0.25 GB | 0.25x |
| small-1x | 0.5 | 0.5 GB | 1x (baseline) |
| small-2x | 1 | 1 GB | 2x |
| medium-1x | 1 | 2 GB | 2x |
| medium-2x | 2 | 4 GB | 4x |
| large-1x | 4 | 8 GB | 8x |
| large-2x | 8 | 16 GB | 16x |
## Key Principles
- **Waits > 5 seconds are free** — checkpointed, no compute charge
- **Start small, scale up** — default `small-1x` is right for most tasks
- **I/O-bound tasks don't need big machines** — API calls, DB queries wait on network
- **Debounce saves the most on high-frequency tasks** — consolidates bursts into single runs
- **Idempotency prevents duplicate work** — especially important for expensive operations
- **`AbortTaskRunError` stops wasteful retries** — don't retry permanent failures
See `references/cost-reduction.md` for detailed strategies with code examples.Install this repository
npx skills add triggerdotdev/skillsSkills install per repository, not per chapter — the CLI has no documented per-skill form, so we do not print one.
Analyze Trigger.dev tasks, schedules, and runs for cost optimization opportunities. Use when asked to reduce spend, optimize costs, audit usage, right-size machines, or review task efficiency. Requires Trigger.dev MCP tools for run analysis.
The verbatim description from this skill’s front matter — the string an agent matches on to decide whether to load it.
main, last pushed 15 June 2026.SKILL.md, not by matching a directory convention. One layout observed: */SKILL.md.h1 and no skipped levels:/triggerdotdev/skills.md, and each chapter at its own .md URL.1 file · 5 KB
Everything this skill ships beside its prose. All of it is set here, as a subchapter of chapter 3.
Documentation the agent loads on demand, rather than up front.