Agent skill

Pca Decomposition

by benchflow-ai in benchflow-ai/skillsbench

Reduce dimensionality of multivariate data using PCA with varimax rotation.

MITAuto-check passed

Install Pca Decomposition

skills CLI
$ npx skills add benchflow-ai/skillsbench --skill pca-decomposition -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install benchflow-ai/skillsbench pca-decomposition --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/benchflow-ai/skillsbench.git skills-src && mkdir -p .claude/skills && cp -r skills-src/tasks/lake-warming-attribution/environment/skills/pca-decomposition .claude/skills/pca-decomposition && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
pca-decomposition
GitHub stars
1.8k
Token cost
~990 tokens
SKILL.md length
235 words
Files
1
Skills in repo
178
Repo updated
First seen
Licence
MIT

At a glance

Reduce dimensionality of multivariate data using PCA with varimax rotation.

  • Works in 3 steps: Combine ALL variables first, then do PCA… → Interpret loadings to map factors to… → Use factor scores directly for R²…
  • You have many correlated variables and need to identify underlying factors
  • SKILL.md covers Overview, When to Use PCA, Basic PCA with Varimax Rotation and Workflow for Attribution…, plus 5 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Pca Decomposition is an agent skill from benchflow-ai/skillsbench. Reduce dimensionality of multivariate data using PCA with varimax rotation. Use when you have many correlated variables and need to identify underlying factors or reduce collinearity.

Its SKILL.md is about 990 tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

The repository describes itself as: SkillsBench evaluates how well skills work and how effective agents are at using them. The licence is MIT.

When your agent uses it

  • You have many correlated variables and need to identify underlying factors
  • Reduce collinearity

Example prompts

  • “/pca-decomposition”

Requirements

  • Python 3

Workflow steps

3 steps, taken from the first numbered list in SKILL.md.

  1. Combine ALL variables first, then do PCA together
  2. Interpret loadings to map factors to categories (optional for understanding)
  3. Use factor scores directly for R² decomposition

What it can do on your machine

Read from SKILL.md and the folder at commit 9a1f4dd. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are python).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Pca Decomposition loads about 990 tokens when it runs. Until then it costs about 50 tokens; SKILL.md has 235 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~50
When it runs · the whole SKILL.md, loaded when a task matches
~990

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from benchflow-ai/skillsbench at commit 9a1f4dd, republished under its MIT licence (© benchflow-ai). 235 words, ~990 tokens.

