Install any skill in seconds. Free to start, no credit card required.
Get Started Free →brycewang-stanford/data-anomaly-detection
Detect anomalies and outliers in research data using statistical methods
Passed 19 of 24 test cases with the skill, and 12 of 24 without it.
and 9 more in the full report
7 fixed12 passed either way5 still failing0 broke
Tokens, turns and time describe resource use, not a dollar price.
One of 7 test cases the skill fixed. Same model, same prompt, with and without the skill.
We are writing an automated Python function `detect_timeseries_anomalies` for rolling time-series anomaly detection. What specific keys must be present in the returned dictionary?
| Checked | Without skill | With skill |
|---|---|---|
| Includes key 'anomaly_indices' in the returned time-series dictionary. | Missed | Passed |
| Includes key 'n_anomalies' in the returned time-series dictionary. | Missed | Passed |
| Includes key 'window_size' in the returned time-series dictionary. | Passed | Passed |
The instructions your model reads when the skill loads.
A skill for identifying anomalies, outliers, and suspicious patterns in research datasets. Combines classical statistical methods with modern machine learning approaches to flag data points that deviate significantly from expected distributions, helping researchers maintain data integrity and uncover genuine scientific findings.
Anomalous data points in research datasets can arise from measurement errors, instrument malfunction, data entry mistakes, or genuine rare phenomena. Distinguishing between these sources is critical: blindly removing outliers can bias results, while ignoring measurement errors introduces noise. This skill provides a structured framework for detecting, classifying, and handling anomalies in univariate, multivariate, and time-series research data.
The approach follows a three-stage pipeline: detection (flagging candidate anomalies), diagnosis (determining likely cause), and decision (remove, transform, or retain with justification). Every decision is logged for reproducibility and transparent reporting.
import numpy as np
from scipy import stats
def detect_univariate_outliers(data: np.ndarray, method: str = 'iqr') -> dict:
"""
Detect outliers using classical univariate methods.
Methods:
'iqr': Interquartile range (1.5x IQR rule)
'zscore': Z-score threshold (|z| > 3)
'mad': Median absolute deviation (robust)
'grubbs': Grubbs' test for single outlier
"""
results = {'method': method, 'n_total': len(data)}
if method == 'iqr':
q1, q3 = np.percentile(data, [25, 75])
iqr = q3 - q1
lower, upper = q1 - 1.5 * iqr, q3 + 1.5 * iqr
mask = (data < lower) | (data > upper)
elif method == 'zscore':
z = np.abs(stats.zscore(data))
mask = z > 3
test cases passed, vs 12 / 24 without
More skills from the same source and nearby in the registry, with their headline benchmark lift.