Agent Native

custom-metrics

Emit numeric measurements from Vercel Functions using the metric() function from @vercel/functions, then query and analyze those metrics with the vc CLI tool.

by VercelOfficial publisherNot reviewed

Identity proven by GitHub's verified organisation badge (vercel, vercel-labs)

Agents
Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode
License
Apache-2.0 (permissive)
Pin
2a1e58dpinned Oct 9, 2026
Context cost
about 1,100 tokenswhen the skill loads
GitHub stars
300on vercel/vercel-plugin
Scripts
None found

What it does

“Emit and query Vercel Custom Metrics. Use when instrumenting application or business measurements in Vercel Functions, using metric() from @vercel/functions, choosing metric names and attributes, or querying emitted values with vc metrics.”
The author's description, from SKILL.md

Generated summary from the skill's own text

Emit numeric measurements from Vercel Functions using the metric() function from @vercel/functions, then query and analyze those metrics with the vc CLI tool. This enables tracking application and business measurements like order counts, processing duration, and batch sizes with optional string tags for filtering and grouping.

When to use it

  • Measure numeric application behavior in Vercel Functions like durations or counters
  • Track business metrics such as checkout completion or queue sizes
  • Query aggregated metrics with filtering and grouping by attributes
  • Instrument Vercel Functions for observability and performance analysis

When not to

  • Tracking detailed user interactions should use Web Analytics events instead
  • Need request tracing and causality, use OpenTelemetry spans instead
  • Detailed diagnostic records per request, use logs instead

Install

These commands install from the publisher's repository and need no account.

skills CLI

npx skills add vercel/vercel-plugin --skill custom-metrics

Installs from the repository's default branch, which may have changed since the commit we checked.

GitHub CLI 2.90 or later

gh skill install vercel/vercel-plugin custom-metrics@2a1e58dfb63c064c2589c0c21b3e93c53728f8d5

Installs the commit we checked (2a1e58d).

Copy by hand

Download the folder at 2a1e58d and put it in .claude/skills/custom-metrics for Claude Code and in .agents/skills/custom-metrics for Codex, Cursor, Gemini CLI, GitHub Copilot and OpenCode.

Skill folder on GitHub at 2a1e58d

Claude Code plugin

/plugin install vercel@claude-plugins-official

The publisher's plugin in Claude's official marketplace. It may hold more than this skill, and we have not pinned it.

Copy for your agent

A prompt for any coding agent. It installs this skill from GitHub at the pinned commit, copies the files as they are, and runs nothing unless you ask.

Prompt

Install the agent skill "custom-metrics" by Vercel.

Source, pinned to commit 2a1e58dfb63c064c2589c0c21b3e93c53728f8d5:
https://github.com/vercel/vercel-plugin/tree/2a1e58dfb63c064c2589c0c21b3e93c53728f8d5/skills/custom-metrics

1. Download that folder at exactly this commit. Do not use the default branch.
2. Copy every file unchanged, keeping the folder structure, into .claude/skills/custom-metrics/ for Claude Code and .agents/skills/custom-metrics/ for Codex, Cursor, Gemini CLI, GitHub Copilot and OpenCode. Create the folders if they do not exist.
3. Do not edit the files, and do not run any script in the folder unless I ask you to.
4. When you are done, list the files you copied and where you put them.

Listing and checks: https://www.agentnative.dev/skills/vercel/custom-metrics

SKILL.md at the pin

---
name: custom-metrics
description: Emit and query Vercel Custom Metrics. Use when instrumenting application or business measurements in Vercel Functions, using metric() from @vercel/functions, choosing metric names and attributes, or querying emitted values with vc metrics.
summary: Emit numeric measurements from Functions and query them with vc metrics
metadata:
  priority: 9
  docs:
    - "https://vercel.com/docs/functions/functions-api-reference/vercel-functions-package"
    - "https://vercel.com/docs/cli/metrics"
    - "https://vercel.com/docs/observability/observability-plus"
  sitemap: "https://vercel.com/sitemap/docs.xml"
  pathPatterns: []
  bashPatterns:
    - '\b(?:vercel|vc)\s+metrics\s+(?!schema(?:\s|$)|vercel\.)[A-Za-z_][A-Za-z0-9_./-]*\b'
    - '\b(?:vercel|vc)\s+metrics\s+schema\s+(?!vercel\.)[A-Za-z_][A-Za-z0-9_./-]*\b'
  importPatterns: []
  promptSignals:
    phrases:
      - "custom metric"
      - "custom metrics"
      - "emit a metric"
      - "emit metrics"
      - "report a metric"
      - "report metrics"
      - "application metrics"
      - "business metrics"
      - "@vercel/functions metric"
    allOf:
      - [emit, metric]
      - [report, metric]
      - [instrument, metric]
      - [vercel, metric]
    anyOf:
      - "observability"
      - "instrumentation"
      - "duration"
      - "counter"
      - "percentile"
    noneOf:
      - "font metrics"
      - "core web vitals"
    minScore: 6
