# trigger-authoring-chat-agent

trigger-authoring-chat-agent is a skill for building and running a chat agent as a single long-lived Trigger.dev task.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode, Windsurf (Devin Desktop), Claude.ai · 267 installs · ★ 35 repo stars
- Author: triggerdotdev
- License: not stated · policy=link-only · description only; the file stays with the author
- Source: https://github.com/triggerdotdev/skills/tree/HEAD/trigger-authoring-chat-agent/SKILL.md
- Updated: 2026-10-19
- Security check: automated, 2026-11-16 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/skills/trigger-authoring-chat-agent

## What it does

A chat agent is built from three parts: the agent task using `chat.agent` from `@trigger.dev/sdk/ai`, two server actions (`chat.createStartSessionAction` and `auth.createPublicToken`), and the frontend transport `useTriggerChatTransport`. When a message arrives, the agent wakes, processes it through `streamText` (pulled from the `run` parameter, not imported from the `ai` module), and returns the result either via `return StreamTextResult` or through `chat.pipe()` if the `streamText` call lives deep in helper functions.

This skill covers the agent lifecycle: session startup, per-turn message handling, typed tools (declare once on `chat.agent({ tools })` and pass back to `streamText`), custom data parts for context transfer, lifecycle hooks like `onTurnComplete`, error handling, and cancellation via `AbortSignal`. Supports Vercel AI SDK versions 5, 6, and 7 (on v7, install `@ai-sdk/otel` for model call tracing).

Load this when building or debugging the agent backend (the task itself, its hooks) or the frontend transport, when declaring typed tools or writing custom data parts, or when moving a plain `streamText` route to `chat.agent` architecture.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add triggerdotdev/skills --skill trigger-authoring-chat-agent -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/trigger-authoring-chat-agent/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/trigger-authoring-chat-agent/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add triggerdotdev/skills --skill trigger-authoring-chat-agent -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/trigger-authoring-chat-agent/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add triggerdotdev/skills --skill trigger-authoring-chat-agent -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/trigger-authoring-chat-agent/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install triggerdotdev/skills trigger-authoring-chat-agent
```

2. **Manually: put the files in place**
- File: `.github/skills/trigger-authoring-chat-agent/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add triggerdotdev/skills --skill trigger-authoring-chat-agent -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/triggerdotdev/skills --path trigger-authoring-chat-agent
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/trigger-authoring-chat-agent/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add triggerdotdev/skills --skill trigger-authoring-chat-agent -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/triggerdotdev/skills/tree/HEAD/trigger-authoring-chat-agent/SKILL.md

## When to use it
- build a long-lived chat agent with server-side state
- attach typed tools to an agent and control their visibility per turn
- return a `streamText` result from a nested function inside the agent
- sync message history between client and server
- migrate an existing AI SDK route to Trigger.dev agent architecture

## Example prompts
- Help me set up a chat agent with two tools: docs search and code execution
- How does the agent lifecycle work in trigger-authoring-chat-agent? What is `onTurnComplete`?
- Show me how to return a `streamText` result through `chat.pipe()` instead of return

## Similar
- [trigger-dev](https://affpapa.org/en/nevibecode/skills/trigger-dev.md) — skill · 93 installs
- [trigger.basic](https://affpapa.org/en/nevibecode/rules/triggerbasic.md) — rule · ★ 1120 repo stars
- [pp-trigger-dev](https://affpapa.org/en/nevibecode/skills/pp-trigger-dev.md) — skill · 144 installs
- [ai-sdk-6](https://affpapa.org/en/nevibecode/skills/ai-sdk-6.md) — skill · 218 installs
- [nextjs15-react19-vercelai-tailwind-cursorrules-prompt-file](https://affpapa.org/en/nevibecode/rules/nextjs15-react19-vercelai-tailwind-cursorrules-prompt-file.md) — rule · ★ 41178 repo stars
- [convex-component-authoring](https://affpapa.org/en/nevibecode/skills/convex-component-authoring.md) — skill · 1200 installs

From the same set: [triggerdotdev/skills](https://affpapa.org/en/nevibecode/by/triggerdotdev/skills.md) — 6 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
