Agent Skillsn8n-io/n8n › n8n:telemetry

n8n:telemetry

GitHub

指导在n8n项目中添加、修改和审查遥测事件。提供通过注册表查找事件详情、规范命名与类型定义(Zod)以及使用track()方法的流程,确保前端和后端埋点数据的准确性与一致性。

.agents/skills/telemetry/SKILL.md n8n-io/n8n

触发场景

需要添加新的用户行为追踪事件 查询现有遥测事件的定义或属性 修改或审查现有的telemetry代码 处理RudderStack或PostHog相关的事件配置

安装

npx skills add n8n-io/n8n --skill n8n:telemetry -g -y
更多选项

非标准路径

npx skills add https://github.com/n8n-io/n8n/tree/master/.agents/skills/telemetry -g -y

不安装直接使用

npx skills use n8n-io/n8n@n8n:telemetry

指定 Agent (Claude Code)

npx skills add n8n-io/n8n --skill n8n:telemetry -a claude-code -g -y

安装 repo 全部 skill

npx skills add n8n-io/n8n --all -g -y

预览 repo 内 skill

npx skills add n8n-io/n8n --list

SKILL.md

Frontmatter
{
    "name": "n8n:telemetry",
    "description": "Guides adding, changing, and reviewing telemetry through the `@n8n\/telemetry` event registry. Use when working on telemetry, analytics, tracking, product events, `track()` calls, or RudderStack\/PostHog product events, in frontend or backend code — and whenever you need to find which registered telemetry events exist, what an event means, or what properties it carries."
}

Telemetry

The registry

Events migrated to the registry live in packages/@n8n/telemetry as one entry per event — its exact emitted name, a description, and a zod schema typing its properties — organized per product domain in src/events/ and composed into TELEMETRY_EVENT.<DOMAIN>.<EVENT>. The package defines registered events and never depends on transport SDKs.

To find which events are registered, what they mean, or what properties they carry, run the catalog first:

pnpm --filter @n8n/telemetry catalog          # human-readable, grouped by domain
pnpm --filter @n8n/telemetry catalog --json   # structured, for programmatic use

The registry is being adopted incrementally. Events not yet registered do not appear in the catalog, so search track() call sites when the catalog has no match.

Pass the entry itself to track() — it resolves the emitted name internally:

import { TELEMETRY_EVENT } from '@n8n/telemetry';

telemetry.track(TELEMETRY_EVENT.PLATFORM.USER_IS_PART_OF_EXPERIMENT, {
	name: experimentName,
	variant,
});

Both track() implementations accept registry entries and plain strings. Plain strings remain supported for events that have not yet migrated:

  • Frontend: packages/frontend/editor-ui/src/app/plugins/telemetry/index.ts
  • Backend: packages/cli/src/telemetry/index.ts

Entries get property autocomplete and compile-time checks — typo'd, missing, or wrongly typed properties fail typecheck. When the telemetry transport is initialized, track() additionally validates registered-event payloads via getEventValidationError (shared from @n8n/telemetry) and logs a warning on mismatch, including unrecognized properties that slipped past structural typing. A validation warning does not stop the event from being emitted.

Adding an event

  1. Check the catalog first (pnpm --filter @n8n/telemetry catalog). If an existing event covers the same user action from another surface, augment it with a property instead of adding a near-duplicate event.
  2. Pick the domain by the event's subject — what the event is about, never the surface that triggered it. User opened Credential modal is CREDENTIALS whether opened from the NDV, template setup, or chat. The trigger context goes into a source property.
  3. Name it with the house grammar: sentence case, actor first, past-tense verb, specific object (User pinned node data). No template interpolation in names — variability goes into properties. The name must snake_case cleanly into a BigQuery table name: no punctuation beyond spaces, no casing that collides after snake_casing.
  4. Write the entry description stating what the event means and when it fires — a registry test rejects blank descriptions. Document individual properties with .describe() where the key alone is not obvious.
  5. Type the properties with zod (import { z } from 'zod/v4'): snake_case keys, explicit .optional() where a call site may omit a value, z.looseObject()/.catchall() for genuinely dynamic remainders. Schemas must stay JSON-Schema-representable — no transforms, refinements, or z.date() (a registry test enforces this via z.toJSONSchema()).
  6. Place the emission: frontend via useTelemetry().track(...); backend either through a RelayEventMap handler in packages/cli/src/events/relays/telemetry.event-relay.ts (event-bus-driven) or a direct Telemetry.track(...) call — both reference the same registry entry.

