Communitygithub.com

bg-szy/TOP-SKILLS

Portfolio Buddy 2 开发的自动加载上下文。适用于任何涉及 React 19 开发、TypeScript、投资组合分析功能、指标计算、交易策略比较或处理 Portfolio Buddy 2 代码库的任务。包含技术栈、已知问题和架构约束。

TOP-SKILLS 是什么?

此技能为开发 Portfolio Buddy 2(一款面向投资者和期货交易者的投资组合分析工具)提供全面的项目上下文。它详细说明了技术栈,包括 React 19、TypeScript、Vite、Tailwind CSS、Chart.js 和 Supabase,以及部署在 Cloudflare Pages 上。该技能作为自动加载的上下文,指导 AI 助手处理任何任务,确保它们遵守架构约束,例如组件大小限制为 200 行、使用纯 React Hooks 进行状态管理以及严格的 TypeScript 类型安全(无 any 类型)。它还记录了已知的技术债务,例如三个组件超出大小限制以及 15 个 TypeScript 违规行为,以及间歇性 Supabase 上传错误等已知错误,使 AI 能够主动解决这些问题。该技能突出显示了近期添加的功能,例如 Sortino 比率计算和日期范围过滤,并提供了关键组件和约定的清晰结构,使其成为在 IDE(如 Cursor 或 Claude Code)中与 Portfolio Buddy 2 代码库交互的任何人的必备上下文。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/bg-szy/TOP-SKILLS/tree/HEAD/skills/marketplace/portfolio-context

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

Portfolio Buddy 2 - 项目上下文

技术栈

  • 前端: React 19, TypeScript, Vite
  • UI: Tailwind CSS, shadcn/ui (仅颜色系统)
  • 图表: Chart.js, react-chartjs-2, chartjs 插件 (zoom, annotation, date adapter)
  • 状态管理: 纯 React (useState, useMemo, useCallback)
  • 数据处理: date-fns 用于日期操作
  • 后端: Supabase (PostgreSQL)
  • 部署: Cloudflare Pages

项目目标

面向投资者和期货交易者的投资组合分析工具,用于:

  • 比较交易策略与基准资产 (SPY, GLD)
  • 计算资产间的相关性矩阵 (Spearman 和 Pearson)
  • 分析风险指标和绩效 (夏普比率、索提诺比率、最大回撤等)
  • 通过 CSV 上传交易数据并可视化结果
  • 应用合约乘数调整期货交易的指标
  • 按日期范围筛选数据以进行特定时期分析

已知问题与技术债务

当前技术债务

  1. 未使用的依赖: Recharts (11.5KB) 已安装但从未导入

    • 应从 package.json 中移除
    • 当前使用 Chart.js 替代
  2. 组件过大: 违反 200 行标准

    • PortfolioSection.tsx (591 行) → 需要重构为子组件
    • App.tsx (351 行) → 将部分提取到组件中
    • MetricsTable.tsx (242 行) → 已改进但仍超限
  3. TypeScript 违规: 15 处使用了 any 类型

    • usePortfolio.ts: 交易/指标类型中出现 11 次
    • useMetrics.ts: 排序比较中出现 4 次
    • dataUtils.ts: Metrics 接口中出现 1 次

已知错误

  1. Supabase 上传错误: 大文件上传时偶发 500 错误
    • 在提交 9fb7fdb 中增强了错误处理
    • 检查上传钩子中的错误处理
    • 验证免费套餐的行限制是否未超出

近期新增功能

  • 索提诺比率计算 (提交 258ba3a, 9f25040)
    • 位置: 在 PortfolioSection.tsx 中内联实现 (第 133-158 行)
    • 用户指定的无风险利率输入状态
    • 使用 sqrt(365) 因子计算年化下行偏差
    • 修正了方差计算 (除以总回报数,而不仅仅是负回报)
    • 显示在投资组合统计部分 (第 535 行)
    • 注意: 不在 dataUtils.ts 中 - 由于投资组合级别的上下文而保留在组件中
  • 日期范围过滤 (提交 258ba3a)
    • 按开始/结束日期过滤投资组合数据
    • 在 usePortfolio 钩子中实现
  • 高级多列排序 (useSorting 钩子)
    • 按多个列排序并设置优先级
    • 每列的自定义比较逻辑

架构约束

  • 组件限制: 每个组件最多 200 行 (当前有 3 个组件违反)
  • 钩子模式: 自定义钩子位于 /src/hooks/
  • 工具模式: 纯函数位于 /src/utils/
  • 类型安全: 严格 TypeScript,无 any 类型 (技术债务中存在 15 处违规)
  • 状态管理: 仅使用纯 React 钩子 - 无 Zustand 或 TanStack Query

关键组件结构

