Communitygithub.com

ComeOnOliver/skillshub

為 Portfolio Buddy 2 開發自動載入的專案上下文。適用於任何涉及 React 19 開發、TypeScript、投資組合分析功能、指標計算、交易策略比較或處理 Portfolio Buddy 2 程式碼庫的任務。包含技術棧、已知問題與架構限制。

skillshub 是什麼?

這個技能會自動將 Portfolio Buddy 2 專案的完整上下文載入到 AI 代理的提示中,確保開發 AI 代理(例如 Claude Code、Cursor 或 Codex)始終掌握正確的技術棧、架構約束和已知的技術債務。它涵蓋了 React 19、TypeScript、Vite、Tailwind CSS、Chart.js、Supabase 和 Cloudflare Pages 等技術,並詳細說明了投資組合分析工具的主要功能,包括策略比較、相關性矩陣計算、風險指標分析和 CSV 上傳。技能文件中也明確記錄了三個違反 200 行限制的大型元件、15 個 `any` 類型違規,以及 Supabase 上傳錯誤等已知問題,這有助於 AI 代理在生成程式碼時避免引入新的技術債務。通過提供這些結構化信息,該技能能顯著提高開發效率,減少 AI 生成程式碼與專案實際需求之間的偏差。

相容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/ComeOnOliver/skillshub/tree/HEAD/skills/aiskillstore/marketplace/5minfutures/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 中添加了增強的錯誤處理
    • 檢查上傳 hook 中的錯誤處理
    • 確認免費版的行數限制未被超出

近期新增功能

  • 索提諾比率計算(提交 258ba3a、9f25040)
    • 位置:在 PortfolioSection.tsx(第 133–158 行)中內聯實現
    • 無風險利率輸入狀態,供用戶指定無風險利率
    • 使用 sqrt(365) 因子的年化下行標準差
    • 修正的變異數計算(除以總回報數,而不僅是負回報)
    • 在投資組合統計部分顯示(第 535 行)
    • 注意:不在 dataUtils.ts 中 – 由於投資組合級別的上下文而保留在元件中
  • 日期範圍過濾(提交 258ba3a)
    • 按開始/結束日期過濾投資組合數據
    • 在 usePortfolio hook 中實現
  • 進階多列排序(useSorting hook)
    • 按優先級對多列進行排序
    • 每列自定義比較邏輯

架構限制

  • 元件限制:每個元件最多 200 行(目前有 3 個元件違規)
  • Hook 模式:自定義 hooks 放置在 /src/hooks/
  • 工具函數模式:純函數放置在 /src/utils/
  • 型別安全:嚴格的 TypeScript,禁止使用 any 類型(目前有 15 處違規作為技術債務)
  • 狀態管理:僅使用純 React hooks – 不使用 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       完成 UI
│   ├── SortableHeader.tsx        帶排序指示器的表格標題列
│   ├── UploadedFilesList.tsx     已上傳文件列表
│   └── UploadSection.tsx         上傳文件至 Supabase
├── hooks/
│   ├── useContractMultipliers.ts 管理合約乘數
│   ├── useMetrics.ts             計算交易指標
│   ├── usePortfolio.ts           投資組合數據與日期過濾
│   └── useSorting.ts             進階多列排序
└── utils/
    └── dataUtils.ts              指標計算、CSV 解析、相關性分析

遷移上下文

正在從舊應用程式遷移 40 項功能(已完成 35/40)。詳情請參閱 migration-tracker 技能。

Individual skills in this repo

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

ComeOnOliver/skillshub

Create stunning, animation-rich HTML presentations from scratch or by converting PowerPoint files. Use when the user wants to build a presentation, convert a PPT/PPTX to web, or create slides for a talk/pitch. Helps non-designers discover their aesthetic through visual exploration rather than abstract choices.

ComeOnOliver/skillshub

Next.js 16+ 和 Turbopack — 增量打包、文件系统缓存、开发速度,以及何时使用 Turbopack 与 webpack。