Hard rules

  • Never rename an emitted event. BigQuery materializes one table per event name; a rename orphans downstream history. A rename is delete + create, names are never reused, and removals must be coordinated with the data team before deleting the registry entry.
  • Never duplicate an event name — one entry per event across all domains, referenced by every call site (even FE + BE). CI fails on collision.
  • Properties evolve additively only. Changing a property's type forks warehouse columns even under a stable name. Mark deprecations on the schema (.meta({ deprecated: true })) instead of removing.
  • Breaking changes need a data-team heads-up in Slack plus a Notion note before they ship.

Testing

Do not retype event-name literals in tests:

  • In call-site tests, mock useTelemetry().track or the backend Telemetry.track service and expect the registry entry itself with the payload.
  • In frontend transport tests, expect window.rudderanalytics.track to receive entry.name and the augmented payload.
  • In backend transport tests, expect the RudderStack payload's event field to equal entry.name and its properties to include the event payload.

Related

Experiment exposure and metric events follow n8n:experiments (.agents/skills/experiments/SKILL.md).

版本历史

  • c31d0e5 当前 2026-08-20 19:08

同 Skill 集合

.agents/skills/community-pr-readiness-check/SKILL.md
.agents/skills/content-design/SKILL.md
.agents/skills/conventions/SKILL.md
.agents/skills/create-agent-builder-eval/SKILL.md
.agents/skills/create-community-node-lint-rule/SKILL.md
.agents/skills/create-instance-ai-eval/SKILL.md
.agents/skills/create-issue/SKILL.md
.agents/skills/create-pr/SKILL.md
.agents/skills/create-skill/SKILL.md
.agents/skills/db-migrations/SKILL.md
.agents/skills/design-system/SKILL.md
.agents/skills/experiments/SKILL.md
.agents/skills/gh-stack/SKILL.md
.agents/skills/human-like-code-review/SKILL.md
.agents/skills/linear-issue/SKILL.md
.agents/skills/loom-transcript/SKILL.md
.agents/skills/nathan/SKILL.md
.agents/skills/node-add-oauth/SKILL.md
.agents/skills/protect-endpoints/SKILL.md
.agents/skills/public-api/SKILL.md
.agents/skills/reproduce-bug/SKILL.md
.agents/skills/spec-driven-development/SKILL.md
.agents/skills/ui-design/SKILL.md
.claude/plugins/n8n/skills/setup-mcps/SKILL.md
.opencode/skills/setup-mcps/SKILL.md
packages/@n8n/cli/skills/n8n-cli/SKILL.md
packages/@n8n/instance-ai/skills/agent-builder/SKILL.md
packages/@n8n/instance-ai/skills/config-evals/SKILL.md
packages/@n8n/instance-ai/skills/credential-recipe-research/SKILL.md
packages/@n8n/instance-ai/skills/credential-setup-with-computer-use/SKILL.md
packages/@n8n/instance-ai/skills/debugging-executions/SKILL.md
packages/@n8n/instance-ai/skills/instance-awareness/SKILL.md
packages/@n8n/instance-ai/skills/n8n-docs-assistant/SKILL.md
packages/@n8n/instance-ai/skills/planned-task-runtime/SKILL.md
packages/@n8n/instance-ai/skills/planning/SKILL.md
packages/@n8n/instance-ai/skills/post-build-flow/SKILL.md
packages/@n8n/instance-ai/skills/data-table-manager/SKILL.md
packages/@n8n/instance-ai/skills/intent-recognition/SKILL.md
packages/@n8n/instance-ai/skills/model-selection/SKILL.md
packages/@n8n/instance-ai/skills/one-off-operations/SKILL.md
packages/@n8n/instance-ai/skills/progressive-building/SKILL.md
packages/@n8n/instance-ai/skills/workflow-builder/SKILL.md

元信息

文件数
0
版本
fe0fad5
Hash
b0b4b3f2
收录时间
2026-08-20 19:08

首页 - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-09-23 15:21
浙ICP备14020137号-1