Communitygithub.com

majiayu000/claude-skill-registry

AI 기반 포트폴리오 리스크 관리 및 최적화 기술. 포지션 크기 조정, 포트폴리오 할당 관리, 위험 지표(VaR, 샤프 비율) 계산, 리밸런싱 및 방어 전략 구현 시 사용합니다. 포지션 사이징, 상관관계 분석, 드로다운 관리, 동적 리밸런싱, 킬 스위치를 포함합니다.

claude-skill-registry란 무엇인가요?

이 스킬은 시그널 생성과 거래 실행 사이에 위치한 체계적인 위험 관리 계층입니다. 포지션 사이징 엔진, 포트폴리오 위험 지표 대시보드, 동적 리밸런싱, 자동 방어 조치(킬 스위치), 시나리오 분석 등 5가지 핵심 기능을 제공합니다. 주요 위험 지표로는 VaR(위험가치), 샤프 비율, 최대 드로다운, 상관관계 행렬 등을 계산하며, 켈리 기준(Kelly Criterion)을 수정하여 포지션 크기를 최적화합니다. Claude Code (또는 Cursor, Codex) 환경에서 사용할 수 있으며, CLI 스크립트를 통해 포지션 사이징, 리스크 메트릭, 리밸런싱, 스트레스 테스트, 킬 스위치 상태 확인 등을 실행할 수 있습니다. 또한 다른 AI 에이전트 스킬(예: meme-trader, meme-executor, flow-tracker)과 연동되어 포트폴리오 위험을 종합적으로 관리할 수 있도록 설계되었습니다.

지원 대상✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/majiayu000/claude-skill-registry/tree/HEAD/skills/analysis/risk-portfolio-manager-dreamineering-meme-times-3

즐겨 사용하는 AI에게 물어보기

이 에이전트 스킬이 미리 로드된 새 채팅을 엽니다.

문서

위험 포트폴리오 관리자 - AI 기반 위험 통제

시그널 생성과 거래 실행 사이에 위치하는 체계적인 위험 관리 계층입니다. 데이터 기반 접근법을 사용하여 포지션 크기를 최적화하고, 포트폴리오 리스크를 관리하며, 방어 조치를 자동화합니다.

핵심 원칙

포지션 사이징과 리스크 관리가 장기적인 생존을 결정합니다. 어떤 단일 거래도 포트폴리오를 위협해서는 안 됩니다.

활성화 트리거

핵심 기능

1. 포지션 사이징 엔진

<position_sizing> 사이징 방법:

interface PositionSizeRequest {
  signal_strength: number;    // 0-1 (meme-trader로부터)
  token_risk_score: number;   // 1-10 (rug 감지로부터)
  current_portfolio: Portfolio;
  market_regime: 'bull' | 'bear' | 'sideways' | 'volatile';
  risk_tolerance: 'conservative' | 'moderate' | 'degen';
}

interface PositionSizeResult {
  recommended_size_pct: number;  // 포트폴리오 비율
  recommended_size_usd: number;
  max_allowed_size: number;
  reasoning: string[];
  risk_warnings: string[];
}

켈리 기준 (수정됨):

Optimal Size = (Win Rate * Avg Win - (1 - Win Rate) * Avg Loss) / Avg Win
Adjusted Size = Kelly * Fractional Multiplier (0.25-0.5 for safety)

위험 조정 사이징 매트릭스:

위험 허용 범위기본 크기최대 단일 포지션최대 상관 노출
보수적0.5-1%2%5%
중간1-2%4%10%
탈주자2-5%10%25%

시그널 기반 조정:

Final Size = Base Size * Signal Strength * (1 - Token Risk / 20) * Market Multiplier

Where:
- Signal Strength: 0.5-1.5 (weak to strong)
- Token Risk: 1-10 (lower is safer)
- Market Multiplier: 0.5 (volatile) to 1.2 (trending)

출력 형식:

POSITION SIZE RECOMMENDATION

Token: $MEME
Signal Strength: 8/10
Token Risk Score: 4/10
Market Regime: BULL

RECOMMENDED SIZE:
├─ Percentage: 2.3% of portfolio
├─ Amount: $460 (of $20,000 portfolio)
├─ Max Allowed: $800 (4% limit)
└─ Risk-Adjusted: WITHIN LIMITS

REASONING:
1. Strong signal (8/10) supports above-average sizing
2. Low-medium risk token (4/10) allows full allocation
3. Bull market regime permits aggressive sizing
4. No correlation with existing positions

WARNINGS:
- Consider scaling in (3 tranches) vs single entry
- Set stop-loss at -25% ($345 max loss)

</position_sizing>

2. 포트폴리오 위험 지표

<risk_metrics> 실시간 포트폴리오 대시보드:

PORTFOLIO RISK DASHBOARD
═══════════════════════════════════════

POSITIONS (5 active):
Token      | Size    | PnL      | Risk  | Weight
$BONK      | $4,200  | +$840    | 5/10  | 21%
$MEME      | $3,100  | +$620    | 4/10  | 15.5%
$DOGE      | $2,800  | -$140    | 3/10  | 14%
$WIF       | $2,500  | +$1,250  | 6/10  | 12.5%
SOL        | $7,400  | +$2,220  | 2/10  | 37%
───────────────────────────────────────
TOTAL      | $20,000 | +$4,790  |       | 100%

RISK METRICS:
├─ Daily VaR (95%): -$1,240 (-6.2%)
├─ Max Drawdown (30d): -18.3%
├─ Current Drawdown: 0% (at ATH)
├─ Sharpe Ratio (30d): 2.14
├─ Sortino Ratio: 2.87
├─ Beta to SOL: 1.34

CORRELATION MATRIX:
        BONK   MEME   DOGE   WIF    SOL
BONK    1.00   0.82   0.71   0.78   0.65
MEME    0.82   1.00   0.68   0.85   0.61
DOGE    0.71   0.68   1.00   0.59   0.54
WIF     0.78   0.85   0.59   1.00   0.72
SOL     0.65   0.61   0.54   0.72   1.00

CONCENTRATION RISK:
├─ Top Position: 37% (SOL) - WITHIN LIMIT
├─ Top 3 Positions: 72.5% - HIGH
├─ Herfindahl Index: 0.23 - MODERATE
└─ Meme Exposure: 63% - HIGH

ALERTS:
⚠️ High correlation between MEME and WIF (0.85)
⚠️ Meme sector concentration above 50%

위험 계산:

interface PortfolioRisk {
  // Value at Risk
  var_95: number;       // 95% confidence daily VaR
  var_99: number;       // 99% confidence daily VaR
  cvar_95: number;      // Conditional VaR (expected shortfall)

  // Performance Risk
  sharpe_ratio: number;
  sortino_ratio: number;
  max_drawdown: number;
  current_drawdown: number;

  // Correlation Risk
  avg_correlation: number;
  max_correlation: number;
  correlation_cluster: string[]; // Highly correlated groups

  // Concentration Risk
  herfindahl_index: number;
  top_position_pct: number;
  sector_concentrations: Record<string, number>;
}

function calculateVaR(
  positions: Position[],
  confidence: number = 0.95,
  horizon_days: number = 1
): number {
  // Historical VaR using past 30 days of returns
  const returns = getHistoricalReturns(positions, 30);
  const portfolio_returns = calculatePortfolioReturns(returns, positions);
  const sorted = portfolio_returns.sort((a, b) => a - b);
  const index = Math.floor((1 - confidence) * sorted.length);
  return sorted[index] * getPortfolioValue(positions) * Math.sqrt(horizon_days);
}

</risk_metrics>

3. 동적 리밸런싱

목표 할당 프레임워크:

interface AllocationTarget {
  core_holdings: {
    SOL: { target: 30, min: 20, max: 50 };
    stablecoins: { target: 20, min: 10, max: 40 };
  };
  satellite_holdings: {
    memes: { target: 30, min: 0, max: 50 };
    defi: { target: 15, min: 0, max: 30 };
    other: { target: 5, min: 0, max: 15 };
  };
  rebalance_threshold: 5; // % drift to trigger
}

리밸런싱 출력:

REBALANCING RECOMMENDATION

Current vs Target Allocation:
Category     | Current | Target | Drift  | Action
SOL          | 37%     | 30%    | +7%    | SELL $1,400
Memes        | 63%     | 50%    | +13%   | SELL $2,600
Stables      | 0%      | 20%    | -20%   | BUY $4,000

SUGGESTED TRADES:
1. SELL 15% of BONK position ($630) → USDC
2. SELL 20% of WIF position ($500) → USDC
3. SELL 10% of SOL position ($740) → USDC
4. Keep MEME and DOGE positions
5. Convert sales to USDC stablecoin buffer

POST-REBALANCE PROJECTION:
├─ SOL: 31% (target: 30%)
├─ Memes: 48% (target: 50%)
├─ Stables: 21% (target: 20%)
└─ VaR Reduction: -18% (improved risk profile)

4. 자동 방어 조치

<defensive_actions> 킬 스위치 시스템:

interface KillSwitchConfig {
  daily_loss_limit: number;      // 포트폴리오 비율
  weekly_loss_limit: number;     // 포트폴리오 비율
  position_loss_limit: number;   // 포지션당 비율
  drawdown_limit: number;        // 정점 대비 비율
  correlation_spike_action: 'alert' | 'reduce' | 'exit';
  auto_execute: boolean;
}

const defaultKillSwitch: KillSwitchConfig = {
  daily_loss_limit: 10,      // Halt new trades at -10% day
  weekly_loss_limit: 20,     // Halt all activity at -20% week
  position_loss_limit: 30,   // Auto-close position at -30%
  drawdown_limit: 25,        // Emergency mode at -25% from peak
  correlation_spike_action: 'alert',
  auto_execute: false,       // Require confirmation in Phase 1
};

트리거된 조치:

트리거조치심각도
포지션 -25%손절 경고중간
포지션 -30%자동 종료 (활성화된 경우)높음
일일 -10%신규 거래 중단높음
주간 -20%스테이블 코인으로 전환심각
드로다운 -25%비상 청산심각
상관관계 > 0.95하나의 포지션 축소중간

알림 출력:

🚨 RISK ALERT: DAILY LOSS LIMIT APPROACHING

Current Day PnL: -8.7% ($-1,740)
Daily Limit: -10% ($-2,000)
Buffer Remaining: $260

TRIGGERED ACTIONS:
1. ⏸️ New trade execution PAUSED
2. ⚠️ Review all open positions
3. 📊 Increased monitoring frequency

RECOMMENDED:
- Review worst performing position (WIF: -15%)
- Consider partial exit if trend continues
- DO NOT average down

Type RESUME to re-enable trading
Type EXIT_ALL to liquidate positions

</defensive_actions>

5. 시나리오 분석

<scenario_analysis> 스트레스 테스트:

interface StressScenario {
  name: string;
  market_move: {
    sol: number;      // % 변화
    memes: number;    // SOL 대비 % 변화
    correlation_shift: number;
  };
  probability: number;
}

const stressScenarios: StressScenario[] = [
  {
    name: 'SOL -30% Flash Crash',
    market_move: { sol: -30, memes: -50, correlation_shift: 0.2 },
    probability: 0.05,
  },
  {
    name: 'Meme Rotation Out',
    market_move: { sol: 0, memes: -40, correlation_shift: -0.1 },
    probability: 0.10,
  },
  {
    name: 'Bull Run Continuation',
    market_move: { sol: 50, memes: 100, correlation_shift: 0 },
    probability: 0.15,
  },
  {
    name: 'Black Swan Event',
    market_move: { sol: -60, memes: -80, correlation_shift: 0.3 },
    probability: 0.01,
  },
];

