Agent skill

Add Metric

by microbus-io in microbus-io/fabric

TRIGGER when user asks to add or modify a metric, counter, gauge, or histogram, or to track/measure an operation.

Apache-2.0Auto-check passedDevOps & Cloud

Install Add Metric

skills CLI
$ npx skills add microbus-io/fabric --skill add-metric -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install microbus-io/fabric add-metric --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/microbus-io/fabric.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.claude/skills/microbus/add-metric .claude/skills/add-metric && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
add-metric
GitHub stars
172
Token cost
~1.5k tokens
SKILL.md length
692 words
Files
1
Skills in repo
32
Repo updated
First seen
Licence
Apache-2.0

At a glance

TRIGGER when user asks to add or modify a metric, counter, gauge, or histogram, or to track/measure an operation.

  • Works in 10 steps: Read Local CLAUDE.md File → Determine the Kind → Determine If Observable Just in Time → …
  • User asks to add
  • Calls go
  • Modify a metric

What it does

Add Metric is an agent skill from microbus-io/fabric. TRIGGER when user asks to add or modify a metric, counter, gauge, or histogram, or to track/measure an operation.

Its SKILL.md is about 1.5k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in DevOps & Cloud, covering Observability and Microservices. It works with OpenTelemetry. The repository describes itself as: Microbus is the only fabric where every agentic workflow runs on a true microservice substrate - giving your workflows security, scale, observability, and prompt-driven authoring. The licence is Apache-2.0.

When your agent uses it

  • User asks to add
  • Modify a metric
  • Track/measure an operation

Example prompts

  • “/add-metric”

Workflow steps

10 steps, taken from the step headings in SKILL.md.

  1. Read Local CLAUDE.md File
  2. Determine the Kind
  3. Determine If Observable Just in Time
  4. Determine the Value Type and Labels
  5. Determine the OpenTelemetry Name
  6. Declare the Metric in definition.go
  7. Record the Metric
  8. Generate the Boilerplate
  9. Test the Callback
  10. Housekeeping

What it can do on your machine

Read from SKILL.md and the folder at commit fb98098. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • go

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Add Metric loads about 1.5k tokens when it runs. Until then it costs about 31 tokens; SKILL.md has 692 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~31
When it runs · the whole SKILL.md, loaded when a task matches
~1.5k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from microbus-io/fabric at commit fb98098, republished under its Apache-2.0 licence (© microbus-io). 692 words, ~1,459 tokens.

