implementation_skill

This skill guides test-driven development workflows for implementing features, refactoring, and bug fixes in a Rust-based multi-agent trading bot.
  • Rust

3

GitHub Stars

1

Bundled Files

2 months ago

Catalog Refreshed

4 months ago

First Indexed

Readme & install

Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.

Installation

Preview and clipboard use veilstrat where the catalogue uses aiagentskills.

npx veilstrat add skill zuytan/rustrade --skill implementation

  • SKILL.md3.7 KB

Overview

This skill codifies a test-driven implementation workflow tailored for adding features, refactoring, and fixing complex bugs in a Rust-based algorithmic trading system. It enforces writing failing tests first, minimal focused implementations, and disciplined refactoring with Rust tooling. The goal is safe, auditable changes across domain, application, and infrastructure layers.

How this skill works

Follow a five-phase TDD loop: Understand the scope and affected DDD layer, write failing tests that capture behavior and edge cases, implement the smallest change to make tests pass, refactor for clarity and correctness, and validate with formatting, linting, and full test runs. Tests live beside code in Rust test modules; production code uses Result types, Decimal for money, and avoids unwrap().

When to use it

  • Adding a new trading feature or strategy module
  • Major refactor that touches domain or orchestration layers
  • Fixing complex bugs that require regression protection
  • Implementing integrations with exchanges (Alpaca/Binance) or risk subsystems
  • Hardening numeric or financial calculations (use Decimal)

Best practices

  • Write tests before implementation: at least basic, edge, and error cases
  • Keep domain logic pure (no I/O) and put I/O in infrastructure
  • Return Result types and map errors; avoid .unwrap() in production
  • Use Decimal for money-related values instead of f64
  • Run cargo fmt, cargo clippy, and cargo test before merging

Example use cases

  • Implement position-sizing calculation with tests for normal and edge inputs
  • Add a new strategy use case: write orchestration tests and then wire domain logic
  • Refactor persistence layer and add integration tests to prevent regressions
  • Introduce a risk rule: test expected rejections and successful trades
  • Add exchange adapter: mock external API calls and validate behavior with tests

FAQ

Place unit tests next to the implementation in the same module file under a cfg(test) mod. For integration or scenario tests, use tests/ or a dedicated test harness.

How do I handle numeric precision for trading calculations?

Use a Decimal type for all monetary and percentage values. Return Result and validate input ranges; avoid f64 to prevent rounding and precision errors.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational