跳转到内容
Telemetry
编程智能体的审查埋点技能

Skill.md 可观测性包装示例

复制经过审核的 Skill.md,其中包含 TypeScript 和 Python 遥测包装示例、安全事件边界、SQL 验证以及 Claude Code、Codex、Cursor 或其他编程智能体的仪表板工作流程。

将技能运用到工作中

立即使用一种真实智能体工作流程

从准备好的 API 密钥和智能体提示开始,运行一个代表性工作流程,并在构建仪表板之前验证生成的事件。

连接代理遥测

技能涵盖什么

以可检查数据结尾的指令

稳定的事件合约

智能体被引导至命名事件、有界 snake_case 字段、显式单元和在 SQL 中仍然有用的标识符。

安全收集边界

默认情况下,原始提示、完成、凭据、授权标头和私有有效负载不会进入分析路径。

端到端的结果

直到代表性事件到达并且查询或仪表板证明工作流可见时,检测才完成。

Telemetry 包装示例

为智能体提供一个小的、可审查的摄取边界

Pass the API key from trusted server-side configuration and verify a real event with SQL. Anonymous keys support this workflow; claim the workspace before creating dashboards. Keep the Python User-Agent header so requests reach the API.

打字稿

TypeScript 遥测包装器

javascript
type TelemetryEvent = Record<string, unknown>;

export async function emitTelemetry(
  apiKey: string,
  table: string,
  data: TelemetryEvent,
) {
  const response = await fetch("https://api.telemetry.sh/log", {
    method: "POST",
    headers: {
      Authorization: apiKey,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({ table, data }),
  });

  if (!response.ok) {
    throw new Error(`Telemetry ingestion failed: ${response.status}`);
  }
}
蟒蛇

Python 遥测包装器

python
import json
from urllib.request import Request, urlopen

def emit_telemetry(api_key: str, table: str, data: dict) -> int:
    request = Request(
        "https://api.telemetry.sh/log",
        data=json.dumps({"table": table, "data": data}).encode(),
        headers={
            "Authorization": api_key,
            "Content-Type": "application/json",
            "User-Agent": "telemetry-agent/1.0",
        },
        method="POST",
    )
    with urlopen(request, timeout=5) as response:
        return response.status

从这里开始

粘贴一份有界摘要

将占位符替换为服务器端 API 密钥,然后要求智能体在选择事件边界之前检查存储库。

代理提示

AI智能体可观测性提示

text
Instrument this project with structured logs using /skill.md. Use this Telemetry API key: YOUR_API_KEY Anonymous keys: logging and synchronous SQL work without signup. Claim the existing workspace at https://telemetry.sh/register with the same key before creating dashboards or alerts. If it is unclaimed, finish with verified event readback and mark account features as pending signup. Please: 1. Find the most important user-facing flows, background jobs, and AI/tooling workflows. 2. Add structured logging with pragmatic snake_case tables and fields. 3. Capture the key signals for each workflow, including status, latency, identifiers, and error context when relevant. 4. Run one real user-facing or operational flow through the instrumented application and verify its event appears 中 Telemetry. Do not use telemetry_quickstart for this milestone. 5. Run a read-only query over that real event, then create a high-level dashboard with charts and tables that summarize the most important signals in this project. 6. Tell me what you instrumented, which real flow you verified, which tables you created, and which dashboard views I should review first. Prefer small, composable events over giant payloads, and optimize for dashboards that humans can scan quickly.

审核边界

让人类控制合同

该技能可帮助智能体找到有用的工作流程边界,但您的团队仍然拥有事件含义、允许的字段、保留策略和操作阈值。

  • 在部署之前检查每个新表和字段。
  • 使用有界标识符而不是私有有效负载。
  • 验证成功、失败和最终结果。

继续工作流程

检测第一个工作流程,然后检查结果

使用预配置的工作区、API 密钥、智能体提示和入门仪表板免费开始。连接一个真实的工作流程,验证事件,并保存第一个有用的查询。