Skip to content

Commit 603d5e4

Browse files
committed
feat(sdk,cli): namespace agent skills with trigger- and add cost-savings
The installed skills now use a `trigger-` prefix (`trigger-authoring-tasks`, `trigger-getting-started`, and so on) so they do not collide with non-Trigger skills in a shared agent skills directory, matching the public skills repo. Adds `trigger-cost-savings`: an MCP-driven audit that right-sizes machines, flags missing `maxDuration`, and spots sequential triggers that could batch. `@trigger.dev/sdk` now bundles the entire Documentation section of the docs (not just a curated subset), so an agent has the full version-pinned reference in node_modules. The build derives the set from the docs navigation, so it stays in sync automatically.
1 parent e829edd commit 603d5e4

16 files changed

Lines changed: 253 additions & 103 deletions

File tree

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@trigger.dev/sdk": patch
3+
"trigger.dev": patch
4+
---
5+
6+
The agent skills installed by `trigger skills` are now namespaced with a `trigger-` prefix (e.g. `trigger-authoring-tasks`, `trigger-getting-started`) so they don't collide with unrelated skills in your coding agent's skills directory. Adds a `trigger-cost-savings` skill for auditing and reducing compute spend (right-sizing machines, `maxDuration`, batching, debounce), and `@trigger.dev/sdk` now bundles the full Trigger.dev documentation so your agent can read the complete, version-pinned reference directly from node_modules.

docs/mcp-agent-rules.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ npx trigger.dev@latest skills
2121

2222
`npx trigger.dev@latest install-rules` still works as an alias, and `trigger dev` offers to install the skills on first run.
2323

24-
The old task and realtime guidance now lives in the `authoring-tasks` and `realtime-and-frontend` skills, alongside two new skills for building `chat.agent` AI agents. See [Skills](/skills) for the full list and supported assistants.
24+
The old task and realtime guidance now lives in the `trigger-authoring-tasks` and `trigger-realtime-and-frontend` skills, alongside two new skills for building `chat.agent` AI agents. See [Skills](/skills) for the full list and supported assistants.
2525

2626
## Next steps
2727

docs/skills.mdx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,13 @@ npx trigger.dev@latest skills --target claude-code --target cursor -y
4242

4343
| Skill | Use for | Covers |
4444
| ---------------------- | -------------------------------------------------------------- | ---------------------------------------------------------------------------- |
45-
| `authoring-tasks` | Writing background and scheduled tasks | `task`/`schemaTask`, retries, queues, waits, idempotency, metadata, triggering, cron, `trigger.config.ts` |
46-
| `realtime-and-frontend`| Live run updates and triggering from the browser | `runs.subscribeToRun`, `@trigger.dev/react-hooks`, public access tokens, streams |
47-
| `authoring-chat-agent` | Building durable AI chat agents | `chat.agent` run loop, `toStreamTextOptions`, server actions, `useChat` transport, tools, lifecycle hooks |
48-
| `chat-agent-advanced` | Advanced chat.agent patterns | sessions, human-in-the-loop, sub-agents, compaction, fast starts, resilience, version upgrades |
45+
| `trigger-authoring-tasks` | Writing background and scheduled tasks | `task`/`schemaTask`, retries, queues, waits, idempotency, metadata, triggering, cron, `trigger.config.ts` |
46+
| `trigger-realtime-and-frontend`| Live run updates and triggering from the browser | `runs.subscribeToRun`, `@trigger.dev/react-hooks`, public access tokens, streams |
47+
| `trigger-authoring-chat-agent` | Building durable AI chat agents | `chat.agent` run loop, `toStreamTextOptions`, server actions, `useChat` transport, tools, lifecycle hooks |
48+
| `trigger-chat-agent-advanced` | Advanced chat.agent patterns | sessions, human-in-the-loop, sub-agents, compaction, fast starts, resilience, version upgrades |
49+
| `trigger-cost-savings` | Auditing and reducing compute spend | right-sizing machines, `maxDuration`, batch vs sequential, debounce, schedule frequency, MCP run analysis |
4950