ComeOnOliver/skillshub

SwiftUI architecture patterns, state management with @Observable, view composition, navigation, performance optimization, and modern iOS/macOS UI best practices.

ComeOnOliver/skillshub

See, Understand, Act on video and audio. See- ingest from local files, URLs, RTSP/live feeds, or live record desktop; return realtime context and playable stream links. Understand- extract frames, build visual/semantic/temporal indexes, and search moments with timestamps and auto-clips. Act- transcode and normalize (codec, fps, resolution, aspect ratio), perform timeline edits (subtitles, text/image overlays, branding, audio overlays, dubbing, translation), generate media assets (image, audio, video), and create real time alerts for events from live streams or desktop capture.

ComeOnOliver/skillshub

AI-assisted video editing workflows for cutting, structuring, and augmenting real footage. Covers the full pipeline from raw capture through FFmpeg, Remotion, ElevenLabs, fal.ai, and final polish in Descript or CapCut. Use when the user wants to edit video, cut footage, create vlogs, or build video content.

ComeOnOliver/skillshub

Next.js 15 애플리케이션을 위한 프론트엔드 개발 가이드라인. React 19, TypeScript, Shadcn/ui, Tailwind CSS를 사용한 모던 패턴. Server Components, Client Components, App Router, 파일 구조, Shadcn/ui 컴포넌트, 성능 최적화, TypeScript 모범 사례 포함. 컴포넌트, 페이지, 기능 생성, 데이터 페칭, 스타일링, 라우팅, 프론트엔드 코드 작업 시 사용.

ComeOnOliver/skillshub

Provides Tamagui patterns for config v4, compiler optimization, styled context, and cross-platform styling. Must use when working with Tamagui projects (tamagui.config.ts, @tamagui imports).

ComeOnOliver/skillshub

Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.

ComeOnOliver/skillshub

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.

ComeOnOliver/skillshub

Next.js development tooling via MCP. Inspect routes, components, build info, and debug Next.js apps. Use when working on Next.js applications, debugging routing, or inspecting app structure. NOT for general React or non-Next.js projects.

ComeOnOliver/skillshub

Implement UI using Shadcn MCP (atoms/theme) and 21st.dev MCP (complex sections). Use when adding buttons, layouts, or generating landing pages.

ComeOnOliver/skillshub

A conceptual skill for building an API client in Next.js that handles JWT tokens

ComeOnOliver/skillshub

Best practices and patterns for Next.js App Router, Server Actions, and Routing in this project.

ComeOnOliver/skillshub

The Design System, Theme, and UX rules for the Physical AI Hub.

ComeOnOliver/skillshub

Comprehensive frontend development skill for building modern, performant web applications using ReactJS, NextJS, TypeScript, Tailwind CSS. Includes component scaffolding, performance optimization, bundle analysis, and UI best practices. Use when developing frontend features, optimizing performance, implementing UI/UX designs, managing state, or reviewing frontend code.

ComeOnOliver/skillshub

This document captures learnings from fixing keyboard navigation issues when floating components (Select, DropdownMenu, Popover) have CSS open/close animations.

ComeOnOliver/skillshub

Build Next.js 16 applications with correct patterns and distinctive design. Use when creating pages, layouts, dynamic routes, upgrading from Next.js 15, or implementing proxy.ts. Covers breaking changes (async params/searchParams, Turbopack, cacheComponents) and frontend aesthetics. NOT when building non-React or backend-only applications.

ComeOnOliver/skillshub

Comprehensive Framer Motion animation library for React. Covers motion components, variants, gestures, page transitions, and scroll animations. Use when adding animations to React/Next.js applications.

ComeOnOliver/skillshub

Next.js 16+ uses App Router with Server Components by default. Client Components are only used when interactivity is needed (hooks, event handlers, browser APIs).

ComeOnOliver/skillshub

Build interfaces that resonate, not just render. This skill enforces bold, intentional

相關技能