
risk-management
Portfolio-level risk controls, drawdown management, exposure limits, and circuit breakers for crypto trading
- Installs
- 637
- Last 24h
- —
- Trending rank
- —
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/agiprolabs/claude-trading-skills --skill risk-management- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads risk-management automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
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:
- Survival — Never risk account ruin. No single trade, day, or week should threaten your ability to continue trading.
- Capital preservation — Protect what you have. Losses compound geometrically; recovery requires outsized gains.
- 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 Type | Max Drawdown | Action |
|---|---|---|
| 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:
| Dimension | Max 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/narrative | 30% |
| Single strategy | 40% |
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
| Drawdown | Status | Response |
|---|---|---|
| 0–5% | Normal | Continue trading at full size |
| 5–10% | Caution | Reduce position sizes by 25–50% |
| 10–15% | Warning | Minimum position sizes only |
| 15–20% | Critical | Halt new trades, manage existing positions only |
| >20% | Emergency | Full stop, review everything before resuming |
Recovery Requirements
| Loss | Required 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:
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%
Expected Shortfall (CVaR)
Average loss in the worst (1 - confidence)% of scenarios:
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
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-analysisskill 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-modelingskill 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 sizesexit-strategies: Circuit breakers override exit strategies (forced exits)portfolio-analytics: Feed portfolio metrics back for risk assessmentliquidity-analysis: Adjust position limits based on available liquidityslippage-modeling: Factor execution costs into risk calculations
Files
References
references/drawdown_management.md— Drawdown math, response framework, causes, and remediationreferences/exposure_limits.md— Position limits by token type, portfolio limits, correlation managementreferences/circuit_breakers.md— Implementation details for all circuit breaker types
Scripts
scripts/risk_dashboard.py— Portfolio risk dashboard with limit checking and color-coded statusscripts/drawdown_analyzer.py— Equity curve drawdown analysis with response recommendations
Quick Start
# 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
FAQ
What does the risk-management skill do?
Portfolio-level risk controls, drawdown management, exposure limits, and circuit breakers for crypto trading
How do I install risk-management?
Run npx skills add https://github.com/agiprolabs/claude-trading-skills --skill risk-management in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/risk-management/ (personal) or .claude/skills/risk-management/ (project).
Which AI agents can use risk-management?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is risk-management safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains risk-management?
It is published by agiprolabs in agiprolabs/claude-trading-skills. It has 637 recorded installs.
More from agiprolabs/claude-trading-skills
walk-forward-validation
agiprolabs/claude-trading-skills
Walk-forward validation framework for trading strategies and ML models with time-series-aware splits, overfit detection, and regime-aware validation
pandas-ta
agiprolabs/claude-trading-skills
Technical analysis with 130+ indicators using pandas-ta for crypto market data
position-sizing
agiprolabs/claude-trading-skills
Trade sizing methods including fixed fractional, volatility-adjusted, Kelly criterion, and liquidity-constrained sizing
regime-detection
agiprolabs/claude-trading-skills
Market regime identification using volatility clustering, trend detection, and statistical methods for adaptive trading
kelly-criterion
agiprolabs/claude-trading-skills
Kelly criterion optimal sizing with fractional variants, edge estimation, and practical application for crypto trading
trade-journal
agiprolabs/claude-trading-skills
Structured trade logging, performance review, behavioral pattern detection, and strategy attribution for systematic improvement
Popular business & finance skills
sales-enablement
coreyhaines31/marketingskills
When the user wants to create sales collateral, pitch decks, one-pagers, objection handling docs, or demo scripts. Also use when the user mentions 'sales deck,' 'pitch deck,' 'one-pager,' 'leave-behind,' 'objection handling,' 'deal-specific ROI analysis,' 'demo script,' 'talk track,' 'sales playbook,' 'proposal template,' 'buyer persona card,' 'battle card,' 'battlecard,' 'competitive one-pager,' 'win-loss analysis,' 'why are we losing deals,' 'loss reasons,' 'how do I respond to this objection,' 'prospect just said,' 'help my sales team,' 'sales materials,' or 'what should I give my sales reps,' 'cold call script,' or 'voicemail script.' Use this for any document or asset that helps a sales team close deals. For public competitor comparison pages, see competitors. For running buyer interviews or churn research, see customer-research. For marketing website copy, see copywriting. For cold outreach emails, see cold-email. For the offer being sold (bonuses, guarantees, pricing structure),
revops
coreyhaines31/marketingskills
When the user wants help with revenue operations, lead lifecycle management, or marketing-to-sales handoff processes. Also use when the user mentions 'RevOps,' 'revenue operations,' 'lead scoring,' 'outbound pipeline stages,' 'lead routing,' 'MQL,' 'SQL,' 'pipeline stages,' 'deal desk,' 'CRM automation,' 'marketing-to-sales handoff,' 'data hygiene,' 'leads aren't getting to sales,' 'pipeline management,' 'lead qualification,' or 'when should marketing hand off to sales.' Use this for anything involving the systems and processes that connect marketing to revenue. For cold outreach emails, see cold-email. For email drip campaigns, see emails. For pricing decisions, see pricing.
sales-funnel-blueprint
autonnel/autonnel-skills
Turn an offer into a concrete multi-step sales funnel spec - page-by-page structure, price ladder, copy outline and the metrics each step must hit. Use when asked to build a sales funnel, marketing funnel, landing page flow, lead magnet funnel, webinar funnel, tripwire or VSL funnel, when planning a product launch page flow, or when someone asks "what pages do I need" for selling something online.
pricing
coreyhaines31/marketingskills
When the user wants help with pricing decisions, packaging, or monetization strategy. Also use when the user mentions 'pricing,' 'pricing tiers,' 'freemium,' 'free trial,' 'packaging,' 'price increase,' 'value metric,' 'Van Westendorp,' 'willingness to pay,' 'monetization,' 'how much should I charge,' 'my pricing is wrong,' 'pricing page,' 'annual vs monthly,' 'per seat pricing,' 'should I offer a free plan,' 'pricing page teardown,' 'pricing page audit,' 'is my pricing page AI-readable,' or 'can AI read my pricing.' Use this whenever someone is figuring out what to charge, how to structure their plans, or wants to audit a pricing page (for humans and for the AI agents that shortlist tools). For in-app upgrade screens, see paywalls. For offer construction (bonuses, guarantees, value framing, naming) on services/courses/coaching/high-ticket B2B, see offers.
cross-border-ecommerce
nexscope-ai/ecommerce-skills
Cross-border e-commerce expansion advisor. Scores target markets on 8 weighted dimensions (market size, ecommerce penetration, competition, regulatory complexity, logistics infrastructure, payment ecosystem, cultural distance, IP protection), compares 5 fulfillment models with cost and transit data, provides country-by-country tax/duty compliance guides (EU VAT/IOSS, UK VAT, US sales tax, CA GST, AU GST, JP consumption tax), maps local payment preferences by market, and builds a phased expansion roadmap. No API key required.
pricing-strategy
coreyhaines31/marketingskills
When the user wants help with pricing decisions, packaging, or monetization strategy. Also use when the user mentions 'pricing,' 'pricing tiers,' 'freemium,' 'free trial,' 'packaging,' 'price increase,' 'value metric,' 'Van Westendorp,' 'willingness to pay,' 'monetization,' 'how much should I charge,' 'my pricing is wrong,' 'pricing page,' 'annual vs monthly,' 'per seat pricing,' or 'should I offer a free plan.' Use this whenever someone is figuring out what to charge or how to structure their plans. For in-app upgrade screens, see paywall-upgrade-cro.