Agent skill

Risk Management

by agiprolabs in agiprolabs/claude-trading-skills

Portfolio-level risk controls, drawdown management, exposure limits, and circuit breakers for crypto trading

MITAuto-check passedBusiness, Finance & HR

Install Risk Management

skills CLI
$ npx skills add agiprolabs/claude-trading-skills --skill risk-management -a claude-code

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

GitHub CLI
$ gh skill install agiprolabs/claude-trading-skills risk-management --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/agiprolabs/claude-trading-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/risk-management .claude/skills/risk-management && 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
risk-management
GitHub stars
410
Token cost
~2.3k tokens
SKILL.md length
946 words
Files
6 (incl. scripts, references)
Skills in repo
68
Repo updated
First seen
Licence
MIT

At a glance

Portfolio-level risk controls, drawdown management, exposure limits, and circuit breakers for crypto trading

  • Works in 6 steps: Maximum Drawdown Limits → Daily Loss Limits → Weekly Loss Limits → …
  • Tasks that involve Trading and backtesting
  • SKILL.md covers Risk Management Hierarchy, Portfolio-Level Controls, Drawdown Management and Circuit Breakers, plus 3 more sections
  • Runs Python scripts from its folder; calls python

What it does

Risk Management is an agent skill from agiprolabs/claude-trading-skills. Portfolio-level risk controls, drawdown management, exposure limits, and circuit breakers for crypto trading

Its SKILL.md is about 2.3k tokens, which your agent loads only when the skill is triggered. The skill folder holds 7 other files, including scripts and reference files (for example `references/circuit_breakers.md`, `references/drawdown_management.md` and `references/exposure_limits.md`).

It sits in Business, Finance & HR, covering Trading and backtesting. The repository describes itself as: 68 trading, DeFi, and quantitative finance Agent Skills. Works with Claude Code, Cursor, Codex, Gemini CLI, and 30+ other tools. The licence is MIT.

When your agent uses it

  • Tasks that involve Trading and backtesting

Example prompts

  • “/risk-management”

Requirements

  • Python 3

Workflow steps

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

  1. Maximum Drawdown Limits
  2. Daily Loss Limits
  3. Weekly Loss Limits
  4. Concentration Limits
  5. Exposure Limits
  6. Correlation Management

What it can do on your machine

Read from SKILL.md and the folder at commit 981e1d7. 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

    Ships 2 files in scripts/ (Python), which the agent can run.

    Shell commands in SKILL.md call:

    • 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

Risk Management loads about 2.3k tokens when it runs, and up to ~7.6k if it reads all its reference files. Until then it costs about 31 tokens; SKILL.md has 946 words of instructions outside code blocks.

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

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); the scripts in this folder are not scanned.

SKILL.md

The full file from agiprolabs/claude-trading-skills at commit 981e1d7, republished under its MIT licence (© agiprolabs). 946 words, ~2,275 tokens.

