xingwudao/open-xquant/create-rule
Claude Code and agent skill by xingwudao/open-xquant
- community
Checking that the SKILL.md file is still in the repository.
Create a new open-xquant Rule with portfolio-state tests and registry wiring; use after create-component confirms no existing rule satisfies the requested risk or exit behavior.
Install
npx vskill@latest install xingwudao/open-xquant/create-ruleSKILL.md
Create Rule
You create bar-by-bar risk, hold, weight override, or exit logic.
Scope
Default built-in paths:
- source:
src/oxq/rules/{snake_name}.py - tests:
tests/rules/test_{snake_name}.py - package export:
src/oxq/rules/__init__.py - built-in registry:
src/oxq/core/registry.py
Phase 1: Read Existing Patterns
Read before editing:
src/oxq/core/types.pysrc/oxq/core/engine.pyrule handling instep()src/oxq/rules/constraint.pysrc/oxq/rules/order.py- one existing test in
tests/rules/ src/oxq/rules/__init__.py- the rule registration block in
src/oxq/core/registry.py
Important current engine behavior:
- pre-trade consumes
RuleResult.weights - pre-trade consumes
RuleResult.hold - post-trade consumes
RuleResult.target_positions RuleResult.constraintsexists in the type but is not currently applied by
Engine.step()
Phase 2: Define Behavior
State before coding:
- pre-trade or post-trade
- trigger condition
- fields returned in
RuleResult - constructor parameters
- internal state, if any
- reset behavior, if any
- exact no-trigger result
Ask the user if risk thresholds or trigger semantics are ambiguous.
Phase 3: Test First
Write tests with hand-built portfolio and bar rows:
- protocol compliance with
Rule - trigger scenario
- no-trigger scenario returns empty
RuleResult() - correct
reasonwhen activated - no mutation of
Portfolio - stateful behavior if relevant
namevalue
Run the new test and confirm the missing implementation fails before coding.
Phase 4: Implement
Skeleton:
Rules:
- read
portfolio; never mutate it - use
priceswhen current bar valuation is needed - return
RuleResult()when inactive - include
reasonwhen active - use
target_positions={symbol: 0.0}for exits - use
hold=Truefor full-bar trading freeze
Phase 5: Register
For a built-in component:
- import it in
src/oxq/rules/__init__.py - add it to
__all__ - add it to
_load_builtins()insrc/oxq/core/registry.py
Verify:
Run engine-level tests when the rule affects order generation or lifecycle.
Red Lines
- Do not use
constraintsfor execution-critical behavior unless engine
support is implemented and tested.
- Do not mutate
Portfolioinsideevaluate(). - Do not omit no-trigger tests.
- Do not register before rule behavior tests pass.
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingagent/skills/create-rule/SKILL.md
Popularity
- 7-day trend score
- 5
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/xingwudao/open-xquant/create-rule)