스트레스 테스트 출력:

STRESS TEST RESULTS

Current Portfolio Value: $20,000

SCENARIO                    | Portfolio Impact | Probability
SOL -30% Flash Crash        | -$7,200 (-36%)   | 5%
Meme Rotation Out           | -$5,040 (-25%)   | 10%
Bull Run Continuation       | +$14,600 (+73%)  | 15%
Black Swan Event            | -$12,400 (-62%)  | 1%

EXPECTED PORTFOLIO VALUE:
├─ Base Case: $20,000
├─ Expected (prob-weighted): $22,340 (+11.7%)
├─ Worst Case (99%): -$12,400 (-62%)
└─ VaR (95%, 30d): -$4,800 (-24%)

RISK ASSESSMENT:
⚠️ High sensitivity to meme rotation (-25% scenario)
⚠️ Black swan exposure significant (-62%)
✓ Positive expected value in base scenarios
✓ Bull case upside substantial (+73%)

RECOMMENDATION:
Consider hedging meme exposure with SOL puts or reducing
meme allocation by 10-15% to improve risk profile.

</scenario_analysis>

통합 포인트

위험 관리자가 제공하는 정보:

  • meme-executor: 승인된 포지션 크기, 손절 수준
  • meme-trader: 포지션 한도, 사용 가능 자본
  • 모든 스킬: 포트폴리오 상태, 위험 알림

CLI 사용법

# 포지션 크기 계산
npx tsx .claude/skills/risk-portfolio-manager/scripts/position-sizer.ts \
  --signal 8 \
  --risk-score 4 \
  --portfolio-file ./portfolio.json \
  --risk-mode moderate

# 포트폴리오 위험 지표 확인
npx tsx .claude/skills/risk-portfolio-manager/scripts/risk-metrics.ts \
  --portfolio-file ./portfolio.json \
  --include-correlation \
  --var-confidence 95

# 리밸런싱 추천
npx tsx .claude/skills/risk-portfolio-manager/scripts/rebalancer.ts \
  --portfolio-file ./portfolio.json \
  --target-allocation ./targets.json \
  --threshold 5

# 스트레스 테스트 실행
npx tsx .claude/skills/risk-portfolio-manager/scripts/stress-test.ts \
  --portfolio-file ./portfolio.json \
  --scenarios default \
  --output-format detailed

# 킬 스위치 상태 확인
npx tsx .claude/skills/risk-portfolio-manager/scripts/kill-switch.ts \
  --portfolio-file ./portfolio.json \
  --check-status

품질 게이트

<validation_rules>

  • 포지션 사이징은 가격 데이터에 대한 품질 점수 >= 85% 필요
  • VaR 계산에는 30일 이상의 깨끗한 과거 데이터 필요
  • 상관관계 매트릭스에는 동기화된 가격 데이터 필요
  • 모든 추천에는 신뢰 수준 포함
  • Rug 감지 확인 없이 포지션 사이징 불가 </validation_rules>

오류 처리

<error_recovery>

  • 가격 데이터 누락: 마지막 알려진 값 + 만료 경고 사용
  • 계산 오류: 보수적 대체 (최소 크기)
  • 킬 스위치 충돌: 안전 우선 (중단 > 계속)
  • 데이터 품질 부족: 사이징 거부, 갱신 요청 </error_recovery>

<see_also>

  • references/risk-models.md - 수학적 공식
  • references/allocation-templates.md - 목표 포트폴리오
  • scripts/position-sizer.ts - 사이징 엔진
  • scripts/risk-metrics.ts - 위험 계산
  • scripts/kill-switch.ts - 자동 안전 장치 </see_also>

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

majiayu000/claude-skill-registry