50-
Not sure which to install? Pick `authoring-tasks`; it covers the most common patterns for writing Trigger.dev tasks.
51+
Not sure which to install? Pick `trigger-authoring-tasks`; it covers the most common patterns for writing Trigger.dev tasks.
5152

5253
## Supported AI assistants
5354

packages/cli-v3/skills/authoring-chat-agent/SKILL.md renamed to packages/cli-v3/skills/trigger-authoring-chat-agent/SKILL.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
name: authoring-chat-agent
2+
name: trigger-authoring-chat-agent
33
description: >
44
Author and run a durable AI chat agent with chat.agent from @trigger.dev/sdk/ai: the per-turn
55
run loop, why you MUST spread ...chat.toStreamTextOptions() first, returning a StreamTextResult
@@ -16,7 +16,7 @@ library: trigger.dev
1616

1717
The full, version-pinned reference ships **inside your installed `@trigger.dev/sdk`**. Read it before writing code — it always matches the SDK version in this project, so it never drifts:
1818

19-
- **Skill:** `node_modules/@trigger.dev/sdk/skills/authoring-chat-agent/SKILL.md` — the per-turn run loop, `chat.toStreamTextOptions()`, the two server actions, typed tools/data parts, and the React transport.
19+
- **Skill:** `node_modules/@trigger.dev/sdk/skills/trigger-authoring-chat-agent/SKILL.md` — the per-turn run loop, `chat.toStreamTextOptions()`, the two server actions, typed tools/data parts, and the React transport.
2020
- **Docs:** the full, version-pinned docs ship bundled at `node_modules/@trigger.dev/sdk/docs/ai-chat/`; the skill above lists the exact pages it draws from in its `sources:` frontmatter. Grep for an API, e.g. `grep -rl "toStreamTextOptions" node_modules/@trigger.dev/sdk/docs/`.
2121

2222
If those paths don't exist, `@trigger.dev/sdk` isn't installed yet — install it first. In a non-hoisted layout, resolve the package with `node -p "require.resolve('@trigger.dev/sdk/package.json')"` and read `skills/` + `docs/` beside it.
@@ -57,4 +57,4 @@ If those paths don't exist, `@trigger.dev/sdk` isn't installed yet — install i
5757

5858
## References
5959

60-
Sibling skills: **chat-agent-advanced** (Sessions primitive, custom transports, sub-agents, HITL, fast starts, resilience, testing, upgrades), **authoring-tasks** and **realtime-and-frontend** (the task + frontend foundations chat builds on).
60+
Sibling skills: **trigger-chat-agent-advanced** (Sessions primitive, custom transports, sub-agents, HITL, fast starts, resilience, testing, upgrades), **trigger-authoring-tasks** and **trigger-realtime-and-frontend** (the task + frontend foundations chat builds on).

packages/cli-v3/skills/authoring-tasks/SKILL.md renamed to packages/cli-v3/skills/trigger-authoring-tasks/SKILL.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
name: authoring-tasks
2+
name: trigger-authoring-tasks
33
description: >
44
Covers writing backend Trigger.dev tasks with @trigger.dev/sdk: defining task() and
55
schemaTask(), the run function and its ctx, retries, waits, queues and concurrency,
@@ -15,7 +15,7 @@ library: trigger.dev
1515

1616
The full, version-pinned reference for authoring tasks ships **inside your installed `@trigger.dev/sdk`**. Read it before writing code — it always matches the SDK version in this project, so it never drifts:
1717

18-
- **Skill:** `node_modules/@trigger.dev/sdk/skills/authoring-tasks/SKILL.md` — the complete guide (setup, `schemaTask`, retries, triggering + the Result shape, idempotency, waits, metadata, scheduled tasks, queues/concurrency, `trigger.config.ts`).
18+
- **Skill:** `node_modules/@trigger.dev/sdk/skills/trigger-authoring-tasks/SKILL.md` — the complete guide (setup, `schemaTask`, retries, triggering + the Result shape, idempotency, waits, metadata, scheduled tasks, queues/concurrency, `trigger.config.ts`).
1919
- **Docs:** the full, version-pinned docs ship bundled at `node_modules/@trigger.dev/sdk/docs/`; the skill above lists the exact pages it draws from in its `sources:` frontmatter. Grep for an API, e.g. `grep -rl "schemaTask" node_modules/@trigger.dev/sdk/docs/`.
2020

