skills/new-co-trader-worktree/SKILL.md
Creates a new git worktree in the auto-co-trader project for any purpose — optimization, regression, backtesting, brainstorming, etc. Use this skill when the user wants to CREATE or SET UP a new worktree — phrases like "prepare a new worktree", "set up a worktree", "create a new worktree for <purpose>", "prep a new worktree", "new worktree for autoresearch", "prepare optimization from [strategy]", or "create a worktree using [strategy]". Do NOT use this skill when the user is already in a worktree and wants to start/run/begin a task — that is handled by the relevant program file in the worktree session.
npx skillsauth add giladresisi/ai-dev-env new-co-trader-worktreeInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Creates a new git worktree for auto-co-trader work (optimization, regression, backtesting, brainstorming, or any other purpose) and optionally seeds it with a named starting strategy.
Before doing anything else, check which branch you are on:
git branch --show-current
If the current branch is not master, stop and tell the user:
You're on branch
<current-branch>, notmaster. Worktree creation should be done from themasterbranch so each worktree starts from a clean baseline.Would you like to switch to master first, or proceed anyway using this branch as the base?
Do not proceed further until the user confirms.
This is the normal flow. Continue to Step 1 below.
Check whether the user named a starting strategy in their message:
strategies/<name>.py in the current repo.The branch name needs a descriptive prefix so the worktree folder is self-explanatory
(e.g. energy-mar21, regression-apr05, backtest-may08). Derive it from, in order:
energy_momentum_v1 → energy, semis_mar20 → semis), use that.To name the worktree, can you briefly describe what it's for? (e.g. "energy stocks", "regression run", "backtesting mag7") — no need to list exact tickers.
Once you have a prefix, the tag is <prefix>-<month><day> (e.g. energy-mar21).
Check for collision:
git branch -a | grep "autoresearch/<tag>"
If it exists, append a suffix: energy-mar21-b, etc.
Full branch name: autoresearch/<tag>.
Get the current branch:
git branch --show-current
Use the create-worktree skill:
autoresearch/<tag>The worktree lands at ../<tag>.
All subsequent file edits go into the new worktree, not the current repo.
After the worktree is created, copy any cached regression data so the new worktree can use it without re-downloading or re-computing.
Note: The main
data/*.parquetbar files are NOT copied. They live in the shared global path (~/projects/auto-co-trader/global/...) and all worktrees read from there — copying them per-worktree is no longer necessary.
if [ -d "data/regression" ]; then
mkdir -p "../<tag>/data/regression"
for dir in data/regression/*/; do
cp -r "$dir" "../<tag>/$dir"
done
echo "Copied data/regression date folders"
fi
If the directory does not exist, skip silently — the worktree will fetch or generate data as needed.
Skip if using the default train.py.
Replace the strategy functions in the worktree's train.py with those from the named
strategy, keeping the infrastructure preamble intact.
strategies/<name>.py from the current repo.# ── section comment or def that
follows the closing } of the METADATA dict, and take from there to end of file.train.py, find the same boundary (the # ── Indicators
comment, or the first def after load_all_ticker_data). Replace from there to
(but not including) # DO NOT EDIT BELOW THIS LINE with the extracted functions.BACKTEST_START, BACKTEST_END, TRAIN_END, TEST_START) live
above the indicators section — do not change them.# LEGACY_OBJECTIVE: sharpe, carry that comment into
the worktree's train.py as-is — Step 5 below will detect and neutralize it.Resulting structure:
[preamble: docstring, imports, CACHE_DIR, date constants, WRITE_FINAL_OUTPUTS]
[load_ticker_data / load_all_ticker_data] ← unchanged
[strategy functions from named strategy] ← replaced
# DO NOT EDIT BELOW THIS LINE
[harness] ← unchanged
grep "LEGACY_OBJECTIVE: sharpe" "../<tag>/train.py"
If found: The strategy was tuned to maximize Sharpe, not P&L — its thresholds likely
suppress trade count to inflate the ratio. Reset any that look overly restrictive (narrow
RSI bands, very high volume multiples, extremely strict CCI cutoffs) to more neutral
values so the screener produces a reasonable trade count. Remove the
# LEGACY_OBJECTIVE: sharpe comment when done.
If not found: No action needed.
If train.py was modified (strategy injection or legacy-objective neutralization), commit it now:
cd "../<tag>"
git add train.py
git commit -m "setup(<tag>): seed from <strategy_name>, neutralize legacy Sharpe objective"
If train.py was not modified (default strategy, no legacy marker), skip this step — the worktree starts from the base branch commit with no additional changes needed.
Tell the user the worktree is ready:
── Worktree ready ───────────────────────────────────
Worktree: ../<tag>
Branch: autoresearch/<tag>
Strategy: <name> (from strategies/) OR current train.py
Data: regression dates copied (parquets via global path) OR none found
─────────────────────────────────────────────────────
Then give the user these instructions:
Open a new Claude Code session in the worktree:
cd ../<tag>
claude
From there you can start any task — optimization, regression, backtesting, or brainstorming. Example requests:
Run the optimization
Run regression for the dates in regression.md
Backtest the current strategy over the past 3 months
Run the optimization for AAPL, MSFT, NVDA over the past 4 months, 40 iterations
development
Use when running comprehensive project validation including tests, type checking, linting, API connectivity checks, and server startup verification
research
Use when performing a meta-level analysis of plan adherence after implementation to identify process improvements and suggest CLAUDE.md updates
documentation
Use when investigating a GitHub issue to identify root cause, assess impact, and create a fix strategy document
testing
Use when loading project context and architecture overview before starting implementation work, with optional focus on a specific area