Agent skill

Algo Risk Var

by asgard-ai-platform in asgard-ai-platform/skills

Calculate Value at Risk to estimate maximum portfolio loss at a given confidence level.

MITAuto-check passed

Install Algo Risk Var

skills CLI
$ npx skills add asgard-ai-platform/skills --skill algo-risk-var -a claude-code

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

GitHub CLI
$ gh skill install asgard-ai-platform/skills algo-risk-var --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/asgard-ai-platform/skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/algo-risk-var .claude/skills/algo-risk-var && 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
algo-risk-var
GitHub stars
242
Token cost
~1.2k tokens
SKILL.md length
480 words
Files
4 (incl. references)
Skills in repo
207
Repo updated
First seen
Licence
MIT

At a glance

Calculate Value at Risk to estimate maximum portfolio loss at a given confidence level.

  • Works in 4 steps: Input Validation → Core Algorithm → Verification → …
  • The user needs to quantify downside risk
  • SKILL.md covers Overview, When to Use, Algorithm and Output Format, plus 3 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Algo Risk Var is an agent skill from asgard-ai-platform/skills. Calculate Value at Risk to estimate maximum portfolio loss at a given confidence level. Use this skill when the user needs to quantify downside risk, set risk limits, or report regulatory risk measures — even if they say 'worst case loss', 'portfolio risk', or 'how much could we lose'.

Its SKILL.md is about 1.2k tokens, which your agent loads only when the skill is triggered. The skill folder holds 5 other files, including reference files (for example `examples/sample_scenario.md`, `references/backtesting.md` and `references/expected-shortfall.md`).

The repository describes itself as: 301 open-source coding agent skills across 22 domains — methodology, judgment & gotchas packaged as Claude Agent Skills for the Asgard AI Platform. The licence is MIT.

When your agent uses it

  • The user needs to quantify downside risk
  • Set risk limits
  • Report regulatory risk measures — even if they say worst case loss
  • How much could we lose

Example prompts

  • “worst case loss”
  • “portfolio risk”
  • “how much could we lose”
  • “/algo-risk-var”

Workflow steps

4 steps, taken from the step headings in SKILL.md.

  1. Input Validation
  2. Core Algorithm
  3. Verification
  4. Output

What it can do on your machine

Read from SKILL.md and the folder at commit 4e7f4f8. 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 json).

    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

Algo Risk Var loads about 1.2k tokens when it runs, and up to ~5.5k if it reads all its reference files. Until then it costs about 75 tokens; SKILL.md has 480 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~75
When it runs · the whole SKILL.md, loaded when a task matches
~1.2k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~5.5k

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 asgard-ai-platform/skills at commit 4e7f4f8, republished under its MIT licence (© asgard-ai-platform). 480 words, ~1,187 tokens.

