analyze-usage

analyze-usage is a command for Claude Code from openshift-eng/ai-helpers. It costs 9 tokens per session (1,861 once invoked), scanned A, original, Apache-2.0.

A command that reviews BigQuery usage for a cloud project. BigQuery is a service for storing and querying large datasets, and the review covers usage, estimated costs, users, and query performance.

In plain words
What is it for?
Use it with a project ID and time period to find expensive queries, heavy users, usage thresholds, optimization opportunities, and optionally produce a report.
Why use it?
It helps reveal which users, queries, and recurring patterns are driving data-scanning costs or inefficient performance.

Command for Claude Code

Written for Claude Code: argument-hint in frontmatter. Also seen: names the AskUserQuestion tool; positional $N argument.

Part of the bigquery-cost-analysis plugin — 1 skill, 1 command shipped together

Good fit Use it with a project ID and time period to find expensive queries, heavy users, usage thresholds, optimization opportunities, and optionally produce a report.

Compare 6 commands from other repositories ↓
Install with agentmods
npx agentmods add commands/openshift-eng/ai-helpers/analyze-usage
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/openshift-eng/ai-helpers

Made for: Claude Code.

Or install bigquery-cost-analysis, the plugin that ships this one along with the rest of its 1 skill, 1 command.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for analyze-usage

README.md
[![agentmods](https://agentmods.dev/badge/commands/openshift-eng/ai-helpers/analyze-usage/github.svg)](https://agentmods.dev/commands/openshift-eng/ai-helpers/analyze-usage)
Your own site
<a href="https://agentmods.dev/commands/openshift-eng/ai-helpers/analyze-usage"><img src="https://agentmods.dev/badge/commands/openshift-eng/ai-helpers/analyze-usage/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for analyze-usage

Your own site · 80×15
<a href="https://agentmods.dev/commands/openshift-eng/ai-helpers/analyze-usage"><img src="https://agentmods.dev/badge/commands/openshift-eng/ai-helpers/analyze-usage.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 9 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,861 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00009 $0.01861
Opus 5.5 $0.00004 $0.00744
Sonnet 5.5 $0.00002 $0.00372
Haiku 4.5 $0.00001 $0.00186

Measured 16d ago against content hash a26b04c2d91f, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

analyze-usage scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 16d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

Copies of this mod

1 near-identical copy found in the catalogue:

plugins/bigquery-cost-analysis/commands/analyze-usage.md · 219 lines

How it starts

The opening of the file, as written. The whole thing — 219 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Name

bigquery-cost-analysis:analyze-usage

Synopsis

/bigquery-cost-analysis:analyze-usage <project-id> <timeframe>
/bigquery-cost-analysis:analyze-usage openshift-ci-data-analysis "24 hours"
/bigquery-cost-analysis:analyze-usage my-project "7 days"

Description

The analyze-usage command provides comprehensive analysis of BigQuery usage patterns, costs, and query performance for a given project. It identifies expensive queries, heavy users, and provides actionable optimization recommendations.

This command helps answer questions like:

  • Which users or service accounts are consuming the most data?
  • What are the most expensive queries?
  • Which query patterns are running most frequently?
  • How can we reduce BigQuery costs?
  • Are we over any usage thresholds?

The analysis includes:

  • Total usage summary (queries, data scanned, estimated costs)
  • Usage breakdown by user/service account
  • Per-user deep dive analysis for top 2-3 users
  • Top individual queries by cost
  • Query pattern analysis to identify optimization opportunities
  • Specific, actionable optimization recommendations
  • Optional markdown report generation

Implementation

This command uses the bigquery-cost-analysis:analyze-usage skill to perform the analysis.

Prerequisites

  • Google Cloud SDK (bq command-line tool) must be installed
  • User must have BigQuery read access to the project
  • User must be authenticated (gcloud auth login)

Steps

  1. Parse and Validate Arguments:

    • If project-id is missing: Use AskUserQuestion to prompt for it
    • If timeframe is missing: Use AskUserQuestion to prompt for it (options: "1 hour", "6 hours", "24 hours", "7 days", "30 days")
    • Parse timeframe into hours (e.g., "24 hours" → 24, "7 days" → 168)
  2. Invoke the analyze-usage Skill:

    Use the Skill tool to invoke "bigquery-cost-analysis:analyze-usage"
    

    The skill will handle all the data collection and analysis.

  3. Present Results: The skill returns a comprehensive report. Present it to the user in a clear, readable format with:

    • Executive summary at the top
    • Tables for user usage and top queries
    • Per-user deep dive for top 2-3 users showing their specific query patterns
    • Detailed query pattern analysis
    • Prioritized optimization recommendations

Read the full file on GitHub · 219 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 16d ago Changed a26b04c2d91f
  2. 1mo ago First seen · 219 lines · 9 tokens per session scan A 2f93d44be52e

Subscribe to this mod's changes

analyze-usage is a command published in the GitHub repository openshift-eng/ai-helpers (121 stars, last pushed today), licensed Apache-2.0. It adds 9 tokens to every session and 1,861 once invoked, about $0.0000 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.