Agent skill

Guard Trailing Stop

by Nunchi-trade in Nunchi-trade/agent-cli

Guard — two-phase ROE-based trailing stop system for Hyperliquid perps.

MITAuto-check passedBusiness, Finance & HR

Install Guard Trailing Stop

skills CLI
$ npx skills add Nunchi-trade/agent-cli --skill guard-trailing-stop -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install Nunchi-trade/agent-cli guard-trailing-stop --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/Nunchi-trade/agent-cli.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/guard .claude/skills/guard-trailing-stop && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
guard-trailing-stop
GitHub stars
521
Token cost
~1.9k tokens
SKILL.md length
708 words
Files
2 (incl. scripts)
Skills in repo
7
Repo updated
First seen
Licence
MIT

At a glance

Guard — two-phase ROE-based trailing stop system for Hyperliquid perps.

  • Works in 2 steps: "Let It Breathe" → "Lock the Bag"
  • Protecting an open position
  • SKILL.md covers How It Works, Usage, Configuration Reference and Direction Reference, plus 6 more sections
  • Runs Python scripts from its folder

What it does

Guard Trailing Stop is an agent skill from Nunchi-trade/agent-cli. Guard — two-phase ROE-based trailing stop system for Hyperliquid perps. Phase 1 lets the trade breathe with wide retrace and patient breach counting. Phase 2 locks profit through configurable tier ratcheting with per-tier retrace overrides. Supports LONG and SHORT, hard/soft breach decay, stagnation take-profit, and preset configs. Use when protecting an open position, setting trailing stops, or automating profit-locked exits.

Its SKILL.md is about 1.9k tokens, which your agent loads only when the skill is triggered. The skill folder holds 2 other files, including scripts (for example `scripts/standalone_runner.py`). Compatibility notes: Requires python3 and yex-trader (agent-cli) installed. Hyperliquid perp positions. Direct HL API — no mcporter needed.

It sits in Business, Finance & HR. It works with Hyperliquid. The licence is MIT.

When your agent uses it

  • Protecting an open position
  • Setting trailing stops
  • Automating profit-locked exits

Example prompts

  • “/guard-trailing-stop”

Requirements

  • Python 3
  • Compatibility (from SKILL.md): Requires python3 and yex-trader (agent-cli) installed. Hyperliquid perp positions. Direct HL API — no mcporter needed.

Workflow steps

2 steps, taken from the step headings in SKILL.md.

  1. "Let It Breathe"
  2. "Lock the Bag"

What it can do on your machine

Read from SKILL.md and the folder at commit 58619a2. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships 1 file in scripts/ (Python), which the agent can run.

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

  • Compatibility

    Requires python3 and yex-trader (agent-cli) installed. Hyperliquid perp positions. Direct HL API — no mcporter needed.

    From compatibility in the SKILL.md frontmatter.

Context cost

Guard Trailing Stop loads about 1.9k tokens when it runs. Until then it costs about 113 tokens; SKILL.md has 708 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~113
When it runs · the whole SKILL.md, loaded when a task matches
~1.9k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); the scripts in this folder are not scanned.

SKILL.md

The full file from Nunchi-trade/agent-cli at commit 58619a2, republished under its MIT licence (© Nunchi-trade). 708 words, ~1,935 tokens.

