Skip to content

Guide · Agent skill

How to use the correlation-analysis agent skill

Updated · written with AI from the project's own documentation and checked against our catalogue data

The correlation-analysis skill is a set of instructions that tells an AI agent how to study how financial assets move together. It covers co-movement scanning, bivariate correlation statistics, sector clustering, and cointegration tests that lead to pair-trading signals. This guide explains what the skill does, how to install it, how to ask for it in plain language, and what to check before relying on its output.

Correlation and Cointegration AnalysisHKUDS/Vibe-Trading · MIT

Quick start

  1. 1Download the ZIP. Download the correlation-analysis skill ZIP from this page.
  2. 2Unzip into a skills folder. Unzip it into ~/.claude/skills/ for personal use, or into a project's .claude/skills/ folder.
  3. 3Or upload it in the Claude apps. In the Claude apps, open Settings, go to Capabilities, then Skills, and upload the skill.
  4. 4Install the Python packages. Make sure pandas, numpy, scipy, statsmodels, matplotlib and seaborn are available in your Python environment.
  5. 5Prepare your return data. Gather historical daily returns or prices for the target and candidate assets, since the skill does not fetch data.
  6. 6Ask a plain-language question. Describe the task, such as finding correlated assets or testing a pair for cointegration, and include your data.
  7. 7Review the output critically. Check the statistics, screening thresholds and economic logic, and validate any signal independently before relying on it.

What the skill makes the agent do

Once installed, the agent follows a fixed method when a question is about how financial assets move together. The skill is documented in a single file, SKILL.md, which contains four analysis modes and the Python code templates for each step.

The modes are co-movement discovery (scan a universe for correlated candidates), deep return-correlation analysis (a full statistical study of two assets), sector clustering (group assets from their correlation matrix), and cointegration and pair-trading work, which tests whether pairs share a long-run equilibrium and produces spread signals.

  • Pearson, Spearman and Kendall correlations, plus p-values
  • Beta, alpha and R-squared from an OLS regression
  • Rolling correlation and spread Z-score
  • Hierarchical clustering on a correlation matrix with a heatmap
  • Engle-Granger and Johansen cointegration, half-life and a Kalman dynamic hedge ratio

Install the correlation-analysis skill

Download the ZIP for the skill from this page. Unzip it into ~/.claude/skills/ to make it available across your projects, or into a project's .claude/skills/ folder to limit it to that project.

If you use the Claude apps instead, open Settings, go to Capabilities, then Skills, and upload the skill there.

  • Personal install: unzip into ~/.claude/skills/
  • Project install: unzip into the project's .claude/skills/ folder
  • Claude apps: Settings → Capabilities → Skills, then upload

Trigger the skill with natural requests

You do not need a special command. Describe the task in plain language that mentions correlation, co-movement, cointegration, pairs, clustering or hedge ratios, and the agent should pick up the skill. The skill's description lists these topics, so phrasing that matches them works best.

Give the agent your data. The skill does not fetch prices, so provide historical daily returns or prices for each asset, either as files you attach or as data already in your session.

  • Find stocks that move most closely with XYZ, then test which ones are cointegrated with it.
  • Cluster these 40 assets by their return correlations and show me the heatmap.
  • Are these two ETFs cointegrated? Estimate the half-life and hedge ratio.
  • Check how diversified my holdings are using their pairwise correlations.
  • Generate pair-trading z-score signals for this pair using a 60-day window.

Read the screening and statistics outputs

The co-movement scan ranks candidates by correlation and keeps the top results, with a minimum absolute correlation threshold. The skill's screening guide treats correlations above 0.8 as strong same-direction co-movement that should move on to cointegration testing, 0.6 to 0.8 as moderate and needing an industry or factor check, and below 0.6 as usually unsuitable for pairs trading.

For a two-asset study, the skill recommends reporting Pearson, Spearman and Kendall together. If Pearson and Spearman differ by more than 0.1, it suggests the relationship may be nonlinear or heavy-tailed, and Spearman should carry more weight.

  • Negative correlations below -0.6 are described as strong inverse co-movement, which can suit hedged portfolios but needs care with spread direction.
  • Kendall is listed as slower on large samples.
  • The rolling window defaults to 60 trading days in the templates.
import statsmodels.api as sm from scipy.stats import pearsonr, spearmanr, kendalltau

Requirements and safety notes

The skill needs Python with pandas, numpy, scipy, statsmodels, matplotlib and seaborn installed, along with historical daily return or price data for your assets. The skill's listing says it runs scripts and does not use the network, so it works on data you provide rather than downloading it.

Because it runs code, read the templates before running them on sensitive files. The methods assume financial return series, so do not use them on non-financial data where those assumptions fail.

  • Required Python packages: pandas, numpy, scipy, statsmodels, matplotlib, seaborn
  • Data: daily returns or prices supplied by you
  • Network access: not used
  • Scripts: run as part of the analysis

Tips for reliable results

Treat each result as a hypothesis to test. Correlations and cointegration often break down out of sample, and the skill does not backtest or manage risk. Check that candidate pairs make economic sense, such as shared industry or factor exposure, before acting on a signal.

Keep your windows and sample periods explicit, and say which coefficient you want reported so the agent does not pick one silently.

  • Check industry or factor alignment for pairs in the 0.6 to 0.8 range
  • Compare results across more than one time period
  • Validate any pair-trading signal independently before using real money

What people use it for

  • Scanning a universe of stocks for candidates to pair with a target asset
  • Checking whether two assets share a long-run equilibrium before building a hedge
  • Grouping a portfolio's holdings by correlation to see whether they are really diversified
  • Producing a correlation heatmap sorted by cluster for a research write-up
  • Estimating a half-life and dynamic hedge ratio for a pairs-trading study

Frequently asked questions

Is the correlation-analysis skill free to use?

The skill is published under the MIT licence, as stated in its listing. You still need your own Python environment and your own historical return data, because the skill does not supply data.

What do I need installed to run it?

You need Python with pandas, numpy, scipy, statsmodels, matplotlib and seaborn, plus daily return or price data for your assets. The skill's listing says it does not use the network, so it works only on the data you give it.

Where do I put the skill files after downloading?

Unzip the ZIP into ~/.claude/skills/ for personal use, or into a project's .claude/skills/ folder. In the Claude apps, you can instead upload it under Settings, Capabilities, Skills.

Does the skill download stock prices for me?

No. The skill expects you to supply historical daily returns or prices. It does not fetch market data itself.

Can I use it for trading decisions?

The skill is not designed for trading with real money without independent validation. Correlations and cointegration often break down out of sample, and the skill does not backtest or manage risk.

How does it compare with doing the analysis by hand?

The skill gives the agent a consistent method and ready-made code templates for correlation statistics, clustering and cointegration tests. You still need to check the inputs and interpret the results yourself, since the source does not compare it with other tools.

New agent skills, repos and AI tools — every week

The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.

Our verdict

This skill suits quantitative analysts, students and developers who want a consistent, code-backed method for correlation, clustering and cointegration studies on financial return data. It is a poor fit for anyone wanting a ready-made trading system, a backtester or risk management, or for use on non-financial data.

Download the skill