tradeblocks-mcp 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/README.md +246 -0
  2. package/agent-skills/INSTALL.md +240 -0
  3. package/agent-skills/README.md +115 -0
  4. package/agent-skills/index.json +16 -0
  5. package/agent-skills/install.ps1 +77 -0
  6. package/agent-skills/install.sh +63 -0
  7. package/agent-skills/optionomega-backtesting.md +285 -0
  8. package/agent-skills/tradeblocks-compare/SKILL.md +148 -0
  9. package/agent-skills/tradeblocks-compare/references/scaling.md +169 -0
  10. package/agent-skills/tradeblocks-health-check/SKILL.md +118 -0
  11. package/agent-skills/tradeblocks-health-check/references/metrics.md +185 -0
  12. package/agent-skills/tradeblocks-optimize/SKILL.md +208 -0
  13. package/agent-skills/tradeblocks-optimize/references/optimization.md +246 -0
  14. package/agent-skills/tradeblocks-portfolio/SKILL.md +170 -0
  15. package/agent-skills/tradeblocks-portfolio/references/correlation.md +168 -0
  16. package/agent-skills/tradeblocks-portfolio/references/diversification.md +216 -0
  17. package/agent-skills/tradeblocks-risk/SKILL.md +162 -0
  18. package/agent-skills/tradeblocks-risk/references/kelly-guide.md +246 -0
  19. package/agent-skills/tradeblocks-risk/references/tail-risk.md +246 -0
  20. package/agent-skills/tradeblocks-wfa/SKILL.md +153 -0
  21. package/agent-skills/tradeblocks-wfa/references/wfa-guide.md +230 -0
  22. package/dist/skill-installer.d.ts +65 -0
  23. package/dist/skill-installer.js +127 -0
  24. package/dist/skill-installer.js.map +1 -0
  25. package/dist/test-exports.js +694 -0
  26. package/dist/test-exports.js.map +1 -0
  27. package/manifest.json +91 -0
  28. package/package.json +54 -0
  29. package/server/index.d.ts +2 -0
  30. package/server/index.js +57369 -0
  31. package/server/index.js.map +1 -0
