Communitygithub.com

gabrielmoreira/agent-skills-mirror

使用 R、dplyr 和 PortfolioAnalytics 執行完整的 4 步驟財務分析:摘要統計、受限資產篩選(基於報酬/風險與本益比)、資料探索,以及使用 ROI 求解器進行投資組合最佳化(GMVP 和切線組合)。

agent-skills-mirror 是什麼?

此技能提供一個結構化的 4 步驟財務分析工作流程,專為在 R 環境中評估與最佳化投資組合而設計。它整合了 dplyr 進行資料處理、PortfolioAnalytics 進行投資組合分析,以及 ROI 作為最佳化求解器。步驟依序為:(1) 計算摘要統計量(包含對數報酬率與等權重指數);(2) 使用兩種策略(報酬/風險比與本益比)篩選出確切 5 檔資產,並強制包含至少一項商品與一項外匯;(3) 透過相關圖、直方圖、Q-Q 圖和盒形圖進行資料探索;以及 (4) 計算全球最小變異數投資組合(GMVP,禁止放空)與切線投資組合(允許放空)的最佳權重。此技能支援 Claude Code、Cursor、Codex 等 AI 代理平台,確保產出完整可執行的 R 程式碼,並附帶明確的註解與匯出檔案功能。

相容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/gabrielmoreira/agent-skills-mirror/tree/HEAD/mirrors/repos/ECNU-ICALK@AutoSkill/SkillBank/ConvSkill/english_gpt4_8_GLM4.7/r_portfolio_analysis_optimization_workflow

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

r_portfolio_analysis_optimization_workflow

使用 R、dplyr 和 PortfolioAnalytics 執行完整的 4 步驟財務分析:摘要統計、受限資產篩選(基於報酬/風險與本益比)、資料探索,以及使用 ROI 求解器進行投資組合最佳化(GMVP 和切線組合)。

Prompt

角色與目標

扮演財務分析師與 R 程式設計師。執行一個由四個不同階段組成的完整投資組合分析工作流程:摘要統計、投資組合標的篩選、資料探索與投資組合最佳化。

工具與函式庫

使用 R 的 dplyr 進行資料處理,PortfolioAnalytics 進行最佳化,以及 ROI 作為最佳化求解器。

操作規則與限制

  1. 摘要統計 (Q1):

    • 計算資產的對數報酬率。
    • 從資產中建立一個等權重指數。
    • 估計個別資產與指數的摘要統計量。
    • 明確說明所使用的報酬率衡量方式(例如:對數報酬率)及其理由。
  2. 投資組合標的篩選 (Q2):

    • 根據兩種不同的策略篩選出確切 5 檔資產。
    • 限制: 必須包含至少一項商品和一項外匯。
    • 策略 1(報酬風險比):
      • 計算報酬風險比為(中位數報酬率 / 標準差)。
      • 依此指標對資產排序。
      • 選取前 5 檔資產。
      • **平手處理:**選擇平均報酬率較高的資產。
    • 策略 2(本益比):
      • 根據本益比(偏好的遞增順序)篩選資產。
    • 將兩種策略篩選出的資產匯出至 CSV 或 XLSX 檔案。
  3. 資料探索 (Q3):

    • 針對兩種策略所選的資產執行以下視覺化:
      • 相關圖
      • 直方圖
      • Q-Q 圖
      • 盒形圖
    • 從視覺化結果推論。
  4. 投資組合最佳化 (Q4):

    • 比較兩種策略下所選資產的權重配置。
    • 使用 PortfolioAnalytics 和 ROI 求解器,為每種策略計算兩個目標函數的權重。
    • 全球最小變異數投資組合 (GMVP):
      • 目標:最小化風險(objective_type = "minrisk")。
      • 限制:不允許放空。
      • 實作:加入 weight_sum 限制(min_sum=1, max_sum=1)以及 box 限制(min=0, max=1)。
    • 切線投資組合:
      • 目標:最大化夏普比率(objective_type = "tangency")。
      • 限制:允許放空。
      • 實作:加入 weight_sum 限制(min_sum=1, max_sum=1)。不要加入 box 限制。
    • **執行:**兩種策略皆使用 optimize_method = "ROI"。使用 extractWeights 提取並印出最佳權重。
    • 計算並評論每種組合的投資組合報酬率與投資組合風險衡量。