retrieval:
  aliases:
    - Vercel application metrics
    - Vercel business metrics
    - function metrics
    - vc metrics
  intents:
    - emit a custom metric
    - instrument a Vercel Function
    - query a custom metric
    - measure application behavior
  entities:
    - metric
    - "@vercel/functions"
    - Vercel Custom Metrics
    - vc metrics
    - Observability Plus
  examples:
    - emit checkout duration as a custom metric
    - add a business counter to this Vercel Function
    - query my custom metric with vc metrics
    - group an application metric by outcome
---

# Vercel Custom Metrics

Use Custom Metrics for numeric application and business measurements emitted by server-side code running in a Vercel Function. The workflow is **emit a numeric sample with `metric()` → invoke the deployed function → discover and query the metric with `vc metrics` or Observability**.

## Emit a metric

Install or upgrade `@vercel/functions`, then import `metric` from its root entry point:

```bash
pnpm add @vercel/functions
```

```ts
import { metric } from '@vercel/functions';

export async function POST() {
  const startedAt = performance.now();

  try {
    await createOrder();
    metric('orders.created', 1, { outcome: 'success' });
    return Response.json({ ok: true });
  } catch (error) {
    metric('orders.created', 1, { outcome: 'error' });
    throw error;
  } finally {
    metric('orders.duration_ms', performance.now() - startedAt);
  }
}
```

The signature is:

```ts
metric(name: string, value: number, tags?: Record<string, string>): void
```

- `name` identifies one stable measurement, such as `orders.created` or `orders.duration_ms`.
- `value` is the numeric sample. Emit `1` for an increment that will be summed; emit the observed value for a duration, size, or score.
- `tags` are optional string attributes. After ingestion, discovered tag keys appear as dimensions for filtering and grouping.
- `metric()` is synchronous and returns `void`; do not `await` it.
- The helper is a no-op when the runtime does not expose Custom Metrics support. Verify instrumentation through a deployed Vercel Function invocation, not local execution alone.

## Model metrics for useful queries

- Prefer stable, dotted names with a unit suffix where useful: `checkout.completed`, `checkout.duration_ms`, `queue.batch_size`.
- Do not use the reserved `vercel.` prefix for application-defined names.
- Keep variable data in tags instead of metric names. Use `checkout.completed` with `{ plan: 'pro' }`, not `checkout.completed.pro`.
- Keep tag cardinality bounded. Good tags are `outcome`, `plan`, `provider`, or a normalized route. Do not attach user IDs, request IDs, email addresses, raw URLs, or other unique or sensitive values.
- Emit one sample at the point where the outcome is known. For retryable or at-least-once work, decide whether attempts or successful logical operations are the intended measurement and name the metric accordingly.

Choose the query aggregation to match what was emitted:

| Measurement | Emit | Query |
| --- | --- | --- |
| Occurrence or increment | `metric('checkout.completed', 1)` | `sum` or `persecond` |
| Duration or size | `metric('checkout.duration_ms', duration)` | `avg`, `p75`, `p95`, `max` |
| Sampled level | `metric('queue.batch_size', size)` | `avg`, `min`, `max`, percentiles |

## Discover and query the metric

Run the deployed code at least once, then use the linked project and correct team scope:

```bash
vc metrics schema
vc metrics schema orders.duration_ms

vc metrics orders.created -a sum --group-by outcome --since 24h
vc metrics orders.duration_ms -a p95 --since 1h
vc metrics orders.duration_ms -a p95 --group-by outcome --since 24h --format=json
```

`vc` and `vercel` are equivalent. Always inspect the exact metric first with `vc metrics schema <name>` because the schema reports the available aggregations and discovered tag dimensions. Use `-S <team>` and `-p <project>` when the current link or scope is ambiguous; use `--all` only for a deliberate team-wide query.

Custom Metrics querying requires Observability Plus and availability for the selected team. If a metric is missing:

1. Confirm the function was deployed to Vercel and the instrumented path actually ran.
2. Confirm `@vercel/functions` exports `metric`; upgrade it if necessary.
3. Check `vc whoami`, the selected team, and the linked project.
4. Allow for ingestion delay, then rerun `vc metrics schema`.
5. Confirm Observability Plus and Custom Metrics are enabled for the team.

