administration

How to monitor usage, track costs, configure analytics, and measure ROI for Claude Code. Use when user asks about monitoring, telemetry, metrics, costs, analytics, or OpenTelemetry.

16 stars

Best use case

administration is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

How to monitor usage, track costs, configure analytics, and measure ROI for Claude Code. Use when user asks about monitoring, telemetry, metrics, costs, analytics, or OpenTelemetry.

Teams using administration should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/administration/SKILL.md --create-dirs "https://raw.githubusercontent.com/diegosouzapw/awesome-omni-skill/main/skills/devops/administration/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/administration/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How administration Compares

Feature / AgentadministrationStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

How to monitor usage, track costs, configure analytics, and measure ROI for Claude Code. Use when user asks about monitoring, telemetry, metrics, costs, analytics, or OpenTelemetry.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# Claude Code Administration

## Monitoring Overview

Claude Code supports **OpenTelemetry (OTel) for metrics and events**. The system exports time series data via standard metrics protocol and events through logs/events protocol.

### Quick Setup

Enable telemetry:
```bash
export CLAUDE_CODE_ENABLE_TELEMETRY=1
```

Configure exporters (optional, pick what you need):
```bash
# Metrics
export OTEL_METRICS_EXPORTER=otlp  # Options: otlp, prometheus, console

# Logs
export OTEL_LOGS_EXPORTER=otlp     # Options: otlp, console
```

### Export Intervals

Default intervals:
- **Metrics**: 60 seconds
- **Logs**: 5 seconds

Customize intervals:
```bash
export OTEL_METRIC_EXPORT_INTERVAL=30000  # milliseconds
export OTEL_LOGS_EXPORT_INTERVAL=10000    # milliseconds
```

## Available Metrics

Claude Code tracks eight core metrics:

### 1. Session Counter
CLI sessions started

**Use for:** Tracking adoption and active users

### 2. Lines of Code
Code additions/removals tracked by type

**Use for:** Measuring productivity and code generation volume

### 3. Pull Requests
Creation count

**Use for:** Tracking automated PR generation

### 4. Commits
Git commits via Claude Code

**Use for:** Measuring development activity

### 5. Cost Usage
Session costs in USD (model-segmented)

**Use for:** Budget tracking and cost allocation

**Important:** Cost metrics are approximations. For official billing data, refer to your API provider (Claude Console, AWS Bedrock, or Google Cloud Vertex).

### 6. Token Usage
Tokens consumed (input/output/cache types)

**Use for:** Understanding API usage patterns and optimizing costs

### 7. Code Edit Tool Decisions
Accept/reject counts per tool

**Use for:** Understanding user trust and automation acceptance

### 8. Active Time
Actual usage duration in seconds

**Use for:** Measuring engagement and productivity time

## Metric Segmentation

Segment metrics by:
- `user.account_uuid` - Individual user tracking
- `organization.id` - Team/organization grouping
- `session.id` - Session-specific analysis
- `model` - Model usage breakdown
- `app.version` - Version tracking

## Events & Logging

Five event types are exported:

### 1. User Prompt Events
Prompt submissions (content redacted by default)

**Enable prompt logging:**
```bash
export OTEL_LOG_USER_PROMPTS=1
```

**Use for:** Understanding user interaction patterns

### 2. Tool Result Events
Tool execution completion with success status and duration

**Use for:** Monitoring tool performance and reliability

### 3. API Request Events
Claude API calls with cost and token data

**Use for:** Detailed cost analysis and API usage tracking

### 4. API Error Events
Failed requests with HTTP status codes

**Use for:** Troubleshooting and reliability monitoring

### 5. Tool Decision Events
User accept/reject actions with decision source

**Use for:** Understanding automation trust and user preferences

## Cost Monitoring

### Cost Tracking Setup

Monitor costs by model and user:
```bash
export CLAUDE_CODE_ENABLE_TELEMETRY=1
export OTEL_METRICS_EXPORTER=prometheus
```

### Cost Analysis

View costs segmented by:
- Model (Sonnet vs Haiku)
- User/account
- Session
- Time period

