Agent Skills
PyBroker ships Agent Skills that give coding agents workflows for writing strategies, indicators, models, and backtests.
Installation
Public skills live under the skills/ directory in the PyBroker
Git repository. Each skill is
contained in its own folder and defined by a standard SKILL.md file.
The recommended way to install them is the Skills CLI, which supports Claude Code, OpenAI Codex, Cursor, and many other coding agents:
# Inside your own working project directory:
npx skills add edtechre/pybroker
The command asks which skills to install and which agents to install
them for, then copies each one into that agent’s skills folder. Add
--all to install every skill for every detected agent without
prompting.
Manual Install
You can also clone the PyBroker repository and symlink the skills yourself:
git clone https://github.com/edtechre/pybroker.git
# Inside your own working project directory:
mkdir -p .claude/skills
# Symlink all PyBroker skills into your local Claude config
for skill in /path/to/pybroker/skills/*; do \
ln -s "$skill" .claude/skills/; \
done
Replace .claude/skills with the folder that your own agent reads.
Claude Code
Claude Code discovers skills
placed inside a .claude/skills/ folder in your project root. Once
they are installed, every skill and its respective commands become
available in the terminal.
OpenAI Codex
OpenAI Codex discovers
skills in .agents/skills/.
Cursor
Cursor discovers skills in
.cursor/skills/.
Claude Agent SDK
The Claude Agent SDK discovers skills
from the .claude/skills/ folder installed above, so it loads them on
demand and invokes them automatically without any prompt assembly:
pip install claude-agent-sdk
import asyncio
import os
from claude_agent_sdk import ClaudeAgentOptions, query
options = ClaudeAgentOptions(
cwd=os.getcwd(),
setting_sources=["user", "project"],
skills="all",
allowed_tools=["Read", "Write", "Bash"],
)
async def main():
async for message in query(
prompt="Create a mean-reversion PyBroker strategy on AAPL",
options=options,
):
print(message)
asyncio.run(main())
Pydantic-AI
Pydantic-AI builds agents in pure
Python. It does not search for skill directories automatically, so you
point its Skills
capability at the .agents/skills library installed above:
pip install "pydantic-ai-harness[skills]"
from pydantic_ai import Agent
from pydantic_ai_harness.skills import Skills
agent = Agent(
'anthropic:claude-opus-5',
capabilities=[Skills('.agents/skills')],
)
result = agent.run_sync("Create a mean-reversion strategy on AAPL")
print(result.output)
Available Skills
pybroker-strategy-creator
Create practical PyBroker strategy code from user intent while preserving backtest hygiene, including no lookahead leakage, explicit sizing, clear risk controls, and locally valid PyBroker API usage.
pybroker-indicator-creator
Write fast, correct PyBroker indicators by registering vectorized NumPy/Numba functions with pybroker.indicator, wiring them into strategy executions and models, and keeping every value free of lookahead bias. Covers the built-in indicator factories and vector helpers, custom Numba @njit kernels, wrapping third-party technical analysis libraries such as TA-Lib and pandas-ta, standalone computation with IndicatorSet, hyperparam-driven indicators, and multi-timeframe interval indicators.
pybroker-model-trainer
Wire machine learning models into PyBroker backtests by registering training and prediction functions with pybroker.model, feeding them indicator features, and evaluating them with walkforward analysis while keeping the train/test flow free of lookahead leakage. Covers per-symbol, pooled multi-symbol, per-bar time-series, lagged-feature, and pretrained models across common libraries such as scikit-learn, XGBoost, and arch.
pybroker-optimize
Tune PyBroker strategy hyperparameters with Strategy.optimize by declaring tunable values with pybroker.hyperparam, wiring them into indicators and execution functions, and scoring each candidate combination on a training window before the winning values are replayed on held-out test data. Covers grid, TPE, and random sampling through the integrated Optuna backend, custom Optuna samplers and studies, walkforward optimization across multiple windows, and reading results from OptimizeResult and the underlying optuna.Study.
pybroker-multi-interval
Build multi-timeframe PyBroker strategies that trade a base timeframe while confirming regime and trend on strictly coarser compressed intervals such as weekly and monthly bars. Covers the three interval formats, providing compressed bars with add_execution(intervals=...), computing indicators and training models per interval by binding them with .intervals(...), reading completed bars through ctx.interval(...), and standalone compression with compress_bars. Strategy code only ever sees completed compressed bars, which keeps higher-timeframe logic free of partial-bar lookahead.
pybroker-rotational-trading
Build rotational PyBroker strategies that hold the top-ranked symbols in a universe and rotate out names that fall from favor. Execution functions score symbols with ctx.long_score and ctx.short_score, cap positions with Strategy.set_max_long_positions and set_max_short_positions, and Strategy.enable_rotation(worst_rank_held=...) liquidates and refills slots each bar from the top-ranked candidates, optionally sized with a custom sizer over RotationContext. Also covers the simpler ranked-cap mode and dynamic universes via SymbolSelector.