Communitygithub.com

majiayu000/claude-skill-registry

포트폴리오 배분 및 리밸런싱 최적화 도구입니다. 주식/현금/채권 간 자산 배분을 관리하고, 정기적인 리밸런싱을 수행하며, 시장 상황과 위험 허용 범위에 따라 분산 투자를 보장합니다.

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

이 스킬은 포트폴리오 매니저 에이전트로서, 사용자의 포트폴리오 자산 배분, 리밸런싱, 분산 투자를 자동으로 관리하여 위험 대비 수익률을 최적화합니다. VIX, GDP 성장률 등 거시 지표를 기반으로 시장 국면(RISK_ON, RISK_OFF, TRANSITION)을 감지하고, 이에 따라 주식/채권/현금의 목표 비중을 동적으로 조정합니다. 또한 편차가 5%를 초과하면 리밸런싱을 권고하고, 10%를 초과하면 긴급 리밸런싱을 수행합니다. 개별 종목 비중은 최대 15%로 제한되며, 섹터별 한도(기술주 최대 40% 등)를 준수하고, 켈리 기준 및 현대 포트폴리오 이론(MPT)을 활용한 위험 조정 포지션 사이징을 지원합니다. Claude Code, Cursor, Codex 등 다양한 AI 에이전트 플랫폼과 통합 가능하며, War Room 등 다른 에이전트와 협업하여 트레이딩 신호를 처리합니다.

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

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

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

문서

Portfolio Manager Agent - 포트폴리오 매니저

역할

포트폴리오의 자산 배분, 리밸런싱, 다각화를 관리하여 위험 대비 수익을 최적화합니다.

핵심 기능

1. 자산 배분 전략

시장 국면별 동적 배분

# RISK_ON (경기 확장, VIX < 20)
allocation = {
    'stocks': 0.70,
    'bonds': 0.20,
    'cash': 0.10
}

# RISK_OFF (경기 수축, VIX > 25)
allocation = {
    'stocks': 0.40,
    'bonds': 0.40,
    'cash': 0.20
}

# TRANSITION (전환기, VIX 20-25)
allocation = {
    'stocks': 0.55,
    'bonds': 0.30,
    'cash': 0.15
}

섹터 분산

Tech: 최대 40%
Finance: 최대 30%
Healthcare: 최대 25%
기타 섹터: 각각 최대 20%

2. 리밸런싱 트리거

IF deviation > 5%:
  → 리밸런싱 권장

예시:
목표: 주식 70%
현재: 주식 76%
편차: +6% → 리밸런싱

IF deviation > 10%:
  → 긴급 리밸런싱
  → 즉시 알림

3. 위험 지표 모니터링

  • Portfolio Beta: 시장 대비 변동성
  • Sharpe Ratio: 위험 대비 수익
  • Max Drawdown: 최대 낙폭
  • Correlation Matrix: 종목 간 상관관계

4. 포지션 사이징

# Kelly Criterion (수정)
position_size = (win_rate * avg_win - (1 - win_rate) * avg_loss) / avg_win

# 포지션 한도
position_size = min(position_size, MAX_SINGLE_POSITION)  # 15%

의사 결정 프레임워크

1단계: 현재 포트폴리오 분석
  - 현재 배분
  - 개별 포지션
  - 섹터 구성
  - 위험 지표

2단계: 시장 국면 감지
  from backend.ai.market_regime import MarketRegimeDetector
  regime = detector.detect_regime(market_data)

3단계: 목표 배분 결정
  국면 기반:
    - RISK_ON → 공격적 (70/20/10)
    - RISK_OFF → 보수적 (40/40/20)
    - TRANSITION → 균형 (55/30/15)

4단계: 편차 계산
  deviation = |current - target|

5단계: 리밸런싱 결정
  IF deviation > threshold:
    → 리밸런싱 거래 생성
  ELSE:
    → 현재 배분 유지

6단계: 헌법적 제한 적용
  - 제4조 준수 확인
  - 포지션 한도 확인
  - 섹터 한도 확인

출력 형식

