Agent skill

Contrarian Setup Gate

by tradermonty in tradermonty/claude-trading-skills

Synthesize the three Jason Shapiro contrarian-pipeline verdicts (COT crowding, news-reaction failure, weekly price-action confirmation) into one actionable setupstatus via a fail-closed precedence…

MITAuto-check passed

Install Contrarian Setup Gate

skills CLI
$ npx skills add tradermonty/claude-trading-skills --skill contrarian-setup-gate -a claude-code

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

GitHub CLI
$ gh skill install tradermonty/claude-trading-skills contrarian-setup-gate --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/tradermonty/claude-trading-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/contrarian-setup-gate .claude/skills/contrarian-setup-gate && 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
contrarian-setup-gate
GitHub stars
3k
Token cost
~2.4k tokens
SKILL.md length
1,093 words
Files
8 (incl. scripts, references)
Skills in repo
74
Repo updated
First seen
Licence
MIT

At a glance

Synthesize the three Jason Shapiro contrarian-pipeline verdicts (COT crowding, news-reaction failure, weekly price-action confirmation) into one actionable setupstatus via a fail-closed precedence…

  • Works in 3 steps: Run the Gate → Read the Setup Status → Act on READY_FOR_PLAN Only
  • SKILL.md covers Overview, When to Use, Prerequisites and Workflow, plus 4 more sections
  • Runs Python scripts from its folder; calls python3

What it does

Contrarian Setup Gate is an agent skill from tradermonty/claude-trading-skills. Synthesize the three Jason Shapiro contrarian-pipeline verdicts (COT crowding, news-reaction failure, weekly price-action confirmation) into one actionable setupstatus via a fail-closed precedence state machine. Pure, offline synthesis -- no network, no API keys, no computation beyond validation and precedence.

Its SKILL.md is about 2.4k tokens, which your agent loads only when the skill is triggered. The skill folder holds 10 other files, including scripts and reference files (for example `references/gate-decision-table.md`, `scripts/gate_logic.py` and `scripts/run_contrarian_setup_gate.py`).

The repository describes itself as: Claude Code skills for equity investors and traders — market analysis, technical charting, economic calendars, screeners, and trading strategy development. The licence is MIT.

Example prompts

  • “/contrarian-setup-gate”

Requirements

  • Python 3

Workflow steps

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

  1. Run the Gate
  2. Read the Setup Status
  3. Act on READY_FOR_PLAN Only

What it can do on your machine

Read from SKILL.md and the folder at commit eab8d5c. 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 5 files in scripts/ (Python), which the agent can run.

    Shell commands in SKILL.md call:

    • python3

    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.

Context cost

Contrarian Setup Gate loads about 2.4k tokens when it runs, and up to ~7.9k if it reads all its reference files. Until then it costs about 84 tokens; SKILL.md has 1,093 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~84
When it runs · the whole SKILL.md, loaded when a task matches
~2.4k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~7.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 tradermonty/claude-trading-skills at commit eab8d5c, republished under its MIT licence (© tradermonty). 1,093 words, ~2,445 tokens.