Download SKILL.mdSave it as .claude/skills/risk-management/SKILL.md (or your agent's skills folder). This skill also uses 5 other files; get the full folder from GitHub.
name
risk-management
description
Portfolio-level risk controls, drawdown management, exposure limits, and circuit breakers for crypto trading

Risk Management

Portfolio-level risk controls for crypto and Solana trading. This skill provides frameworks for drawdown management, exposure limits, circuit breakers, and crypto-specific risk considerations.

Risk Management Hierarchy

Every decision must respect this priority order:

  1. Survival — Never risk account ruin. No single trade, day, or week should threaten your ability to continue trading.
  2. Capital preservation — Protect what you have. Losses compound geometrically; recovery requires outsized gains.
  3. Growth — Only after survival and preservation are secured, pursue returns.

Violating this hierarchy (chasing growth at the expense of survival) is the primary cause of account blowups.

Portfolio-Level Controls

1. Maximum Drawdown Limits

Halt trading when portfolio drawdown from equity peak reaches a threshold:

Account TypeMax DrawdownAction
Conservative-15%Full stop, review all strategies
Moderate-20%Full stop, reduce to minimum size on recovery
Aggressive-25%Full stop, mandatory cooling period

Recovery math makes this critical: a -20% drawdown requires +25% to recover. A -50% drawdown requires +100%. See references/drawdown_management.md for the full recovery table.

2. Daily Loss Limits

Stop opening new positions after daily P&L (realized + unrealized) hits:

  • Conservative: -3% of account
  • Moderate: -4% of account
  • Aggressive: -5% of account

Reset at midnight UTC. Three consecutive days hitting the daily limit triggers a weekly halt.

3. Weekly Loss Limits

Reduce size or halt after weekly P&L reaches:

  • Reduce size by 50%: -5% weekly loss
  • Minimum size only: -7% weekly loss
  • Full halt: -10% weekly loss
4. Concentration Limits

Maximum allocation to any single dimension:

DimensionMax Concentration
Single token (blue chip)10% of account
Single token (mid-cap)5%
Single token (small-cap)2%
Single token (PumpFun/micro)0.5%
Single sector/narrative30%
Single strategy40%
5. Exposure Limits

Total deployed capital constraints:

  • Normal conditions: 50–80% deployed, 20–50% cash reserve
  • Elevated risk: 30–50% deployed
  • Drawdown >10%: 20–30% deployed
  • Max concurrent positions: 5–10 depending on account size
6. Correlation Management

Crypto assets correlate >0.7 during sell-offs. Effective diversification requires:

  • Treat all meme tokens as a single correlated bucket
  • Limit total meme exposure to one position-size equivalent
  • Diversify across strategies (trend, mean-reversion, scalp), not just tokens
  • Monitor rolling correlation and reduce when correlations spike

See references/exposure_limits.md for detailed limits by token type and strategy.

Drawdown Management

Response Framework
DrawdownStatusResponse
0–5%NormalContinue trading at full size
5–10%CautionReduce position sizes by 25–50%
10–15%WarningMinimum position sizes only
15–20%CriticalHalt new trades, manage existing positions only
>20%EmergencyFull stop, review everything before resuming
Recovery Requirements
LossRequired Gain to Recover
-5%+5.3%
-10%+11.1%
-15%+17.6%
-20%+25.0%
-30%+42.9%
-40%+66.7%
-50%+100.0%

The asymmetry accelerates rapidly. Managing small drawdowns prevents them from becoming catastrophic. See references/drawdown_management.md for the full framework.

Circuit Breakers

Automated controls that restrict trading when conditions are met:

Time-Based
  • No trading for 24 hours after hitting daily loss limit
  • 48-hour cooling period after weekly loss limit
  • Mandatory weekly review day (no new positions)
Loss-Based
  • 3 consecutive losses → reduce size 50%
  • 5 consecutive losses → minimum size only
  • 7 consecutive losses → halt 24 hours, full review
Volatility-Based
  • Portfolio volatility >2× rolling average → reduce exposure 50%
  • Market-wide liquidation events → pause all new entries
  • Individual token volatility spike → exit or tighten stops
Emotional (Self-Assessed)
  • Recognize tilt: anger after losses, urge to "make it back"
  • FOMO: rushing entries without proper analysis
  • Overconfidence: increasing size after a win streak without justification

See references/circuit_breakers.md for implementation details.

Risk Metrics

Value at Risk (VaR)

95th-percentile daily loss estimate using historical returns:

python
import numpy as np

def historical_var(returns: list[float], confidence: float = 0.95) -> float:
    """Calculate historical VaR at given confidence level."""
    sorted_returns = sorted(returns)
    index = int((1 - confidence) * len(sorted_returns))
    return abs(sorted_returns[index])

# Example: 95% VaR of 3.2% means on 95% of days, loss won't exceed 3.2%
Show full SKILL.md (377 more words)Show less
Expected Shortfall (CVaR)

Average loss in the worst (1 - confidence)% of scenarios:

python
def expected_shortfall(returns: list[float], confidence: float = 0.95) -> float:
    """Average loss beyond VaR threshold."""
    sorted_returns = sorted(returns)
    index = int((1 - confidence) * len(sorted_returns))
    tail = sorted_returns[:index]
    return abs(sum(tail) / len(tail)) if tail else 0.0
Maximum Drawdown
python
def max_drawdown(equity_curve: list[float]) -> float:
    """Peak-to-trough decline as a fraction."""
    peak = equity_curve[0]
    max_dd = 0.0
    for value in equity_curve:
        peak = max(peak, value)
        dd = (peak - value) / peak
        max_dd = max(max_dd, dd)
    return max_dd
Additional Metrics
  • Win/loss streak tracking: Detect hot/cold streaks for circuit breaker logic
  • Rolling Sharpe ratio: 30-day rolling risk-adjusted returns
  • Calmar ratio: Annualized return / max drawdown
  • Sortino ratio: Return / downside deviation (penalizes only negative volatility)

Crypto-Specific Risks

Smart Contract Risk
  • Never allocate >5% of account to a single unaudited protocol
  • Diversify across audited protocols for yield strategies
  • Monitor exploit databases and social channels for emerging threats
Rug Pull Risk
  • Size inversely with token age: newer tokens get smaller positions
  • Verify: locked liquidity, renounced mint authority, holder distribution
  • Cross-reference with token-holder-analysis skill for red flags
Bridge and Custody Risk
  • Don't hold >20% on any single platform or bridge
  • Self-custody the majority of trading capital
  • Budget for bridge fees and delays in execution planning
MEV and Execution Risk
  • Budget 1–3% for MEV/slippage on Solana DEX trades
  • Use priority fees during congestion
  • See slippage-modeling skill for detailed cost estimation
Correlation Spikes
  • In crashes, crypto correlations approach 1.0
  • Your "diversified" portfolio may behave as one position
  • Stress-test portfolio assuming all positions drop simultaneously

PumpFun Risk Framework

PumpFun and similar meme token platforms require a distinct risk approach:

Core Principle

Treat every PumpFun trade as a potential 100% loss. Size accordingly.

Position Limits
  • Per-token maximum: 0.1–0.5 SOL
  • Daily PumpFun budget: Fixed allocation (e.g., 2 SOL/day)
  • Never exceed budget: When daily allocation is gone, stop
Tracking
  • Track PumpFun P&L separately from main portfolio
  • Calculate PumpFun win rate and expectancy independently
  • Don't let PumpFun losses affect main portfolio risk limits
Risk Adjustments
  • No stop-losses on PumpFun (assume 100% loss at entry)
  • Take profits aggressively: 2×, 3×, 5× partial exits
  • Time-based exit: close within hours, not days

Integration with Other Skills

  • position-sizing: Use risk limits from this skill to constrain position sizes
  • exit-strategies: Circuit breakers override exit strategies (forced exits)
  • portfolio-analytics: Feed portfolio metrics back for risk assessment
  • liquidity-analysis: Adjust position limits based on available liquidity
  • slippage-modeling: Factor execution costs into risk calculations

Files

References
  • references/drawdown_management.md — Drawdown math, response framework, causes, and remediation
  • references/exposure_limits.md — Position limits by token type, portfolio limits, correlation management
  • references/circuit_breakers.md — Implementation details for all circuit breaker types
Scripts
  • scripts/risk_dashboard.py — Portfolio risk dashboard with limit checking and color-coded status
  • scripts/drawdown_analyzer.py — Equity curve drawdown analysis with response recommendations

Quick Start

bash
# Run the risk dashboard with demo data
python scripts/risk_dashboard.py --demo

# Analyze drawdowns on a demo equity curve
python scripts/drawdown_analyzer.py --demo

© agiprolabs, 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 5 other files (scripts, references) in skills/risk-management of agiprolabs/claude-trading-skills.

  • SKILL.md
  • references/circuit_breakers.md
  • references/drawdown_management.md
  • references/exposure_limits.md
  • scripts/drawdown_analyzer.py
  • scripts/risk_dashboard.py

Open the folder on GitHubat commit 981e1d7

Compare with similar skills

Risk Management 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.

Risk Management compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Risk Management this skillagiprolabs/claude-trading-skills410—~2.3kAutomated safety check: PassMIT
Tushare Datazillionare/zillionare3212 repos~2.3kAutomated safety check: PassNone
Tradingview MCPatilaahmettaner/tradingview-mcp5k—~1.3kAutomated safety check: PassMIT
Digital Oraclekomako-workshop/digital-oracle878—~5.9kAutomated safety check: PassMIT
Polyclawchainstacklabs/polyclaw3591 repos~2kAutomated safety check: PassApache-2.0
Markdownfacioquo/stock-indicators-dotnet1.2k—~812Automated safety check: PassApache-2.0

Similar skills

  • Tushare Data

    zillionare/zillionare

    面向中文自然语言的 Tushare 数据研究技能。用于把“看看这只股票最近怎么样”“帮我查财报趋势”“最近哪个板块最强”“北向资金在买什么”“给我导出一份行情数据”这类请求,转成可执行的数据获取、清洗、对比、筛选、导出与简要分析流程。适用于 A 股、指数、ETF/基金、财务、估值、资金流、公告新闻、板块概念与宏观数据等研究场景。

    321 GitHub starsUsed in 2 repos~2.3k tokens
    Business, Finance & HRAuto-check passed
  • Tradingview MCP

    atilaahmettaner/tradingview-mcp

    AI Trading Intelligence — live prices, 30+ technical indicators, backtesting (6 strategies), walk-forward overfitting detection, trade logs, equity curves, licensed news sentiment (Marketaux), and…

    5k GitHub stars~1.3k tokensUpdated today
    Business, Finance & HRAuto-check passed
  • Digital Oracle

    komako-workshop/digital-oracle

    Answer prediction questions using market trading data, not opinions.

    878 GitHub stars~5.9k tokensUpdated 2 mo ago
    Business, Finance & HRAuto-check passed
  • Polyclaw

    chainstacklabs/polyclaw

    Trade on Polymarket via split + CLOB execution. An agent skill from chainstacklabs/polyclaw.

    359 GitHub starsUsed in 1 repo~2k tokens
    Business, Finance & HRAuto-check passed
  • Markdown

    facioquo/stock-indicators-dotnet

    Format and lint Markdown in this repository against GitHub Flavored Markdown and its markdownlint-cli2 configuration — headers, lists, code fences, callouts (VitePress containers on docs-site pages…

    1.2k GitHub stars~812 tokensUpdated today
    Business, Finance & HRAuto-check passed
  • Openmobius Skill

    MobiusQuant/OpenMobius-skill

    Provides multi-school trading Q&A, chart/OHLCV analysis, annotation, and fresh-market workflows covering ICT/SMC, ChanLun, Wyckoff, Price Action, Order Flow, VSA, and Elliott Wave.

    697 GitHub stars~7.2k tokensUpdated 1 mo ago
    Business, Finance & HRAuto-check passed

More from agiprolabs/claude-trading-skills

All 68 skills in this repo
  • Backtrader

    agiprolabs/claude-trading-skills

    Event-driven backtesting with bar-by-bar execution, complex order types, multiple analyzers, and custom indicators

    410 GitHub stars~2.4k tokensUpdated 1 mo ago
    Auto-check passed
  • Birdeye API

    agiprolabs/claude-trading-skills

    Solana token market data via Birdeye — prices, OHLCV, trades, token metadata, security checks, and trader activity

    410 GitHub stars~1.8k tokensUpdated 1 mo ago
    Auto-check passed
  • Coingecko API

    agiprolabs/claude-trading-skills

    Broad crypto market data from CoinGecko covering 13,000+ tokens.

    410 GitHub stars~1.6k tokensUpdated 1 mo ago
    Auto-check passed
  • Cointegration Analysis

    agiprolabs/claude-trading-skills

    Cointegration testing for pairs trading using Engle-Granger, Johansen, and rolling stability analysis

    410 GitHub stars~2.1k tokensUpdated 1 mo ago
    Auto-check passed
  • Copy Trading

    agiprolabs/claude-trading-skills

    Wallet evaluation, monitoring, and copy-trade strategy design for Solana DEX trading

    410 GitHub stars~2.4k tokensUpdated 1 mo ago
    Auto-check passed
  • Correlation Analysis

    agiprolabs/claude-trading-skills

    Cross-asset correlation analysis including rolling correlation, hierarchical clustering, tail dependence, and regime-dependent correlation

    410 GitHub stars~2.4k tokensUpdated 1 mo ago
    Auto-check passed

Questions about Risk Management

What does Risk Management do?

Portfolio-level risk controls, drawdown management, exposure limits, and circuit breakers for crypto trading. Risk Management is an agent skill from agiprolabs/claude-trading-skills.

When should I use Risk Management?

Risk Management fits situations like: tasks that involve Trading and backtesting.

How do I install Risk Management in Claude Code?

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

How do I install Risk Management in Codex?

Run `npx skills add agiprolabs/claude-trading-skills --skill risk-management -a codex`. Or copy the skill folder (skills/risk-management in agiprolabs/claude-trading-skills) into .agents/skills/risk-management in your project. Codex loads it when a task matches its description.

Can I use Risk Management 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 agiprolabs/claude-trading-skills --skill risk-management -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/risk-management, .gemini/skills/risk-management, .github/skills/risk-management and .opencode/skills/risk-management in your project.

What does Risk Management need to run?

Going by SKILL.md and its folder, Risk Management needs Python for the scripts in its folder and the command-line tools its instructions call (python). Our summary lists: Python 3.

Does Risk Management 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 Risk Management 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. The check reads SKILL.md only: the scripts in the folder are not scanned, so read them before running anything.

What licence does Risk Management use?

Risk Management 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 Risk Management use?

About 2.3k tokens (SKILL.md is roughly 9.1k 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 5.4k tokens, read only when the agent opens those files.

What are the alternatives to Risk Management?

Skills that share tags, products or a category with Risk Management: Tushare Data (zillionare/zillionare, 321 stars), Tradingview MCP (atilaahmettaner/tradingview-mcp, 5k stars), Digital Oracle (komako-workshop/digital-oracle, 878 stars) and Polyclaw (chainstacklabs/polyclaw, 359 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Risk Management?

agiprolabs (a GitHub user) maintains it in agiprolabs/claude-trading-skills, which has 410 GitHub stars. The repository holds 68 skills in this directory. The repository was last updated on September 3, 2026.

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