Download SKILL.mdSave it as .claude/skills/add-metric/SKILL.md (or your agent's skills folder).
name
add-metric
description
TRIGGER when user asks to add or modify a metric, counter, gauge, or histogram, or to track/measure an operation.

CRITICAL: Do NOT explore or analyze other microservices unless explicitly instructed to do so. The instructions in this skill are self-contained to this microservice.

CRITICAL: A metric is declared as a define.Metric var in myserviceapi/definition.go; its observe callback, if any, is implemented in service.go. Add the declaration and run cmd/genservice.

CRITICAL: Keep the // MARKER: MyMetric comment on the define.Metric var.

Workflow

Copy this checklist and track your progress:

Creating or modifying a metric:
- [ ] Step 1: Read local CLAUDE.md file
- [ ] Step 2: Determine the kind
- [ ] Step 3: Determine if observable just in time
- [ ] Step 4: Determine the value type and labels
- [ ] Step 5: Determine the OpenTelemetry name
- [ ] Step 6: Declare the metric in definition.go
- [ ] Step 7: Record the metric
- [ ] Step 8: Generate the boilerplate
- [ ] Step 9: Test the callback
- [ ] Step 10: Housekeeping
Step 1: Read Local CLAUDE.md File

Read the local CLAUDE.md file in the microservice's directory. It contains microservice-specific instructions that should take precedence over global instructions.

Step 2: Determine the Kind

Determine if the metric is a:

  • Counter - an ever increasing number
  • Gauge - a number that can go up or down
  • Histogram - a distribution of cumulative values over time

If a histogram, determine the boundaries that determine its buckets.

Step 3: Determine If Observable Just in Time

For some metrics, and in particular gauges, it is enough to observe just in time before recording. For example, there's no reason to sample available system memory constantly if only the last sampling will be reported. Determine if this metric is observable.

Step 4: Determine the Value Type and Labels

The value type is the type of the number being recorded: int, float64, or time.Duration.

The labels are the dimensions the metric is broken down by, named like Go arguments (e.g. status, method). They are recorded as strings. A metric may have no labels.

Step 5: Determine the OpenTelemetry Name

The OpenTelemetry name of the metric:

  • Should have a (single-word) application prefix relevant to the domain the metric belongs to. The prefix is usually the application name itself
  • Should have a suffix describing the unit, in plural form

For example, myapplication_my_metric_units.

Do not add a _total suffix to a counter's OpenTelemetry name. _total is a Prometheus naming convention, not an OpenTelemetry one.

Step 6: Declare the Metric in definition.go

Append the define.Metric var to myserviceapi/definition.go. The godoc is the metric's description.

go
/*
MyMetric counts X.
*/
var MyMetric = define.Metric{ // MARKER: MyMetric
	Kind: define.Counter, Value: int(0), Labels: []string{"status"},
	OTelName: "myapplication_my_metric_units",
}
  • Kind is define.Counter, define.Gauge, or define.Histogram
  • Value is a type carrier declaring the recorded value's type: int(0), float64(0), or time.Duration(0). For time.Duration, add the "time" import
  • Labels is the list of label argument names; omit when there are none
  • Buckets: []float64{0.1, 0.5, 1, 5} is required for a histogram and omitted otherwise
  • OTelName is the name from Step 5
  • Observable: true for a metric observed just in time (Step 3); omit when false
Show full SKILL.md (293 more words)Show less
Step 7: Record the Metric

The generated recorder is IncrementMyMetric(ctx, value, labels...) for a counter and RecordMyMetric(ctx, value, labels...) for a gauge or histogram.

If the metric is observable just in time, the boilerplate generator (Step 8) creates a placeholder OnObserveMyMetric handler in service.go, tagged // MARKER: MyMetric and holding a // TODO body. Fill in that body to record the current value, for example:

go
v, err := svc.calculateMyMetric()
if err != nil {
	return errors.Trace(err)
}
err = svc.RecordMyMetric(ctx, v, "ok")
return errors.Trace(err)

Otherwise, call the recorder from the place in service.go where the event occurs.

go
svc.IncrementMyMetric(ctx, 1, "ok")
Step 8: Generate the Boilerplate

From the microservice's directory, run the generator. It regenerates intermediate.go (the recorder, the Describe* registration, and the observe dispatcher), mock.go, mock_test.go, and manifest.yaml from the updated definition.go. It also scaffolds a placeholder handler in service.go and a placeholder test in service_test.go for any new feature that lacks one, each ready for you to fill in.

shell
go run github.com/microbus-io/fabric/cmd/genservice .

Then verify the microservice compiles with go vet ./... from the project root.

Step 9: Test the Callback

Skip this step if the metric is not observable just in time, or if instructed to be "quick" or to skip tests.

When present, the boilerplate generator created a placeholder test function TestMyService_OnObserveMyMetric in service_test.go, tagged with a // MARKER: MyMetric comment and a HINT block. Add one or more test cases at the bottom of that function, following the pattern shown in its HINT comment. Do not remove the HINT comment.

If the feature or microservice cannot or should not be tested - for example, it starts a daemon or requires a resource unavailable in the test environment - do not delete the generated test. The generator keys on the test function's name and would scaffold it again on the next regeneration. Instead, replace the entire body of the test with a t.Skip("reason") explaining why.

Step 10: Housekeeping

Follow the housekeeping skill.

© microbus-io, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .claude/skills/microbus/add-metric of microbus-io/fabric.

Open the folder on GitHubat commit fb98098

Compare with similar skills

Add Metric next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Add Metric compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Add Metric this skillmicrobus-io/fabric172—~1.5kAutomated safety check: PassApache-2.0
Aspire Service DefaultsAaronontheweb/dotnet-skills1.2k1 repos~2.6kAutomated safety check: PassMIT
Sentry Advanced Troubleshootingjeremylongshore/tons-of-skills-marketplace2.8k—~3.7kAutomated safety check: PassMIT
Distributed Tracingwshobson/agents40k12 repos~527Automated safety check: PassMIT
Service Mesh Expertaiskillstore/marketplace4337 repos~686Automated safety check: PassNone
Setting Up Distributed Tracingjeremylongshore/tons-of-skills-marketplace2.8k—~896Automated safety check: PassMIT

Similar skills

  • Aspire Service Defaults

    Aaronontheweb/dotnet-skills

    Sets up a shared ServiceDefaults project for .NET Aspire apps that centralizes OpenTelemetry, health checks, HTTP resilience and service discovery for every service.

    1.2k GitHub starsUsed in 1 repo~2.6k tokens
    DevOps & CloudAuto-check passed
  • Sentry Advanced Troubleshooting

    jeremylongshore/tons-of-skills-marketplace

    Advanced Sentry troubleshooting for complex SDK issues, silent event drops, source map failures, distributed tracing gaps, and SDK conflicts.

    2.8k GitHub stars~3.7k tokensUpdated today
    DevOps & CloudAuto-check passed
  • Distributed Tracing

    wshobson/agents

    Implement distributed tracing with Jaeger and Tempo to track requests across microservices and identify performance bottlenecks.

    40k GitHub starsUsed in 12 repos~527 tokens
    DevOps & CloudAuto-check passed
  • Service Mesh Expert

    aiskillstore/marketplace

    Expert service mesh architect specializing in Istio, Linkerd, and cloud-native networking patterns.

    433 GitHub starsUsed in 7 repos~686 tokens
    DevOps & CloudAuto-check passed
  • Setting Up Distributed Tracing

    jeremylongshore/tons-of-skills-marketplace

    Execute this skill automates the setup of distributed tracing for microservices.

    2.8k GitHub stars~896 tokensUpdated today
    DevOps & CloudAuto-check passed
  • Otel Python

    ollygarden/opentelemetry-agent-skills

    OpenTelemetry in Python — SDK setup, declarative config, zero-code instrumentation (opentelemetry-instrument, opentelemetry-distro), contrib auto-instrumentation, manual API, performance tuning…

    106 GitHub stars~911 tokensUpdated today
    DevOps & CloudAuto-check passed

More from microbus-io/fabric

All 32 skills in this repo
  • Add Config

    microbus-io/fabric

    TRIGGER when user asks to add or modify a configuration property or setting, or to make a value configurable.

    172 GitHub stars~2.3k tokensUpdated 12 days ago
    Auto-check passed
  • Add Function

    microbus-io/fabric

    TRIGGER when user asks to add, create, or modify an API endpoint, function, or RPC, or a route that accepts typed arguments and returns typed results.

    172 GitHub stars~2.4k tokensUpdated 12 days ago
    Auto-check passed
  • Add Inbound Event

    microbus-io/fabric

    TRIGGER when user asks to listen for, subscribe to, or handle an event emitted by another microservice.

    172 GitHub stars~1.4k tokensUpdated 12 days ago
    Auto-check passed
  • Add Outbound Event

    microbus-io/fabric

    TRIGGER when user asks to fire, emit, or publish an event that other microservices can subscribe to.

    172 GitHub stars~1.7k tokensUpdated 12 days ago
    Auto-check passed
  • Add Python Function

    microbus-io/fabric

    TRIGGER when user asks to add a Python-backed function endpoint to an existing Python-backed microservice.

    172 GitHub stars~1.3k tokensUpdated 12 days ago
    Auto-check passed
  • Add Python Microservice

    microbus-io/fabric

    TRIGGER when user asks to create a microservice that calls Python, runs ML inference, or uses Python libraries (PyTorch, pandas, sentence-transformers, numpy) for its core compute.

    172 GitHub stars~1.1k tokensUpdated 12 days ago
    Auto-check passed

Works with

Questions about Add Metric

What does Add Metric do?

TRIGGER when user asks to add or modify a metric, counter, gauge, or histogram, or to track/measure an operation. Add Metric is an agent skill from microbus-io/fabric. TRIGGER when user asks to add or modify a metric, counter, gauge, or histogram, or to track/measure an operation.

When should I use Add Metric?

Add Metric fits situations like: user asks to add; modify a metric; track/measure an operation.

How do I install Add Metric in Claude Code?

Run `npx skills add microbus-io/fabric --skill add-metric -a claude-code`. Or copy the skill folder (.claude/skills/microbus/add-metric in microbus-io/fabric) into .claude/skills/add-metric in your project. Claude Code loads it when a task matches its description.

How do I install Add Metric in Codex?

Run `npx skills add microbus-io/fabric --skill add-metric -a codex`. Or copy the skill folder (.claude/skills/microbus/add-metric in microbus-io/fabric) into .agents/skills/add-metric in your project. Codex loads it when a task matches its description.

Can I use Add Metric in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add microbus-io/fabric --skill add-metric -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/add-metric, .gemini/skills/add-metric, .github/skills/add-metric and .opencode/skills/add-metric in your project.

What does Add Metric need to run?

Going by SKILL.md and its folder, Add Metric needs the command-line tools its instructions call (go).

Does Add Metric access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Add Metric safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Add Metric use?

Add Metric is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Add Metric use?

About 1.5k tokens (SKILL.md is roughly 5.8k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Add Metric?

Skills that share tags, products or a category with Add Metric: Aspire Service Defaults (Aaronontheweb/dotnet-skills, 1.2k stars), Sentry Advanced Troubleshooting (jeremylongshore/tons-of-skills-marketplace, 2.8k stars), Distributed Tracing (wshobson/agents, 40k stars) and Service Mesh Expert (aiskillstore/marketplace, 433 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Add Metric?

microbus-io (a GitHub organization) maintains it in microbus-io/fabric, which has 172 GitHub stars. The repository holds 32 skills in this directory. The repository was last updated on September 28, 2026.

Source: microbus-io/fabric on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.