Download SKILL.mdSave it as .claude/skills/algo-risk-var/SKILL.md (or your agent's skills folder). This skill also uses 3 other files; get the full folder from GitHub.
name
algo-risk-var
description
Calculate Value at Risk to estimate maximum portfolio loss at a given confidence level. Use this skill when the user needs to quantify downside risk, set risk limits, or report regulatory risk measures — even if they say 'worst case loss', 'portfolio risk', or 'how much could we lose'.
metadata.category
WP-40 風險演算法
metadata.tags
risk, value-at-risk, portfolio, risk-management

Value at Risk (VaR)

Overview

VaR estimates the maximum loss a portfolio can suffer over a given time horizon at a specified confidence level. Example: "95% 1-day VaR of $1M" means there's a 5% chance of losing more than $1M in one day. Three methods: parametric (normal), historical simulation, Monte Carlo.

When to Use

Trigger conditions:

  • Quantifying portfolio downside risk for risk management
  • Setting trading limits and capital reserves
  • Regulatory reporting (Basel III requires VaR-based capital)

When NOT to use:

  • When you need to know how bad losses CAN get beyond VaR (use CVaR/Expected Shortfall)
  • For illiquid assets with no price history (VaR needs return data)

Algorithm

IRON LAW: VaR Does NOT Tell You How Bad It Gets BEYOND the Threshold
VaR says "95% of the time, losses won't exceed $X." It says NOTHING
about the 5% worst case. A portfolio can have low VaR but catastrophic
tail losses. Always supplement with Expected Shortfall (CVaR) which
measures the average loss in the tail.
Phase 1: Input Validation

Collect: portfolio positions, historical returns (min 250 days for 1Y), confidence level (typically 95% or 99%), time horizon (1 day or 10 days). Gate: Sufficient return history, positions valued at current market.

Phase 2: Core Algorithm

Parametric VaR: VaR = -μ + zα × σ (assumes normal returns). For portfolio: use covariance matrix for portfolio σ.

Historical Simulation: 1. Compute daily P&L from historical returns. 2. Sort P&L ascending. 3. VaR = the (1-α) percentile loss.

Monte Carlo: 1. Fit return distribution (or use historical). 2. Simulate 10,000+ portfolio paths. 3. VaR = (1-α) percentile of simulated losses.

Phase 3: Verification

Backtest: count how often actual losses exceed VaR over the past year. At 95% confidence, exceedances should be ~5%. Use Kupiec or Christoffersen test. Gate: Backtest exceedance rate within acceptable bounds.

Phase 4: Output

Return VaR estimate with backtest results.

Output Format

json
{
  "var": {"amount": 1250000, "confidence": 0.95, "horizon_days": 1, "currency": "TWD"},
  "cvar": {"amount": 1800000},
  "backtest": {"exceedances": 13, "expected": 12.5, "days_tested": 250, "pass": true},
  "metadata": {"method": "historical_simulation", "portfolio_value": 50000000}
}

Examples

Sample I/O

Input: Portfolio value = $1,000,000. Last 20 sorted daily returns (descending loss):

[-0.050, -0.040, -0.035, -0.030, -0.025, -0.020, -0.015, -0.010, -0.005, 0.000,
  0.005,  0.010,  0.015,  0.020,  0.025,  0.030,  0.035,  0.040,  0.045,  0.050]

Confidence = 95%, horizon = 1 day.

Expected (Historical Simulation):

  • 5th percentile index = floor(20 × 0.05) = 1 → return[1] = -0.040
  • VaR = $1,000,000 × 0.040 = $40,000
  • CVaR (Expected Shortfall) = mean of returns worse than VaR = (-0.050) × $1M = $50,000

Verify: VaR ≤ CVaR always (tail loss ≥ threshold loss). Count of losses > VaR should be ≤ 5% of observations (1 of 20).

Show full SKILL.md (165 more words)Show less
Edge Cases
InputExpectedWhy
Normal market conditionsVaR looks adequateBut misses tail events
2008-like crisis in historyHigher VaR from historical methodCaptures fat tails if crisis is in window
Very short history (30 days)Unreliable VaRInsufficient data for tail estimation

Gotchas

  • Normality assumption: Parametric VaR assumes normal returns. Financial returns have fat tails — parametric VaR UNDERESTIMATES tail risk.
  • Historical window: Historical simulation is only as good as the history. If the past 250 days were calm, VaR will be low even if a crisis is coming.
  • Time scaling: VaR scales with √T only under independence and normality. For volatile or trending markets, this approximation is poor.
  • Diversification illusion: VaR from correlated assets using normal-times correlations understates risk. Correlations spike during crises (correlation breakdown).
  • Gaming VaR: Traders can structure positions that look safe under VaR but have catastrophic tail risk. This is why regulators also require stress testing.

References

  • For Expected Shortfall (CVaR) calculation, see references/expected-shortfall.md
  • For VaR backtesting methods, see references/backtesting.md

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

Files

SKILL.md and 3 other files (references) in algo-risk-var of asgard-ai-platform/skills.

  • SKILL.md
  • examples/sample_scenario.md
  • references/backtesting.md
  • references/expected-shortfall.md

Open the folder on GitHubat commit 4e7f4f8

Compare with similar skills

Algo Risk Var 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.

Algo Risk Var compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Algo Risk Var this skillasgard-ai-platform/skills242—~1.2kAutomated safety check: PassMIT
Portfolioanthropics/claude-for-legal9.6k3 repos~5.3kAutomated safety check: PassApache-2.0
Trader Portfolioruvnet/ruflo74k—~475Automated safety check: NotesMIT
Portfolio Risk Metricswshobson/agents40k12 repos~502Automated safety check: PassMIT
Task Effort EstimatorDonchitos/Claude-Code-Game-Studios26k—~1.2kAutomated safety check: PassMIT
Progressive Estimationsickn33/agentic-awesome-skills47k2 repos~863Automated safety check: PassMIT

Similar skills

  • Portfolio

    anthropics/claude-for-legal

    Official

    Track the IP portfolio — registrations, renewals, maintenance fees, and use declarations.

    9.6k GitHub starsUsed in 3 repos~5.3k tokens
    Legal & ComplianceAuto-check passed
  • Trader Portfolio

    ruvnet/ruflo

    Optimize portfolio allocation using npx neural-trader mean-variance engine with risk constraints and rebalancing plan

    74k GitHub stars~475 tokensUpdated yesterday
    Auto-check: notes
  • Portfolio Risk Metrics

    wshobson/agents

    Covers portfolio risk measurement with VaR, CVaR, Sharpe, Sortino and drawdown, plus guidance on limits, stress tests and tail risk.

    40k GitHub starsUsed in 12 repos~502 tokens
    Business, Finance & HRAuto-check passed
  • Task Effort Estimator

    Donchitos/Claude-Code-Game-Studios

    Estimates the effort for a game development task from code complexity, scope, risk and past sprint data, returning a range with a confidence level.

    26k GitHub stars~1.2k tokensUpdated 3 days ago
    Product & Project ManagementAuto-check passed
  • Progressive Estimation

    sickn33/agentic-awesome-skills

    Estimate AI-assisted and hybrid human+agent development work with research-backed PERT statistics and calibration feedback loops

    47k GitHub starsUsed in 2 repos~863 tokens
    Data & AnalyticsAuto-check passed
  • Portfolio Review

    xbtlin/ai-berkshire

    Reviews an investment portfolio holding by holding and as a whole: position health, concentration, overlap and opportunity cost, from a holdings list or saved portfolio file.

    17k GitHub stars~1.2k tokensUpdated 2 days ago
    Business, Finance & HRAuto-check passed

More from asgard-ai-platform/skills

All 207 skills in this repo
  • Algo Ecom Bm25

    asgard-ai-platform/skills

    Implement BM25 ranking function for e-commerce product search relevance scoring.

    242 GitHub stars~1.4k tokensUpdated 4 mo ago
    Auto-check passed
  • Algo Mfg Cpk

    asgard-ai-platform/skills

    Calculate Cpk process capability index to assess whether a process meets specification requirements.

    242 GitHub stars~1.1k tokensUpdated 4 mo ago
    Auto-check passed
  • Algo Price Elasticity

    asgard-ai-platform/skills

    Calculate price elasticity of demand to quantify how price changes affect sales volume.

    242 GitHub stars~1.1k tokensUpdated 4 mo ago
    Auto-check passed
  • Algo Rank Bayesian

    asgard-ai-platform/skills

    Apply Bayesian averaging to rank items by combining observed ratings with prior expectations.

    242 GitHub stars~1.1k tokensUpdated 4 mo ago
    Auto-check passed
  • Algo Rank Elo

    asgard-ai-platform/skills

    Implement Elo rating system to rank items or players from pairwise comparison outcomes.

    242 GitHub stars~1.1k tokensUpdated 4 mo ago
    Auto-check passed
  • Algo Rank Wilson

    asgard-ai-platform/skills

    Calculate Wilson Score confidence intervals for ranking items by positive proportion with sample size correction.

    242 GitHub stars~1.1k tokensUpdated 4 mo ago
    Auto-check passed

Questions about Algo Risk Var

What does Algo Risk Var do?

Calculate Value at Risk to estimate maximum portfolio loss at a given confidence level. Algo Risk Var is an agent skill from asgard-ai-platform/skills. Calculate Value at Risk to estimate maximum portfolio loss at a given confidence level.

When should I use Algo Risk Var?

Algo Risk Var fits situations like: the user needs to quantify downside risk; set risk limits; report regulatory risk measures — even if they say worst case loss; how much could we lose.

How do I install Algo Risk Var in Claude Code?

Run `npx skills add asgard-ai-platform/skills --skill algo-risk-var -a claude-code`. Or copy the skill folder (algo-risk-var in asgard-ai-platform/skills) into .claude/skills/algo-risk-var in your project. Claude Code loads it when a task matches its description.

How do I install Algo Risk Var in Codex?

Run `npx skills add asgard-ai-platform/skills --skill algo-risk-var -a codex`. Or copy the skill folder (algo-risk-var in asgard-ai-platform/skills) into .agents/skills/algo-risk-var in your project. Codex loads it when a task matches its description.

Can I use Algo Risk Var 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 asgard-ai-platform/skills --skill algo-risk-var -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/algo-risk-var, .gemini/skills/algo-risk-var, .github/skills/algo-risk-var and .opencode/skills/algo-risk-var in your project.

What does Algo Risk Var need to run?

SKILL.md names no scripts, command-line tools or credentials: Algo Risk Var is instructions for the agent only.

Does Algo Risk Var 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 Algo Risk Var 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 Algo Risk Var use?

Algo Risk Var is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Algo Risk Var use?

About 1.2k tokens (SKILL.md is roughly 4.7k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 4.3k tokens, read only when the agent opens those files.

What are the alternatives to Algo Risk Var?

Skills that share tags, products or a category with Algo Risk Var: Portfolio (anthropics/claude-for-legal, 9.6k stars), Trader Portfolio (ruvnet/ruflo, 74k stars), Portfolio Risk Metrics (wshobson/agents, 40k stars) and Task Effort Estimator (Donchitos/Claude-Code-Game-Studios, 26k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Algo Risk Var?

asgard-ai-platform (a GitHub organization) maintains it in asgard-ai-platform/skills, which has 242 GitHub stars. The repository holds 207 skills in this directory. The repository was last updated on June 6, 2026.

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