SkillAtlasSkill 详情

architecture-reference

This is the open-source content repository behind

审核状态:已审核Quality 80Security 88

复制安装命令

用 Codex 或 Claude 安装复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它先审查 Skill 页面再帮你安装。

复制前请先查看来源、License 和安全提示。

项目 README

来源文件:README.md

抓取于 2026年9月3日

Skill Store — Marketplace Repository

This is the open-source content repository behind Skill Store. It stores every approved Agent Skill, the records that go with it, and the automated security audits published with each skill.

This repo is a companion to the Skill Store platform, not the place to submit skills. Skills are added through skillstore.io — its review pipeline writes to this repo automatically. Please do not open a pull request here to add a skill; PRs adding skills will be closed. See Contributing a skill below.

Installing a skill

The recommended way to install any skill is the skillstore CLI — one command works for both Claude Code and Codex:

npx skillstore add author/skill-name

For example:

npx skillstore add aiskillstore/code-review

It downloads the skill and drops it into the right skills/ directory for your tool. Claude Code auto-discovers it; for Codex, restart the session.

Prefer to do it by hand, or installing via Claude Web? See the full Installation Guides for every method (CLI, manual, and ZIP upload) and the scope directories (~/.agents/skills/, .claude/skills/, ~/.claude/skills/, .codex/skills/, …).

Contributing a skill

Submit through the platform — not through a pull request:

  1. Go to skillstore.io/submit.
  2. Enter the GitHub repository URL that contains your SKILL.md.
  3. Your submission runs through automated security analysis.
  4. A maintainer reviews and approves it.
  5. On approval, the skill is published here and appears on skillstore.io.

What makes a valid skill

  • SKILL.md — the skill definition (required, per the Agent Skills spec)
  • Supporting files the skill references (optional)
  • LICENSE (recommended)

Security audit

Every submission is scanned automatically before it can be published. The audit flags things like:

  • Dangerous code patterns (eval, exec, raw system commands)
  • File access outside the project scope
  • Network calls to external hosts
  • Obfuscated or minified code
  • Credential / secret handling

Security analysis is report-only: findings inform maintainers and users, but a risk result does not automatically block an otherwise approved skill from being published. See our Security Trust Center for the methodology, limitations, and risk-level definitions.

Live Security Passport example:

Skillstore security

Repository layout

.
├── skills/        # Approved, published skills (one folder each, with SKILL.md)
├── pending/       # Submissions awaiting review
├── packages/
│   ├── cli/       # The `skillstore` CLI (npx skillstore add …)
│   └── skillstore/
├── schemas/       # JSON schemas for skill records
├── scripts/       # Maintenance & scoring scripts
└── .github/workflows/   # Submission, audit, and sync automation

The contents of this repo are maintained by Skill Store's automated pipeline. Manual changes are limited to maintainers.

Links

License

The marketplace catalog is MIT-licensed. Individual skills carry their own licenses — check each skill's LICENSE file.

数据与 AI

中风险

  • 来源需自行核对维护者身份。
  • 未检测到明显脚本安装指令。
  • 未检测到明显外部权限要求。
  • 未检测到高风险命令。
  • 扫描发现:1 条。

Codex — Git Clone 安装

  1. 安装前请先查看来源仓库和风险报告。
  2. 克隆仓库:git clone https://github.com/aiskillstore/marketplace.git
  3. 将 "skills/5minfutures/architecture-reference" 文件夹复制到 Codex 的 skills 目录中。
  4. 重启 Codex 让新的 skill 生效。

Codex — 手动复制安装

  1. 安装前请先查看来源仓库和风险报告。
  2. 从源仓库下载 SKILL.md 及相关文件。
  3. 在 Codex 的 skills 目录中创建新文件夹。
  4. 将所有 skill 文件复制到新文件夹中。
  5. 重启 Codex 让新的 skill 生效。

Claude Code — Git Clone 安装

  1. 安装前请先查看来源仓库和风险报告。
  2. 克隆仓库:git clone https://github.com/aiskillstore/marketplace.git
  3. 将 "skills/5minfutures/architecture-reference" 文件夹复制到 Claude Code 的 skills 目录中。
  4. 重启 Claude Code 让新的 skill 生效。