溝通與風格偏好

  • 確保程式碼處理資料清理(例如 na.omit)。
  • 提供清晰的註解說明限制條件與計算邏輯。
  • 確保變數名稱與使用者的上下文相符(例如 assets, log_returns, strategy1_selection)。
  • 提供完整、可執行的 R 程式碼區塊,包含載入函式庫與投資組合規格。

反模式

  • 不可忽略關於商品與外匯資產的特定限制。
  • 不可混淆策略 1 與策略 2 的限制條件。
  • 不可遺漏匯出篩選檔案。
  • 不可使用錯誤的 GMVP 或切線投資組合限制定義(例如在 GMVP 中允許放空,或在切線組合中禁止放空)。
  • 不可憑空捏造資產資料;應使用使用者提供的結構,若缺少資料則使用通用佔位符。
  • 不可使用已淘汰的函式或與標準 PortfolioAnalytics 工作流程不相容的語法。

Triggers

  • portfolio analysis workflow
  • financial portfolio optimization
  • asset selection strategy
  • global minimum variance portfolio
  • tangency portfolio calculation
  • optimize portfolio in R
  • PortfolioAnalytics optimization

Individual skills in this repo

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

gabrielmoreira/agent-skills-mirror

Design exclusive bonus packages that make YOUR affiliate link the obvious choice. Triggers on: "create bonuses for", "bonus stack", "what bonuses should I offer", "bonus ideas for", "exclusive bonuses", "differentiate my affiliate link", "why buy through my link", "affiliate bonuses", "bonus package", "what can I offer as a bonus", "design bonuses", "build a bonus stack".

gabrielmoreira/agent-skills-mirror

Design irresistible affiliate offers using the Hormozi Grand Slam framework. Triggers on: "create an offer for", "design my offer", "grand slam offer", "make an irresistible offer", "why should someone buy through my link", "offer framework", "value proposition for", "Hormozi offer", "offer stack", "make my offer irresistible", "craft an offer", "what makes my offer different", "offer design", "increase perceived value".

gabrielmoreira/agent-skills-mirror

Create YOUR personal guarantee on top of the product's guarantee for risk reversal. Triggers on: "create a guarantee", "guarantee for my affiliate", "risk reversal", "money back guarantee", "what guarantee can I offer", "reduce buyer risk", "guarantee copy", "how to guarantee", "affiliate guarantee", "personal guarantee", "risk-free offer", "satisfaction guarantee", "results guarantee".

gabrielmoreira/agent-skills-mirror

Build high-converting affiliate landing pages as single self-contained HTML files. Triggers on: "create a landing page for", "build a landing page", "product landing page", "affiliate landing page", "comparison page for", "vs page", "single product page", "conversion page", "sales page for affiliate", "landing page HTML", "build me a page for", "create a page to promote [product]", "I need a landing page", "make a page for [product]".

gabrielmoreira/agent-skills-mirror

Build a single-product deep-dive showcase page as a self-contained HTML file. Triggers on: "build a product showcase page", "deep dive landing page for [product]", "create a product spotlight page", "product feature page", "single product page", "detailed page about [product]", "build a page showing everything about [product]", "create a long-form product page", "build a sales page for [product]", "product deep dive page", "make a feature breakdown page for [product]".

gabrielmoreira/agent-skills-mirror

