agentleFS
krzysukrzysu/market-skills/skills/strategy-mean-reversion/SKILL.md

strategy-mean-reversion

Skill3 starsChanged 4 months agoMITView on GitHub

L3 mean-reversion strategy. Buys oversold at support, sells overbought at resistance. Composes RSI, S/R, and volatility.

The file

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    When SP500 CAPE valuation disagrees with the trade direction, each idea carries a soft veto_reasons tag (sp500_cape_overextended_z{X.XX} …

    line 63

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

strategy-mean-reversion

L3 strategy that fades extreme moves by entering when price reaches a key S/R level and RSI confirms exhaustion.

When NOT to use

  • Without a mandatory risk-engine vet before execution — this skill emits ideas, not orders. Always vet the Intent and get explicit user approval.
  • In a strong trend — mean-reversion fails hardest when price keeps running (e.g. RSI pinned overbought in an uptrend). Confirm a real range/low-vol regime (market-volatility) first.
  • For a single-indicator read — it composes market-rsi + market-s-r + market-volatility; call those directly if you only want the levels/oscillator.

Quick Start

uv run skills/strategy-mean-reversion/scripts/run.py SPY
uv run skills/strategy-mean-reversion/scripts/run.py SPY --json

Flags

FlagDefaultNotes
TICKER (positional)—Required. Supports provider:ticker (e.g. hl:LIT, yf:AAPL).
--jsonhumanEmit JSON to stdout.
--source=PROVIDERauto-detectForce a data provider (see README).
--interval=INTERVAL1d1m/2m/5m/15m/30m/1h/2h/4h/8h/12h/1d/3d/1wk/1M.
--period=PERIOD1y1d/5d/1mo/3mo/6mo/1y/2y/5y/10y/ytd/max.

Both timeframe flags are validated — bad values exit 2 with a friendly error. For intraday (--interval=1h), bump --period to 6mo or 1y; yfinance caps hourly at ~2y and anything sub-hour at ~60d.

Composes

L2 SkillPurpose
market-rsiDetect oversold/overbought conditions (L1, composed by L3 directly)
market-s-rIdentify nearest support/resistance levels
market-volatilityConfirm low vol for tighter reversal (L1, composed by L3 directly)
market-valuationSP500 CAPE z-score — soft veto_reasons tag when valuation disagrees with the trade

Entry Logic

  • Long: RSI < 30 (oversold) + price at or below support + low vol regime
  • Short: RSI > 70 (overbought) + price at or above resistance + low vol regime
  • Stop: below support (long) / above resistance (short) — ~1 ATR beyond level
  • Targets: return to middle (50% S/R range), 1:1 R:R

Output

  • ideas[] — trade ideas with direction, conviction, entry/stop/target, reasoning
    • Each idea carries version: "v1".."v5" derived from conviction via analysis.contracts.conviction_version()
    • Each idea carries take_profit_ideal (unrounded construction) and rr_to_tp: [rr_to_tp1, rr_to_tp2, rr_to_tp3] (precomputed R:R to each TP via analysis.contracts.compute_rr_to_tp()) so consumers can read a canonical R:R without reimplementing the direction-asymmetric formula
    • Each idea is validated against validate_l3_tp_ladder() (TP3 ≥ entry × 1.05 long, or ≤ entry × 0.95 short). Mean-reversion widens TP3 to clear the 5% dead zone — far_target is clamped at entry × 1.05 (long) / entry × 0.95 (short) regardless of where resistance/support sits, so low-vol assets with a real mean-reversion setup still emit an idea rather than silently dropping to ideas: []. If validation ever fails after the clamp, the strategy surfaces the validator's error message as narrative so the silent-failure fingerprint doesn't reappear.
    • When SP500 CAPE valuation disagrees with the trade direction, each idea carries a soft veto_reasons tag (sp500_cape_overextended_z{X.XX} for longs during OVEREXTENDED regimes, sp500_cape_oversold_z{X.XX} for shorts during OVERSOLD regimes). The tag is informational; conviction is not auto-downgraded. The LLM agent brain reads the tag and decides.
  • narrative — summary for user briefing

Output envelope (AXI)

--json output follows the canonical AXI envelope — {data, count, errors, help[]}. Default schema is the per-skill minimal fields (3-6 essentials); pass --fields=<csv> to project or --full for the full payload. count is the item count, help[] is contextual next-step command templates. Lib.py return shapes (L1Result / L2Result / L3Result / L3Idea / RegimeSignal) are unchanged — the envelope wraps them at the scripts/run.py boundary.

Home view (no-arg mode)

No-arg mode prints the home view from $XDG_DATA_HOME/market-skills/<skill>_last.json (last successful run). Errors are not cached.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.