Download SKILL.mdSave it as .claude/skills/pca-decomposition/SKILL.md (or your agent's skills folder).
name
pca-decomposition
description
Reduce dimensionality of multivariate data using PCA with varimax rotation. Use when you have many correlated variables and need to identify underlying factors or reduce collinearity.
license
MIT

PCA Decomposition Guide

Overview

Principal Component Analysis (PCA) reduces many correlated variables into fewer uncorrelated components. Varimax rotation makes components more interpretable by maximizing variance.

When to Use PCA

  • Many correlated predictor variables
  • Need to identify underlying factor groups
  • Reduce multicollinearity before regression
  • Exploratory data analysis

Basic PCA with Varimax Rotation

python
from sklearn.preprocessing import StandardScaler
from factor_analyzer import FactorAnalyzer

# Standardize data first
scaler = StandardScaler()
X_scaled = scaler.fit_transform(X)

# PCA with varimax rotation
fa = FactorAnalyzer(n_factors=4, rotation='varimax')
fa.fit(X_scaled)

# Get factor loadings
loadings = fa.loadings_

# Get component scores for each observation
scores = fa.transform(X_scaled)

Workflow for Attribution Analysis

When using PCA for contribution analysis with predefined categories:

  1. Combine ALL variables first, then do PCA together:
python
# Include all variables from all categories in one matrix
all_vars = ['AirTemp', 'NetRadiation', 'Precip', 'Inflow', 'Outflow',
            'WindSpeed', 'DevelopedArea', 'AgricultureArea']
X = df[all_vars].values

scaler = StandardScaler()
X_scaled = scaler.fit_transform(X)

# PCA on ALL variables together
fa = FactorAnalyzer(n_factors=4, rotation='varimax')
fa.fit(X_scaled)
scores = fa.transform(X_scaled)
  1. Interpret loadings to map factors to categories (optional for understanding)

  2. Use factor scores directly for R² decomposition

Important: Do NOT run separate PCA for each category. Run one global PCA on all variables, then use the resulting factor scores for contribution analysis.

Interpreting Factor Loadings

Loadings show correlation between original variables and components:

LoadingInterpretation
> 0.7Strong association
0.4 - 0.7Moderate association
< 0.4Weak association

Example: Economic Indicators

python
import pandas as pd
from sklearn.preprocessing import StandardScaler
from factor_analyzer import FactorAnalyzer

# Variables: gdp, unemployment, inflation, interest_rate, exports, imports
df = pd.read_csv('economic_data.csv')
variables = ['gdp', 'unemployment', 'inflation',
             'interest_rate', 'exports', 'imports']

X = df[variables].values
scaler = StandardScaler()
X_scaled = scaler.fit_transform(X)

fa = FactorAnalyzer(n_factors=3, rotation='varimax')
fa.fit(X_scaled)

# View loadings
loadings_df = pd.DataFrame(
    fa.loadings_,
    index=variables,
    columns=['RC1', 'RC2', 'RC3']
)
print(loadings_df.round(2))

Choosing Number of Factors

Option 1: Kaiser Criterion
python
# Check eigenvalues
eigenvalues, _ = fa.get_eigenvalues()

# Keep factors with eigenvalue > 1
n_factors = sum(eigenvalues > 1)
Option 2: Domain Knowledge

If you know how many categories your variables should group into, specify directly:

python
# Example: health data with 3 expected categories (lifestyle, genetics, environment)
fa = FactorAnalyzer(n_factors=3, rotation='varimax')

Common Issues

IssueCauseSolution
Loadings all similarToo few factorsIncrease n_factors
Negative loadingsInverse relationshipNormal, interpret direction
Low variance explainedData not suitable for PCACheck correlations first

Best Practices

  • Always standardize data before PCA
  • Use varimax rotation for interpretability
  • Check factor loadings to name components
  • Use Kaiser criterion or domain knowledge for n_factors
  • For attribution analysis, run ONE global PCA on all variables

© benchflow-ai, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in tasks/lake-warming-attribution/environment/skills/pca-decomposition of benchflow-ai/skillsbench.

Open the folder on GitHubat commit 9a1f4dd

Compare with similar skills

Pca Decomposition next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Pca Decomposition compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Pca Decomposition this skillbenchflow-ai/skillsbench1.8k—~990Automated safety check: PassMIT
Pca Dimensionality Reductionaipoch/medical-research-skills2k—~1.5kAutomated safety check: PassMIT
Reduced Motionthedaviddias/Front-End-Checklist74k—~534Automated safety check: PassMIT
Performing Service Account Credential Rotationmukul975/Anthropic-Cybersecurity-Skills34k—~2.6kAutomated safety check: PassApache-2.0
Sector Rotation AnalysisHKUDS/Vibe-Trading35k—~965Automated safety check: PassMIT
Reduceagenticnotetaking/arscontexta3.5k1 repos~11kAutomated safety check: PassMIT

Similar skills

  • Pca Dimensionality Reduction

    aipoch/medical-research-skills

    A skill your agent uses when performing PCA principal component dimensionality reduction on tabular numeric data.

    2k GitHub stars~1.5k tokensUpdated 21 days ago
    Data & AnalyticsAuto-check passed
  • Reduced Motion

    thedaviddias/Front-End-Checklist

    A skill your agent uses when reviewing rendered HTML, interactive components, or design-system patterns related to Respect reduced motion preferences.

    74k GitHub stars~534 tokensUpdated 2 days ago
    Frontend & DesignAuto-check passed
  • Performing Service Account Credential Rotation

    mukul975/Anthropic-Cybersecurity-Skills

    Automates credential rotation for service accounts across Active Directory, cloud platforms, and application databases to eliminate stale secrets and reduce compromise risk.

    34k GitHub stars~2.6k tokensUpdated 1 mo ago
    SecurityAuto-check passed
  • Sector Rotation Analysis

    HKUDS/Vibe-Trading

    A-share sector rotation workflow in Chinese: scores Shenwan industries on prosperity, ranks momentum and compares valuation, earnings and fund flows.

    35k GitHub stars~965 tokensUpdated today
    Business, Finance & HRAuto-check passed
  • Reduce

    agenticnotetaking/arscontexta

    Extract structured knowledge from source material. An agent skill from agenticnotetaking/arscontexta.

    3.5k GitHub starsUsed in 1 repo~11k tokens
    Auto-check passed
  • Refactor Method Complexity Reduce

    github/awesome-copilot

    Official

    Refactor given method ${input:methodName} to reduce its cognitive complexity to ${input:complexityThreshold} or below, by extracting helper methods.

    40k GitHub starsUsed in 1 repo~1.1k tokens
    DevelopmentAuto-check passed

More from benchflow-ai/skillsbench

All 178 skills in this repo
  • Lean4 Memories

    benchflow-ai/skillsbench

    This skill should be used when working on Lean 4 formalization projects to maintain persistent memory of successful proof patterns, failed approaches, project conventions, and user preferences…

    1.8k GitHub stars~3.2k tokensUpdated 2 mo ago
    Auto-check passed
  • Senior Data Engineer

    benchflow-ai/skillsbench

    World-class data engineering skill for building scalable data pipelines, ETL/ELT systems, real-time streaming, and data infrastructure.

    1.8k GitHub stars~5.9k tokensUpdated 2 mo ago
    Auto-check passed
  • Ac Branch Pi Model

    benchflow-ai/skillsbench

    AC branch pi-model power flow equations (P/Q and |S|) with transformer tap ratio and phase shift, matching acopf-math-model.md and MATPOWER branch fields.

    1.8k GitHub stars~1.1k tokensUpdated 2 mo ago
    Auto-check passed
  • Civ6lib

    benchflow-ai/skillsbench

    Civilization 6 district mechanics library. An agent skill from benchflow-ai/skillsbench.

    1.8k GitHub stars~1.7k tokensUpdated 2 mo ago
    Auto-check passed
  • D3 Visualization

    benchflow-ai/skillsbench

    Build deterministic, verifiable data visualizations with D3.js (v6).

    1.8k GitHub stars~1.5k tokensUpdated 2 mo ago
    Auto-check passed
  • Dc Power Flow

    benchflow-ai/skillsbench

    DC power flow analysis for power systems. An agent skill from benchflow-ai/skillsbench.

    1.8k GitHub stars~717 tokensUpdated 2 mo ago
    Auto-check passed

Questions about Pca Decomposition

What does Pca Decomposition do?

Reduce dimensionality of multivariate data using PCA with varimax rotation. Pca Decomposition is an agent skill from benchflow-ai/skillsbench. Reduce dimensionality of multivariate data using PCA with varimax rotation.

When should I use Pca Decomposition?

Pca Decomposition fits situations like: you have many correlated variables and need to identify underlying factors; reduce collinearity.

How do I install Pca Decomposition in Claude Code?

Run `npx skills add benchflow-ai/skillsbench --skill pca-decomposition -a claude-code`. Or copy the skill folder (tasks/lake-warming-attribution/environment/skills/pca-decomposition in benchflow-ai/skillsbench) into .claude/skills/pca-decomposition in your project. Claude Code loads it when a task matches its description.

How do I install Pca Decomposition in Codex?

Run `npx skills add benchflow-ai/skillsbench --skill pca-decomposition -a codex`. Or copy the skill folder (tasks/lake-warming-attribution/environment/skills/pca-decomposition in benchflow-ai/skillsbench) into .agents/skills/pca-decomposition in your project. Codex loads it when a task matches its description.

Can I use Pca Decomposition in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add benchflow-ai/skillsbench --skill pca-decomposition -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/pca-decomposition, .gemini/skills/pca-decomposition, .github/skills/pca-decomposition and .opencode/skills/pca-decomposition in your project.

What does Pca Decomposition need to run?

SKILL.md names no scripts, command-line tools or credentials: Pca Decomposition is instructions for the agent only. Our summary lists: Python 3.

Does Pca Decomposition access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Pca Decomposition safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Pca Decomposition use?

Pca Decomposition is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Pca Decomposition use?

About 990 tokens (SKILL.md is roughly 4k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Pca Decomposition?

Skills that share tags, products or a category with Pca Decomposition: Pca Dimensionality Reduction (aipoch/medical-research-skills, 2k stars), Reduced Motion (thedaviddias/Front-End-Checklist, 74k stars), Performing Service Account Credential Rotation (mukul975/Anthropic-Cybersecurity-Skills, 34k stars) and Sector Rotation Analysis (HKUDS/Vibe-Trading, 35k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Pca Decomposition?

benchflow-ai (a GitHub organization) maintains it in benchflow-ai/skillsbench, which has 1,832 GitHub stars. The repository holds 178 skills in this directory. The repository was last updated on July 23, 2026.

Source: benchflow-ai/skillsbench on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.