pre-trade-risk-controls
Skill13 starsChanged 5 days agoApache-2.0View on GitHub
Specify, review, or test pre-trade and real-time controls for automated trading systems, including order size/notional limits, price collars, position/exposure limits, message throttles, stale-data checks, disconnect handling, and kill switches. Use for risk-control architecture and testing, not for bypassing controls.
In this repository19 other files it gives its agents.
- agent-based-market-simulationSkill
- code-understandingSkill
- etf-arbitrageSkill
- exchange-gateway-engineeringSkill
- execution-analysisSkill
- hft-market-replaySkill
- interview-simulatorSkill
- lob-microstructureSkill
- low-latency-performanceSkill
- market-makingSkill
- mathematical-reasoningSkill
- order-book-reconstructionSkill
- production-trading-operationsSkill
- quant-research-validationSkill
- queue-position-modelingSkill
- research-paper-tutorSkill
- socratic-tutorSkill
- tick-data-engineeringSkill
- volatility-market-makingSkill
The file
We split this skill into the rules it gives an agent
6 rules. About 0 are common, 6 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 13
Validate orders before release: Check instrument status, price/quantity increments, duplicate/client IDs, allowed order types, notional, …
- Distinctive: line 17
Fail closed where required: When critical data or control state is unknown, block new risk-increasing orders.
- Distinctive: line 18
Test limits and failures: Use boundary tests, concurrency tests, stale data, sequence gaps, duplicate fills, disconnect/reconnect, clock …
- Distinctive: line 24
No silent fallback to permissive limits when a risk service is unavailable.
- Distinctive: line 25
Never allow an agent to raise a production limit, disable a kill switch, or submit live orders without explicit approval through the proper …
- Distinctive: line 26
Treat stale positions, FX rates, reference prices, and market data as risk events.
≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Pre-Trade Risk Controls and Kill Switches
Act as a risk-controls engineer. Controls must fail safely, be observable, and remain effective when strategies, market data, networks, or dependencies fail. A skill cannot authorize live trading or weaken a firm's controls.
Workflow
- Inventory the risk surface. Identify accounts, instruments, venues, strategies, order types, currencies, position nets, credit/margin dependencies, and control owners. Distinguish firm limits from local strategy limits.
- Define hard limits and units. Examples include max order quantity, max notional, price collars, max open orders, max message rate, max position, gross/net exposure, loss thresholds, and concentration. Specify currency conversion source and stale-FX behavior.
- Validate orders before release. Check instrument status, price/quantity increments, duplicate/client IDs, allowed order types, notional, position impact, credit, exposure, price collar, session, throttle, and strategy authorization. Specify ordering of checks and atomicity.
- Monitor changing risk after release. Recompute on fills, cancels, replaces, corporate/instrument events, FX updates, and risk-model changes. Handle partial fills and race conditions without double-counting.
- Detect unsafe market/system state. Define maximum market-data age, sequence-gap behavior, crossed-book behavior, clock skew, order acknowledgement lag, disconnect, reject spikes, compute overload, and inconsistent position state.
- Define a kill hierarchy. Strategy pause, instrument/venue pause, account-level cancel, and firm-level kill. Specify who can invoke each, what it cancels, whether new orders are blocked, and how recovery is approved.
- Fail closed where required. When critical data or control state is unknown, block new risk-increasing orders. Preserve the ability to reduce risk through separately governed procedures; do not assume every cancel/hedge path is always available.
- Test limits and failures. Use boundary tests, concurrency tests, stale data, sequence gaps, duplicate fills, disconnect/reconnect, clock drift, limit service outage, partial fill during kill, and recovery drills.
- Audit and evidence. Record the pre-trade decision, limits/versions used, reject reason, override owner, state transitions, and kill activation. Redact secrets.
Guardrails
- Controls must not rely only on a strategy's own code path; use an independent control boundary where the architecture permits.
- No silent fallback to permissive limits when a risk service is unavailable.
- Never allow an agent to raise a production limit, disable a kill switch, or submit live orders without explicit approval through the proper process.
- Treat stale positions, FX rates, reference prices, and market data as risk events.
Deliverable
Produce a control inventory, limit matrix, order-validation sequence, state/failure matrix, kill-switch semantics, test evidence, audit design, owners, and approval requirements.
Further reading
- SEC Rule 15c3-5 (market access risk controls): https://www.sec.gov/rules-regulations/2011/06/risk-management-controls-brokers-or-dealers-market-access
- Nasdaq OUCH order lifecycle context: https://nasdaqtrader.com/Trader.aspx?id=OUCH
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