Download SKILL.mdSave it as .claude/skills/guard-trailing-stop/SKILL.md (or your agent's skills folder). This skill also uses 1 other file; get the full folder from GitHub.
name
guard-trailing-stop
description
Guard — two-phase ROE-based trailing stop system for Hyperliquid perps. Phase 1 lets the trade breathe with wide retrace and patient breach counting. Phase 2 locks profit through configurable tier ratcheting with per-tier retrace overrides. Supports LONG and SHORT, hard/soft breach decay, stagnation take-profit, and preset configs. Use when protecting an open position, setting trailing stops, or automating profit-locked exits.
compatibility
Requires python3 and yex-trader (agent-cli) installed. Hyperliquid perp positions. Direct HL API — no mcporter needed.
license
MIT
metadata.author
Nunchi Trade
metadata.version
1.0.0
metadata.platform
yex-trader
metadata.exchange
hyperliquid
metadata.category
risk-management

Guard Trailing Stop

Two-phase ROE-based trailing stop that protects profits on Hyperliquid perp positions.

How It Works

Phase 1: "Let It Breathe"
  • Wide retrace (3% default) from high-water mark
  • Patient: requires 3 consecutive breach checks before close
  • Absolute price floor caps max loss
  • Goal: don't get shaken out before the trade develops
Phase 2: "Lock the Bag"
  • Tight retrace (1.5% default, per-tier overrides)
  • Quick exit: 1-2 breaches to close
  • ROE-based tier ratcheting — profit floors never go backward
  • Per-tier retrace tightens as profit grows
ROE-Based Tiers

All triggers use ROE (Return on Equity): PnL / margin * 100. At 10x leverage, 1% price move = 10% ROE.

Usage

Standalone — Guard an existing position
bash
hl guard start ETH-PERP \
  --entry 2500.0 \
  --size 1.0 \
  --direction long \
  --leverage 10 \
  --preset tight \
  --tick 5
Composable — Attach to any strategy
yaml
# config.yaml
strategy: avellaneda_mm
instrument: ETH-PERP
tick_interval: 10.0
guard:
  enabled: true
  preset: tight
  leverage: 10.0
bash
hl run avellaneda_mm --config config.yaml
Presets
PresetTiersStagnation TPUse Case
moderate6 (10/20/30/50/75/100% ROE)NoStandard trades
tight4 (10/20/40/75% ROE)Yes (8% ROE, 1hr)Aggressive protection
Module API
python
from modules.trailing_stop import TrailingStopEngine, GuardAction
from modules.guard_config import GuardConfig, PRESETS
from modules.guard_state import GuardState

config = PRESETS["tight"]
config.leverage = 10.0
config.direction = "long"

engine = TrailingStopEngine(config)
state = GuardState.new("ETH-PERP", entry_price=2500.0, position_size=1.0, direction="long")

result = engine.evaluate(price=2520.0, state=state)
# result.action: GuardAction.HOLD | .CLOSE | .TIER_CHANGED
# result.state: updated state (persist this)
# result.roe_pct, result.effective_floor, result.reason

Configuration Reference

ParameterDefaultDescription
directionlongPosition direction: long or short
leverage10.0Position leverage (used in ROE calc)
phase1_retrace0.03Phase 1 retrace from high-water (3%)
phase1_max_breaches3Consecutive breaches before Phase 1 close
phase1_absolute_floor0.0Hard price floor (0 = disabled)
phase2_retrace0.015Default Phase 2 retrace (1.5%)
phase2_max_breaches2Default breaches in Phase 2
breach_decay_modehardhard (reset to 0) or soft (decay by 1)
stagnation_enabledfalseEnable stagnation take-profit
stagnation_min_roe8.0Min ROE% for stagnation trigger
stagnation_timeout_ms3600000HW stale time before stagnation close (1hr)
Tier Format
yaml
tiers:
  - trigger_pct: 10.0    # Activate at 10% ROE
    lock_pct: 5.0         # Lock 5% ROE as floor
  - trigger_pct: 20.0
    lock_pct: 14.0
    retrace: 0.012        # Per-tier retrace override (1.2%)
    max_breaches: 1       # Per-tier breach count override

Direction Reference

ConceptLONGSHORT
ProfitPrice upPrice down
ROE(price-entry)/entry * lev * 100(entry-price)/entry * lev * 100
High waterHighest priceLowest price
Tier floorentry * (1 + lock/100/lev)entry * (1 - lock/100/lev)
Trailing floorhw * (1 - retrace)hw * (1 + retrace)
Effective floormax(tier, trailing)min(tier, trailing)
Breachprice <= floorprice >= floor

Agent Mandate

You are the Guard trailing stop guardian. Your job is to protect profits and limit losses on open positions. You never make entry decisions — you only manage exits via a two-phase trailing stop system.

RULES:

  • ALWAYS attach Guard to every open position — unprotected positions are unacceptable
  • NEVER override a CLOSE signal — if Guard says close, close immediately
  • ALWAYS use the correct direction (long/short) — wrong direction inverts all logic
  • Let Phase 1 breathe — do not panic on early retrace within 3% threshold
  • In Phase 2, trust the tier system — floors only ratchet up, never down
  • ALWAYS verify entry price and leverage are correct before starting
Show full SKILL.md (321 more words)Show less

Decision Rules

ConditionAction
Guard returns CLOSEClose position immediately — no hesitation
Guard returns TIER_CHANGEDLog the new tier — no action needed, floors auto-ratchet
Guard returns HOLDDo nothing — position is healthy
ROE > 10% and still Phase 1Normal — Phase 2 triggers at first tier (usually 10% ROE)
Breach count incrementing but no closePhase 1 patience — 3 consecutive breaches needed
Stagnation timer triggeredClose — profit is stale, capital better deployed elsewhere
PresetWhen to Use
moderateStandard trades, medium hold time, balanced protection
tightAggressive protection, short holds, includes stagnation TP
CustomOnly when you understand all tier parameters — test with mock first

Anti-Patterns

  • Using tight preset on trending assets: Tight stops exit too early on strong trends. Use moderate for trend-following strategies.
  • Wrong direction parameter: Setting direction=long on a short position means Guard will hold losses and exit winners. Always double-check.
  • Overriding CLOSE signals: "It'll come back" — it won't. Guard computed the exit. Trust it.
  • Starting Guard after the move: Guard needs accurate entry price. Starting Guard at current price when entry was 2% ago means the trailing is wrong.
  • Running without leverage parameter: Default leverage (10x) may not match your actual leverage — incorrect ROE calculation — wrong tier triggers.

Error Recovery

ErrorCauseFix
No position foundPosition already closed or wrong instrumentCheck hl status for actual positions
Guard state staleProcess crashed mid-tickRestart Guard — state file preserves last known state
Negative ROE but no closeStill in Phase 1 toleranceNormal if within 3% retrace. Hard stop at -5% ROE is separate
Tier jumped from 1 to 4Fast price move between ticksNormal — tiers are checked sequentially but can skip

Composition

Guard is a sub-component of APEX (runs every tick per active slot). Can also be used standalone to guard any position. When used with APEX, Guard states are managed automatically. When used standalone, you must provide entry price, size, direction, and leverage.

Cron Template

bash
# Guard is typically long-running (attached to a position), not cron-scheduled.
# Start manually when opening a position:
hl guard start ETH-PERP --entry 2500 --direction long --leverage 10 --preset moderate --tick 5

© Nunchi-trade, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 1 other file (scripts) in skills/guard of Nunchi-trade/agent-cli.

  • SKILL.md
  • scripts/standalone_runner.py

Open the folder on GitHubat commit 58619a2

Compare with similar skills

Guard Trailing Stop next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Guard Trailing Stop compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Guard Trailing Stop this skillNunchi-trade/agent-cli521—~1.9kAutomated safety check: PassMIT
Fintoolsecond-state/fintool316—~5.9kAutomated safety check: PassNone
Vendor ImplementationNo-Trade-No-Life/Yuan3521 repos~1.4kAutomated safety check: PassMIT
Moss Trade Bot Factorymoss-site/moss-trade-bot-skills389—~2.2kAutomated safety check: PassMIT-0
Hyperliquid Smart Money Flow ReaderSenpi-ai/senpi-skills134—~3.5kAutomated safety check: PassApache-2.0
Senpi Trading Runtime ContractSenpi-ai/senpi-skills134—~2.6kAutomated safety check: PassApache-2.0

Similar skills

  • Fintool

    second-state/fintool

    Financial trading CLIs — spot and perp trading on Hyperliquid, Binance, Coinbase, OKX.

    316 GitHub stars~5.9k tokensUpdated 4 mo ago
    Business, Finance & HRAuto-check passed
  • Vendor Implementation

    No-Trade-No-Life/Yuan

    基于Hyperliquid成功实现经验,为新交易所供应商提供Yuan框架集成指南。使用此技能当需要为新的交易所创建供应商实现,包括项目结构设计、API集成、核心服务实现和最佳实践。适用于交易所API集成、金融系统开发、微服务架构设计。

    352 GitHub starsUsed in 1 repo~1.4k tokens
    Business, Finance & HRAuto-check passed
  • Moss Trade Bot Factory

    moss-site/moss-trade-bot-skills

    用户用自然语言描述币种、回测时间区间和策略风格时,自动创建加密货币交易 Bot,读取内置 Hyperliquid CSV 覆盖并运行本地回测/进化;若币种、时间区间或策略风格缺失,则主动询问缺失项并展示 CSV 解析出的可用回测区间。也可在回测后上传平台 verify 或创建模拟实盘 Bot。适用于创建bot、交易策略、回测、backtest、evolve、upload verify、live…

    389 GitHub stars~2.2k tokensUpdated 1 mo ago
    Business, Finance & HRAuto-check passed
  • Reads where proven profitable Hyperliquid wallets are positioned versus smaller traders, surfacing the divergence worth paying attention to.

    134 GitHub stars~3.5k tokensUpdated yesterday
    Business, Finance & HRAuto-check passed
  • Senpi Trading Runtime Contract

    Senpi-ai/senpi-skills

    Documents how a Senpi strategy's scan function talks to the runtime that schedules it, sizes orders, and manages stop-loss exits on Hyperliquid.

    134 GitHub stars~2.6k tokensUpdated yesterday
    Business, Finance & HRAuto-check passed
  • Ranks Hyperliquid traders by how copyable they are right now and builds a due-diligence dossier on one trader, judging whether their track record is real or just a hot streak.

    134 GitHub stars~6.3k tokensUpdated yesterday
    Business, Finance & HRAuto-check passed

More from Nunchi-trade/agent-cli

  • Apex Strategy

    Nunchi-trade/agent-cli

    Autonomous multi-slot trading orchestrator. An agent skill from Nunchi-trade/agent-cli.

    521 GitHub stars~1.4k tokensUpdated 3 mo ago
    Auto-check passed
  • Opportunity Radar

    Nunchi-trade/agent-cli

    Screens all Hyperliquid perps and surfaces top trading setups

    521 GitHub stars~1.2k tokensUpdated 3 mo ago
    Auto-check passed
  • Pulse

    Nunchi-trade/agent-cli

    Detects assets with sudden capital inflow via OI/volume/funding proxy signals

    521 GitHub stars~1.1k tokensUpdated 3 mo ago
    Auto-check passed
  • Agent Onboarding

    Nunchi-trade/agent-cli

    First-time setup — from zero to first trade on Hyperliquid. An agent skill from Nunchi-trade/agent-cli.

    521 GitHub stars~2.1k tokensUpdated 3 mo ago
    Auto-check passed
  • Reflect Performance Review

    Nunchi-trade/agent-cli

    Reflect, Evaluate, Fine-tune, Learn, Evolve, Correct, Transform — nightly automated performance review

    521 GitHub stars~1.3k tokensUpdated 3 mo ago
    Auto-check passed
  • Yex Trader

    Nunchi-trade/agent-cli

    Autonomous Hyperliquid trading — 14 strategies (MM, momentum, arbitrage, LLM) with APEX multi-slot orchestrator, REFLECT performance review, DSL trailing stops, and builder fee revenue collection.

    521 GitHub stars~1.9k tokensUpdated 3 mo ago
    Auto-check: notes

Works with

Questions about Guard Trailing Stop

What does Guard Trailing Stop do?

Guard — two-phase ROE-based trailing stop system for Hyperliquid perps. Guard Trailing Stop is an agent skill from Nunchi-trade/agent-cli. Guard — two-phase ROE-based trailing stop system for Hyperliquid perps.

When should I use Guard Trailing Stop?

Guard Trailing Stop fits situations like: protecting an open position; setting trailing stops; automating profit-locked exits.

How do I install Guard Trailing Stop in Claude Code?

Run `npx skills add Nunchi-trade/agent-cli --skill guard-trailing-stop -a claude-code`. Or copy the skill folder (skills/guard in Nunchi-trade/agent-cli) into .claude/skills/guard-trailing-stop in your project. Claude Code loads it when a task matches its description.

How do I install Guard Trailing Stop in Codex?

Run `npx skills add Nunchi-trade/agent-cli --skill guard-trailing-stop -a codex`. Or copy the skill folder (skills/guard in Nunchi-trade/agent-cli) into .agents/skills/guard-trailing-stop in your project. Codex loads it when a task matches its description.

Can I use Guard Trailing Stop in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add Nunchi-trade/agent-cli --skill guard-trailing-stop -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/guard-trailing-stop, .gemini/skills/guard-trailing-stop, .github/skills/guard-trailing-stop and .opencode/skills/guard-trailing-stop in your project.

What does Guard Trailing Stop need to run?

Going by SKILL.md and its folder, Guard Trailing Stop needs Python for the scripts in its folder. Our summary lists: Python 3. Compatibility (from SKILL.md): Requires python3 and yex-trader (agent-cli) installed. Hyperliquid perp positions. Direct HL API — no mcporter needed..

Does Guard Trailing Stop access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Guard Trailing Stop safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. The check reads SKILL.md only: the scripts in the folder are not scanned, so read them before running anything.

What licence does Guard Trailing Stop use?

Guard Trailing Stop is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Guard Trailing Stop use?

About 1.9k tokens (SKILL.md is roughly 7.7k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Guard Trailing Stop?

Skills that share tags, products or a category with Guard Trailing Stop: Fintool (second-state/fintool, 316 stars), Vendor Implementation (No-Trade-No-Life/Yuan, 352 stars), Moss Trade Bot Factory (moss-site/moss-trade-bot-skills, 389 stars) and Hyperliquid Smart Money Flow Reader (Senpi-ai/senpi-skills, 134 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Guard Trailing Stop?

Nunchi-trade (a GitHub organization) maintains it in Nunchi-trade/agent-cli, which has 521 GitHub stars. The repository holds 7 skills in this directory. The repository was last updated on July 8, 2026.

Source: Nunchi-trade/agent-cli on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.