Communitygithub.com

ComeOnOliver/skillshub

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

skillshub 是什么?

该技能为开发者提供了一套自动加载的完整项目上下文,专门用于 Portfolio Buddy 2 投资组合分析工具的开发和维护。它详细记录了项目的技术栈(包括 React 19、TypeScript、Vite、Tailwind CSS、Chart.js 和 Supabase)、项目目的(如交易策略对比、相关性矩阵计算、风险指标分析等)、已知问题与技术债务(例如未使用的依赖、超过 200 行限制的组件、TypeScript 'any' 类型的违规实例以及 Supabase 上传错误),以及近期新增功能(如 Sortino 比率计算、日期范围筛选和高级多列排序)。该技能支持在 Claude Code、Cursor 和 Codex 等 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 插件(缩放、注释、日期适配器)
  • 状态管理: 纯 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:1 处出现在 Metrics 接口中

已知错误

  1. Supabase 上传错误: 大文件上传时出现间歇性 500 错误
    • 在提交 9fb7fdb 中增强了错误处理
    • 检查上传 hooks 中的错误处理逻辑
    • 确认免费层的行数限制未被超出

最近新增功能

  • 索提诺比率计算(提交 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

相关技能