Claude Code — 手动复制安装

  1. 安装前请先查看来源仓库和风险报告。
  2. 从源仓库下载 SKILL.md 及相关文件。
  3. 在 Claude Code 的 skills 目录中创建新文件夹。
  4. 将所有 skill 文件复制到新文件夹中。
  5. 重启 Claude Code 让新的 skill 生效。

Cursor — Git Clone 安装

  1. 安装前请先查看来源仓库和风险报告。
  2. 克隆仓库:git clone https://github.com/aiskillstore/marketplace.git
  3. 将 "skills/5minfutures/architecture-reference" 文件夹复制到 Cursor 的 skills 目录中。
  4. 重启 Cursor 让新的 skill 生效。

Cursor — 手动复制安装

  1. 安装前请先查看来源仓库和风险报告。
  2. 从源仓库下载 SKILL.md 及相关文件。
  3. 在 Cursor 的 skills 目录中创建新文件夹。
  4. 将所有 skill 文件复制到新文件夹中。
  5. 重启 Cursor 让新的 skill 生效。

GitHub Copilot — Git Clone 安装

  1. 安装前请先查看来源仓库和风险报告。
  2. 克隆仓库:git clone https://github.com/aiskillstore/marketplace.git
  3. 将 "skills/5minfutures/architecture-reference" 文件夹复制到 GitHub Copilot 的 skills 目录中。
  4. 重启 GitHub Copilot 让新的 skill 生效。

GitHub Copilot — 手动复制安装

  1. 安装前请先查看来源仓库和风险报告。
  2. 从源仓库下载 SKILL.md 及相关文件。
  3. 在 GitHub Copilot 的 skills 目录中创建新文件夹。
  4. 将所有 skill 文件复制到新文件夹中。
  5. 重启 GitHub Copilot 让新的 skill 生效。

Windsurf — Git Clone 安装

  1. 安装前请先查看来源仓库和风险报告。
  2. 克隆仓库:git clone https://github.com/aiskillstore/marketplace.git
  3. 将 "skills/5minfutures/architecture-reference" 文件夹复制到 Windsurf 的 skills 目录中。
  4. 重启 Windsurf 让新的 skill 生效。

Windsurf — 手动复制安装

  1. 安装前请先查看来源仓库和风险报告。
  2. 从源仓库下载 SKILL.md 及相关文件。
  3. 在 Windsurf 的 skills 目录中创建新文件夹。
  4. 将所有 skill 文件复制到新文件夹中。
  5. 重启 Windsurf 让新的 skill 生效。
查看 SKILL.md 原文
name: architecture-reference
description: "Quick reference for Portfolio Buddy 2 project structure. Use when: adding new features, modifying existing components, understanding data flow, or onboarding to the codebase. Contains component hierarchy, hook patterns, and utility functions."

Portfolio Buddy 2 - Architecture Reference

Component Hierarchy

App.tsx (351 lines)
├── Header
│   └── App title and branding
├── UploadSection
│   ├── File upload to Supabase
│   ├── CSV parsing and validation
│   └── Error handling
├── ErrorList
│   └── Display parsing/validation errors
├── UploadedFilesList
│   └── List of successfully uploaded files
├── AnalyticsControls
│   ├── Toggle Metrics view
│   ├── Toggle Portfolio view
│   └── Toggle Correlation view
├── PortfolioSection (591 lines - NEEDS REFACTOR!)
│   ├── usePortfolio hook (date filtering)
│   ├── useContractMultipliers hook
│   ├── Chart.js equity curves
│   ├── Portfolio statistics
│   ├── ContractInput components
│   ├── MasterContractControl
│   └── MetricsTable integration
├── CorrelationSection
│   ├── CorrelationHeatmap (Chart.js)
│   ├── Spearman correlation
│   └── Pearson correlation
├── MetricsTable (242 lines)
│   ├── useMetrics hook
│   ├── useSorting hook (advanced multi-column)
│   ├── SortableHeader components
│   └── Selection state management
└── SessionComplete
    └── Completion UI/messaging

Key Hooks

useMetrics

Location: src/hooks/useMetrics.ts Purpose: Calculate trading metrics from uploaded portfolio data Features:

  • Calculates Sharpe Ratio, Sortino Ratio, Max Drawdown, CAGR, Win Rate, etc.
  • Memoized calculations for performance
  • Handles empty/invalid data gracefully

Usage:

const { metrics, isCalculating } = useMetrics(portfolioData, riskFreeRate)

Returns:

  • metrics: Array of calculated metrics per strategy
  • isCalculating: Boolean loading state

