create-rule

Create framework-compliant trading rules for the open-xquant kernel.

116|38|Updated Feb 26, 2026
One-click install
npx skills add https://github.com/xingwudao/open-xquant --skill create-rule-xingwudao
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: create-rule
Source: https://github.com/xingwudao/open-xquant/tree/main/agent/skills/create-rule
Command: npx skills add https://github.com/xingwudao/open-xquant --skill create-rule-xingwudao

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Creating custom risk, exit, hold, or weight override rules for the open-xquant quantitative research kernel requires manual boilerplate code, strict adherence to the framework's Rule protocol, test setup, and registry wiring, which is error-prone and time-consuming for researchers and AI agents building custom trading logic.

Core Features & Use Cases

  • End-to-End Rule Creation Workflow: Guides users through 5 structured phases: reading existing rule patterns, defining rule behavior, writing test-first implementations, coding the rule, and registering it in the framework's built-in registry.
  • Built-in Guardrails: Enforces critical best practices including portfolio non-mutation, proper RuleResult formatting, test coverage for trigger and no-trigger scenarios, and pre-registration validation to avoid broken framework integrations.
  • Use Case: If you need a custom trailing stop-loss rule that exits positions when a stock's price drops 8% from its recent peak, this skill walks you through building, testing, and registering the rule so it works seamlessly with the open-xquant engine's pre-trade and post-trade lifecycle.

Quick Start

Use the create-rule skill to build a new custom exit rule that triggers when a stock's price falls 12% below its 30-day moving average, with full test coverage and automatic framework registration.

Frequently Asked Questions about create-rule

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create custom trading rules for the open-xquant framework without writing boilerplate code?

To create custom trading rules for open-xquant, use a structured workflow that defines rule behavior, writes test-first implementations, and registers the logic in the framework's built-in registry, ensuring full protocol compliance without manual boilerplate.

How does test-driven development work when building quantitative risk management rules?

Test-driven development for quantitative risk management rules requires writing test coverage for both trigger and no-trigger scenarios before coding the logic, ensuring proper RuleResult formatting and validating pre-registration to avoid broken framework integrations.

Can I build a custom trailing stop-loss rule for backtesting strategies in open-xquant?

Yes, you can build a custom trailing stop-loss exit rule for backtesting in open-xquant by defining the trigger conditions, writing test-first implementations, and registering the rule to work seamlessly with the engine's pre-trade and post-trade lifecycle.

What are the requirements for portfolio non-mutation guarantees in open-xquant rule development?

Portfolio non-mutation guarantees in open-xquant rule development require that custom risk, hold, or weight override rules enforce critical best practices by formatting RuleResult outputs properly without directly modifying the portfolio state during the engine lifecycle.

Why do my custom open-xquant rules fail during engine lifecycle integration?

Custom open-xquant rules fail during engine lifecycle integration due to protocol violations, missing pre-registration validation, lack of test coverage for trigger scenarios, or improper RuleResult formatting that breaks the framework's pre-trade and post-trade workflows.