Synthesizes three Jason Shapiro contrarian-pipeline verdicts (COT crowding, news-reaction failure, weekly price-action confirmation) into one actionable setup_status via a fail-closed precedence state machine. Fully offline, no API keys.
Ships in tradermonty-claude-trading-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Synthesize the outputs of Jason Shapiro's 3-step contrarian process into one actionable state. cot-contrarian-detector (step 1) flags crowded positioning, news-reaction-failure-analyzer (step 2) tests whether the market failed to react to news favorable to the crowd, and technical-analyst's contrarian-confirmation mode (step 3) confirms weekly price-action evidence of a reversal. This gate reads those three report JSONs and applies an explicit, exhaustively-tested precedence rule set to produce one setup_status, with a fail-closed reason attached to every input that could not be confirmed.
The gate does no fetching, no API calls, and no computation beyond validating and combining the three inputs it is given. It is the pipeline's synthesis center, not a data source.
Validate run_context.data_date and every supplied vintage for the selected market:
markets[].data_date and data_provenance.market_data_dates[symbol]. Each must
be nonempty, parseable, not after --as-of, and no older than
--max-detector-age-days (the boundary itself is accepted). Use the oldest
validated date for the audit age; keep the original run context unchanged.
Legacy reports may omit row/map dates and fall back to the report date. A
present invalid/null/empty date or malformed provenance/map container fails
closed using the existing missing/invalid/future/stale reason codes. Other
symbols' row/map dates do not replace the selected market's vintage. Existing
first-10-character date parsing remains compatible; this is not a stricter
full-timestamp or provenance-schema validator.
python3 skills/contrarian-setup-gate/scripts/run_contrarian_setup_gate.py \
--symbol B6 \
--detector-json reports/cot_crowding_2026-07-12.json \
--news-json reports/nrf_B6_2026-07-12.json \
--price-action-json reports/ta_confirmation_B6_2026-07-12.json \
--as-of 2026-07-15 \
--output-dir reports/
--symbol and --detector-json are required; --news-json and --price-action-json are optional -- omit either to see the state at that pipeline stage. --as-of is required (no implicit "today"): staleness is always evaluated against an explicit reference date so reruns are deterministic.
Exit behavior is intentionally asymmetric: a missing or malformed --as-of (or any other CLI usage error) is an operator config mistake, so the CLI exits 2 with usage text and writes no report. A problem with one of the three untrusted report files -- unreadable, malformed, stale, inconsistent -- is always handled fail-closed instead: the CLI exits 0 and writes a report naming the reason, exactly like every other skill in this pipeline.
| Status | Meaning | Next Step |
|---|---|---|
READY_FOR_PLAN | All three steps confirmed; direction, entry_trigger, and invalidation_level are populated | Hand direction and invalidation_level to a position-sizing skill |
WATCHING_PRICE | Crowding + news confirmed; price action still pending | Run technical-analyst's contrarian-confirmation mode |
CROWDED | Crowding confirmed; news and/or price still pending | Run news-reaction-failure-analyzer |
REJECTED | Crowding is NOT_CONFIRMED (classification NEUTRAL), or news/price came back NOT_CONFIRMED | Stop -- do not run further steps for this symbol/direction |
INSUFFICIENT_EVIDENCE | A required input is missing, unreadable, stale, inconsistent, or could not itself reach a verdict | Stop -- fix or regenerate the named input before rerunning |
missing_confirmations lists every step still blocking, with its state and reason. warnings never change the status -- they flag audit-worthy conditions such as a MEDIUM-confidence confirming signal or a near-stale input.
At READY_FOR_PLAN, direction (SHORT/LONG, the fade side of the crowd), entry_trigger (a factual echo of the confirming weekly signal), and invalidation_level (the stop reference from the price-action report) are populated. gate_confidence is the weaker of the news and price-action confidences (HIGH/MEDIUM/LOW -- LOW is a token both upstream skills document as reserved but never actually emit; the gate accepts it and ranks it weakest rather than rejecting it as unknown). Position sizing is the next pipeline stage (not yet built as of this skill's release -- see the roadmap in the repository's workflow docs); this gate never places or recommends an order.
Each step is evaluated in strict pipeline order -- crowding, then news, then price-action -- and each step fully settles before the next step's file is even consulted. An earlier step's definitive verdict is never softened by a later step's problem.
INSUFFICIENT_EVIDENCE; a NOT_CONFIRMED (NEUTRAL) classification is always REJECTED, regardless of any downstream file's state or corruption.INSUFFICIENT_EVIDENCE; NOT_CONFIRMED forces REJECTED; INSUFFICIENT forces INSUFFICIENT_EVIDENCE -- in every one of these cases, price-action is never even inspected for the decision.CROWDED with a warning -- a NOT_CONFIRMED price-action verdict still REJECTs even out of order, since price-action is still fully evaluated in that branch.CROWDED.WATCHING_PRICE.READY_FOR_PLAN.See references/gate-decision-table.md for the full decision table (every reachable {crowding} x {news} x {price-action} state combination), the reason-token glossary, and worked examples.
The script writes contrarian_setup_gate_<SYMBOL>_<as-of>.json and .md to --output-dir:
symbol: B6
setup_status: READY_FOR_PLAN | WATCHING_PRICE | CROWDED | REJECTED | INSUFFICIENT_EVIDENCE
direction: SHORT | LONG | null
gate_confidence: HIGH | MEDIUM | LOW | null
entry_trigger: string | null
invalidation_level: number | null
missing_confirmations: [{step, state, reason}, ...]
warnings: [string, ...]
inputs:
crowding: {state, classification, data_date, age_days, report_path}
news_failure: {state, verdict, confidence, verdict_reason, as_of, age_days, report_path}
price_action: {state, verdict, confidence, verdict_reason, stop_reference, as_of, age_days, report_path}
run_context: {symbol, as_of, max_detector_age_days, max_report_age_days, schema_version, skill}
Every input's state is one of CONFIRMED, NOT_CONFIRMED, INSUFFICIENT, PENDING (report not provided), or INVALID (a report was provided but is unusable -- unreadable, malformed, stale, or inconsistent with the other inputs; always carries a named reason).
READY_FOR_PLAN is the furthest state this skill reaches. Order entry and position sizing are separate, downstream decisions.verdict_reason (allowlisted against technical-analyst's actual confirming-signal vocabulary, not merely type-checked) and its stop_reference (must be a finite, positive number -- never non-finite, zero, negative, or a boolean). Before any of the three report files reaches this validation, the CLI also rejects a file outright (reason <input>_non_finite) if it contains a non-finite number (Infinity/-Infinity/NaN, including an ordinary-looking number like 1e309 that overflows on parse) ANYWHERE in it, not just in a field the gate reads -- this is what keeps every report a valid, complete JSON file even under adversarial input.READY_FOR_PLAN always carries a usable plan. entry_trigger is guaranteed non-empty and invalidation_level is guaranteed a finite positive number whenever the status is READY_FOR_PLAN -- enforced both by input validation and by a defensive invariant check.entry_trigger and invalidation_level are factual echoes of the upstream price-action report, not recommendations.scripts/run_contrarian_setup_gate.py -- CLI: hardened JSON loading (unreadable / parse_error incl. RecursionError / non_finite via an iterative whole-file scan), report generationscripts/gate_logic.py -- Pure synthesis core: normalization (incl. malformed-shape detection), consistency checks, the precedence state machinereferences/gate-decision-table.md -- Full decision table, reason-token glossary, worked examples (including the real B6 REJECTED case)references/gate-decision-table.md (opens in a new tab)requirements.txt (opens in a new tab)scripts/gate_logic.py (opens in a new tab)scripts/run_contrarian_setup_gate.py (opens in a new tab)scripts/tests/conftest.py (opens in a new tab)scripts/tests/test_cot_market_vintage.py (opens in a new tab)scripts/tests/test_gate_logic.py (opens in a new tab)scripts/tests/test_run_contrarian_setup_gate.py (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
74 skills in this plugin
/backtest-expertExpert guidance for systematic backtesting of trading strategies. Use when developing, testing, stress-testing, or validating quantitative trading strategies. Covers "beating ideas to death" methodology, parameter robustness testing, slippage modeling, bias prevention, and interpreting backtest results. Applicable when user asks about backtesting, strategy validation, robustness testing, avoiding overfitting, or systematic trading development./breadth-chart-analystThis skill should be used when analyzing market breadth charts, specifically the S&P 500 Breadth Index (200-Day MA based) and the US Stock Market Uptrend Stock Ratio charts. Use this skill when the user provides breadth chart images for analysis, requests market breadth assessment, positioning strategy recommendations, or wants to understand medium-term strategic and short-term tactical market outlook based on breadth indicators. Also works WITHOUT chart images by fetching CSV data directly from public sources. All analysis and output are conducted in English./breakout-trade-plannerGenerate Minervini-style breakout trade plans from VCP screener output with worst-case risk calculation, portfolio heat management, and Alpaca-compatible order templates (stop-limit bracket for pre-placement, limit bracket for post-confirmation). Use when user has VCP screener results and wants actionable trade plans with entry/stop/target levels and position sizing./canslim-screenerScreen US stocks using William O'Neil's CANSLIM growth stock methodology. Use when user requests CANSLIM stock screening, growth stock analysis, momentum stock identification, or wants to find stocks with strong earnings and price momentum following O'Neil's investment system./cot-contrarian-detectorDetect crowded speculative positioning in CFTC futures markets (COT report analysis) to find contrarian setups using Jason Shapiro's methodology. Screens large-speculator ("non-commercial") net positioning across 65 futures markets (indices, rates, FX, metals, energy, crypto) via the FMP Commitment of Traders API, computes a 3-year and 26-week COT Index per market, and classifies extremes as CROWDED_LONG / CROWDED_SHORT. Use when the user asks about COT report analysis, crowded positioning, "who is trapped", speculative positioning extremes, contrarian futures setups, or wants to run Jason Shapiro-style analysis. This skill automates crowding DETECTION only (step 1 of 5) — it does not generate trade signals by itself./crypto-regime-analyzerQuantifies crypto market regime health using free, keyless public data (CoinGecko + Binance funding). Generates a 0-100 composite score across 6 components (100 = risk-on) with a posture recommendation. No API key required. Use when user asks about crypto market conditions, whether it's alt season, BTC dominance, crypto risk-on vs risk-off, funding rates, or whether crypto exposure should be increased or reduced./tradermonty-claude-trading-skills:contrarian-setup-gatefrom tradermonty-claude-trading-skills
tradermonty-claude-trading-skills@cascade-business-ops is listed by joshuarweaver/cascade-business-ops — review the source before installing
npx claudepluginhub joshuarweaver/cascade-business-ops --plugin tradermonty-claude-trading-skillsOther plugins' skills for the same job