Note: Contains 4 TypeScript any violations in sort comparisons (tech debt)

usePortfolio

Location: src/hooks/usePortfolio.ts Purpose: Manage portfolio data with date range filtering Features:

  • Parses CSV trade data
  • Filters by date range (start/end date)
  • Builds equity curves
  • Aggregates daily returns

Usage:

const {
  portfolioData,
  filteredData,
  dateRange,
  setDateRange
} = usePortfolio(uploadedFiles)

Recent Addition: Date range filtering (commit 258ba3a)

Note: Contains 11 TypeScript any violations in trade/metrics types (tech debt)

useContractMultipliers

Location: src/hooks/useContractMultipliers.ts Purpose: Manage contract multipliers for futures trading Features:

  • Per-strategy contract size tracking
  • Apply multipliers to metrics
  • Master control to set all contracts at once

Usage:

const {
  multipliers,
  setMultiplier,
  setAllMultipliers,
  getAdjustedMetrics
} = useContractMultipliers(strategies)

useSorting

Location: src/hooks/useSorting.ts Purpose: Advanced multi-column sorting for MetricsTable Features:

  • Sort by multiple columns with priority
  • Toggle ascending/descending
  • Custom comparison logic per data type

Usage:

const {
  sortedData,
  sortColumn,
  sortDirection,
  handleSort
} = useSorting(data, defaultColumn)

Utility Functions

dataUtils.ts

Location: src/utils/dataUtils.ts Contains Core Functions:

CSV & Data Processing:

  • parseCSV(file) - Parse CSV file with PapaParse
  • processCurrencyColumns(data) - Clean currency values ($, commas)
  • parseFilenameComponents(filename) - Extract symbol/direction/strategy from filename
  • getDisplayName(symbol, direction, strategy) - Format display names
  • normalizeDate(date) - Normalize dates to midnight UTC
  • getDateKey(date) - Convert date to YYYY-MM-DD string key

Metric Calculations:

  • calculateMetrics(data, filename) - Calculate trade-level metrics for a strategy
    • Net Profit, Gross Profit/Loss
    • Profit Factor, Win Rate
    • Average Win/Loss, Expected Value
    • Max Drawdown (from equity curve)
    • CAGR equivalent (annualGrowthRate)
    • Total trades, winning/losing counts
    • Note: Does NOT calculate Sharpe or Sortino (those are in PortfolioSection.tsx)
  • getAdjustedMetrics(metrics, multiplier) - Apply contract multiplier to metrics

Risk-Adjusted Metrics (PortfolioSection.tsx):

  • Sharpe Ratio (line 533): Calculated inline as (annualGrowthRate / 100) / (maxDrawdown / startingCapital)
  • Sortino Ratio (lines 133-158): Calculated inline with downside deviation, uses risk-free rate state

Correlation Analysis:

  • buildCorrelationMatrix(strategies) - Build Spearman correlation matrix
  • calculatePearsonCorrelation(returns1, returns2) - Pearson correlation coefficient
  • calculateRanks(values) - Rank calculation for Spearman correlation

Trading Calculations:

  • getMarginRate(symbol) - Get margin requirements by symbol
  • calculateEquityCurve(trades) - Build cumulative equity curve
  • calculateDailyReturns(equity) - Calculate daily returns from equity curve

Formatting:

  • formatNumber(value, decimals) - Format numbers with decimals
  • formatCurrency(value) - Format as currency ($X,XXX.XX)
  • formatPercent(value) - Format as percentage (X.XX%)

Note: Contains 1 TypeScript any violation in Metrics interface (tech debt)

Data Flow

Upload & Processing Flow

1. User uploads CSV via UploadSection
   ↓
2. parseCSV() extracts trade data
   ↓
3. processCurrencyColumns() cleans data
   ↓
4. File uploaded to Supabase storage
   ↓
5. usePortfolio hook fetches and aggregates data
   ↓
6. Date range filter applied (if set)
   ↓
7. useMetrics calculates all metrics
   ↓
8. MetricsTable displays results

Contract Multiplier Flow

1. User inputs contract size in ContractInput
   ↓
2. useContractMultipliers stores value
   ↓
3. getAdjustedMetrics() applies multiplier
   ↓
4. Adjusted metrics shown in MetricsTable
   ↓
5. Portfolio charts update with adjusted values

Sorting Flow

1. User clicks SortableHeader
   ↓
