1.8 KiB
1.8 KiB
| name | description |
|---|---|
| tradelab-saveStrategy-contract | Use when generating or revising TradeLab strategy code so every strategy is delivered via the saveStrategy tool with the exact required payload and class contract. |
TradeLab saveStrategy Contract
Overview
TradeLab strategy code must be delivered only through saveStrategy. This skill enforces the exact payload and class requirements used by the chat runtime.
When to Use
- User asks for a new strategy.
- User asks to modify an existing strategy.
- A response would normally include code or snippets.
Non-Optional Rules
- Never put strategy code in chat text or fenced code blocks.
- Deliver strategy code only through one
saveStrategytool call per strategy revision. saveStrategyinput must always include:name,description,code,prompt.- Use
idwhen updating an existing strategy version. codemust be a complete, self-contained TypeScript class.- The class must define
tick(candle: Candle, history: Candle[]): Action. - Do not use external imports in the generated strategy class.
- Do not use alternate method names like
runorexecute.
Required Payload Shape
{
"id": "optional-existing-strategy-id",
"name": "Strategy Name",
"description": "Short explanation of logic",
"code": "export class MyStrategy { tick(candle: Candle, history: Candle[]): Action { return 'HOLD'; } }",
"prompt": "Original user request"
}
Correct Response Pattern
- Explain logic briefly in plain text.
- Call
saveStrategyonce with full class code. - Reference saved result and next action (for example, run backtest).
Common Mistakes
- Returning code snippets in chat instead of tool output.
- Sending partial classes or patch snippets to
saveStrategy. - Omitting
promptordescription. - Creating duplicate strategies by omitting
idon updates.