src/
├── components/
│   ├── AnalyticsControls.tsx     (切换 Metrics/Portfolio/Correlation 视图)
│   ├── ContractInput.tsx         (合约乘数输入)
│   ├── CorrelationHeatmap.tsx    (相关性热力图)
│   ├── CorrelationSection.tsx    (相关性分析包装器)
│   ├── CustomTooltip.tsx         (图表提示框)
│   ├── ErrorList.tsx             (错误显示)
│   ├── Header.tsx                (应用头部)
│   ├── MasterContractControl.tsx (将合约值应用于所有)
│   ├── MetricsTable.tsx          (指标显示与选择)
│   ├── PortfolioSection.tsx      (投资组合图表与分析 - 591 行!)
│   ├── SessionComplete.tsx       (完成界面)
│   ├── SortableHeader.tsx        (带排序指示器的表头)
│   ├── UploadedFilesList.tsx     (已上传文件列表)
│   └── UploadSection.tsx         (文件上传到 Supabase)
├── hooks/
│   ├── useContractMultipliers.ts (管理合约乘数)
│   ├── useMetrics.ts             (计算交易指标)
│   ├── usePortfolio.ts           (投资组合数据和日期过滤)
│   └── useSorting.ts             (高级多列排序)
└── utils/
    └── dataUtils.ts              (指标计算、CSV 解析、相关性)

关键约定

  • 路径别名: @/ 映射到 src/ — 在所有内部导入中使用
  • shadcn-ui: 仅颜色令牌 — CSS 变量位于 src/index.css 中,未安装实际的 shadcn 组件。后续可通过 npx shadcn@latest add button 等命令添加
  • Git 工作流: 功能分支 → git checkout -b feature/name → 约定式提交 (feat:、fix:、chore:) → 向 main 发起 PR
  • 社区品牌: 5minfutures.com 交易社区;资产中的 Skool 徽标;嵌入的 GoHighLevel 表单

迁移上下文

从旧应用迁移 40 个功能 (已完成 90%)。详情请参考 migration-tracker 技能。

Individual skills in this repo

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

bg-szy/TOP-SKILLS

Brand-first landing page designer — runs a brand-identity interview (colors, typography, shape language), then generates and iterates on a polished landing page via Stitch with deployment-ready HTML. Use when the user asks to create, design, or build a landing page, homepage, or marketing page and has no established visual direction. Skip when they have a design mockup, need a dashboard or app UI, are working at component level, building a multi-page app, or restyling with known design tokens — use frontend-design instead.

bg-szy/TOP-SKILLS

Fill out Microsoft Azure Landing Zone (ALZ) Accelerator checklists by interviewing the user, mapping their Azure subscriptions, integrating IP addressing documentation, and applying Microsoft Cloud Adoption Framework best practices. Produces a completed Excel checklist (.xlsx) ready for ALZ deployment. Use this skill whenever the user mentions Azure Landing Zone, ALZ checklist, landing zone accelerator, platform landing zone configuration, ALZ bootstrap, hub-and-spoke setup, Azure network topology planning, or wants to fill out any ALZ-related checklist or configuration file. Also trigger when the user uploads an Excel file that contains tabs like "Accelerator - Bootstrap", "Accelerator - Bicep", or "Accelerator - Terraform".

bg-szy/TOP-SKILLS

Compose a premium, animated landing page section by section in Next.js + Tailwind + Motion (Framer Motion) — built on a real design system, with editorial copy and motion that feels human-crafted, not template-generated. Use when building or rebuilding a landing page, marketing site, or hero/feature/pricing/CTA sections that need to look production-ready and bespoke from day one.

bg-szy/TOP-SKILLS

Write high-converting landing page copy using proven frameworks like PAS (Problem-Agitate-Solution), AIDA, and StoryBrand. Creates headlines, value propositions, CTAs, and full page sections optimized for conversion. Use when users need landing page copy, sales page content, or marketing website text.

bg-szy/TOP-SKILLS

Optimize landing pages for conversions, performance, and SEO. Use when improving landing pages, increasing conversions, or optimizing page performance.

bg-szy/TOP-SKILLS

Review investment portfolios for risk, diversification, fees. Asset allocation recommendations, tax-loss harvesting, rebalancing.

bg-szy/TOP-SKILLS

Beads Viewer - Graph-aware triage engine for Beads projects. Computes PageRank, betweenness, critical path, and cycles. Use --robot-* flags for AI agents.

bg-szy/TOP-SKILLS

CI red? Call us. Pipeline fire brigade deploys. Use when user mentions CI failures, build errors, test failures, or pipeline issues. Do NOT load for: local builds, standard implementation work, reviews, or setup.

bg-szy/TOP-SKILLS

CASS Memory System - procedural memory for AI coding agents. Three-layer cognitive architecture with confidence decay, anti-pattern learning, cross-agent knowledge transfer, trauma guard safety system. Bun/TypeScript CLI.

bg-szy/TOP-SKILLS

Mandatory entry point: read this first for any request to make, create, edit, animate, or render a video, animation, or motion graphic, including a promo, explainer, captioned clip, title card, overlay, slideshow or interactive deck, Remotion port, or any HyperFrames HTML composition. Also use it to inspect, diagnose, validate, preview, publish, or batch-render an existing HyperFrames project. Inputs may be a website URL, GitHub PR, Figma design or URL, text or brief, existing footage, or music. It resumes project state, captures intent when applicable, selects and installs the owning workflow, and routes domain capabilities. HyperFrames is the default output framework unless the user explicitly chooses another framework for the deliverable or asks only to record a browser session.

bg-szy/TOP-SKILLS

Expert in building portfolios that actually land jobs and clients - not just showing work, but creating memorable experiences. Covers developer portfolios, designer portfolios, creative portfolios, and portfolios that convert visitors into opportunities.

bg-szy/TOP-SKILLS

Use when the user asks to "pre-launch check the landing page", "run a Quality-Score preflight", or "verify ad-to-page message match before launch"; produces an ad↔page continuity report — message-match gaps, above-the-fold check, page-speed read, form-friction count, mobile-render flags — as a pass/fix punch list. Not for redesigning or rewriting the page — use landing-optimizer; not for scoring the account or the RQS — use ad-account-auditor. 落地页体验预检/广告落地页一致性检查

bg-szy/TOP-SKILLS

Use when the user asks to "optimize our landing page for influencer traffic", "fix our promo-code landing page", or "improve conversion from a creator campaign"; produces a message-match audit, page-structure and social-proof recommendations, a promo-code/CTA conversion plan, and an A/B test roadmap. Not for measuring campaign results after launch — use performance-analyzer.

bg-szy/TOP-SKILLS

Audit a landing page, sales page or checkout page for conversion leaks and return a fix list ordered by expected revenue impact. Use when asked to review, critique or improve a landing page, sales page, opt-in page, product page or checkout flow, when conversion rate is low, when paid traffic is not converting, or when someone asks "why isn't this page converting" or wants a CRO / landing page review.

bg-szy/TOP-SKILLS

Landing page conversion optimization with layout rules, hero section design, and CTA psychology. Covers above-the-fold formula, social proof placement, mobile design, and F-pattern reading. Use for: startup landing pages, product pages, SaaS marketing, conversion optimization. Triggers: landing page, hero section, above the fold, conversion optimization, landing page design, cta button, hero image, landing page layout, saas landing page, product page design, conversion rate, landing page best practices

bg-szy/TOP-SKILLS

Create high-converting, visually distinctive landing pages. Use when building marketing pages, product launches, SaaS homepages, or any single-page conversion-focused website. Guides section-by-section composition with anti-AI-slop principles.

bg-szy/TOP-SKILLS

Landing page conversion optimization with layout rules, hero section design, and CTA psychology. Covers above-the-fold formula, social proof placement, mobile design, and F-pattern reading. Use for: startup landing pages, product pages, SaaS marketing, conversion optimization. Triggers: landing page, hero section, above the fold, conversion optimization, landing page design, cta button, hero image, landing page layout, saas landing page, product page design, conversion rate, landing page best practices

bg-szy/TOP-SKILLS

Account assets, equity and fund positions, P&L, cash flow records, account statements, margin ratios, buy-power estimates, order management, and DCA recurring investments via Longbridge (most require Trade permission). Frameworks: portfolio diagnosis, rebalancing, asset allocation, risk analysis (VaR/CVaR), performance attribution, and tax-loss harvesting. Triggers: "持仓", "账户", "盈亏", "资产", "对账单", "下单", "买入", "卖出", "撤单", "定投", "组合诊断", "再平衡", "资产配置", "风险分析", "绩效归因", "税损收割", "持倉", "賬戶", "盈虧", "對賬單", "下單", "買入", "賣出", "組合診斷", "再平衡", "稅損收割", "positions", "portfolio", "P&L", "order", "buy", "sell", "DCA", "statement", "risk analysis", "rebalancing", "tax harvesting", "我的风险", "持仓风险", "风险敞口", "資產", "資產配置", "風險分析", "績效歸因", "撤單

bg-szy/TOP-SKILLS

Process video files with audio extraction, format conversion (mp4, webm), and Whisper transcription. Use when user mentions video conversion, audio extraction, transcription, mp4, webm, ffmpeg, or whisper transcription.

bg-szy/TOP-SKILLS

Using the Wonda CLI to generate images, videos, music, and audio from the terminal — plus LinkedIn, Reddit, and X/Twitter research and automation

相关技能