package/README.md ADDED
@@ -0,0 +1,246 @@
1
+ # TradeBlocks MCP Server
2
+
3
+ Model Context Protocol (MCP) server for options trading analysis. Provides programmatic access to backtest statistics, walk-forward analysis, Monte Carlo simulations, and risk metrics.
4
+
5
+ ## Features
6
+
7
+ - **19 MCP tools** for comprehensive trading analysis
8
+ - **Block-based data organization** - each folder is a trading strategy
9
+ - **Automatic caching** - statistics cached in `.block.json` for fast access
10
+ - **Flexible CSV detection** - auto-detects file types by column headers
11
+ - **Cross-platform** - works with Claude, Codex CLI, Gemini CLI, and any MCP client
12
+
13
+ ## Installation
14
+
15
+ ### Option 1: MCPB Bundle (Claude Desktop - One Click)
16
+
17
+ Download the latest `.mcpb` file from [GitHub Releases](https://github.com/davidromeo/tradeblocks/releases) and double-click to install.
18
+
19
+ The installer will prompt you to select your Trading Data Directory.
20
+
21
+ ### Option 2: npx (Claude Desktop / Claude Code)
22
+
23
+ Run directly without installation:
24
+
25
+ ```bash
26
+ npx tradeblocks-mcp ~/Trading/backtests
27
+ ```
28
+
29
+ For Claude Desktop, add to your config file:
30
+
31
+ ```json
32
+ {
33
+ "mcpServers": {
34
+ "tradeblocks": {
35
+ "command": "npx",
36
+ "args": ["tradeblocks-mcp", "/path/to/your/backtests"]
37
+ }
38
+ }
39
+ }
40
+ ```
41
+
42
+ ### Option 3: From Source
43
+
44
+ ```bash
45
+ git clone https://github.com/davidromeo/tradeblocks
46
+ cd tradeblocks
47
+ npm install
48
+ npm run build -w packages/mcp-server
49
+
50
+ # Run the server
51
+ node packages/mcp-server/server/index.js ~/Trading/backtests
52
+ ```
53
+
54
+ ## Quick Start
55
+
56
+ 1. **Set up your data** - Create folders for each strategy with CSV files
57
+ 2. **Connect Claude** - Install via MCPB or configure manually
58
+ 3. **Start analyzing** - Ask Claude to "list my backtests" or "run a health check on iron-condor"
59
+
60
+ For detailed usage examples, see [docs/USAGE.md](docs/USAGE.md).
61
+
62
+ ## Configuration by Platform
63
+
64
+ ### Claude Desktop
65
+
66
+ | Platform | Config Location |
67
+ |----------|-----------------|
68
+ | macOS | `~/Library/Application Support/Claude/claude_desktop_config.json` |
69
+ | Windows | `%APPDATA%\Claude\claude_desktop_config.json` |
70
+ | Linux | `~/.config/Claude/claude_desktop_config.json` |
71
+
72
+ ```json
73
+ {
74
+ "mcpServers": {
75
+ "tradeblocks": {
76
+ "command": "npx",
77
+ "args": ["tradeblocks-mcp", "/path/to/your/backtests"]
78
+ }
79
+ }
80
+ }
81
+ ```
82
+
83
+ ### Claude Code (CLI)
84
+
85
+ ```bash
86
+ # Add the MCP server
87
+ claude mcp add tradeblocks -- npx tradeblocks-mcp ~/Trading/backtests
88
+
89
+ # Or with environment variable
90
+ export BLOCKS_DIRECTORY=~/Trading/backtests
91
+ claude mcp add tradeblocks -- npx tradeblocks-mcp
92
+ ```
93
+
94
+ ### OpenAI Codex CLI
95
+
96
+ Add to `~/.codex/config.toml`:
97
+
98
+ ```toml
99
+ [mcp_servers.tradeblocks]
100
+ command = "npx"
101
+ args = ["tradeblocks-mcp", "/path/to/your/backtests"]
102
+ ```
103
+
104
+ Or add via command line:
105
+
106
+ ```bash
107
+ codex mcp add tradeblocks -- npx tradeblocks-mcp ~/Trading/backtests
108
+ ```
109
+
110
+ See [Codex MCP documentation](https://developers.openai.com/codex/mcp/) for more options.
111
+
112
+ ### Gemini CLI
113
+
114
+ Add to `~/.gemini/settings.json`:
115
+
116
+ ```json
117
+ {
118
+ "mcpServers": {
119
+ "tradeblocks": {
120
+ "command": "npx",
121
+ "args": ["tradeblocks-mcp", "/path/to/your/backtests"]
122
+ }
123
+ }
124
+ }
125
+ ```
126
+
127
+ See [Gemini CLI MCP documentation](https://geminicli.com/docs/tools/mcp-server/) for more options.
128
+
129
+ ## Agent Skills
130
+
131
+ For guided conversational workflows, install the bundled agent skills:
132
+
133
+ ```bash
134
+ # Install skills to Claude Code
135
+ tradeblocks-mcp install-skills
136
+
137
+ # Install to other platforms
138
+ tradeblocks-mcp install-skills --platform codex
139
+ tradeblocks-mcp install-skills --platform gemini
140
+
141
+ # Check installation status
142
+ tradeblocks-mcp check-skills
143
+
144
+ # Remove skills
145
+ tradeblocks-mcp uninstall-skills
146
+ ```
147
+
148
+ Skills provide structured prompts for tasks like:
149
+ - Strategy health checks
150
+ - Walk-forward analysis interpretation
151
+ - Portfolio addition recommendations
152
+ - Correlation analysis
153
+
154
+ See [Agent Skills README](../agent-skills/README.md) for details.
155
+
156
+ ## Block Directory Structure
157
+
158
+ Each folder in your blocks directory represents a trading strategy:
159
+
160
+ ```
161
+ backtests/
162
+ SPX-Iron-Condor/
163
+ tradelog.csv # Required - trade history
164
+ dailylog.csv # Optional - daily portfolio values
165
+ reportinglog.csv # Optional - live/reported trades
166
+ .block.json # Auto-generated - cached metadata
167
+ NDX-Put-Spread/
168
+ my-export.csv # Works! Auto-detected by columns
169
+ ...
170
+ ```
171
+
172
+ ### CSV Formats
173
+
174
+ **tradelog.csv** - Trade records with these key columns:
175
+ - Date Opened, Time Opened, Date Closed, Time Closed
176
+ - P/L (gross profit/loss)
177
+ - Strategy, Legs (or Symbol)
178
+ - No. of Contracts, Premium (optional)
179
+
180
+ **dailylog.csv** - Daily portfolio values:
181
+ - Date
182
+ - Net Liquidity (or Portfolio Value, Equity)
183
+ - P/L, Drawdown % (optional)
184
+
185
+ **Flexible Detection**: Files don't need standard names. The server detects CSV types by examining column headers (ISS-006).
186
+
187
+ ## Available Tools
188
+
189
+ ### Core Tools
190
+ | Tool | Description |
191
+ |------|-------------|
192
+ | `list_backtests` | List all available blocks |
193
+ | `get_statistics` | Performance metrics (Sharpe, Sortino, drawdown, etc.) |
194
+ | `get_trades` | Raw trade data with optional filters |
195
+ | `reprocess_block` | Re-parse CSVs and recalculate statistics |
196
+
197
+ ### Analysis Tools
198
+ | Tool | Description |
199
+ |------|-------------|
200
+ | `run_walk_forward` | Walk-forward analysis with configurable windows |
201
+ | `run_monte_carlo` | Monte Carlo simulation with worst-case scenarios |
202
+ | `calculate_correlation` | Strategy correlation matrix (Kendall's tau) |
203
+ | `get_tail_risk` | VaR, CVaR, and max drawdown analysis |
204
+ | `calculate_position_sizing` | Kelly criterion position sizing |
205
+
206
+ ### Performance Tools
207
+ | Tool | Description |
208
+ |------|-------------|
209
+ | `get_performance_charts` | 16 chart types (equity, drawdown, distribution) |
210
+ | `get_period_returns` | Returns aggregated by time period |
211
+ | `compare_backtest_vs_actual` | Backtest vs live performance comparison |
212
+
213
+ ### Report Builder Tools
214
+ | Tool | Description |
215
+ |------|-------------|
216
+ | `list_available_fields` | List filterable trade fields |
217
+ | `run_filtered_query` | Query trades with custom filters |
218
+ | `get_field_statistics` | Statistics for a specific field |
219
+ | `aggregate_by_field` | Group and aggregate by field values |
220
+
221
+ ### Import Tools
222
+ | Tool | Description |
223
+ |------|-------------|
224
+ | `import_csv` | Import a CSV file as a new block *(CLI only - not available in Claude Desktop)* |
225
+
226
+ ## Development
227
+
228
+ ```bash
229
+ # Watch mode
230
+ npm run dev
231
+
232
+ # Build
233
+ npm run build
234
+
235
+ # Run tests
236
+ npm test
237
+
238
+ # Pack MCPB bundle
239
+ npm run mcpb:pack
240
+ ```
241
+
242
+ ## Related
243
+
244
+ - [Usage Guide](docs/USAGE.md) - Detailed usage examples and workflows
245
+ - [Agent Skills](../agent-skills/README.md) - Conversational workflows for guided analysis
246
+ - [Main Application](../../README.md) - Web-based UI for TradeBlocks
@@ -0,0 +1,240 @@
1
+ # TradeBlocks Skills Installation Guide
2
+
3
+ This guide covers installation of TradeBlocks skills for all supported AI agent platforms.
4
+
5
+ ## Prerequisites
6
+
7
+ Before installing skills, ensure you have:
8
+
9
+ 1. **Node.js 18+** installed
10
+ 2. **TradeBlocks MCP server** built and configured
11
+ 3. **At least one block directory** with trade data
12
+
13
+ ### Verify MCP Server
14
+
15
+ ```bash
16
+ # Build the MCP server (if not already done)
17
+ cd packages/mcp-server
18
+ npm install
19
+ npm run build
20
+
21
+ # Set blocks directory environment variable
22
+ export TRADEBLOCKS_BLOCKS_DIR=/path/to/your/blocks
23
+ ```
24
+
25
+ ## Claude Code Installation
26
+
27
+ Claude Code supports skills in two locations:
28
+
29
+ ### Option A: Personal Installation (Recommended)
30
+
31
+ Skills in `~/.claude/skills/` are available in all projects:
32
+
33
+ ```bash
34
+ # Create skills directory if it doesn't exist
35
+ mkdir -p ~/.claude/skills
36
+
37
+ # Symlink all TradeBlocks skills
38
+ ln -s /path/to/tradeblocks/packages/agent-skills/tradeblocks-* ~/.claude/skills/
39
+ ```
40
+
41
+ Or use the installation script:
42
+
43
+ ```bash
44
+ cd /path/to/tradeblocks/packages/agent-skills
45
+ ./install.sh claude
46
+ ```
47
+
48
+ ### Option B: Project Installation
49
+
50
+ Skills in `.claude/skills/` (project root) are shared with your team via git:
51
+
52
+ ```bash
53
+ # From your project root
54
+ mkdir -p .claude/skills
55
+ ln -s /path/to/tradeblocks/packages/agent-skills/tradeblocks-* .claude/skills/
56
+ ```
57
+
58
+ ### Verification
59
+
60
+ Ask Claude: "What skills are available?"
61
+
62
+ Or check directly:
63
+
64
+ ```bash
65
+ ls -la ~/.claude/skills/
66
+ ```
67
+
68
+ You should see symlinks for all 6 TradeBlocks skills.
69
+
70
+ ### Debug Mode
71
+
72
+ If skills aren't loading, run Claude with debug output:
73
+
74
+ ```bash
75
+ claude --debug
76
+ ```
77
+
78
+ Look for skill loading messages in the output.
79
+
80
+ ## Codex CLI Installation
81
+
82
+ Codex CLI uses a similar skills directory structure:
83
+
84
+ ```bash
85
+ # Create skills directory
86
+ mkdir -p ~/.codex/skills
87
+
88
+ # Symlink all TradeBlocks skills
89
+ ln -s /path/to/tradeblocks/packages/agent-skills/tradeblocks-* ~/.codex/skills/
90
+ ```
91
+
92
+ Or use the installation script:
93
+
94
+ ```bash
95
+ ./install.sh codex
96
+ ```
97
+
98
+ **Note:** Codex may use different syntax to invoke skills. Consult Codex documentation for the current activation method.
99
+
100
+ ## Gemini CLI Installation
101
+
102
+ Gemini CLI follows the same pattern:
103
+
104
+ ```bash
105
+ # Create skills directory
106
+ mkdir -p ~/.gemini/skills
107
+
108
+ # Symlink all TradeBlocks skills
109
+ ln -s /path/to/tradeblocks/packages/agent-skills/tradeblocks-* ~/.gemini/skills/
110
+ ```
111
+
112
+ Or use the installation script:
113
+
114
+ ```bash
115
+ ./install.sh gemini
116
+ ```
117
+
118
+ **Note:** Gemini may use different syntax to invoke skills. Consult Gemini documentation for the current activation method.
119
+
120
+ ## All Platforms at Once
121
+
122
+ To install to all platforms:
123
+
124
+ ```bash
125
+ ./install.sh all
126
+ ```
127
+
128
+ ## Troubleshooting
129
+
130
+ ### "Skill not found"
131
+
132
+ 1. Verify the skill directory exists:
133
+ ```bash
134
+ ls ~/.claude/skills/tradeblocks-health-check/SKILL.md
135
+ ```
136
+
137
+ 2. Check that SKILL.md has valid YAML frontmatter (must start on line 1):
138
+ ```yaml
139
+ ---
140
+ name: tradeblocks-health-check
141
+ description: ...
142
+ ---
143
+ ```
144
+
145
+ 3. Ensure no tabs in YAML (use spaces only)
146
+
147
+ ### "Tool not found" during skill execution
148
+
149
+ The skill invokes MCP tools but the server isn't available:
150
+
151
+ 1. Verify MCP server is built:
152
+ ```bash
153
+ ls packages/mcp-server/dist/index.js
154
+ ```
155
+
156
+ 2. Check MCP server configuration in your agent settings
157
+
158
+ 3. Verify `TRADEBLOCKS_BLOCKS_DIR` is set correctly
159
+
160
+ ### YAML Parsing Errors
161
+
162
+ - Frontmatter must start on line 1 (no blank lines before `---`)
163
+ - Use spaces, not tabs
164
+ - Ensure closing `---` is present
165
+
166
+ ### Symlink Issues (macOS/Linux)
167
+
168
+ If symlinks aren't working:
169
+
170
+ ```bash
171
+ # Remove existing broken symlink
172
+ rm ~/.claude/skills/tradeblocks-health-check
173
+
174
+ # Recreate with absolute path
175
+ ln -s /absolute/path/to/tradeblocks/packages/agent-skills/tradeblocks-health-check ~/.claude/skills/
176
+ ```
177
+
178
+ ### Windows Installation
179
+
180
+ Windows doesn't support Unix symlinks. Use the PowerShell install script instead:
181
+
182
+ ```powershell
183
+ cd C:\path\to\tradeblocks\packages\agent-skills
184
+ .\install.ps1 claude
185
+ ```
186
+
187
+ Or copy manually:
188
+
189
+ ```powershell
190
+ # Create skills directory
191
+ mkdir $env:USERPROFILE\.claude\skills
192
+
193
+ # Copy all TradeBlocks skills
194
+ Copy-Item -Recurse C:\path\to\tradeblocks\packages\agent-skills\tradeblocks-* $env:USERPROFILE\.claude\skills\
195
+ ```
196
+
197
+ **Note:** When updating skills on Windows, re-run `.\install.ps1 claude` (unlike macOS/Linux where symlinks auto-update).
198
+
199
+ ### Permission Denied
200
+
201
+ Ensure the install script is executable:
202
+
203
+ ```bash
204
+ chmod +x install.sh
205
+ ```
206
+
207
+ ## Updating Skills
208
+
209
+ ### If Using Symlinks (Recommended)
210
+
211
+ Simply pull the latest code:
212
+
213
+ ```bash
214
+ cd /path/to/tradeblocks
215
+ git pull
216
+ ```
217
+
218
+ Skills update automatically since symlinks point to the source.
219
+
220
+ ### If You Copied Files
221
+
222
+ Re-copy after updates:
223
+
224
+ ```bash
225
+ # Remove old skills
226
+ rm -rf ~/.claude/skills/tradeblocks-*
227
+
228
+ # Re-copy
229
+ cp -r /path/to/tradeblocks/packages/agent-skills/tradeblocks-* ~/.claude/skills/
230
+ ```
231
+
232
+ ## Uninstalling
233
+
234
+ Remove the symlinks:
235
+
236
+ ```bash
237
+ rm ~/.claude/skills/tradeblocks-*
238
+ rm ~/.codex/skills/tradeblocks-*
239
+ rm ~/.gemini/skills/tradeblocks-*
240
+ ```
@@ -0,0 +1,115 @@
1
+ # TradeBlocks Agent Skills
2
+
3
+ Conversational workflows for options trading analysis. These skills guide AI agents through structured analysis processes using the TradeBlocks MCP server.
4
+
5
+ **Compatible with:** Claude Code, Codex CLI, Gemini CLI
6
+
7
+ ## What Are Skills?
8
+
9
+ Skills are markdown files that teach AI agents how to perform specific tasks. They:
10
+
11
+ - Guide conversation through structured analytical workflows
12
+ - Ask clarifying questions to understand context
13
+ - Use MCP tools to gather data and run analyses
14
+ - Present results with educational context
15
+
16
+ Skills do not execute code directly - they require the TradeBlocks MCP server for actual data access and calculations.
17
+
18
+ ## Available Skills
19
+
20
+ | Skill | Purpose | Key MCP Tools Used |
21
+ |-------|---------|-------------------|
22
+ | `tradeblocks-health-check` | Strategy health evaluation - metrics, stress tests, risk indicators | `get_statistics`, `run_monte_carlo`, `get_tail_risk` |
23
+ | `tradeblocks-wfa` | Walk-forward analysis - test parameter robustness on unseen data | `run_walk_forward` |
24
+ | `tradeblocks-risk` | Risk assessment and position sizing | `calculate_position_sizing`, `get_tail_risk` |
25
+ | `tradeblocks-compare` | Performance comparison - backtest vs actual, strategy correlations | `compare_backtest_vs_actual`, `calculate_correlation` |
26
+ | `tradeblocks-portfolio` | Portfolio addition decisions - should I add this strategy? | `calculate_correlation`, `get_statistics` |
27
+ | `tradeblocks-optimize` | Parameter optimization with overfitting awareness | `list_available_fields`, `aggregate_by_field` |
28
+
29
+ ## Prerequisites
30
+
31
+ Before using these skills, you need:
32
+
33
+ 1. **TradeBlocks MCP server** configured and accessible
34
+ 2. **At least one block directory** containing your trade data (tradelog.csv required)
35
+ 3. **An AI agent** that supports skills (Claude Code, Codex CLI, or Gemini CLI)
36
+
37
+ See [MCP Server Setup](../mcp-server/README.md) for server configuration.
38
+
39
+ ## Quick Start (Claude Code)
40
+
41
+ ```bash
42
+ # Personal installation (available in all projects)
43
+ ln -s /path/to/tradeblocks/packages/agent-skills/tradeblocks-* ~/.claude/skills/
44
+
45
+ # Or project installation (shared via git)
46
+ ln -s /path/to/tradeblocks/packages/agent-skills/tradeblocks-* .claude/skills/
47
+ ```
48
+
49
+ Then invoke a skill by name:
50
+
51
+ ```
52
+ /tradeblocks-health-check
53
+ ```
54
+
55
+ ## Usage Pattern
56
+
57
+ Skills are conversational - they ask clarifying questions before diving into analysis:
58
+
59
+ 1. **Step 1**: Skill verifies MCP server connection
60
+ 2. **Step 2**: User selects what to analyze (block, strategy, etc.)
61
+ 3. **Step 3**: Skill gathers data and runs appropriate analyses
62
+ 4. **Step 4**: Results presented with educational context
63
+ 5. **Step 5**: Related skills suggested for further exploration
64
+
65
+ Example conversation:
66
+ ```
67
+ User: /tradeblocks-health-check
68
+
69
+ Agent: Let me check which backtests are available...
70
+ [lists available blocks]
71
+ Which backtest would you like to analyze?
72
+
73
+ User: SPX-Iron-Condor
74
+
75
+ Agent: [runs get_statistics, run_monte_carlo, get_tail_risk]
76
+ Here's the health check for SPX-Iron-Condor:
77
+ ...
78
+ ```
79
+
80
+ ## Installation Script
81
+
82
+ For convenience, use the installation script:
83
+
84
+ ```bash
85
+ cd packages/agent-skills
86
+ ./install.sh claude # Install to Claude Code
87
+ ./install.sh codex # Install to Codex CLI
88
+ ./install.sh gemini # Install to Gemini CLI
89
+ ./install.sh all # Install to all platforms
90
+ ```
91
+
92
+ ## See Also
93
+
94
+ - [Detailed Installation Guide](INSTALL.md) - Instructions for all platforms
95
+ - [MCP Server for Claude Desktop](../mcp-server/README.md) - Desktop Extension installation
96
+
97
+ ## Skill Development
98
+
99
+ Each skill follows this structure:
100
+
101
+ ```
102
+ tradeblocks-{name}/
103
+ SKILL.md # Main skill definition (YAML frontmatter + markdown)
104
+ references/ # Supporting educational materials
105
+ {topic}.md
106
+ ```
107
+
108
+ The `SKILL.md` file contains:
109
+ - YAML frontmatter with `name` and `description`
110
+ - Prerequisites section
111
+ - Step-by-step process
112
+ - Interpretation guidance
113
+ - Related skills
114
+
115
+ Reference files provide deeper educational content that agents can consult when users need more explanation.
@@ -0,0 +1,16 @@
1
+ {
2
+ "version": "1.0.0",
3
+ "skills": [
4
+ "tradeblocks-health-check",
5
+ "tradeblocks-wfa",
6
+ "tradeblocks-risk",
7
+ "tradeblocks-compare",
8
+ "tradeblocks-portfolio",
9
+ "tradeblocks-optimize"
10
+ ],
11
+ "platforms": {
12
+ "claude": ".claude/skills",
13
+ "codex": ".codex/skills",
14
+ "gemini": ".gemini/skills"
15
+ }
16
+ }
@@ -0,0 +1,77 @@
1
+ # Install TradeBlocks skills for Claude Code, Codex CLI, or Gemini CLI (Windows)
2
+ # Usage: .\install.ps1 <platform>
3
+ # Platforms: claude, codex, gemini, all
4
+
5
+ param(
6
+ [Parameter(Position=0)]
7
+ [ValidateSet("claude", "codex", "gemini", "all")]
8
+ [string]$Platform
9
+ )
10
+
11
+ $ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
12
+ $Skills = @(
13
+ "tradeblocks-health-check",
14
+ "tradeblocks-wfa",
15
+ "tradeblocks-risk",
16
+ "tradeblocks-compare",
17
+ "tradeblocks-portfolio",
18
+ "tradeblocks-optimize"
19
+ )
20
+
21
+ function Show-Usage {
22
+ Write-Host "Usage: .\install.ps1 <platform>"
23
+ Write-Host ""
24
+ Write-Host "Platforms:"
25
+ Write-Host " claude Install to ~\.claude\skills\"
26
+ Write-Host " codex Install to ~\.codex\skills\"
27
+ Write-Host " gemini Install to ~\.gemini\skills\"
28
+ Write-Host " all Install to all platforms"
29
+ Write-Host ""
30
+ Write-Host "Example:"
31
+ Write-Host " .\install.ps1 claude"
32
+ exit 1
33
+ }
34
+
35
+ function Install-Skills {
36
+ param([string]$PlatformName)
37
+
38
+ $TargetDir = Join-Path $env:USERPROFILE ".$PlatformName\skills"
39
+
40
+ Write-Host "Installing skills to $TargetDir..."
41
+
42
+ if (-not (Test-Path $TargetDir)) {
43
+ New-Item -ItemType Directory -Path $TargetDir -Force | Out-Null
44
+ }
45
+
46
+ foreach ($Skill in $Skills) {
47
+ $Source = Join-Path $ScriptDir $Skill
48
+ $Target = Join-Path $TargetDir $Skill
49
+
50
+ if (Test-Path $Target) {
51
+ Write-Host " Updating: $Skill"
52
+ Remove-Item -Recurse -Force $Target
53
+ } else {
54
+ Write-Host " Installing: $Skill"
55
+ }
56
+
57
+ Copy-Item -Recurse $Source $Target
58
+ }
59
+
60
+ Write-Host ""
61
+ Write-Host "Done! Verify with: Get-ChildItem $TargetDir"
62
+ }
63
+
64
+ if (-not $Platform) {
65
+ Show-Usage
66
+ }
67
+
68
+ switch ($Platform) {
69
+ "all" {
70
+ Install-Skills "claude"
71
+ Install-Skills "codex"
72
+ Install-Skills "gemini"
73
+ }
74
+ default {
75
+ Install-Skills $Platform
76
+ }
77
+ }