init
Set up Trigger.dev in this repository with a short discovery, an explicit architecture decision, and a first task proven to run.
- License 许可
- MIT
- 最近更新
- 2026-11-02
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- init
- description
- Set up Trigger.dev in this repository with a short discovery, an explicit architecture decision, and a first task proven to run.
- allowed-tools
- Bash(npx tsc --noEmit*) Bash(pnpm exec tsc --noEmit*) Bash(yarn tsc --noEmit*) Bash(bunx tsc --noEmit*) Bash(trigger-ctx *) Bash(node *trigger-ctx.mjs *) Bash(node *trigger-ctx.mjs" *) Bash(npx trigger.dev@latest whoami*) Bash(npx trigger.dev@latest login*) Bash(npx trigger.dev@latest projects *) Bash(npx trigger.dev@latest init*) Bash(pnpm dlx trigger.dev@latest whoami*) Bash(pnpm dlx trigger.dev@latest login*) Bash(pnpm dlx trigger.dev@latest projects *) Bash(pnpm dlx trigger.dev@latest init*) Bash(yarn dlx trigger.dev@latest whoami*) Bash(yarn dlx trigger.dev@latest login*) Bash(yarn dlx trigger.dev@latest projects *) Bash(yarn dlx trigger.dev@latest init*) Bash(bunx trigger.dev@latest whoami*) Bash(bunx trigger.dev@latest login*) Bash(bunx trigger.dev@latest projects *) Bash(bunx trigger.dev@latest init*)
- argument-hint
- [what you want Trigger.dev to run first]
- disable-model-invocation
- true
02 资源文件 11
- 参考文档agents/openai.yaml43 B
- 脚本templates/manual-config.ts676 B
- 其他templates/polyglot-subpackage/.gitignore22 B
- 参考文档templates/polyglot-subpackage/package.json394 B
- 脚本templates/polyglot-subpackage/src/example.ts306 B
- 脚本templates/polyglot-subpackage/trigger.config.ts253 B
- 参考文档templates/polyglot-subpackage/tsconfig.json251 B
- 参考文档templates/realtime-token-route.md886 B
- 其他templates/realtime/progress.tsx540 B
- 脚本templates/realtime/token-route.ts729 B
- 参考文档templates/rest-call-sites.md3.1 KB
03 SKILL.md 正文
Set up Trigger.dev here
Goal from the user: $ARGUMENTS
Project facts
!node "${CLAUDE_PLUGIN_ROOT}/scripts/trigger-ctx.mjs" detect --brief
(If the line above is empty or shows a command error, run node "${CLAUDE_PLUGIN_ROOT}/scripts/trigger-ctx.mjs" detect --brief yourself.)
How to run this
Work through the stages in order. Each stage ends with something you can show. Human steps are marked [you]: do them with the user, never around them. Read ${CLAUDE_PLUGIN_ROOT}/skills/build/discovery.md for the question bank and ${CLAUDE_PLUGIN_ROOT}/skills/build/SKILL.md for the invariants; both apply here.
Stage 0: read the facts and branch
- Already set up (a root with
trigger.config.*, SDK installed): say so and offer/trigger-dev:new <capability>or/trigger-dev:audit. Stop unless the user wants more. - SDK 3.x or v2 code: read
${CLAUDE_PLUGIN_ROOT}/skills/build/scenarios/migrate-v2-v3.mdand offer the migration instead. - No Node (
nodenot on PATH): tasks cannot be written or run here. Explain that, offer the REST call site for the host language (templates/rest-call-sites.md) and stop. - Caller-only repo (the SDK is a dependency, no config): the tasks live elsewhere; ask where, and build only the call site.
- Self-hosted target: say it once; never write
https://api.trigger.devinto code, and skip cloud-only advice.
Stage 1: intent (skip if the goal above is clear)
One AskUserQuestion, at most 4 options: background or scheduled jobs · long workflow with waits or approvals · AI chat agent · reacting to webhooks or events. A chat agent goes to the chat-agent skill's discovery (its stages 4 to 6 replace the ones below).
Stage 2: architecture questions
One AskUserQuestion call with at most 2 questions, and only those the repo does not answer (discovery.md, Q2 to Q6). State every inferred answer in a line and give a default for everything else; the login and the project choice are human steps in stage 4, not extra questions here.
Stage 3: decision record
At most 15 lines: the primitives, one line of why each, a doc link per primitive (trigger-ctx docs <topic> gives the path), and the files you will create. [you] confirm before anything is written.
Stage 4: set up (human gates marked)
4a. Auth. npx trigger.dev@latest whoami first: logged out it answers "You must login first" in seconds, while the MCP whoami can hang with no login (use it once the CLI shows an account). If logged out, use the resumable login: npx trigger.dev@latest login --no-browser --no-wait, show the URL to the user, and [you] approve it in the browser (plus email verification for a new account). From CLI 4.8.3 the approval page then shows a one-time code (a login is bound to the machine that started it), so ask the user for it and finish with npx trigger.dev@latest login --code <code>; on older CLIs run npx trigger.dev@latest login --no-browser. Do not pass --email or --name unless the user gives them. Never create an account for the user.
4b. Project. list_projects (or npx trigger.dev@latest projects list). [you] choose one, or confirm creating a new one (it creates a cloud resource). A fresh account needs --project-name and --org-name on init -y.
4c. Install and config. From the package directory that will hold the tasks (the Trigger root in a monorepo): npx trigger.dev@latest init -y --project-ref <proj_…> --runtime node-24 (use the project's package manager: pnpm dlx, yarn dlx, bunx; add --skip-package-install when the install should be done another way, --pkg-args for package-manager arguments). pnpm 10 may stop with ERR_PNPM_IGNORED_BUILDS (esbuild, @depot/cli) before writing anything: rerun with --allow-build=esbuild --allow-build=@depot/cli, or use npx. If a config already exists, or tasks belong in a new trigger/ subpackage of a Python/Go/Ruby repo, use the manual path in templates/ instead.
4d. Patch the config and package.json. Add trigger.dev to devDependencies at the SDK's version, with scripts "trigger:dev": "trigger dev", "deploy:staging": "trigger deploy --env staging" and "deploy:prod": "trigger deploy --env prod" (the project's own CLI keeps versions aligned in CI). Config: defineConfig from @trigger.dev/sdk; dirs; a default maxDuration; extensions with their own import paths and a pinned runtime; .trigger in .gitignore; the config file in the tsconfig include. Verify option names with trigger-ctx docs config-file.
4e. Secret key (only if app code or a REST caller will trigger tasks). [you] copy TRIGGER_SECRET_KEY for the right environment from the dashboard (API keys page; restricted presets exist only on Pro and Enterprise) into the git-ignored env file yourself. Do not ask the user to paste it into the chat, and never echo it.
4f. First task and call site. Write the task from the scenario card chosen in stage 3, then the call site: a type-only tasks.trigger<typeof t>("id", payload) in TypeScript, or a REST call in the host language with an idempotency key (templates/rest-call-sites.md). A realtime page also needs the token route (templates/realtime-token-route.md).
Stage 5: prove it runs
Follow ${CLAUDE_PLUGIN_ROOT}/skills/build/verify.md (the login is done in stage 4; the dev run is step 4 there). Done means a run reached COMPLETED. If you could not run it (no login, no MCP), say UNVERIFIED and why.
Stage 6: hand-off
List what exists. Offer next steps: /trigger-dev:new (a UI, a schedule, an approval step), /trigger-dev:ship (deploy), /trigger-dev:audit. Offer, and only with consent, a 5-line pointer in CLAUDE.md or AGENTS.md saying that Trigger.dev work goes through the trigger-dev plugin.
04 同仓库更多 Skills
ship
Deploy Trigger.dev tasks (trigger deploy) to staging, prod or a preview branch with a preflight, the right CI or integration pipeline, an explicit --env, and a verification step. Use when asked to deploy, ship or release the Trigger.dev tasks or jobs. Not for deploying the app itself to Vercel, Fly or another host.
new
Add one capability to an existing Trigger.dev project (a task, a schedule, a progress UI, an approval step, a webhook handler) and prove it runs.
doctor
Check the Trigger.dev toolchain around this project (Node, CLI login and profile, MCP server, versions, duplicate official skills, self-host target, plugin install scope) and report what to fix.
diagnose
Find out why Trigger.dev runs or deploys misbehave (stuck QUEUED or PENDING_VERSION, failed, timed out, crashed or OOM, schedules not firing, 429s, CI deploy failures, chat history lost). Use when a Trigger.dev project shows an error, a run id such as run_abc123, or the user says a task did not run.
chat-agent
Build, migrate or debug AI chat agents on Trigger.dev (chat.agent, the chat transport, sessions, transcript storage, tool approvals, server, Slack and Linear callers). Use when a Trigger.dev project needs a chat assistant or agent, or code imports @trigger.dev/sdk/ai or @trigger.dev/sdk/chat.
audit
Review a Trigger.dev codebase against the plugin's rule catalog (stale APIs, silent-failure patterns, config, deploy, cost) and write a findings report; optionally apply safe fixes.