Build email capture landing pages (squeeze pages) as single self-contained HTML files. Triggers on: "build a squeeze page", "email capture page", "lead magnet page", "create an opt-in page", "build an email list page", "lead capture landing page", "create a freebie page", "build a page to collect emails", "opt-in landing page", "email signup page for [product/niche]", "create a lead magnet landing page", "build a page that captures emails before sending to affiliate offer".

gabrielmoreira/agent-skills-mirror

Design the complete free-to-premium value ladder for affiliate promotions. Triggers on: "value ladder", "customer journey", "upsell path", "ascension model", "free to paid funnel", "tripwire offer", "upsell strategy", "downsell", "product ladder", "price ladder", "customer ascension", "funnel architecture", "map my funnel", "design my funnel stages", "monetization path".

gabrielmoreira/agent-skills-mirror

Build a webinar or live event registration page as a self-contained HTML file with countdown timer, speaker bio, agenda, and registration form. Triggers on: "build a webinar registration page", "create a webinar sign-up page", "event registration landing page", "live training registration page", "workshop sign-up page", "create a webinar page", "build an event page", "free webinar landing page", "live demo registration page", "online event page", "create a registration page for my webinar", "build a training event page".

gabrielmoreira/agent-skills-mirror

Audit paid-ad landing pages for message match, mobile experience, performance, accessibility, trust, forms, consent, tracking, security, and conversion friction. Use for landing-page audit, post-click experience, LP audit, conversion-rate optimization, form optimization, ad-to-page message match, redirects, blocked navigation, or requests involving private, loopback, link-local, or metadata IP destinations.

gabrielmoreira/agent-skills-mirror

Automate Klipfolio tasks via Rube MCP (Composio). Always search tools first for current schemas.

gabrielmoreira/agent-skills-mirror

Review UI code for Web Interface Guidelines compliance.

gabrielmoreira/agent-skills-mirror

Generates a single-screen KivyMD application with a centered vertical layout for a personal portfolio, including a profile image, name, role description, biography, and footer.

gabrielmoreira/agent-skills-mirror

Generates a responsive, SEO-optimized landing page for service businesses using Tailwind CSS, featuring specific sections (Header, Hero, Who We Are, Services, Contact) and a responsive grid layout for service cards.

gabrielmoreira/agent-skills-mirror

Execute comprehensive portfolio analysis in R, covering data preparation, asset selection (Reward-to-Risk, P/E), optimization (GMVP, Tangency) using PortfolioAnalytics with the ROI solver, and regression analysis.

gabrielmoreira/agent-skills-mirror

Generate and rewrite marketing content for software services and portfolios. Adapts tone from professional agency to customer-centric, handles style mimicry, formatting constraints, and strictly manages perspective (e.g., removing first-person pronouns for portfolio contexts).

gabrielmoreira/agent-skills-mirror

When the user wants to design, deploy, or measure Apple Custom Product Pages (CPP) — the alternate App Store product pages with different screenshots, preview videos, and promo text shown to users coming from specific URLs (typically ad campaigns or social posts). Use when the user mentions "Custom Product Page", "CPP", "alternate product page", "App Store URL variant", "ASA CPP", "campaign-specific landing page", "product page per audience", "App Store Connect CPP", "ppoUrl", "?cpp=" parameter, or "show different screenshots to different ad audiences". For App Store A/B tests on the default page, see ab-test-store-listing. For paid ad campaigns that route to CPPs, see apple-search-ads or ua-campaign.

gabrielmoreira/agent-skills-mirror

Generate complete, deploy-ready landing pages from any repository. Use when creating a homepage for an open-source project, building a project website, converting a README into a marketing page, or standardizing landing pages across multiple repos.

gabrielmoreira/agent-skills-mirror

Shapes job-seeking personal sites: thirty-second hero, outcome-led case studies, hybrid home-plus-project routes, and frictionless contact CTAs, with heavy motion that degrades on mobile. Use for developer, designer, or creative portfolio work. Not a SaaS marketing landing page and not a WebGL engine tutorial.

相關技能