2121
If those paths don't exist, `@trigger.dev/sdk` isn't installed yet — install it first. In a non-hoisted layout, resolve the package with `node -p "require.resolve('@trigger.dev/sdk/package.json')"` and read `skills/` + `docs/` beside it.
@@ -54,4 +54,4 @@ Always import from `@trigger.dev/sdk` — never `@trigger.dev/sdk/v3` (deprecate
5454

5555
## References
5656

57-
Sibling skills: **realtime-and-frontend** (subscribe to runs, trigger from the frontend), **authoring-chat-agent** and **chat-agent-advanced** (AI chat agents).
57+
Sibling skills: **trigger-realtime-and-frontend** (subscribe to runs, trigger from the frontend), **trigger-authoring-chat-agent** and **trigger-chat-agent-advanced** (AI chat agents).

packages/cli-v3/skills/chat-agent-advanced/SKILL.md renamed to packages/cli-v3/skills/trigger-chat-agent-advanced/SKILL.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
name: chat-agent-advanced
2+
name: trigger-chat-agent-advanced
33
description: >
44
Advanced and operational chat.agent capabilities for Trigger.dev, loaded on demand. Load this when
55
working on the raw Sessions primitive (sessions / SessionHandle), a custom chat transport or the
@@ -8,7 +8,7 @@ description: >
88
Start via @trigger.dev/sdk/chat-server), context resilience (compaction, recovery boot, OOM, large
99
payloads), chat.local run-scoped state, offline testing with mockChatAgent, or prerelease/version
1010
upgrades. For the everyday chat.agent({...}) definition and the useTriggerChatTransport happy path,
11-
use the authoring-chat-agent skill instead.
11+
use the trigger-authoring-chat-agent skill instead.
1212
type: core
1313
library: trigger.dev
1414
---
@@ -17,7 +17,7 @@ library: trigger.dev
1717

1818
The full, version-pinned reference ships **inside your installed `@trigger.dev/sdk`**. Read it before writing code — it always matches the SDK version in this project, so it never drifts:
1919

20-
- **Skill:** `node_modules/@trigger.dev/sdk/skills/chat-agent-advanced/SKILL.md` — Sessions primitive, custom transports/wire protocol, sub-agents, HITL, steering, actions, background injection, fast starts, resilience (compaction/recovery/OOM/large payloads), `chat.local`, testing, upgrades.
20+
- **Skill:** `node_modules/@trigger.dev/sdk/skills/trigger-chat-agent-advanced/SKILL.md` — Sessions primitive, custom transports/wire protocol, sub-agents, HITL, steering, actions, background injection, fast starts, resilience (compaction/recovery/OOM/large payloads), `chat.local`, testing, upgrades.
2121
- **Docs:** the full, version-pinned docs ship bundled at `node_modules/@trigger.dev/sdk/docs/ai-chat/` (including `patterns/` for HITL, sub-agents, sessions); the skill above lists the exact pages it draws from in its `sources:` frontmatter. Grep for an API, e.g. `grep -rl "mockChatAgent" node_modules/@trigger.dev/sdk/docs/`.
2222

2323
If those paths don't exist, `@trigger.dev/sdk` isn't installed yet — install it first. In a non-hoisted layout, resolve the package with `node -p "require.resolve('@trigger.dev/sdk/package.json')"` and read `skills/` + `docs/` beside it.
@@ -67,4 +67,4 @@ If those paths don't exist, `@trigger.dev/sdk` isn't installed yet — install i
6767
6868
## References
6969