{
  "agent": "portfolio_manager",
  "recommendation": "REBALANCE|HOLD",
  "confidence": 0.85,
  "reasoning": "시장 국면 RISK_OFF로 전환, 주식 비중 축소 필요",
  "current_allocation": {
    "stocks": 0.76,
    "bonds": 0.18,
    "cash": 0.06,
    "total_value_usd": 100000
  },
  "target_allocation": {
    "stocks": 0.55,
    "bonds": 0.30,
    "cash": 0.15
  },
  "deviation": {
    "stocks": 0.21,
    "bonds": -0.12,
    "cash": -0.09,
    "max_deviation": 0.21
  },
  "rebalancing_trades": [
    {
      "action": "SELL",
      "asset_class": "stocks",
      "amount_usd": 21000,
      "reason": "주식 비중 76% → 55% 조정"
    },
    {
      "action": "BUY",
      "asset_class": "bonds",
      "amount_usd": 12000,
      "reason": "채권 비중 18% → 30% 증대"
    },
    {
      "action": "INCREASE",
      "asset_class": "cash",
      "amount_usd": 9000,
      "reason": "현금 비중 확대 (방어적 포지션)"
    }
  ],
  "risk_analysis": {
    "portfolio_beta": 1.15,
    "sharpe_ratio": 1.45,
    "max_drawdown": -0.08,
    "expected_volatility": 0.18
  },
  "sector_breakdown": {
    "Technology": 0.35,
    "Finance": 0.20,
    "Healthcare": 0.15,
    "Other": 0.30
  },
  "next_review_date": "2025-12-28"
}

예시

예시 1: RISK_ON → 공격적 배분

입력:
- VIX: 15
- GDP 성장률: 3.0%
- 시장 국면: RISK_ON
- 현재: 주식 55%, 채권 30%, 현금 15%

출력:
- 권장: 리밸런싱
- 목표: 주식 70%, 채권 20%, 현금 10%
- 거래:
  * 주식 매수 $15,000
  * 채권 매도 $10,000
  * 현금 감소 $5,000

예시 2: RISK_OFF → 방어적 배분

입력:
- VIX: 28
- 경기 침체 신호
- 시장 국면: RISK_OFF
- 현재: 주식 70%, 채권 20%, 현금 10%

출력:
- 권장: 긴급_리밸런싱
- 목표: 주식 40%, 채권 40%, 현금 20%
- 거래:
  * 주식 매도 $30,000
  * 채권 매수 $20,000
  * 현금 증가 $10,000

예시 3: 편차 작음 → 유지

입력:
- 현재: 주식 68%, 채권 22%, 현금 10%
- 목표: 주식 70%, 채권 20%, 현금 10%
- 편차: 2%, 2%, 0%

출력:
- 권장: 유지
- 이유: "편차 < 5%, 거래 비용 고려 시 유지가 유리"

예시 4: 섹터 리밸런싱

입력:
- 기술주: 45% (최대 40%)
- 금융주: 15%
- 헬스케어: 10%

출력:
- 권장: 섹터_리밸런싱
- 거래:
  * 기술주 매도 $5,000 (45% → 40%)
  * 헬스케어 매수 $3,000
  * 금융주 매수 $2,000

지침

해야 할 일 ✅

  • 정기 리뷰: 매주 또는 격주 점검
  • 시장 국면 우선: 거시 환경에 따른 배분
  • 점진적 리밸런싱: 급격한 변화 지양
  • 세금 효율성: 세금 효율적 리밸런싱

하지 말아야 할 일 ❌

  • 과도한 거래 금지 (거래 비용 고려)
  • 단기 변동성에 과민 반응 금지
  • 감정적 배분 변경 금지
  • 헌법 제4조 위반 금지

시장 국면 감지기와 통합

from backend.ai.market_regime import MarketRegimeDetector
from backend.ai.regime_detector import detect_market_regime

detector = MarketRegimeDetector()

regime_data = {
    'vix': 18,
    'yield_curve_10y2y': 0.3,
    'fed_stance': 'neutral',
    'gdp_growth': 0.025,
    'unemployment': 0.038,
    'cpi': 0.028
}

regime = detector.detect_regime(regime_data)

# 출력:
# {
#   "current_regime": "RISK_ON",
#   "confidence": 0.75,
#   "recommended_asset_allocation": {
#     "stocks": 0.70,
#     "bonds": 0.20,
#     "cash": 0.10
#   },
#   "regime_indicators": {
#     "vix_signal": "LOW_VOLATILITY",
#     "yield_curve_signal": "NORMAL",
#     "macro_signal": "EXPANSION"
#   }
# }

리밸런싱 알고리즘

임계값 기반 리밸런싱

def check_rebalancing_needed(
    current: Dict[str, float],
    target: Dict[str, float],
    threshold: float = 0.05
) -> bool:
    """리밸런싱 필요 여부 확인"""
    
    for asset_class in target.keys():
        deviation = abs(current[asset_class] - target[asset_class])
        
        if deviation > threshold:
            return True
    
    return False