Download SKILL.mdSave it as .claude/skills/contrarian-setup-gate/SKILL.md (or your agent's skills folder). This skill also uses 7 other files; get the full folder from GitHub.
name
contrarian-setup-gate
description
Synthesize the 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. Pure, offline synthesis -- no network, no API keys, no computation beyond validation and precedence.

Contrarian Setup Gate

Overview

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.

When to Use

  • After running cot-contrarian-detector (always required -- this is the pipeline's entry point)
  • Mid-pipeline, with only the detector report, to see the CROWDED state and what steps remain
  • After running news-reaction-failure-analyzer, to see whether the setup advances to WATCHING_PRICE or is REJECTED
  • After running technical-analyst's contrarian-confirmation mode, to see whether the setup reaches READY_FOR_PLAN
  • Before handing a symbol's direction and stop level to a position-sizing skill

Prerequisites

  • Python 3.9+
  • No API keys -- this skill is fully offline
  • A cot-contrarian-detector JSON report for the symbol under evaluation (required)
  • Optionally, a news-reaction-failure-analyzer JSON report for the same symbol (step 2)
  • Optionally, a technical-analyst contrarian-confirmation JSON report for the same symbol (step 3)

Workflow

Step 1: Run the Gate
bash
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.

Step 2: Read the Setup Status
StatusMeaningNext Step
READY_FOR_PLANAll three steps confirmed; direction, entry_trigger, and invalidation_level are populatedHand direction and invalidation_level to a position-sizing skill
WATCHING_PRICECrowding + news confirmed; price action still pendingRun technical-analyst's contrarian-confirmation mode
CROWDEDCrowding confirmed; news and/or price still pendingRun news-reaction-failure-analyzer
REJECTEDCrowding is NOT_CONFIRMED (classification NEUTRAL), or news/price came back NOT_CONFIRMEDStop -- do not run further steps for this symbol/direction
INSUFFICIENT_EVIDENCEA required input is missing, unreadable, stale, inconsistent, or could not itself reach a verdictStop -- 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.

Step 3: Act on READY_FOR_PLAN Only

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.

Show full SKILL.md (519 more words)Show less

Precedence (Summary)

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.

  1. Crowding is evaluated first and exclusively: INVALID/INSUFFICIENT crowding is always INSUFFICIENT_EVIDENCE; a NOT_CONFIRMED (NEUTRAL) classification is always REJECTED, regardless of any downstream file's state or corruption.
  2. With crowding CONFIRMED, news is evaluated next, on its own: INVALID (unreadable, malformed, stale, symbol mismatch, direction mismatch, unsupported schema) forces 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.
  3. Once news is CONFIRMED (or PENDING, for out-of-order use), price-action is evaluated last, with the same four-way settlement. Running price-action before news (out-of-order pipeline use) caps the status at 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.
  4. Crowding confirmed, both downstream steps pending -> CROWDED.
  5. Crowding + news confirmed, price-action pending -> WATCHING_PRICE.
  6. All three confirmed -> 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.

Output Contract

The script writes contrarian_setup_gate_<SYMBOL>_<as-of>.json and .md to --output-dir:

yaml
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).

Guardrails

  1. Never places or recommends orders. READY_FOR_PLAN is the furthest state this skill reaches. Order entry and position sizing are separate, downstream decisions.
  2. INSUFFICIENT_EVIDENCE and REJECTED never advance. No warning, confidence, or partial input ever pushes the status past what the precedence rules allow.
  3. Fail closed on every input, always. An unreadable, malformed, stale, symbol-mismatched, or unknown-enum report is never treated as a pass -- it is named and blocks or downgrades the status. This includes the price-action report's 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.
  4. 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.
  5. Not investment advice. entry_trigger and invalidation_level are factual echoes of the upstream price-action report, not recommendations.

Resources

  • scripts/run_contrarian_setup_gate.py -- CLI: hardened JSON loading (unreadable / parse_error incl. RecursionError / non_finite via an iterative whole-file scan), report generation
  • scripts/gate_logic.py -- Pure synthesis core: normalization (incl. malformed-shape detection), consistency checks, the precedence state machine
  • references/gate-decision-table.md -- Full decision table, reason-token glossary, worked examples (including the real B6 REJECTED case)

© tradermonty, 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 7 other files (scripts, references) in skills/contrarian-setup-gate of tradermonty/claude-trading-skills.

  • SKILL.md
  • references/gate-decision-table.md
  • requirements.txt
  • scripts/gate_logic.py
  • scripts/run_contrarian_setup_gate.py
  • scripts/tests/conftest.py
  • scripts/tests/test_gate_logic.py
  • scripts/tests/test_run_contrarian_setup_gate.py

Open the folder on GitHubat commit eab8d5c

Compare with similar skills

Contrarian Setup Gate 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.

Contrarian Setup Gate compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Contrarian Setup Gate this skilltradermonty/claude-trading-skills3k—~2.4kAutomated safety check: PassMIT
Gate Testsvercel/next.js143k—~2.8kAutomated safety check: PassMIT
Gateplugin87/ux-ui-agent-skills1.6k—~532Automated safety check: PassMIT
Visual Verdict Screenshot QAYeachan-Heo/oh-my-claudecode40k—~609Automated safety check: PassMIT
Phase Gate CheckDonchitos/Claude-Code-Game-Studios26k—~2.2kAutomated safety check: NotesMIT
Brain Ingest Gategarrytan/gbrain31k—~3.9kAutomated safety check: PassMIT

Similar skills

  • Gate Tests

    vercel/next.js

    Official

    How to use the @gate / @force-gate test directives instead of it.skip or fake-green skip patterns.

    143k GitHub stars~2.8k tokensUpdated today
    Auto-check passed
  • Gate

    plugin87/ux-ui-agent-skills

    Run the one-command quality gate and report the real N/N result.

    1.6k GitHub stars~532 tokensUpdated 2 days ago
    Frontend & DesignAuto-check passed
  • Visual Verdict Screenshot QA

    Yeachan-Heo/oh-my-claudecode

    Compares a generated UI screenshot with reference images and returns a strict JSON verdict with a score, differences and suggested edits to drive the next iteration.

    40k GitHub stars~609 tokensUpdated 2 days ago
    Testing & QAAuto-check passed
  • Phase Gate Check

    Donchitos/Claude-Code-Game-Studios

    Checks whether a game project is ready to move to its next production stage and returns a PASS, CONCERNS, NOT ASSESSED or FAIL verdict with blockers.

    26k GitHub stars~2.2k tokensUpdated 2 days ago
    Game DevelopmentAuto-check: notes
  • Brain Ingest Gate

    garrytan/gbrain

    Pre-write quality gate for content entering the brain. An agent skill from garrytan/gbrain.

    31k GitHub stars~3.9k tokensUpdated today
    Testing & QAAuto-check passed
  • Synthesize research findings from memory into structured reports with evidence grading, contradiction resolution, and actionable recommendations

    74k GitHub stars~706 tokensUpdated today
    Auto-check: notes

More from tradermonty/claude-trading-skills

All 74 skills in this repo
  • Technical Analyst

    tradermonty/claude-trading-skills

    This skill should be used when analyzing weekly price charts for stocks, stock indices, cryptocurrencies, or forex pairs.

    3k GitHub starsUsed in 4 repos~4.6k tokens
    Auto-check passed
  • Theme Detector

    tradermonty/claude-trading-skills

    Detect and analyze trending market themes across sectors. An agent skill from tradermonty/claude-trading-skills.

    3k GitHub starsUsed in 2 repos~4.9k tokens
    Auto-check passed
  • Trader Memory Core

    tradermonty/claude-trading-skills

    Track investment theses across their lifecycle — from screening idea to closed position with postmortem.

    3k GitHub starsUsed in 2 repos~4.3k tokens
    Auto-check passed
  • Edge Strategy Reviewer

    tradermonty/claude-trading-skills

    Critically review strategy drafts from edge-strategy-designer for edge plausibility, overfitting risk, sample size adequacy, and execution realism.

    3k GitHub starsUsed in 1 repo~988 tokens
    Auto-check passed
  • Sector Analyst

    tradermonty/claude-trading-skills

    This skill should be used when analyzing sector rotation patterns and market cycle positioning.

    3k GitHub starsUsed in 1 repo~2.3k tokens
    Auto-check passed
  • Stanley Druckenmiller Investment

    tradermonty/claude-trading-skills

    Druckenmiller Strategy Synthesizer - Integrates 8 upstream skill outputs (Market Breadth, Uptrend Analysis, Market Top, Macro Regime, FTD Detector, VCP Screener, Theme Detector, CANSLIM Screener)…

    3k GitHub starsUsed in 1 repo~2k tokens
    Auto-check passed

Questions about Contrarian Setup Gate

What does Contrarian Setup Gate do?

Synthesize the three Jason Shapiro contrarian-pipeline verdicts (COT crowding, news-reaction failure, weekly price-action confirmation) into one actionable setupstatus via a fail-closed precedence…. Contrarian Setup Gate is an agent skill from tradermonty/claude-trading-skills. Synthesize the three Jason Shapiro contrarian-pipeline verdicts (COT crowding, news-reaction failure, weekly price-action confirmation) into one actionable setupstatus via a fail-closed precedence state machine.

How do I install Contrarian Setup Gate in Claude Code?

Run `npx skills add tradermonty/claude-trading-skills --skill contrarian-setup-gate -a claude-code`. Or copy the skill folder (skills/contrarian-setup-gate in tradermonty/claude-trading-skills) into .claude/skills/contrarian-setup-gate in your project. Claude Code loads it when a task matches its description.

How do I install Contrarian Setup Gate in Codex?

Run `npx skills add tradermonty/claude-trading-skills --skill contrarian-setup-gate -a codex`. Or copy the skill folder (skills/contrarian-setup-gate in tradermonty/claude-trading-skills) into .agents/skills/contrarian-setup-gate in your project. Codex loads it when a task matches its description.

Can I use Contrarian Setup Gate 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 tradermonty/claude-trading-skills --skill contrarian-setup-gate -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/contrarian-setup-gate, .gemini/skills/contrarian-setup-gate, .github/skills/contrarian-setup-gate and .opencode/skills/contrarian-setup-gate in your project.

What does Contrarian Setup Gate need to run?

Going by SKILL.md and its folder, Contrarian Setup Gate needs Python for the scripts in its folder and the command-line tools its instructions call (python3). Our summary lists: Python 3.

Does Contrarian Setup Gate 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 Contrarian Setup Gate 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 Contrarian Setup Gate use?

Contrarian Setup Gate is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Contrarian Setup Gate use?

About 2.4k tokens (SKILL.md is roughly 9.8k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 5.4k tokens, read only when the agent opens those files.

What are the alternatives to Contrarian Setup Gate?

Skills that share tags, products or a category with Contrarian Setup Gate: Gate Tests (vercel/next.js, 143k stars), Gate (plugin87/ux-ui-agent-skills, 1.6k stars), Visual Verdict Screenshot QA (Yeachan-Heo/oh-my-claudecode, 40k stars) and Phase Gate Check (Donchitos/Claude-Code-Game-Studios, 26k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Contrarian Setup Gate?

tradermonty (a GitHub user) maintains it in tradermonty/claude-trading-skills, which has 2,977 GitHub stars. The repository holds 74 skills in this directory. The repository was last updated on October 9, 2026.

Source: tradermonty/claude-trading-skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.