2. useSorting updates sort column/direction
   ↓
3. Custom comparison logic applied
   ↓
4. MetricsTable re-renders with sorted data

Correlation Flow

1. User selects assets in MetricsTable
   ↓
2. Selection state passed to CorrelationSection
   ↓
3. buildCorrelationMatrix() calculates correlations
   ↓
4. CorrelationHeatmap renders Chart.js heatmap
   ↓
5. Spearman & Pearson correlations both shown

State Management

Plain React Hooks (No Zustand/TanStack Query)

  • Local component state → useState
  • Derived state → useMemo
  • Stable callbacks → useCallback
  • Refs for values → useRef

Example Pattern:

const [data, setData] = useState<Trade[]>([])
const metrics = useMemo(() => calculateMetrics(data), [data])
const handleUpload = useCallback((file: File) => {
  // upload logic
}, [])

No Global State Library

  • Props passed down component tree
  • Custom hooks encapsulate shared logic
  • No Redux, Zustand, or Jotai

Adding New Features

New Metric Calculation

  1. Add calculation logic to dataUtils.calculateMetrics()
  2. Update return type in calculateMetrics()
  3. Add column to MetricsTable.tsx
  4. Update sort logic in useSorting.ts if needed
  5. Test with sample data

Example: Sortino Ratio was added in commits 258ba3a & 9f25040

New Chart Component

  1. Create component in src/components/
  2. Use Chart.js (NOT Recharts - it's unused)
  3. Import chart type and plugins needed:
    import { Line } from 'react-chartjs-2'
    import { Chart, registerables } from 'chart.js'
    import zoomPlugin from 'chartjs-plugin-zoom'
    
  4. Hook into useMetrics or usePortfolio for data
  5. Add to appropriate section in App.tsx

New Hook

  1. Create in src/hooks/use[Feature].ts
  2. Follow naming convention: use prefix, camelCase
  3. Return object with clear property names
  4. Use TypeScript for all types (avoid any)
  5. Add JSDoc comments for complex logic

Chart.js Architecture

Current Setup

  • Library: Chart.js 4.x (NOT Recharts)
  • React Wrapper: react-chartjs-2
  • Plugins Used:
    • chartjs-plugin-zoom (pan & zoom)
    • chartjs-plugin-annotation (trend lines, markers)
    • chartjs-adapter-date-fns (time scales)

Where Charts Are Used

  1. PortfolioSection: Equity curve line charts
  2. CorrelationHeatmap: Correlation matrix heatmap
  3. CustomTooltip: Shared tooltip component for charts

Recharts Note

⚠️ Recharts is installed but NEVER imported - should be removed (11.5KB waste)

Component Size Guidelines

Target: 200 Lines Max

Current Violations:

  • ❌ PortfolioSection.tsx: 591 lines (295% of limit) - HIGH PRIORITY REFACTOR
  • ❌ App.tsx: 351 lines (175% of limit)
  • ❌ MetricsTable.tsx: 242 lines (121% of limit) - improved from 350

Refactoring Strategy

For PortfolioSection (591 lines):

  1. Extract equity chart into EquityChartSection.tsx
  2. Extract statistics into PortfolioStats.tsx
  3. Extract contract controls into ContractControls.tsx
  4. Keep only orchestration logic in main component

TypeScript Patterns

Interfaces for Data Structures

interface Trade {
  date: Date
  symbol: string
  pnl: number
  // ...
}

interface Metric {
  name: string
  sharpe: number
  sortino: number
  // ...
}

Avoid any Types

Current violations (15 total) - see portfolio-context skill for details

Preferred approach:

// Bad
const data: any = parseData()

// Good
interface ParsedData {
  trades: Trade[]
  errors: string[]
}
const data: ParsedData = parseData()

Performance Patterns

Memoization with useMemo

// Expensive correlation calculation
const correlationMatrix = useMemo(
  () => buildCorrelationMatrix(selectedStrategies),
  [selectedStrategies]
)

Stable Callbacks with useCallback

const handleSort = useCallback((column: string) => {
  setSortColumn(column)
  setSortDirection(prev => prev === 'asc' ? 'desc' : 'asc')
}, [])

Avoid Premature Optimization

  • Build features first
  • Profile if performance issues arise
  • Optimize based on data, not assumptions

发现问题?提交给管理员复核

评分:

评论 (0)

暂无评论,成为第一个评论者吧!