[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill-trigger-dev-trigger-cost-savings":3,"mdc-h08xm5-key":35,"related-org-trigger-dev-trigger-cost-savings":951,"related-repo-trigger-dev-trigger-cost-savings":1112},{"slug":4,"name":4,"fn":5,"description":6,"org":7,"tags":12,"stars":24,"repoUrl":25,"updatedAt":26,"license":27,"forks":28,"topics":29,"repo":30,"sourceUrl":33,"mdContent":34},"trigger-cost-savings","optimize Trigger.dev task costs","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.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},"trigger-dev","Trigger.dev","https:\u002F\u002Fpexgzepcugksgbtrxkhf.supabase.co\u002Fstorage\u002Fv1\u002Fobject\u002Fpublic\u002Forg-logos\u002Ftrigger-dev.jpg","triggerdotdev",[13,17,20,21],{"name":14,"slug":15,"type":16},"Operations","operations","tag",{"name":18,"slug":19,"type":16},"Cost Optimization","cost-optimization",{"name":9,"slug":8,"type":16},{"name":22,"slug":23,"type":16},"Analytics","analytics",30,"https:\u002F\u002Fgithub.com\u002Ftriggerdotdev\u002Fskills","2026-04-06T18:54:48.555552",null,5,[],{"repoUrl":25,"stars":24,"forks":28,"topics":31,"description":32},[],"Best practices for building AI agents and background jobs with Trigger.dev. Use when creating durable tasks, scheduling workflows, or integrating with the Trigger.dev SDK.","https:\u002F\u002Fgithub.com\u002Ftriggerdotdev\u002Fskills\u002Ftree\u002FHEAD\u002Ftrigger-cost-savings","---\nname: trigger-cost-savings\ndescription: 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.\n---\n\n# Trigger.dev Cost Savings Analysis\n\nAnalyze task runs and configurations to find cost reduction opportunities.\n\n## Prerequisites: MCP Tools\n\nThis skill requires the **Trigger.dev MCP server** to analyze live run data.\n\n### Check MCP availability\n\nBefore analysis, verify these MCP tools are available:\n- `list_runs` — list runs with filters (status, task, time period, machine size)\n- `get_run_details` — get run logs, duration, and status\n- `get_current_worker` — get registered tasks and their configurations\n\nIf these tools are **not available**, instruct the user:\n\n```\nTo analyze your runs, you need the Trigger.dev MCP server installed.\n\nRun this command to install it:\n\n  npx trigger.dev@latest install-mcp\n\nThis launches an interactive wizard that configures the MCP server for your AI client.\n```\n\nDo NOT proceed with run analysis without MCP tools. You can still review source code for static issues (see Static Analysis below).\n\n### Load latest cost reduction documentation\n\nBefore giving recommendations, fetch the latest guidance:\n\n```\nWebFetch: https:\u002F\u002Ftrigger.dev\u002Fdocs\u002Fhow-to-reduce-your-spend\n```\n\nUse the fetched content to ensure recommendations are current. If the fetch fails, fall back to the reference documentation in `references\u002Fcost-reduction.md`.\n\n## Analysis Workflow\n\n### Step 1: Static Analysis (source code)\n\nScan task files in the project for these issues:\n\n1. **Oversized machines** — tasks using `large-1x` or `large-2x` without clear need\n2. **Missing `maxDuration`** — tasks without execution time limits (runaway cost risk)\n3. **Excessive retries** — `maxAttempts` > 5 without `AbortTaskRunError` for known failures\n4. **Missing debounce** — high-frequency triggers without debounce configuration\n5. **Missing idempotency** — payment\u002Fcritical tasks without idempotency keys\n6. **Polling instead of waits** — `setTimeout`\u002F`setInterval`\u002Fsleep loops instead of `wait.for()`\n7. **Short waits** — `wait.for()` with \u003C 5 seconds (not checkpointed, wastes compute)\n8. **Sequential instead of batch** — multiple `triggerAndWait()` calls that could use `batchTriggerAndWait()`\n9. **Over-scheduled crons** — schedules running more frequently than necessary\n\n### Step 2: Run Analysis (requires MCP tools)\n\nUse MCP tools to analyze actual usage patterns:\n\n#### 2a. Identify expensive tasks\n\n```\nlist_runs with filters:\n- period: \"30d\" or \"7d\"\n- Sort by duration or cost\n- Check across different task IDs\n```\n\nLook for:\n- Tasks with high total compute time (duration x run count)\n- Tasks with high failure rates (wasted retries)\n- Tasks running on large machines with short durations (over-provisioned)\n\n#### 2b. Analyze failure patterns\n\n```\nlist_runs with status: \"FAILED\" or \"CRASHED\"\n```\n\nFor high-failure tasks:\n- Check if failures are retryable (transient) vs permanent\n- Suggest `AbortTaskRunError` for known non-retryable errors\n- Calculate wasted compute from failed retries\n\n#### 2c. Check machine utilization\n\n```\nget_run_details for sample runs of each task\n```\n\nCompare actual resource usage against machine preset:\n- If a task on `large-2x` consistently runs in \u003C 1 second, it's over-provisioned\n- If tasks are I\u002FO-bound (API calls, DB queries), they likely don't need large machines\n\n#### 2d. Review schedule frequency\n\n```\nget_current_worker to list scheduled tasks and their cron patterns\n```\n\nFlag schedules that may be too frequent for their purpose.\n\n### Step 3: Generate Recommendations\n\nPresent findings as a prioritized list with estimated impact:\n\n```markdown\n## Cost Optimization Report\n\n### High Impact\n1. **Right-size `process-images` machine** — Currently `large-2x`, average run 2s.\n   Switching to `small-2x` could reduce this task's cost by ~16x.\n   ```ts\n   machine: { preset: \"small-2x\" }  \u002F\u002F was \"large-2x\"\n   ```\n\n### Medium Impact\n2. **Add debounce to `sync-user-data`** — 847 runs\u002Fday, often triggered in bursts.\n   ```ts\n   debounce: { key: `user-${userId}`, delay: \"5s\" }\n   ```\n\n### Low Impact \u002F Best Practices\n3. **Add `maxDuration` to `generate-report`** — No timeout configured.\n   ```ts\n   maxDuration: 300  \u002F\u002F 5 minutes\n   ```\n```\n\n## Machine Preset Costs (relative)\n\nLarger machines cost proportionally more per second of compute:\n\n| Preset | vCPU | RAM | Relative Cost |\n|--------|------|-----|---------------|\n| micro | 0.25 | 0.25 GB | 0.25x |\n| small-1x | 0.5 | 0.5 GB | 1x (baseline) |\n| small-2x | 1 | 1 GB | 2x |\n| medium-1x | 1 | 2 GB | 2x |\n| medium-2x | 2 | 4 GB | 4x |\n| large-1x | 4 | 8 GB | 8x |\n| large-2x | 8 | 16 GB | 16x |\n\n## Key Principles\n\n- **Waits > 5 seconds are free** — checkpointed, no compute charge\n- **Start small, scale up** — default `small-1x` is right for most tasks\n- **I\u002FO-bound tasks don't need big machines** — API calls, DB queries wait on network\n- **Debounce saves the most on high-frequency tasks** — consolidates bursts into single runs\n- **Idempotency prevents duplicate work** — especially important for expensive operations\n- **`AbortTaskRunError` stops wasteful retries** — don't retry permanent failures\n\nSee `references\u002Fcost-reduction.md` for detailed strategies with code examples.\n",{"data":36,"body":37},{"name":4,"description":6},{"type":38,"children":39},"root",[40,49,55,62,75,82,87,126,138,150,155,161,166,175,188,194,200,205,378,384,389,396,405,410,428,434,443,448,473,479,488,493,513,519,528,533,539,544,759,765,875,881,936,945],{"type":41,"tag":42,"props":43,"children":45},"element","h1",{"id":44},"triggerdev-cost-savings-analysis",[46],{"type":47,"value":48},"text","Trigger.dev Cost Savings Analysis",{"type":41,"tag":50,"props":51,"children":52},"p",{},[53],{"type":47,"value":54},"Analyze task runs and configurations to find cost reduction opportunities.",{"type":41,"tag":56,"props":57,"children":59},"h2",{"id":58},"prerequisites-mcp-tools",[60],{"type":47,"value":61},"Prerequisites: MCP Tools",{"type":41,"tag":50,"props":63,"children":64},{},[65,67,73],{"type":47,"value":66},"This skill requires the ",{"type":41,"tag":68,"props":69,"children":70},"strong",{},[71],{"type":47,"value":72},"Trigger.dev MCP server",{"type":47,"value":74}," to analyze live run data.",{"type":41,"tag":76,"props":77,"children":79},"h3",{"id":78},"check-mcp-availability",[80],{"type":47,"value":81},"Check MCP availability",{"type":41,"tag":50,"props":83,"children":84},{},[85],{"type":47,"value":86},"Before analysis, verify these MCP tools are available:",{"type":41,"tag":88,"props":89,"children":90},"ul",{},[91,104,115],{"type":41,"tag":92,"props":93,"children":94},"li",{},[95,102],{"type":41,"tag":96,"props":97,"children":99},"code",{"className":98},[],[100],{"type":47,"value":101},"list_runs",{"type":47,"value":103}," — list runs with filters (status, task, time period, machine size)",{"type":41,"tag":92,"props":105,"children":106},{},[107,113],{"type":41,"tag":96,"props":108,"children":110},{"className":109},[],[111],{"type":47,"value":112},"get_run_details",{"type":47,"value":114}," — get run logs, duration, and status",{"type":41,"tag":92,"props":116,"children":117},{},[118,124],{"type":41,"tag":96,"props":119,"children":121},{"className":120},[],[122],{"type":47,"value":123},"get_current_worker",{"type":47,"value":125}," — get registered tasks and their configurations",{"type":41,"tag":50,"props":127,"children":128},{},[129,131,136],{"type":47,"value":130},"If these tools are ",{"type":41,"tag":68,"props":132,"children":133},{},[134],{"type":47,"value":135},"not available",{"type":47,"value":137},", instruct the user:",{"type":41,"tag":139,"props":140,"children":144},"pre",{"className":141,"code":143,"language":47},[142],"language-text","To analyze your runs, you need the Trigger.dev MCP server installed.\n\nRun this command to install it:\n\n  npx trigger.dev@latest install-mcp\n\nThis launches an interactive wizard that configures the MCP server for your AI client.\n",[145],{"type":41,"tag":96,"props":146,"children":148},{"__ignoreMap":147},"",[149],{"type":47,"value":143},{"type":41,"tag":50,"props":151,"children":152},{},[153],{"type":47,"value":154},"Do NOT proceed with run analysis without MCP tools. You can still review source code for static issues (see Static Analysis below).",{"type":41,"tag":76,"props":156,"children":158},{"id":157},"load-latest-cost-reduction-documentation",[159],{"type":47,"value":160},"Load latest cost reduction documentation",{"type":41,"tag":50,"props":162,"children":163},{},[164],{"type":47,"value":165},"Before giving recommendations, fetch the latest guidance:",{"type":41,"tag":139,"props":167,"children":170},{"className":168,"code":169,"language":47},[142],"WebFetch: https:\u002F\u002Ftrigger.dev\u002Fdocs\u002Fhow-to-reduce-your-spend\n",[171],{"type":41,"tag":96,"props":172,"children":173},{"__ignoreMap":147},[174],{"type":47,"value":169},{"type":41,"tag":50,"props":176,"children":177},{},[178,180,186],{"type":47,"value":179},"Use the fetched content to ensure recommendations are current. If the fetch fails, fall back to the reference documentation in ",{"type":41,"tag":96,"props":181,"children":183},{"className":182},[],[184],{"type":47,"value":185},"references\u002Fcost-reduction.md",{"type":47,"value":187},".",{"type":41,"tag":56,"props":189,"children":191},{"id":190},"analysis-workflow",[192],{"type":47,"value":193},"Analysis Workflow",{"type":41,"tag":76,"props":195,"children":197},{"id":196},"step-1-static-analysis-source-code",[198],{"type":47,"value":199},"Step 1: Static Analysis (source code)",{"type":41,"tag":50,"props":201,"children":202},{},[203],{"type":47,"value":204},"Scan task files in the project for these issues:",{"type":41,"tag":206,"props":207,"children":208},"ol",{},[209,235,251,277,287,297,328,344,368],{"type":41,"tag":92,"props":210,"children":211},{},[212,217,219,225,227,233],{"type":41,"tag":68,"props":213,"children":214},{},[215],{"type":47,"value":216},"Oversized machines",{"type":47,"value":218}," — tasks using ",{"type":41,"tag":96,"props":220,"children":222},{"className":221},[],[223],{"type":47,"value":224},"large-1x",{"type":47,"value":226}," or ",{"type":41,"tag":96,"props":228,"children":230},{"className":229},[],[231],{"type":47,"value":232},"large-2x",{"type":47,"value":234}," without clear need",{"type":41,"tag":92,"props":236,"children":237},{},[238,249],{"type":41,"tag":68,"props":239,"children":240},{},[241,243],{"type":47,"value":242},"Missing ",{"type":41,"tag":96,"props":244,"children":246},{"className":245},[],[247],{"type":47,"value":248},"maxDuration",{"type":47,"value":250}," — tasks without execution time limits (runaway cost risk)",{"type":41,"tag":92,"props":252,"children":253},{},[254,259,261,267,269,275],{"type":41,"tag":68,"props":255,"children":256},{},[257],{"type":47,"value":258},"Excessive retries",{"type":47,"value":260}," — ",{"type":41,"tag":96,"props":262,"children":264},{"className":263},[],[265],{"type":47,"value":266},"maxAttempts",{"type":47,"value":268}," > 5 without ",{"type":41,"tag":96,"props":270,"children":272},{"className":271},[],[273],{"type":47,"value":274},"AbortTaskRunError",{"type":47,"value":276}," for known failures",{"type":41,"tag":92,"props":278,"children":279},{},[280,285],{"type":41,"tag":68,"props":281,"children":282},{},[283],{"type":47,"value":284},"Missing debounce",{"type":47,"value":286}," — high-frequency triggers without debounce configuration",{"type":41,"tag":92,"props":288,"children":289},{},[290,295],{"type":41,"tag":68,"props":291,"children":292},{},[293],{"type":47,"value":294},"Missing idempotency",{"type":47,"value":296}," — payment\u002Fcritical tasks without idempotency keys",{"type":41,"tag":92,"props":298,"children":299},{},[300,305,306,312,314,320,322],{"type":41,"tag":68,"props":301,"children":302},{},[303],{"type":47,"value":304},"Polling instead of waits",{"type":47,"value":260},{"type":41,"tag":96,"props":307,"children":309},{"className":308},[],[310],{"type":47,"value":311},"setTimeout",{"type":47,"value":313},"\u002F",{"type":41,"tag":96,"props":315,"children":317},{"className":316},[],[318],{"type":47,"value":319},"setInterval",{"type":47,"value":321},"\u002Fsleep loops instead of ",{"type":41,"tag":96,"props":323,"children":325},{"className":324},[],[326],{"type":47,"value":327},"wait.for()",{"type":41,"tag":92,"props":329,"children":330},{},[331,336,337,342],{"type":41,"tag":68,"props":332,"children":333},{},[334],{"type":47,"value":335},"Short waits",{"type":47,"value":260},{"type":41,"tag":96,"props":338,"children":340},{"className":339},[],[341],{"type":47,"value":327},{"type":47,"value":343}," with \u003C 5 seconds (not checkpointed, wastes compute)",{"type":41,"tag":92,"props":345,"children":346},{},[347,352,354,360,362],{"type":41,"tag":68,"props":348,"children":349},{},[350],{"type":47,"value":351},"Sequential instead of batch",{"type":47,"value":353}," — multiple ",{"type":41,"tag":96,"props":355,"children":357},{"className":356},[],[358],{"type":47,"value":359},"triggerAndWait()",{"type":47,"value":361}," calls that could use ",{"type":41,"tag":96,"props":363,"children":365},{"className":364},[],[366],{"type":47,"value":367},"batchTriggerAndWait()",{"type":41,"tag":92,"props":369,"children":370},{},[371,376],{"type":41,"tag":68,"props":372,"children":373},{},[374],{"type":47,"value":375},"Over-scheduled crons",{"type":47,"value":377}," — schedules running more frequently than necessary",{"type":41,"tag":76,"props":379,"children":381},{"id":380},"step-2-run-analysis-requires-mcp-tools",[382],{"type":47,"value":383},"Step 2: Run Analysis (requires MCP tools)",{"type":41,"tag":50,"props":385,"children":386},{},[387],{"type":47,"value":388},"Use MCP tools to analyze actual usage patterns:",{"type":41,"tag":390,"props":391,"children":393},"h4",{"id":392},"_2a-identify-expensive-tasks",[394],{"type":47,"value":395},"2a. Identify expensive tasks",{"type":41,"tag":139,"props":397,"children":400},{"className":398,"code":399,"language":47},[142],"list_runs with filters:\n- period: \"30d\" or \"7d\"\n- Sort by duration or cost\n- Check across different task IDs\n",[401],{"type":41,"tag":96,"props":402,"children":403},{"__ignoreMap":147},[404],{"type":47,"value":399},{"type":41,"tag":50,"props":406,"children":407},{},[408],{"type":47,"value":409},"Look for:",{"type":41,"tag":88,"props":411,"children":412},{},[413,418,423],{"type":41,"tag":92,"props":414,"children":415},{},[416],{"type":47,"value":417},"Tasks with high total compute time (duration x run count)",{"type":41,"tag":92,"props":419,"children":420},{},[421],{"type":47,"value":422},"Tasks with high failure rates (wasted retries)",{"type":41,"tag":92,"props":424,"children":425},{},[426],{"type":47,"value":427},"Tasks running on large machines with short durations (over-provisioned)",{"type":41,"tag":390,"props":429,"children":431},{"id":430},"_2b-analyze-failure-patterns",[432],{"type":47,"value":433},"2b. Analyze failure patterns",{"type":41,"tag":139,"props":435,"children":438},{"className":436,"code":437,"language":47},[142],"list_runs with status: \"FAILED\" or \"CRASHED\"\n",[439],{"type":41,"tag":96,"props":440,"children":441},{"__ignoreMap":147},[442],{"type":47,"value":437},{"type":41,"tag":50,"props":444,"children":445},{},[446],{"type":47,"value":447},"For high-failure tasks:",{"type":41,"tag":88,"props":449,"children":450},{},[451,456,468],{"type":41,"tag":92,"props":452,"children":453},{},[454],{"type":47,"value":455},"Check if failures are retryable (transient) vs permanent",{"type":41,"tag":92,"props":457,"children":458},{},[459,461,466],{"type":47,"value":460},"Suggest ",{"type":41,"tag":96,"props":462,"children":464},{"className":463},[],[465],{"type":47,"value":274},{"type":47,"value":467}," for known non-retryable errors",{"type":41,"tag":92,"props":469,"children":470},{},[471],{"type":47,"value":472},"Calculate wasted compute from failed retries",{"type":41,"tag":390,"props":474,"children":476},{"id":475},"_2c-check-machine-utilization",[477],{"type":47,"value":478},"2c. Check machine utilization",{"type":41,"tag":139,"props":480,"children":483},{"className":481,"code":482,"language":47},[142],"get_run_details for sample runs of each task\n",[484],{"type":41,"tag":96,"props":485,"children":486},{"__ignoreMap":147},[487],{"type":47,"value":482},{"type":41,"tag":50,"props":489,"children":490},{},[491],{"type":47,"value":492},"Compare actual resource usage against machine preset:",{"type":41,"tag":88,"props":494,"children":495},{},[496,508],{"type":41,"tag":92,"props":497,"children":498},{},[499,501,506],{"type":47,"value":500},"If a task on ",{"type":41,"tag":96,"props":502,"children":504},{"className":503},[],[505],{"type":47,"value":232},{"type":47,"value":507}," consistently runs in \u003C 1 second, it's over-provisioned",{"type":41,"tag":92,"props":509,"children":510},{},[511],{"type":47,"value":512},"If tasks are I\u002FO-bound (API calls, DB queries), they likely don't need large machines",{"type":41,"tag":390,"props":514,"children":516},{"id":515},"_2d-review-schedule-frequency",[517],{"type":47,"value":518},"2d. Review schedule frequency",{"type":41,"tag":139,"props":520,"children":523},{"className":521,"code":522,"language":47},[142],"get_current_worker to list scheduled tasks and their cron patterns\n",[524],{"type":41,"tag":96,"props":525,"children":526},{"__ignoreMap":147},[527],{"type":47,"value":522},{"type":41,"tag":50,"props":529,"children":530},{},[531],{"type":47,"value":532},"Flag schedules that may be too frequent for their purpose.",{"type":41,"tag":76,"props":534,"children":536},{"id":535},"step-3-generate-recommendations",[537],{"type":47,"value":538},"Step 3: Generate Recommendations",{"type":41,"tag":50,"props":540,"children":541},{},[542],{"type":47,"value":543},"Present findings as a prioritized list with estimated impact:",{"type":41,"tag":139,"props":545,"children":549},{"className":546,"code":547,"language":548,"meta":147,"style":147},"language-markdown shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","## Cost Optimization Report\n\n### High Impact\n1. **Right-size `process-images` machine** — Currently `large-2x`, average run 2s.\n   Switching to `small-2x` could reduce this task's cost by ~16x.\n   ```ts\n   machine: { preset: \"small-2x\" }  \u002F\u002F was \"large-2x\"\n","markdown",[550],{"type":41,"tag":96,"props":551,"children":552},{"__ignoreMap":147},[553,571,581,595,665,691,706],{"type":41,"tag":554,"props":555,"children":558},"span",{"class":556,"line":557},"line",1,[559,565],{"type":41,"tag":554,"props":560,"children":562},{"style":561},"--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF",[563],{"type":47,"value":564},"## ",{"type":41,"tag":554,"props":566,"children":568},{"style":567},"--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B",[569],{"type":47,"value":570},"Cost Optimization Report\n",{"type":41,"tag":554,"props":572,"children":574},{"class":556,"line":573},2,[575],{"type":41,"tag":554,"props":576,"children":578},{"emptyLinePlaceholder":577},true,[579],{"type":47,"value":580},"\n",{"type":41,"tag":554,"props":582,"children":584},{"class":556,"line":583},3,[585,590],{"type":41,"tag":554,"props":586,"children":587},{"style":561},[588],{"type":47,"value":589},"### ",{"type":41,"tag":554,"props":591,"children":592},{"style":567},[593],{"type":47,"value":594},"High Impact\n",{"type":41,"tag":554,"props":596,"children":598},{"class":556,"line":597},4,[599,604,610,616,621,627,631,636,641,647,651,656,660],{"type":41,"tag":554,"props":600,"children":601},{"style":561},[602],{"type":47,"value":603},"1.",{"type":41,"tag":554,"props":605,"children":607},{"style":606},"--shiki-light:#39ADB5;--shiki-light-font-weight:bold;--shiki-default:#89DDFF;--shiki-default-font-weight:bold;--shiki-dark:#89DDFF;--shiki-dark-font-weight:bold",[608],{"type":47,"value":609}," **",{"type":41,"tag":554,"props":611,"children":613},{"style":612},"--shiki-light:#E53935;--shiki-light-font-weight:bold;--shiki-default:#F07178;--shiki-default-font-weight:bold;--shiki-dark:#F07178;--shiki-dark-font-weight:bold",[614],{"type":47,"value":615},"Right-size ",{"type":41,"tag":554,"props":617,"children":618},{"style":606},[619],{"type":47,"value":620},"`",{"type":41,"tag":554,"props":622,"children":624},{"style":623},"--shiki-light:#91B859;--shiki-light-font-weight:bold;--shiki-default:#C3E88D;--shiki-default-font-weight:bold;--shiki-dark:#C3E88D;--shiki-dark-font-weight:bold",[625],{"type":47,"value":626},"process-images",{"type":41,"tag":554,"props":628,"children":629},{"style":606},[630],{"type":47,"value":620},{"type":41,"tag":554,"props":632,"children":633},{"style":612},[634],{"type":47,"value":635}," machine",{"type":41,"tag":554,"props":637,"children":638},{"style":606},[639],{"type":47,"value":640},"**",{"type":41,"tag":554,"props":642,"children":644},{"style":643},"--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8",[645],{"type":47,"value":646}," — Currently ",{"type":41,"tag":554,"props":648,"children":649},{"style":561},[650],{"type":47,"value":620},{"type":41,"tag":554,"props":652,"children":654},{"style":653},"--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D",[655],{"type":47,"value":232},{"type":41,"tag":554,"props":657,"children":658},{"style":561},[659],{"type":47,"value":620},{"type":41,"tag":554,"props":661,"children":662},{"style":643},[663],{"type":47,"value":664},", average run 2s.\n",{"type":41,"tag":554,"props":666,"children":667},{"class":556,"line":28},[668,673,677,682,686],{"type":41,"tag":554,"props":669,"children":670},{"style":643},[671],{"type":47,"value":672},"   Switching to ",{"type":41,"tag":554,"props":674,"children":675},{"style":561},[676],{"type":47,"value":620},{"type":41,"tag":554,"props":678,"children":679},{"style":653},[680],{"type":47,"value":681},"small-2x",{"type":41,"tag":554,"props":683,"children":684},{"style":561},[685],{"type":47,"value":620},{"type":41,"tag":554,"props":687,"children":688},{"style":643},[689],{"type":47,"value":690}," could reduce this task's cost by ~16x.\n",{"type":41,"tag":554,"props":692,"children":694},{"class":556,"line":693},6,[695,700],{"type":41,"tag":554,"props":696,"children":697},{"style":653},[698],{"type":47,"value":699},"   ```",{"type":41,"tag":554,"props":701,"children":703},{"style":702},"--shiki-light:#90A4AE90;--shiki-default:#EEFFFF90;--shiki-dark:#BABED890",[704],{"type":47,"value":705},"ts\n",{"type":41,"tag":554,"props":707,"children":709},{"class":556,"line":708},7,[710,715,720,725,730,734,739,743,748,753],{"type":41,"tag":554,"props":711,"children":712},{"style":567},[713],{"type":47,"value":714},"   machine",{"type":41,"tag":554,"props":716,"children":717},{"style":561},[718],{"type":47,"value":719},":",{"type":41,"tag":554,"props":721,"children":722},{"style":561},[723],{"type":47,"value":724}," {",{"type":41,"tag":554,"props":726,"children":727},{"style":567},[728],{"type":47,"value":729}," preset",{"type":41,"tag":554,"props":731,"children":732},{"style":561},[733],{"type":47,"value":719},{"type":41,"tag":554,"props":735,"children":736},{"style":561},[737],{"type":47,"value":738}," \"",{"type":41,"tag":554,"props":740,"children":741},{"style":653},[742],{"type":47,"value":681},{"type":41,"tag":554,"props":744,"children":745},{"style":561},[746],{"type":47,"value":747},"\"",{"type":41,"tag":554,"props":749,"children":750},{"style":561},[751],{"type":47,"value":752}," }",{"type":41,"tag":554,"props":754,"children":756},{"style":755},"--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#546E7A;--shiki-default-font-style:italic;--shiki-dark:#676E95;--shiki-dark-font-style:italic",[757],{"type":47,"value":758},"  \u002F\u002F was \"large-2x\"\n",{"type":41,"tag":76,"props":760,"children":762},{"id":761},"medium-impact",[763],{"type":47,"value":764},"Medium Impact",{"type":41,"tag":206,"props":766,"children":767},{"start":573},[768],{"type":41,"tag":92,"props":769,"children":770},{},[771,782,784],{"type":41,"tag":68,"props":772,"children":773},{},[774,776],{"type":47,"value":775},"Add debounce to ",{"type":41,"tag":96,"props":777,"children":779},{"className":778},[],[780],{"type":47,"value":781},"sync-user-data",{"type":47,"value":783}," — 847 runs\u002Fday, often triggered in bursts.\n",{"type":41,"tag":139,"props":785,"children":789},{"className":786,"code":787,"language":788,"meta":147,"style":147},"language-ts shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","debounce: { key: `user-${userId}`, delay: \"5s\" }\n","ts",[790],{"type":41,"tag":96,"props":791,"children":792},{"__ignoreMap":147},[793],{"type":41,"tag":554,"props":794,"children":795},{"class":556,"line":557},[796,801,805,809,814,818,823,828,833,838,843,848,853,857,861,866,870],{"type":41,"tag":554,"props":797,"children":798},{"style":567},[799],{"type":47,"value":800},"debounce",{"type":41,"tag":554,"props":802,"children":803},{"style":561},[804],{"type":47,"value":719},{"type":41,"tag":554,"props":806,"children":807},{"style":561},[808],{"type":47,"value":724},{"type":41,"tag":554,"props":810,"children":811},{"style":567},[812],{"type":47,"value":813}," key",{"type":41,"tag":554,"props":815,"children":816},{"style":561},[817],{"type":47,"value":719},{"type":41,"tag":554,"props":819,"children":820},{"style":561},[821],{"type":47,"value":822}," `",{"type":41,"tag":554,"props":824,"children":825},{"style":653},[826],{"type":47,"value":827},"user-",{"type":41,"tag":554,"props":829,"children":830},{"style":561},[831],{"type":47,"value":832},"${",{"type":41,"tag":554,"props":834,"children":835},{"style":643},[836],{"type":47,"value":837},"userId",{"type":41,"tag":554,"props":839,"children":840},{"style":561},[841],{"type":47,"value":842},"}`",{"type":41,"tag":554,"props":844,"children":845},{"style":561},[846],{"type":47,"value":847},",",{"type":41,"tag":554,"props":849,"children":850},{"style":567},[851],{"type":47,"value":852}," delay",{"type":41,"tag":554,"props":854,"children":855},{"style":561},[856],{"type":47,"value":719},{"type":41,"tag":554,"props":858,"children":859},{"style":561},[860],{"type":47,"value":738},{"type":41,"tag":554,"props":862,"children":863},{"style":653},[864],{"type":47,"value":865},"5s",{"type":41,"tag":554,"props":867,"children":868},{"style":561},[869],{"type":47,"value":747},{"type":41,"tag":554,"props":871,"children":872},{"style":561},[873],{"type":47,"value":874}," }\n",{"type":41,"tag":76,"props":876,"children":878},{"id":877},"low-impact-best-practices",[879],{"type":47,"value":880},"Low Impact \u002F Best Practices",{"type":41,"tag":206,"props":882,"children":883},{"start":583},[884],{"type":41,"tag":92,"props":885,"children":886},{},[887,905,907],{"type":41,"tag":68,"props":888,"children":889},{},[890,892,897,899],{"type":47,"value":891},"Add ",{"type":41,"tag":96,"props":893,"children":895},{"className":894},[],[896],{"type":47,"value":248},{"type":47,"value":898}," to ",{"type":41,"tag":96,"props":900,"children":902},{"className":901},[],[903],{"type":47,"value":904},"generate-report",{"type":47,"value":906}," — No timeout configured.\n",{"type":41,"tag":139,"props":908,"children":910},{"className":786,"code":909,"language":788,"meta":147,"style":147},"maxDuration: 300  \u002F\u002F 5 minutes\n",[911],{"type":41,"tag":96,"props":912,"children":913},{"__ignoreMap":147},[914],{"type":41,"tag":554,"props":915,"children":916},{"class":556,"line":557},[917,921,925,931],{"type":41,"tag":554,"props":918,"children":919},{"style":567},[920],{"type":47,"value":248},{"type":41,"tag":554,"props":922,"children":923},{"style":561},[924],{"type":47,"value":719},{"type":41,"tag":554,"props":926,"children":928},{"style":927},"--shiki-light:#F76D47;--shiki-default:#F78C6C;--shiki-dark:#F78C6C",[929],{"type":47,"value":930}," 300",{"type":41,"tag":554,"props":932,"children":933},{"style":755},[934],{"type":47,"value":935},"  \u002F\u002F 5 minutes\n",{"type":41,"tag":139,"props":937,"children":940},{"className":938,"code":939,"language":47},[142],"\n## Machine Preset Costs (relative)\n\nLarger machines cost proportionally more per second of compute:\n\n| Preset | vCPU | RAM | Relative Cost |\n|--------|------|-----|---------------|\n| micro | 0.25 | 0.25 GB | 0.25x |\n| small-1x | 0.5 | 0.5 GB | 1x (baseline) |\n| small-2x | 1 | 1 GB | 2x |\n| medium-1x | 1 | 2 GB | 2x |\n| medium-2x | 2 | 4 GB | 4x |\n| large-1x | 4 | 8 GB | 8x |\n| large-2x | 8 | 16 GB | 16x |\n\n## Key Principles\n\n- **Waits > 5 seconds are free** — checkpointed, no compute charge\n- **Start small, scale up** — default `small-1x` is right for most tasks\n- **I\u002FO-bound tasks don't need big machines** — API calls, DB queries wait on network\n- **Debounce saves the most on high-frequency tasks** — consolidates bursts into single runs\n- **Idempotency prevents duplicate work** — especially important for expensive operations\n- **`AbortTaskRunError` stops wasteful retries** — don't retry permanent failures\n\nSee `references\u002Fcost-reduction.md` for detailed strategies with code examples.\n",[941],{"type":41,"tag":96,"props":942,"children":943},{"__ignoreMap":147},[944],{"type":47,"value":939},{"type":41,"tag":946,"props":947,"children":948},"style",{},[949],{"type":47,"value":950},"html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"items":952,"total":1111},[953,972,985,995,1012,1025,1039,1046,1059,1071,1082,1096],{"slug":954,"name":954,"fn":955,"description":956,"org":957,"tags":958,"stars":969,"repoUrl":970,"updatedAt":971},"trigger-authoring-chat-agent","author durable AI chat agents with Trigger.dev","Author and run a durable AI chat agent with chat.agent from @trigger.dev\u002Fsdk\u002Fai: the per-turn run loop, why you MUST spread ...chat.toStreamTextOptions() first, returning a StreamTextResult vs calling chat.pipe(), the two server actions (chat.createStartSessionAction + auth.createPublicToken), and wiring useChat to useTriggerChatTransport. Load this when building, modifying, or debugging a chat backend (the agent task or its lifecycle hooks) or its React transport, when declaring typed tools or custom data parts, or when migrating a plain AI SDK streamText route to chat.agent.\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[959,962,965,966],{"name":960,"slug":961,"type":16},"Agents","agents",{"name":963,"slug":964,"type":16},"SDK","sdk",{"name":9,"slug":8,"type":16},{"name":967,"slug":968,"type":16},"Workflow Automation","workflow-automation",14401,"https:\u002F\u002Fgithub.com\u002Ftriggerdotdev\u002Ftrigger.dev","2026-07-02T17:12:52.307135",{"slug":973,"name":973,"fn":974,"description":975,"org":976,"tags":977,"stars":969,"repoUrl":970,"updatedAt":984},"trigger-authoring-tasks","author backend Trigger.dev tasks","Covers writing backend Trigger.dev tasks with @trigger.dev\u002Fsdk: defining task() and schemaTask(), the run function and its ctx, retries, waits, queues and concurrency, idempotency keys, run metadata, logging, triggering other tasks (and the Result shape), scheduled\u002Fcron tasks, and the essentials of trigger.config.ts. Load this whenever you are authoring or editing code inside a \u002Ftrigger directory, defining a task, or writing backend code that triggers tasks. Realtime\u002FReact hooks and AI chat are covered by separate skills.\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[978,981,982,983],{"name":979,"slug":980,"type":16},"Backend","backend",{"name":963,"slug":964,"type":16},{"name":9,"slug":8,"type":16},{"name":967,"slug":968,"type":16},"2026-07-02T17:12:48.396964",{"slug":986,"name":986,"fn":987,"description":988,"org":989,"tags":990,"stars":969,"repoUrl":970,"updatedAt":994},"trigger-chat-agent-advanced","manage Trigger.dev chat sessions and transports","Advanced and operational chat.agent capabilities for Trigger.dev, loaded on demand. Load this when working on the raw Sessions primitive (sessions \u002F SessionHandle), a custom chat transport or the realtime wire protocol, durable sub-agents (AgentChat, chat.stream.writer), human-in-the-loop, steering, actions, background injection (chat.defer \u002F chat.inject), fast starts (preload, Head Start via @trigger.dev\u002Fsdk\u002Fchat-server), context resilience (compaction, recovery boot, OOM, large payloads), chat.local run-scoped state, offline testing with mockChatAgent, or prerelease\u002Fversion upgrades. For the everyday chat.agent({...}) definition and the useTriggerChatTransport happy path, use the trigger-authoring-chat-agent skill instead.\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[991,992,993],{"name":960,"slug":961,"type":16},{"name":9,"slug":8,"type":16},{"name":967,"slug":968,"type":16},"2026-07-02T17:12:51.03018",{"slug":996,"name":996,"fn":997,"description":998,"org":999,"tags":1000,"stars":969,"repoUrl":970,"updatedAt":1011},"trigger-realtime-and-frontend","subscribe to Trigger.dev runs in realtime","Trigger.dev client\u002Ffrontend surface: subscribe to runs in realtime (runs.subscribeToRun and the @trigger.dev\u002Freact-hooks hook useRealtimeRun), consume metadata and AI\u002Ftext streams in React (useRealtimeStream), trigger tasks from the browser (useTaskTrigger, useRealtimeTaskTrigger), and mint scoped frontend credentials with auth.createPublicToken \u002F auth.createTriggerPublicToken. Load when wiring a frontend (React\u002FNext.js\u002FRemix) or backend-for-frontend to show live run progress, status badges, token streams, trigger buttons, or wait-token approval UIs. NOT for writing the backend task itself (streams.define \u002F metadata.set is trigger-authoring-tasks territory); this is the consumer side.\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[1001,1004,1007,1010],{"name":1002,"slug":1003,"type":16},"Frontend","frontend",{"name":1005,"slug":1006,"type":16},"React","react",{"name":1008,"slug":1009,"type":16},"Real-time","real-time",{"name":9,"slug":8,"type":16},"2026-07-02T17:12:49.717706",{"slug":1013,"name":1013,"fn":1014,"description":1015,"org":1016,"tags":1017,"stars":24,"repoUrl":25,"updatedAt":1024},"trigger-agents","orchestrate AI agents with Trigger.dev","AI agent patterns with Trigger.dev - orchestration, parallelization, routing, evaluator-optimizer, and human-in-the-loop. Use when building LLM-powered tasks that need parallel workers, approval gates, tool calling, or multi-step agent workflows.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[1018,1019,1022,1023],{"name":960,"slug":961,"type":16},{"name":1020,"slug":1021,"type":16},"Multi-Agent","multi-agent",{"name":9,"slug":8,"type":16},{"name":967,"slug":968,"type":16},"2026-04-06T18:54:46.023553",{"slug":1026,"name":1026,"fn":1027,"description":1028,"org":1029,"tags":1030,"stars":24,"repoUrl":25,"updatedAt":1038},"trigger-config","configure Trigger.dev project settings","Configure Trigger.dev projects with trigger.config.ts. Use when setting up build extensions for Prisma, Playwright, FFmpeg, Python, or customizing deployment settings.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[1031,1034,1037],{"name":1032,"slug":1033,"type":16},"Configuration","configuration",{"name":1035,"slug":1036,"type":16},"Deployment","deployment",{"name":9,"slug":8,"type":16},"2026-04-06T18:54:44.764258",{"slug":4,"name":4,"fn":5,"description":6,"org":1040,"tags":1041,"stars":24,"repoUrl":25,"updatedAt":26},{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[1042,1043,1044,1045],{"name":22,"slug":23,"type":16},{"name":18,"slug":19,"type":16},{"name":14,"slug":15,"type":16},{"name":9,"slug":8,"type":16},{"slug":1047,"name":1047,"fn":1048,"description":1049,"org":1050,"tags":1051,"stars":24,"repoUrl":25,"updatedAt":1058},"trigger-realtime","monitor Trigger.dev tasks in real-time","Subscribe to Trigger.dev task runs in real-time from frontend and backend. Use when building progress indicators, live dashboards, streaming AI\u002FLLM responses, or React components that display task status.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[1052,1053,1056,1057],{"name":1002,"slug":1003,"type":16},{"name":1054,"slug":1055,"type":16},"Observability","observability",{"name":1008,"slug":1009,"type":16},{"name":9,"slug":8,"type":16},"2026-04-06T18:54:47.293822",{"slug":1060,"name":1060,"fn":1061,"description":1062,"org":1063,"tags":1064,"stars":24,"repoUrl":25,"updatedAt":1070},"trigger-setup","set up Trigger.dev in projects","Set up Trigger.dev in your project. Use when adding Trigger.dev for the first time, creating trigger.config.ts, or initializing the trigger directory.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[1065,1066,1069],{"name":1032,"slug":1033,"type":16},{"name":1067,"slug":1068,"type":16},"Local Development","local-development",{"name":9,"slug":8,"type":16},"2026-04-06T18:54:42.280816",{"slug":1072,"name":1072,"fn":1073,"description":1074,"org":1075,"tags":1076,"stars":24,"repoUrl":25,"updatedAt":1081},"trigger-tasks","build durable background tasks with Trigger.dev","Build AI agents, workflows and durable background tasks with Trigger.dev. Use when creating tasks, triggering jobs, handling retries, scheduling cron jobs, or implementing queues and concurrency control.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[1077,1078,1079,1080],{"name":960,"slug":961,"type":16},{"name":979,"slug":980,"type":16},{"name":9,"slug":8,"type":16},{"name":967,"slug":968,"type":16},"2026-04-06T18:54:43.514369",{"slug":1083,"name":1083,"fn":1084,"description":1085,"org":1086,"tags":1087,"stars":583,"repoUrl":1094,"updatedAt":1095},"staff-engineering-skills-backpressure","implement backpressure in streaming pipelines","Prevent unbounded resource growth when producers outpace consumers. Use when writing producer-consumer code, queue processing, batch operations, fan-out patterns, streaming pipelines, or any code where work is generated faster than it can be processed. Activates on patterns like Promise.all on dynamic-sized arrays, unbounded in-memory queues, producer loops without depth checks, fire-and-forget async calls in loops, or any buffer between a producer and consumer without a size limit.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[1088,1091],{"name":1089,"slug":1090,"type":16},"Architecture","architecture",{"name":1092,"slug":1093,"type":16},"Performance","performance","https:\u002F\u002Fgithub.com\u002Ftriggerdotdev\u002Fstaff-engineering-skills","2026-06-17T08:40:42.723559",{"slug":1097,"name":1097,"fn":1098,"description":1099,"org":1100,"tags":1101,"stars":583,"repoUrl":1094,"updatedAt":1110},"staff-engineering-skills-cache-invalidation","implement cache invalidation strategies","Prevent stale data bugs caused by missing or incomplete cache invalidation. Use when adding caching layers (Redis, in-memory Map, CDN, HTTP cache headers), optimizing read performance, or reviewing code that caches query results, API responses, or computed values. Activates on patterns like cache.set without cache.delete on write paths, unbounded Map\u002Fobject caches, TTL-only invalidation on security-sensitive data, Cache-Control headers on mutable content, or any caching where the write path doesn't invalidate the read cache.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[1102,1103,1106,1109],{"name":1089,"slug":1090,"type":16},{"name":1104,"slug":1105,"type":16},"Caching","caching",{"name":1107,"slug":1108,"type":16},"Engineering","engineering",{"name":1092,"slug":1093,"type":16},"2026-06-17T08:40:45.194583",26,{"items":1113,"total":693},[1114,1121,1127,1134,1141,1147],{"slug":1013,"name":1013,"fn":1014,"description":1015,"org":1115,"tags":1116,"stars":24,"repoUrl":25,"updatedAt":1024},{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[1117,1118,1119,1120],{"name":960,"slug":961,"type":16},{"name":1020,"slug":1021,"type":16},{"name":9,"slug":8,"type":16},{"name":967,"slug":968,"type":16},{"slug":1026,"name":1026,"fn":1027,"description":1028,"org":1122,"tags":1123,"stars":24,"repoUrl":25,"updatedAt":1038},{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[1124,1125,1126],{"name":1032,"slug":1033,"type":16},{"name":1035,"slug":1036,"type":16},{"name":9,"slug":8,"type":16},{"slug":4,"name":4,"fn":5,"description":6,"org":1128,"tags":1129,"stars":24,"repoUrl":25,"updatedAt":26},{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[1130,1131,1132,1133],{"name":22,"slug":23,"type":16},{"name":18,"slug":19,"type":16},{"name":14,"slug":15,"type":16},{"name":9,"slug":8,"type":16},{"slug":1047,"name":1047,"fn":1048,"description":1049,"org":1135,"tags":1136,"stars":24,"repoUrl":25,"updatedAt":1058},{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[1137,1138,1139,1140],{"name":1002,"slug":1003,"type":16},{"name":1054,"slug":1055,"type":16},{"name":1008,"slug":1009,"type":16},{"name":9,"slug":8,"type":16},{"slug":1060,"name":1060,"fn":1061,"description":1062,"org":1142,"tags":1143,"stars":24,"repoUrl":25,"updatedAt":1070},{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[1144,1145,1146],{"name":1032,"slug":1033,"type":16},{"name":1067,"slug":1068,"type":16},{"name":9,"slug":8,"type":16},{"slug":1072,"name":1072,"fn":1073,"description":1074,"org":1148,"tags":1149,"stars":24,"repoUrl":25,"updatedAt":1081},{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[1150,1151,1152,1153],{"name":960,"slug":961,"type":16},{"name":979,"slug":980,"type":16},{"name":9,"slug":8,"type":16},{"name":967,"slug":968,"type":16}]