70-
Sibling skills: **authoring-chat-agent** (the everyday `chat.agent({...})` happy path), **authoring-tasks** and **realtime-and-frontend** (task + frontend foundations).
70+
Sibling skills: **trigger-authoring-chat-agent** (the everyday `chat.agent({...})` happy path), **trigger-authoring-tasks** and **trigger-realtime-and-frontend** (task + frontend foundations).
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
name: trigger-cost-savings
3+
description: >
4+
Analyze Trigger.dev tasks, schedules, and runs for cost optimization opportunities. Use when
5+
asked to reduce spend, optimize costs, audit usage, right-size machines, or review task
6+
efficiency. Combines static source analysis with live run analysis via the Trigger.dev MCP
7+
tools (list_runs, get_run_details, get_current_worker).
8+
type: core
9+
library: trigger.dev
10+
---
11+
12+
# Trigger.dev Cost Savings Analysis
13+
14+
The full, version-pinned cost-audit workflow ships **inside your installed `@trigger.dev/sdk`**. Read it before giving recommendations so they match the SDK version in this project:
15+
16+
- **Skill:** `node_modules/@trigger.dev/sdk/skills/trigger-cost-savings/SKILL.md` — the static-analysis checklist, the MCP run-analysis steps (`list_runs`, `get_run_details`, `get_current_worker`), the report format, and the machine-preset cost table.
17+
- **Docs:** the canonical guidance is bundled at `node_modules/@trigger.dev/sdk/docs/how-to-reduce-your-spend.mdx`, with supporting pages under `node_modules/@trigger.dev/sdk/docs/` (`machines.mdx`, `runs/max-duration.mdx`, `queue-concurrency.mdx`, `idempotency.mdx`, `triggering.mdx`, `errors-retrying.mdx`).
18+
19+
If those paths don't exist, `@trigger.dev/sdk` isn't installed yet — install it first. In a non-hoisted layout, resolve the package with `node -p "require.resolve('@trigger.dev/sdk/package.json')"` and read `skills/` + `docs/` beside it.
20+
21+
Live run analysis needs the Trigger.dev MCP server (`npx trigger.dev@latest install-mcp`). Without it, do the static source analysis only — never fabricate run data.
22+
23+
## Key principles
24+
25+
- **Waits > 5 seconds are free** — checkpointed, no compute charge.
26+
- **Start small, scale up** — the default `small-1x` is right for most tasks; right-size down tasks stuck on `large-*` with short durations.
27+
- **I/O-bound tasks don't need big machines** — API calls and DB queries wait on the network.
28+
- **Add `maxDuration`** — cap runaway compute.
29+
- **Debounce high-frequency triggers** — consolidate bursts into single runs.
30+
- **Idempotency keys prevent duplicate billed work.**
31+
- **`AbortTaskRunError` stops wasteful retries** — don't pay to retry permanent failures.
32+
33+
## References
34+
35+
Sibling skills: **trigger-authoring-tasks** (the task options these levers tune: `machine`, `maxDuration`, `retry`, `queue`, idempotency), **trigger-realtime-and-frontend**, **trigger-authoring-chat-agent** and **trigger-chat-agent-advanced** (AI agents).

packages/cli-v3/skills/getting-started/SKILL.md renamed to packages/cli-v3/skills/trigger-getting-started/SKILL.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
name: getting-started
2+
name: trigger-getting-started
33
description: >
44
Bootstrap Trigger.dev into an existing project from scratch: authenticate the
55
CLI, install @trigger.dev/sdk and @trigger.dev/build, write trigger.config.ts
@@ -8,7 +8,7 @@ description: >
88
server. Load this when a project has no trigger.config.ts yet and the user
99
asks to "add Trigger.dev", "set up Trigger.dev", "initialize Trigger.dev", or
1010
get a first task running, including in a monorepo. Once the project is set up
11-
and you are writing task code, switch to the authoring-tasks skill.
11+
and you are writing task code, switch to the trigger-authoring-tasks skill.
1212
type: core
1313
library: trigger.dev
1414
library_version: "{{TRIGGER_SDK_VERSION}}"
@@ -198,10 +198,10 @@ See the manual setup docs for full Turborepo examples before scaffolding either.
198198

199199
Sibling skills:
200200

201-
- **authoring-tasks** for writing the tasks themselves once setup is done: retries, waits,
201+
- **trigger-authoring-tasks** for writing the tasks themselves once setup is done: retries, waits,
202202
queues, scheduled tasks, triggering, and the full `trigger.config.ts`.
203-
- **realtime-and-frontend** for showing live run status in a frontend.
204-
- **authoring-chat-agent** and **chat-agent-advanced** for building AI chat agents.
203+
- **trigger-realtime-and-frontend** for showing live run status in a frontend.
204+
- **trigger-authoring-chat-agent** and **trigger-chat-agent-advanced** for building AI chat agents.
205205

