功能分析埋点设计
instrument-feature-analytics
为某个功能规划分析埋点。在实现任何功能时使用——每个功能都必须附带遥测。确定指标所需的事件与属性(漏斗、采用度、状态流转),检查与现有数据湖及事件注册表的兼容性,并演练本地、预发布和生产环境的验证流程。
- License 许可
- Apache-2.0
- 最近更新
- 2026-11-11
- Stars
- ★ 5.4k
- Forks
- 796
01 前言 Front Matter
- name
- instrument-feature-analytics
- metadata
- { "author": "datascience-team", "version": "1.0", "display-name": "Instrument Feature Analytics", "default-prompt": "Use $instrument-feature-analytics to plan the telemetry for a feature before writing tracking code.", "short-description": "Plan and verify analytics instrumentation for features" }
- description
- Plan analytics instrumentation for a feature. Use when implementing any feature — every feature must ship with telemetry. Decides which events and properties the metrics need (funnels, adoption, status flows), checks compatibility with the existing datalake and event registry, and walks through local, staging, and production verification.
- user-invocable
- true
03 SKILL.md 正文
Instrument a Feature for Analytics
Answer the tracking questions a software engineer would normally take to a data scientist or data engineer. When they bring one here, answer it the way a data person would, and proactively cover what they didn't think to ask.
The software engineer already knows how to emit an event technically. The hard part — and the reason they'd normally ask a data person — is deciding which events and properties matter for the metrics, and making sure they fit what already exists so the data is actually usable. Events land in mistral-data.lake_eu.logs_events.
Use the steps below as the full picture to reason from, not a rigid script: if the software engineer arrives with a specific question, answer that first, then pull in whatever other steps are relevant. If they arrive with "I'm adding feature X, help me track it", walk it in order.
Process
1. Understand the feature and the metrics behind it
Ask the software engineer a few questions before anything else:
- What is the feature? (a new onboarding step, a way to discover a feature, a status/lifecycle change, an action users repeat…)
- What will product and data want to measure about it? Adoption? A funnel and where people drop off? How often a status changes? Whether a surface gets noticed?
Then translate those questions into the events and properties that would answer them. Common patterns:
- Funnel (e.g. onboarding): one event per step (
started,step_completed,completed), with a property identifying the step and its order, plus a shared id to stitch the steps of one user together. - Discoverability: distinguish seen from acted on — an impression event when the thing is shown and an interaction event when the user engages, so you can compute a noticed→used rate.
- Status / lifecycle updates: one event per transition carrying
from_statusandto_status(and what triggered it), so changes can be reconstructed over time. - Repeated action / engagement: one event per occurrence with enough context (what, where) to segment it.
The goal of this step is coverage: make sure every question the software engineer named maps to at least one event + the properties needed to slice it. Naming comes after.
2. Check what already exists — reuse first, create second
Before defining any new event, search for existing events that already capture the same (or similar) user action. A new event that duplicates an existing one fragments the data and makes downstream queries harder.
Check datalake-dbt on the software engineer's behalf (they never have to open that repo):
- Read the event registry (
datalake-dbt/event_registry/<service>.yml) for the software engineer's service and for neighboring services that touch the same domain. Grep broadly — the event you need may already exist under a slightly different name or in a different service's namespace. - If an existing event covers the action but is missing a property, extend it (add the property) rather than creating a parallel event.
- If no existing event fits, create a new one — but reuse property names and types from related events so the new data composes with the old instead of fragmenting it.
- Keep one stable type per property and avoid nesting deeper than two levels — these are what let the data be modeled cleanly and stay queryable over time.
Flag anything that would force an awkward downstream change or that won't age well, and propose the compatible shape instead.
3. Naming
Names are a data-consistency concern, so keep them conventional: <prefix>.<noun>.<verb>, snake_case, dot-namespaced, at least two segments — the prefix maps to the service (e.g. vibe.session_initialized, harmattan.completion.done). Reuse the wording of existing similar events rather than inventing a parallel vocabulary.
4. Standardized metadata
Every event must populate the standardized metadata block (properties.metadata): call_source, call_type, session_id... Look at existing events in the registry to see which metadata fields are used for the service and carry them over.
5. Cover every surface
The same user action on web, cli, mobile, and api must emit the same event with the same properties. List the surfaces in step 1 and confirm each one emits.
6. PII
If any property carries personally identifiable data (raw user content, email, file path, names), flag it explicitly to the data team before shipping — it changes how the field must be stored and queried. Prefer sending an ID over the raw value.
7. Verify locally
Run the app with DEBUG_LEVEL=1 uv run vibe — every telemetry event is logged right before the API call. If the log line appears, the event will reach the pipeline. Use this to confirm the event fires with the expected properties before deploying.
8. Verify in staging
After deploying to the staging environment, trigger the action a few times per surface, then run the verification queries below against mistral-data.lake_eu.logs_events_staging. Confirm events fire with the right properties and values before promoting to production.
9. Verify in production
After shipping to production, repeat the same manual tests and run the queries against mistral-data.lake_eu.logs_events.
Verification queries
Run these in Metabase or via the BigQuery connector. Use logs_events_staging when verifying in staging, logs_events in production.
Volumetry + completeness of every property — fill in your event name(s):
WITH events AS (
SELECT event, properties
FROM `mistral-data.lake_eu.logs_events`
WHERE timestamp >= TIMESTAMP_SUB(CURRENT_TIMESTAMP(), INTERVAL 24 HOUR)
AND event IN UNNEST(['vibe.session_initialized']) -- <- your event name(s)
),
totals AS (
SELECT event, COUNT(*) AS total_events
FROM events
GROUP BY event
),
property_presence AS (
SELECT event, key AS property, COUNT(*) AS present
FROM events, UNNEST(JSON_KEYS(properties, 2)) AS key -- depth 2 = includes metadata.*
GROUP BY event, key
)
SELECT
t.event,
t.total_events,
p.property,
p.present,
ROUND(p.present / t.total_events, 3) AS completeness -- 1.0 = present on every event
FROM totals t
LEFT JOIN property_presence p USING (event)
ORDER BY t.event, completeness DESC;
Read it as: total_events non-zero and roughly matching your manual test count means the event reaches the lake. Every property you meant to always send should read 1.0; below that, some code path or surface isn't sending it. A property you expected but don't see at all never fired.
Distinct values of each property — this catches what completeness misses (a field always present but always the same wrong constant, an enum sending an unexpected value, an ID coming through empty). List the properties worth inspecting (categorical / enum-like ones; skip high-cardinality IDs):
WITH events AS (
SELECT properties
FROM `mistral-data.lake_eu.logs_events`
WHERE timestamp >= TIMESTAMP_SUB(CURRENT_TIMESTAMP(), INTERVAL 24 HOUR)
AND event IN UNNEST(['vibe.session_initialized']) -- <- your event name(s)
)
-- one block per property you want to inspect; add/remove blocks as needed:
SELECT 'surface' AS property, JSON_VALUE(properties, '$.surface') AS value, COUNT(*) AS n FROM events GROUP BY value
UNION ALL
SELECT 'warm_claimed' AS property, JSON_VALUE(properties, '$.warm_claimed') AS value, COUNT(*) AS n FROM events GROUP BY value
ORDER BY property, n DESC;
Each row is a value and how often it appeared. Check the set of values is what you expect (e.g. surface shows web and cli and nothing weird) and that nothing is unexpectedly NULL or empty.
To confirm per-surface coverage from step 5, break volumetry down by surface:
SELECT event, JSON_VALUE(properties, '$.surface') AS surface, COUNT(*) AS n
FROM `mistral-data.lake_eu.logs_events`
WHERE timestamp >= TIMESTAMP_SUB(CURRENT_TIMESTAMP(), INTERVAL 24 HOUR)
AND event IN UNNEST(['vibe.session_initialized'])
GROUP BY event, surface
ORDER BY n DESC;
Every surface you expected should appear with a non-zero count.
04 同仓库更多 Skills
import
Import the user's setup from other coding CLIs (Claude Code, Codex, OpenCode) into Vibe — instructions, skills, subagents, commands, hooks, MCP servers, permissions, and plugins. Load when the user wants to switch to Vibe, import or reuse another CLI's configuration, or asks whether a file from another CLI works in Vibe.
Git 工作树管理
worktree
在 $VIBE_HOME/worktrees 下创建、复用和清理 git worktrees。当用户想要在隔离的 git worktree 中工作、为某个任务创建 worktree,或列出/删除现有 worktrees 时使用。
Vibe CLI 权威参考
vibe
Mistral Vibe 的权威参考——你(模型)正运行于其中的 CLI agent。 在以下情况加载本技能: - 用户询问任何关于 Vibe 本身的问题,即使是间接称呼(“这个 CLI”“这个工具”“你”); - 想要更改、检查或重置其设置; - 询问 agent 为何采取或未采取某行动; - 询问如何让 CLI 做 X、X 位于何处,或某个 flag/command/setting 的作用; - 询问关于你自身行为的任何元问题; - 不确定某个命令、flag、环境变量或文件是否在范围内——本技能即为权威来源。 范围:`~/.vibe/` 下的配置及项目本地的 `.vibe/`;`VIBE_*` 和 `LOG_*` 环境变量;模型与提供者;agents 与 subagents;skills;工具及其权限模型;所有斜杠命令和 CLI flag;hooks;MCP servers;connectors;plugins;受信任文件夹;`@` 文件引用;日志;主题;语音。
Vibe 技能创建与管理
skill-creator
在创建、更新或删除 Vibe 技能之前,或当你计划添加或修改 skills 目录下的 SKILL.md 文件时,加载本技能。它讲解 Vibe 的 SKILL.md frontmatter、发现顺序、支持文件以及权限流程。
Vibe 插件创建
create-plugin
创建 Vibe 插件包——采用 Agent Plugins 1.0 格式,并可选地包含针对 skills、MCP servers、hooks、knowledge、agents、libraries 和 connectors 的 Vibe 扩展。当用户想要为 Mistral Vibe 创建、搭建或编写插件时使用。
提示词
prompts
暂无简介