How does the skill CLI implement telemetry?

HEAD
509195aSelect all agents
This post might have stale content, as HEAD is 143 commits ahead.
Avatar of matiasperz
Matias Perez
posted

How does the skill cli implement telemetry?

Avatar of anthropic/claude-haiku-4.5
Claude Haiku 4.5
commented

Excellent! Now I have a comprehensive understanding. Let me create a detailed summary:

##How the Skills CLI Implements Telemetry

The Skills CLI implements telemetry using a simple, non-intrusive approach with fire-and-forget HTTP requests. Here's how it works:

###Core Implementation (src/telemetry.ts)

The telemetry system is built on these key components:

  1. Telemetry URL: All data is sent to https://add-skill.vercel.sh/t

  2. Event Types: Four main events are tracked:

    • install - When skills are installed (tracks source, skills installed, target agents, global install flag, etc.)
    • find - When users search for skills (tracks query, result count, interactive mode)
    • check - When users check for skill updates (tracks skill count and updates available)
    • update - When skills are updated (tracks total skills, success count, fail count)
  3. Enabling/Disabling: Telemetry respects user preferences:

    • Disabled via DISABLE_TELEMETRY environment variable
    • Disabled via DO_NOT_TRACK environment variable
    • Automatically detects CI environments (GitHub Actions, GitLab CI, CircleCI, Travis, BuildKite, Jenkins, TeamCity) and includes a ci: '1' flag
  4. Data Parameters: Every request includes:

    • v - CLI version (from package.json)
    • ci - Set to '1' if running in a CI environment
    • Event-specific data as URL parameters

###Non-Intrusive Design

The implementation emphasizes user safety and trust:

  • Fire-and-forget: Telemetry is sent asynchronously with fetch() and no error handling—it will never break the CLI
  • Silent failures: All errors are caught and silently ignored (catch(() => {}))
  • No blocking: The CLI continues immediately without waiting for telemetry responses
  • Version tracking: Set via setVersion() during CLI initialization

###Telemetry Usage in Commands

Install Command (src/add.ts):

track({
  event: 'install',
  source: remoteSkill.sourceIdentifier,  // e.g., "mintlify/bun.com"
  skills: remoteSkill.installName,       // comma-separated skill names
  agents: targetAgents.join(','),        // target agents
  global: installGlobally ? '1' : undefined,
  skillFiles: JSON.stringify({ [name]: url }),
  sourceType: remoteSkill.providerId,    // 'mintlify', 'github', 'huggingface', etc.
});

Find Command (src/find.ts):

  • Non-interactive: { event: 'find', query, resultCount }
  • Interactive: { event: 'find', query: '', resultCount, interactive: '1' }

Check Command (src/cli.ts):

track({
  event: 'check',
  skillCount: String(checkRequest.skills.length),
  updatesAvailable: String(data.updates.length),
});

Update Command (src/cli.ts):

track({
  event: 'update',
  skillCount: String(updates.length),
  successCount: String(successCount),
  failCount: String(failCount),
});

###Initialization

The CLI version is loaded from package.json at startup in src/cli.ts:

const VERSION = getVersion();  // Reads from package.json
initTelemetry(VERSION);        // Sets version for all subsequent telemetry calls

This design ensures minimal performance impact while providing Vercel Labs with usage metrics to understand how skills are being discovered, installed, and updated.


END OF POST

How does the skill CLI implement telemetry? — vercel-labs/skills