AgentStack
Browse Sign in
Browse Why AgentStack Sell Docs
Sign in
SKILL verified MIT Self-run

Risk Guard

skill-daviddme-claude-skills-risk-guard · by daviddme

Single source of truth for trading session P&L, per-trade risk cap, and daily drawdown kill-switch. Always called by bybit-trade before any order; also exposes status/init/open/close subcommands. Use for "what's my P&L / am I within risk limits / reset my session". Stateful, no network, no API keys.

No reviews yet
0 installs
36 views
0.0% view→install

Install

$ agentstack add skill-daviddme-claude-skills-risk-guard

✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution Used
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

View the full security report →

Verified badge

Passed review? Show it. Paste this badge into your README, it links to the public security report.

AgentStack Verified badge Links to your public security report.
[![AgentStack Verified](https://agentstack.voostack.com/badges/verified.svg)](https://agentstack.voostack.com/security/report/skill-daviddme-claude-skills-risk-guard)

Reliability & compatibility

Security review passed
0 installs to date
no reviews yet
4mo ago

Declared compatibility

Claude CodeClaude Desktop

Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.

Preview Execution monitoring

We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.

How agent discovery & health will work →
Are you the author of Risk Guard? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

risk-guard

Stateful session tracker. Records every trade, enforces the per-trade risk cap and daily drawdown limit, and acts as a veto gate for bybit-trade.

When to use

  • "Initialize my trading session at $500 equity"
  • "What's my P&L today?"
  • "Am I allowed to risk $30 on this?"
  • Called as a subprocess by bybit-trade before every order (not by the user)

How to run

All subcommands accept --state-file PATH (default: ~/.claude/skills/risk-guard/state.json).

# Start a session (overwrites existing state after confirmation)
python risk-guard/guard.py init --equity 500 \
  [--per-trade-risk-cap 25] [--daily-drawdown-limit 150]

# Veto gate — exit 0 if allowed, exit 2 if blocked
python risk-guard/guard.py check --risk-usd 25

# Record an opened position (called by bybit-trade after a successful order)
python risk-guard/guard.py open \
  --order-link-id clive-SOLUSDT-1719000000000 \
  --symbol SOLUSDT --side long \
  --qty 11.2 --entry 148.20 --sl 145.97 --tp 151.16 --risk-usd 25

# Close it
python risk-guard/guard.py close \
  --order-link-id clive-SOLUSDT-1719000000000 \
  --exit 151.16 --realized-pnl 33.15

# Human-readable or JSON status
python risk-guard/guard.py status [--json]

Block conditions (exit 2)

check exits 2 with an explanation in stderr if ANY of:

  • state file missing (you must run init first)
  • realized_pnl per_trade_risk_cap (this trade would breach the per-trade cap)

There is no override flag. This is intentional — bybit-trade invokes check as a subprocess and treats any non-zero exit as a hard veto.

Exit codes

  • 0 — allowed / success
  • 1 — argument error (missing required fields, invalid state)
  • 2 — veto (cap or drawdown tripped, or state missing)

State file shape

Human-readable JSON. Open it. Read it. Don't trust.

{
  "session_id": "2026-04-22T15:00:00Z",
  "started_at": "2026-04-22T15:00:00Z",
  "equity_start": 500.0,
  "realized_pnl": 0.0,
  "per_trade_risk_cap": 25.0,
  "daily_drawdown_limit": 150.0,
  "trades": [],
  "open_positions": []
}

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet, be the first.

Versions

  • v0.1.0 Imported from the upstream source.