anomaly-detection

anomaly-detection is a skill for Claude Code, Codex from gemini-cli-extensions/sre. It costs 18 tokens per session (1,567 once invoked), scanned A, original, Apache-2.0.

A tool for finding unusual patterns in time-based data, such as metrics recorded over minutes, hours, or days. It can analyze sources such as CSV files and Google Cloud Monitoring.

In plain words
What is it for?
Use it to analyze selected metrics, smooth noisy data, and apply methods such as moving averages, z-scores, K-nearest neighbors, or isolation forests.
Why use it?
It helps identify behavior that differs from the normal pattern without requiring you to inspect every data point manually.

Skill for Claude CodeCodex

Part of the sre-extension plugin — 16 skills shipped together

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.

agentmods
npx agentmods add skills/gemini-cli-extensions/sre/anomaly-detection
Any agent
npx skills add gemini-cli-extensions/sre --skill anomaly-detection
Clone the repo
git clone --depth 1 https://github.com/gemini-cli-extensions/sre

Made for: Claude Code, Codex.

Or install sre-extension, the plugin that ships this one along with the rest of its 16 skills.

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 anomaly-detection

README.md
[![agentmods](https://agentmods.dev/badge/skills/gemini-cli-extensions/sre/anomaly-detection.svg)](https://agentmods.dev/skills/gemini-cli-extensions/sre/anomaly-detection)
Your own site
<a href="https://agentmods.dev/skills/gemini-cli-extensions/sre/anomaly-detection"><img src="https://agentmods.dev/badge/skills/gemini-cli-extensions/sre/anomaly-detection.svg" alt="Measured on agentmods" height="20"></a>
Per session 18 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,567 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00018 $0.01567
Opus 5 $0.00009 $0.00783
Sonnet 5 $0.00004 $0.00313
Haiku 4.5 $0.00002 $0.00157

Measured 5d ago against content hash 9f21ba582454, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

anomaly-detection 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 5d ago.

The scan reads SKILL.md. This mod also ships 5 executable files (scripts/detect_isolation_forest.py, scripts/detect_knn.py, scripts/detect_zscore.py, …), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

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.

skills/anomaly-detection/SKILL.md · 94 lines

How it starts

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

Anomaly Detection Skill

You are an expert SRE Detective. Your job is to analyze time-series metrics and pinpoint anomalous behavior with minimal user friction.

Inputs:

  • source_type: String indicating the data source (e.g., "csv", "cloud_monitoring").
  • source_details: A dictionary or list containing the necessary information to access the data source.
    • For source_type: "csv": A list of file paths.
  • context: (Optional) String, either free-form text describing the issue or an issue tracker ID like a GitHub issue or Jira ticket.
  • metrics: (Optional) List of strings, specific metric names to analyze from the source.
  • smoothing: (Optional) String, method for smoothing (e.g., "moving_average", "exponential"). USER OVERRIDE.
  • window: (Optional) Integer, window for moving average. USER OVERRIDE.
  • alpha: (Optional) Float, alpha for exponential smoothing. USER OVERRIDE.
  • algorithm: (Optional) String, anomaly detection algorithm (e.g., "knn", "zscore", "isolation_forest"). USER OVERRIDE.
  • n_neighbors: (Optional) Integer for KNN detector. USER OVERRIDE.
  • threshold: (Optional) Float, for Z-Score. USER OVERRIDE.
  • contamination: (Optional: Float or "auto") For Isolation Forest. USER OVERRIDE.

Workflow:

  1. Get Data:

    • Call @skills/data_ingestion with source_type and source_details.
    • Save output to .gemini/tmp/user/merged_data.json.
  2. Select Metrics: (Same as before - infer from query/context, ask if needed)

    • Let available_metrics be metadata.available_metrics from merged_data.json.
    • If metrics input is provided, validate they are in available_metrics. Use these valid metrics.
    • If metrics input is NOT provided, analyze the user's initial query and context for metric names. Try to match keywords with available_metrics.
    • If no clear metrics can be inferred, or if there's ambiguity, use ask_user to prompt the user to select one or more metrics from available_metrics.
    • Let selected_metrics be the list of metrics to analyze.
  3. Process Each Selected Metric: Iterate through each metric_name in selected_metrics:

    a. Filter Metric Data: Create a temporary JSON file (/tmp/single_metric_data.json) containing only the "timestamp" and the current metric_name column from merged_data.json. You can write a short Python script to extract the relevant column based on the metric index in the "columns" list, ignoring rows where the metric value is null.

    b. Automated Preprocessing: * Check for User Override: If smoothing parameter is provided, use the specified method and parameters. * Automated Choice: If no override, the agent should autonomously decide if smoothing is needed. Heuristic: calculate the point-to-point change percentage. If a significant number of points exceed a threshold (e.g., >20% change), apply a default moving_average with a small window (e.g., 3 or 5). * Log the decision: "No smoothing applied" or "Applied Moving Average smoothing with window=3". * If smoothing is applied, run scripts/preprocess_data.py as before, outputting to /tmp/preprocessed_data.json. * Input to next step is /tmp/preprocessed_data.json or /tmp/single_metric_data.json. * Let this be data_for_detection.json.

    c. Automated Algorithm Selection: * Check for User Override: If algorithm parameter is provided, use the specified algorithm. * Automated Choice: Default to isolation_forest as it's generally robust. Contamination set to "auto". * Let chosen_algorithm be the selected method.

    d. Detect Anomalies: Execute the script for chosen_algorithm: * All detection scripts take data_for_detection.json as input and output to /tmp/detected_data.json. * Example (Isolation Forest): bash source $HOME/.venvs/sre-extension-anomaly-detection/bin/activate && python3 .gemini/skills/anomaly_detection/scripts/detect_isolation_forest.py \ /tmp/data_for_detection.json --contamination auto \ > /tmp/detected_data.json * Adjust command and parameters for knn or zscore if overridden.

Read the full file on GitHub · 94 lines

Files

What ships with it

5 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 5d ago First seen · 94 lines · 18 tokens per session scan A 9f21ba582454

Subscribe to this mod's changes

anomaly-detection is a skill published in the GitHub repository gemini-cli-extensions/sre (83 stars, last pushed 2d ago), licensed Apache-2.0. It adds 18 tokens to every session and 1,567 once invoked, about $0.0001 per session on Opus 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.

Related

Other skills, from other repositories

systematic-debugging

Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes.

obra/superpowers · 21 tokens

brainstorming

You MUST use this before any creative work - creating features, building components, adding functionality, or modifying behavior. Explores user intent, requirements and design before implementation.

obra/superpowers · 37 tokens

auto-perf-optimize

Run agent-driven VS Code performance or memory investigations. Use when asked to launch Code OSS, automate a VS Code scenario, run the Chat memory smoke runner, capture renderer heap snapshots, take workflow screenshots, compare run summaries, or drive a repeatable scenario before heap-snapshot analysis.

microsoft/vscode · 62 tokens

chat-perf

Run chat perf benchmarks and memory leak checks against the local dev build or any published VS Code version. Use when investigating chat rendering regressions, validating perf-sensitive changes to chat UI, or checking for memory leaks in the chat response pipeline.

microsoft/vscode · 51 tokens

chat-pet-sprite-creation

Use when creating or changing VS Code chat pet sprite art, sprite sheets, state animations, eye treatments, Stable/Insiders variants, or pet transitions under src/vs/workbench/contrib/chat/browser/widget/media/chatPet.

microsoft/vscode · 53 tokens

cpu-profile-analysis

Analyze V8/Chrome CPU profiles (.cpuprofile) and DevTools trace files (Trace-.json). Use when: profiling performance, investigating slow functions, comparing code paths, finding bottlenecks, analyzing timeToRequest, understanding call trees from sampling profiler data, analyzing layout/paint/rendering, investigating…

microsoft/vscode · 71 tokens