Builds, edit or validate Agent Skill through conversational discovery. Use when the user requests to "Create an Agent", "Optimize an Agent" or "Edit an Agent".

majiayu000/claude-skill-registry

Edit existing BMAD agents while maintaining compliance

majiayu000/claude-skill-registry

Edit existing BMAD agents while maintaining compliance

majiayu000/claude-skill-registry

Edit existing BMAD modules while maintaining coherence

majiayu000/claude-skill-registry

Edit existing BMAD modules while maintaining coherence

majiayu000/claude-skill-registry

Analyzes current state and user query to answer BMad questions or recommend the next workflow or agent. Use when user says what should I do next, what do I do now, or asks a question about BMad

majiayu000/claude-skill-registry

Build AI agents with Google ADK Python (Agent Development Kit). Use for multi-agent systems, workflow agents (sequential/parallel/loop), Vertex AI deployment, tool integration, human-in-the-loop.

majiayu000/claude-skill-registry

Build AI agents with Google ADK Python (Agent Development Kit). Use for multi-agent systems, workflow agents (sequential/parallel/loop), Vertex AI deployment, tool integration, human-in-the-loop.

majiayu000/claude-skill-registry

Portfolio allocation and rebalancing optimizer. Manages asset allocation across stocks/cash/bonds, performs periodic rebalancing, and ensures diversification according to market regime and risk tolerance.

majiayu000/claude-skill-registry

Create a hilarious and ultra-realistic video of an anthropomorphic animal acting like a human vlogger in a real-world setting.

majiayu000/claude-skill-registry

Speech-to-text transcription and translation via OpenAI Audio API -- models, response formats, timestamps, prompting, streaming, chunking, and diarization

majiayu000/claude-skill-registry

BlockRun works with Claude Code and Google Antigravity.

majiayu000/claude-skill-registry

This skill should be used when the user asks about libraries, frameworks, API references, or needs code examples. Activates for setup questions, code generation involving libraries, or mentions of specific frameworks like React, Vue, Next.js, Prisma, Supabase, etc.

majiayu000/claude-skill-registry

小省导购员数字人带货版即梦视频提示词生成系统,基于四大智能体协同(提示词生成师、质量管控师、知识库运维师、跨环节适配师),按照"主体+运动+场景+(镜头语言+光影+氛围)"公式输出中英文双版提示词,适配5s短视频。确保人物一致性、视觉连贯性、情绪连贯性,支持知识库智能复用和跨工具适配(Suno音乐、AI绘画),为数字人带货视频提供高质量提示词生成服务。

majiayu000/claude-skill-registry

Upload and manage files using Google Gemini File API via scripts/. Use for uploading images, audio, video, PDFs, and other files for use with Gemini models. Supports file upload, status checking, and file management. Triggers on "upload file", "file API", "upload image", "upload PDF", "upload video", "file management".

majiayu000/claude-skill-registry

CRITICAL: Use for MolyKit AI chat toolkit. Triggers on: BotClient, OpenAI, SSE streaming, AI chat, molykit, PlatformSend, spawn(), ThreadToken, cross-platform async, Chat widget, Messages, PromptInput, Avatar, LLM

majiayu000/claude-skill-registry

AI and machine learning workflow covering LLM application development, RAG implementation, agent architecture, ML pipelines, and AI-powered features.

majiayu000/claude-skill-registry

Analyze images/audio/video with Gemini API (better vision than Claude). Generate images (Imagen 4), videos (Veo 3). Use for vision analysis, transcription, OCR, design extraction, multimodal AI.

majiayu000/claude-skill-registry

Analyze images/audio/video with Gemini API (better vision than Claude). Generate images (Imagen 4), videos (Veo 3). Use for vision analysis, transcription, OCR, design extraction, multimodal AI.

majiayu000/claude-skill-registry

Skill for discovering and researching autonomous AI agents, tools, and ecosystems using the AgentFolio directory.

관련 스킬