### Budget Alerts

Implement budget monitoring:
1. Export cost metrics to your monitoring system
2. Set up alerts for cost thresholds
3. Review high-cost sessions
4. Optimize model selection and usage patterns

## Analytics & ROI

### ROI Measurement Guide

Reference the [Claude Code ROI Measurement Guide](https://github.com/anthropics/claude-code-monitoring-guide) for:
- Docker configurations
- Productivity report templates
- ROI calculation methods
- Team analytics dashboards

### Key Metrics for ROI

**Productivity Metrics:**
- Lines of code generated per hour
- Time saved vs manual coding
- PRs created automatically
- Issues resolved automatically

**Quality Metrics:**
- Code review findings
- Test coverage improvements
- Bug reduction rate
- Technical debt reduction

**Adoption Metrics:**
- Active users
- Session frequency
- Feature usage patterns
- User satisfaction scores

## Monitoring Backend Setup

### Prometheus Setup

```yaml
# prometheus.yml
scrape_configs:
  - job_name: 'claude-code'
    static_configs:
      - targets: ['localhost:9464']
```

Start with Prometheus exporter:
```bash
export OTEL_METRICS_EXPORTER=prometheus
claude
```

### Grafana Dashboard

Create dashboards to visualize:
- Cost over time
- Token usage trends
- Session counts
- User activity
- Tool acceptance rates

### Custom Analytics

Export to your own backend:
```bash
export OTEL_EXPORTER_OTLP_ENDPOINT=https://your-backend.com
export OTEL_EXPORTER_OTLP_HEADERS="api-key=your-key"
```

## Best Practices

### 1. Enable Monitoring Early
Set up telemetry from day one to establish baselines

### 2. Segment by Team/Project
Use organization and user IDs for proper attribution

### 3. Monitor Costs Regularly
Review cost metrics weekly to identify trends

### 4. Track Adoption
Monitor active users and session frequency

### 5. Measure Quality Impact
Track bug rates and code review findings

### 6. Set Alert Thresholds
Configure alerts for:
- Unusual cost spikes
- Error rate increases
- Low adoption indicators

### 7. Review Metrics with Teams
Share analytics to demonstrate value and identify improvements

### 8. Optimize Based on Data
Use metrics to:
- Identify high-value use cases
- Optimize model selection
- Improve automation acceptance
- Reduce costs

## Privacy Considerations

**User Prompts:**
- Disabled by default
- Enable only with user consent: `OTEL_LOG_USER_PROMPTS=1`
- Consider data retention policies

**Sensitive Data:**
- Avoid logging sensitive information
- Implement data filtering
- Review compliance requirements

**Access Control:**
- Restrict metrics access appropriately
- Use secure connections for exporters
- Encrypt data in transit and at rest

## Troubleshooting Monitoring

### Metrics Not Appearing

1. Verify telemetry is enabled: `CLAUDE_CODE_ENABLE_TELEMETRY=1`
2. Check exporter configuration
3. Verify backend connectivity
4. Review export intervals
5. Check for error logs

### High Costs

1. Review token usage by model
2. Identify high-usage sessions
3. Check for inefficient prompts
4. Consider using Haiku for simple tasks
5. Implement cost controls

### Low Adoption

1. Review active user metrics
2. Identify barriers to usage
3. Provide training and documentation
4. Gather user feedback
5. Highlight success stories

## Example Monitoring Stack

```bash
# docker-compose.yml for full monitoring stack
version: '3.8'
services:
  prometheus:
    image: prom/prometheus
    volumes:
      - ./prometheus.yml:/etc/prometheus/prometheus.yml
    ports:
      - "9090:9090"

  grafana:
    image: grafana/grafana
    ports:
      - "3000:3000"
    environment:
      - GF_SECURITY_ADMIN_PASSWORD=admin
```

Configure Claude Code:
```bash
export CLAUDE_CODE_ENABLE_TELEMETRY=1
export OTEL_METRICS_EXPORTER=prometheus
export OTEL_EXPORTER_PROMETHEUS_PORT=9464
```

Related Skills

bgo

10
from diegosouzapw/awesome-omni-skill

Automates the complete Blender build-go workflow, from building and packaging your extension/add-on to removing old versions, installing, enabling, and launching Blender for quick testing and iteration.

Coding & Development

go-microservices

16
from diegosouzapw/awesome-omni-skill

Production-ready Go microservices patterns including Gin, Echo, gRPC, clean architecture, dependency injection, error handling, middleware, testing, Docker containerization, Kubernetes deployment, distributed tracing, observability with Prometheus, high-performance APIs, concurrent processing, database integration with GORM, Redis caching, message queues, and cloud-native best practices.

go-expert

16
from diegosouzapw/awesome-omni-skill

Expert guidance for Go (Golang) development following industry best practices. Use when writing Go code, reviewing PRs, bootstrapping new services, configuring linters, implementing observability, or troubleshooting Go applications. Covers SOLID principles, Gang of Four design patterns, domain-driven structure, error handling, context patterns, concurrency, testing, structured logging, health endpoints, and CI gates.

gke-deployment

16
from diegosouzapw/awesome-omni-skill

Deploy, configure, and manage Kubernetes workloads on GKE with Deployments, Services, Ingress, HPA, health probes, ConfigMaps, and Secrets. Use when deploying containers to GKE, configuring load balancers, setting up autoscaling, writing health checks, managing environment configs, or troubleshooting pod issues.

gitops-workflow

16
from diegosouzapw/awesome-omni-skill

Implement GitOps workflows with ArgoCD and Flux for automated, declarative Kubernetes deployments with continuous reconciliation. Use when implementing GitOps practices, automating Kubernetes deployments, or setting up declarative infrastructure management.

gitops-principles-skill

16
from diegosouzapw/awesome-omni-skill

Comprehensive GitOps methodology and principles skill for cloud-native operations. Use when (1) Designing GitOps architecture for Kubernetes deployments, (2) Implementing declarative infrastructure with Git as single source of truth, (3) Setting up continuous deployment pipelines with ArgoCD/Flux/Kargo, (4) Establishing branching strategies and repository structures, (5) Troubleshooting drift, sync failures, or reconciliation issues, (6) Evaluating GitOps tooling decisions, (7) Teaching or explaining GitOps concepts and best practices, (8) Deploying ArgoCD on Azure Arc-enabled Kubernetes or AKS with workload identity. Covers the 4 pillars of GitOps (OpenGitOps), patterns, anti-patterns, tooling ecosystem, Azure Arc integration, and operational guidance.

gitops-practitioner

16
from diegosouzapw/awesome-omni-skill

GitOps workflows, Flux, ArgoCD, and declarative infrastructure. Activates when implementing GitOps patterns, configuring Flux or ArgoCD, managing Helm releases declaratively, or discussing drift detection and reconciliation loops.

gitlab-ci

16
from diegosouzapw/awesome-omni-skill

Initialize or update GitLab CI/CD pipelines for Go projects with comprehensive testing, coverage reporting, snapshot builds, and automated releases

gitlab-ci-validator

16
from diegosouzapw/awesome-omni-skill

Comprehensive toolkit for validating, linting, testing, and securing GitLab CI/CD pipeline configurations. Use this skill when working with GitLab CI/CD pipelines, validating pipeline syntax, debugging configuration issues, or implementing best practices.

gitlab-ci-patterns

16
from diegosouzapw/awesome-omni-skill

Build GitLab CI/CD pipelines with multi-stage workflows, caching, and distributed runners for scalable automation. Use when implementing GitLab CI/CD, optimizing pipeline performance, or setting up...

github-workflow-authoring

16
from diegosouzapw/awesome-omni-skill

This skill should be used when creating or improving GitHub Actions CI/CD workflows for Breenix kernel development. Use for authoring new test workflows, optimizing existing CI pipelines, adding new test types, fixing workflow configuration issues, or adapting workflows for new kernel features.

github-actions

16
from diegosouzapw/awesome-omni-skill

Debug, optimize, and secure GitHub Actions workflows. Use this skill when writing CI/CD pipelines, fixing failing workflows, or improving build times.