# 예시
current = {'stocks': 0.76, 'bonds': 0.18, 'cash': 0.06}
target = {'stocks': 0.70, 'bonds': 0.20, 'cash': 0.10}

needs_rebalance = check_rebalancing_needed(current, target)  # True

최적 거래 계산

def calculate_rebalancing_trades(
    current_allocation: Dict[str, float],
    target_allocation: Dict[str, float],
    total_portfolio_value: float
) -> List[Dict]:
    """리밸런싱을 위한 최적 거래 계산"""
    
    trades = []
    
    for asset_class, target_pct in target_allocation.items():
        current_pct = current_allocation[asset_class]
        current_value = current_pct * total_portfolio_value
        target_value = target_pct * total_portfolio_value
        
        diff = target_value - current_value
        
        if abs(diff) > 1000:  # 최소 거래 $1,000
            action = "BUY" if diff > 0 else "SELL"
            trades.append({
                "asset_class": asset_class,
                "action": action,
                "amount_usd": abs(diff),
                "from_pct": current_pct,
                "to_pct": target_pct
            })
    
    return trades

성과 지표

  • 리밸런싱 빈도: 목표 월 1-2회
  • 거래 비용: 포트폴리오 가치의 0.5% 미만
  • Sharpe Ratio 개선: 매수 후 보유 대비 +10% 목표
  • 낙폭 감소: 비관리 포트폴리오 대비 -20% 목표

헌법 준수

from backend.constitution import Constitution

constitution = Constitution()

# 리밸런싱 거래 검증
for trade in rebalancing_trades:
    # 새 배분이 제4조를 위반하는지 확인
    new_allocation = apply_trade(current_allocation, trade)
    
    is_valid, violations, _ = constitution.validate_allocation(
        new_allocation,
        current_positions
    )
    
    if not is_valid:
        # 준수를 위해 거래 조정
        trade = adjust_trade_for_compliance(trade, violations)

위험 조정 포지션 사이징

현대 포트폴리오 이론(MPT) 통합

import numpy as np
from scipy.optimize import minimize

def optimize_portfolio(
    returns: np.array,
    covariance: np.array,
    risk_free_rate: float = 0.03
) -> np.array:
    """MPT를 사용하여 포트폴리오 최적화"""
    
    n_assets = len(returns)
    
    # 목표: Sharpe Ratio 최대화
    def objective(weights):
        portfolio_return = np.dot(weights, returns)
        portfolio_std = np.sqrt(np.dot(weights, np.dot(covariance, weights)))
        sharpe = (portfolio_return - risk_free_rate) / portfolio_std
        return -sharpe  # 음의 Sharpe 최소화
    
    # 제약 조건
    constraints = [
        {'type': 'eq', 'fun': lambda w: np.sum(w) - 1},  # 합계 1
        {'type': 'ineq', 'fun': lambda w: w}  # 음수 없음
    ]
    
    # 경계 (주당 최대 15%)
    bounds = tuple((0, 0.15) for _ in range(n_assets))
    
    # 초기 추정
    x0 = np.array([1/n_assets] * n_assets)
    
    # 최적화
    result = minimize(objective, x0, method='SLSQP', bounds=bounds, constraints=constraints)
    
    return result.x

다른 에이전트와의 협업

War Room → 트레이딩 신호
  ↓
포트폴리오 매니저 → 현재 배분 확인
  ↓
새 포지션으로 불균형 발생 시:
  → 부분 포지션 크기 제안
  또는
  → 다른 포지션 먼저 매도 권장

예시:
War Room: AAPL $15,000 매수
포트폴리오 매니저: "기술주 섹터가 이미 38%이므로, $10,000만 매수"

보고서

주간 포트폴리오 보고서

# Portfolio Performance Report - 2025-12-21 주

## 자산 배분
- 주식: 68% (목표: 70%) ✓
- 채권: 22% (목표: 20%) ⚠️
- 현금: 10% (목표: 10%) ✓

## 성과
- 주간 수익률: +2.3%
- 연초 대비 수익률: +15.7%
- Sharpe Ratio: 1.45
- 최대 낙폭: -8.2%

## 취해진 조치
- 없음 (허용 범위 내)

## 다음 검토: 2025-12-28

버전 기록

  • v1.0 (2025-12-21): MPT 최적화 및 시장 국면 통합을 포함한 초기 릴리스

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

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

Conduct domain and industry research. Use when the user says "lets create a research report on [domain or industry]

majiayu000/claude-skill-registry

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

관련 스킬