206206
Docs:
207207

packages/cli-v3/skills/realtime-and-frontend/SKILL.md renamed to packages/cli-v3/skills/trigger-realtime-and-frontend/SKILL.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
name: realtime-and-frontend
2+
name: trigger-realtime-and-frontend
33
description: >
44
Trigger.dev client/frontend surface: subscribe to runs in realtime
55
(runs.subscribeToRun and the @trigger.dev/react-hooks hook useRealtimeRun),
@@ -10,7 +10,7 @@ description: >
1010
Load when wiring a frontend (React/Next.js/Remix) or backend-for-frontend to
1111
show live run progress, status badges, token streams, trigger buttons, or
1212
wait-token approval UIs. NOT for writing the backend task itself (streams.define
13-
/ metadata.set is authoring-tasks territory); this is the consumer side.
13+
/ metadata.set is trigger-authoring-tasks territory); this is the consumer side.
1414
type: core
1515
library: trigger.dev
1616
---
@@ -19,7 +19,7 @@ library: trigger.dev
1919

2020
The full, version-pinned reference ships **inside your installed `@trigger.dev/sdk`**. Read it before writing code — it always matches the SDK version in this project, so it never drifts:
2121

22-
- **Skill:** `node_modules/@trigger.dev/sdk/skills/realtime-and-frontend/SKILL.md` — run subscriptions, `@trigger.dev/react-hooks`, streams, frontend triggering, and scoped tokens.
22+
- **Skill:** `node_modules/@trigger.dev/sdk/skills/trigger-realtime-and-frontend/SKILL.md` — run subscriptions, `@trigger.dev/react-hooks`, streams, frontend triggering, and scoped tokens.
2323
- **Docs:** the full, version-pinned docs ship bundled at `node_modules/@trigger.dev/sdk/docs/realtime/`; the skill above lists the exact pages it draws from in its `sources:` frontmatter. Grep for a hook, e.g. `grep -rl "useRealtimeRun" node_modules/@trigger.dev/sdk/docs/`.
2424

2525
If those paths don't exist, `@trigger.dev/sdk` isn't installed yet — install it first. In a non-hoisted layout, resolve the package with `node -p "require.resolve('@trigger.dev/sdk/package.json')"` and read `skills/` + `docs/` beside it.
@@ -55,4 +55,4 @@ If those paths don't exist, `@trigger.dev/sdk` isn't installed yet — install i
5555

5656
## References
5757

58-
Sibling skills: **authoring-tasks** (the task side: `streams.define()`, `metadata.set()`, `wait.createToken`), **authoring-chat-agent** and **chat-agent-advanced** (chat agents build on these realtime streams).
58+
Sibling skills: **trigger-authoring-tasks** (the task side: `streams.define()`, `metadata.set()`, `wait.createToken`), **trigger-authoring-chat-agent** and **trigger-chat-agent-advanced** (chat agents build on these realtime streams).

packages/cli-v3/src/commands/init.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,9 +237,9 @@ async function _initCommand(dir: string, options: InitCommandOptions) {
237237
if (!isCancel(setupChoice) && setupChoice === "ai") {
238238
outro(
239239
installedSkills && installedMcp
240-
? "Your AI tooling is ready. Ask your assistant to set up Trigger.dev; it can use the getting-started skill and the MCP server to add the SDK, config, and your first task."
240+
? "Your AI tooling is ready. Ask your assistant to set up Trigger.dev; it can use the trigger-getting-started skill and the MCP server to add the SDK, config, and your first task."
241241
: installedSkills
242-
? "Your AI tooling is ready. Ask your assistant to set up Trigger.dev and it will use the getting-started skill to add the SDK, config, and your first task."
242+
? "Your AI tooling is ready. Ask your assistant to set up Trigger.dev and it will use the trigger-getting-started skill to add the SDK, config, and your first task."
243243
: "The MCP server is installed. Ask your assistant to set up Trigger.dev using the MCP server."
244244
);
245245
return;

0 commit comments

Comments
 (0)