## Use the right signal

- Use **Custom Metrics** for numeric values you want to aggregate, trend, and filter.
- Use **Web Analytics custom events** for user interaction and conversion events in Web Analytics.
- Use **OpenTelemetry spans** for traces, operation timing, and request causality.
- Use **logs** for detailed diagnostic context and individual records.

Do not encode detailed event payloads into metric tags. Pair a low-cardinality metric with structured logs or traces when investigation needs per-request detail.

From vercel/vercel-plugin at 2a1e58d, shown as plain text under its license: Apache-2.0 (permissive). The license text is in LICENSE.

View SKILL.md on GitHub at 2a1e58d

Files

2 files, 6.6 KB in total. Each file has a sha256 in the pin's manifest; the first 12 characters are shown.

Skill folder on GitHub at 2a1e58d
All 50 skills from Vercel

More from Vercel

  • next-bundle-optimizer

    Audits Next.js applications to identify and reduce browser bundle size and initial-load work by analyzing routes, dependencies and client outputs.

    Claude Code, Codex, Cursor +4 · about 2.3K tokens · pinned 6 days ago

  • next-cache-components-optimizer

    Optimize Next.js routes to display meaningful UI instantly on initial load or client navigation by encoding the optimization goal as a failing…

    Claude Code, Codex, Cursor +4 · about 5.6K tokens · pinned 6 days ago

  • next-partial-prefetching-adoption

    Enables Partial Prefetching in Next.js 16.3+ apps and guides adoption through auditing Link prefetch behavior, preserving UI in tests or manually, and…

    Claude Code, Codex, Cursor +4 · about 6.7K tokens · pinned 6 days ago

  • next-partial-prefetching-optimizer

    This skill optimizes Next.js client-side navigation under Partial Prefetching by defining what UI loads before and after a click.

    Claude Code, Codex, Cursor +4 · about 2.8K tokens · pinned 6 days ago

  • apple

    This skill emulates Apple's OAuth and OIDC services for local development and testing.

    Claude Code, Codex, Cursor +4 · about 1.9K tokens · pinned 6 days ago

  • aws

    This skill emulates AWS cloud services locally, providing S3 bucket and object operations, SQS message queues, IAM user and role management, and STS assume…

    Claude Code, Codex, Cursor +4 · about 2.8K tokens · pinned 6 days ago

All Observability skills
  • sentry-instrument

    This skill instruments applications with Sentry to capture errors, tracing, logging, profiling, metrics, session replay, user feedback, and AI/LLM monitoring…

    by SentryOfficial publisher

    Claude Code, Codex, Cursor +4 · about 3K tokens · pinned 6 days ago

  • sentry-setup-ai-monitoring

    Configures Sentry to monitor LLM calls, agent execution, and token consumption across JavaScript, Python, and PHP/Laravel applications.

    by SentryOfficial publisher

    Claude Code · about 5.3K tokens · pinned 6 days ago

  • debugging-executions

    Debug workflow execution failures by inspecting failed nodes, re-running executions, and comparing expected versus actual values.

    by n8nOfficial publisher

    Claude Code, Codex, Cursor +3 · about 2.5K tokens · pinned 6 days ago

  • instance-awareness

    This skill teaches the agent to resolve ambiguous requests by reading the instance's activity log and workflow history instead of asking the user to clarify.

    by n8nOfficial publisher

    Claude Code, Codex, Cursor +3 · about 1.3K tokens · pinned 6 days ago

  • creating-replay-vision-scanners

    Guides agents through creating Replay Vision scanners, LLM probes that watch session recordings on a schedule and log findings as observations.

    by PostHogOfficial publisher

    Claude Code, Codex, Cursor +4 · about 3.3K tokens · pinned 6 days ago

  • exploring-replay-vision-observations

    This skill guides agents through reading observations from Replay Vision scanners, understanding their findings across session recordings, and taking action…

    by PostHogOfficial publisher

    Claude Code, Codex, Cursor +4 · about 3.3K tokens · pinned 6 days ago

Open roles at Vercel

5 of 11 open roles on the jobs board

The skills listed here are third-party software, collected from public GitHub repositories as a catalog of recent skills and provided as is. Agent Native does not write or control them and is not responsible for any harm, loss or damage caused by installing or using them. Labels and checks describe what we saw at one commit and are not a guarantee. Read a skill's files before you run it. Terms of use