Agent skill

Wash Sale Detection

by agiprolabs in agiprolabs/claude-trading-skills

Wash sale detection under 2025 US crypto rules with 61-day window monitoring, disallowed loss tracking, and safe re-entry countdown

MITAuto-check passedBusiness, Finance & HR

Install Wash Sale Detection

skills CLI
$ npx skills add agiprolabs/claude-trading-skills --skill wash-sale-detection -a claude-code

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

GitHub CLI
$ gh skill install agiprolabs/claude-trading-skills wash-sale-detection --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/agiprolabs/claude-trading-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/wash-sale-detection .claude/skills/wash-sale-detection && 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
wash-sale-detection
GitHub stars
410
Token cost
~2.3k tokens
SKILL.md length
1,038 words
Files
3 (incl. scripts, references)
Skills in repo
68
Repo updated
First seen
Licence
MIT

At a glance

Wash sale detection under 2025 US crypto rules with 61-day window monitoring, disallowed loss tracking, and safe re-entry countdown

  • Works in 5 steps: End-of-Year Tax Review → Real-Time Monitoring → Copy-Trade and Bot Audit → …
  • Tasks that involve Crypto and DeFi analysis
  • SKILL.md covers Background, Key Concepts, Prerequisites and Capabilities, plus 7 more sections
  • Runs Python scripts from its folder

What it does

Wash Sale Detection is an agent skill from agiprolabs/claude-trading-skills. Wash sale detection under 2025 US crypto rules with 61-day window monitoring, disallowed loss tracking, and safe re-entry countdown

Its SKILL.md is about 2.3k tokens, which your agent loads only when the skill is triggered. The skill folder holds 4 other files, including scripts and reference files (for example `references/planned_features.md` and `scripts/wash_sale_scanner.py`).

It sits in Business, Finance & HR, covering Crypto and DeFi analysis. The repository describes itself as: 68 trading, DeFi, and quantitative finance Agent Skills. Works with Claude Code, Cursor, Codex, Gemini CLI, and 30+ other tools. The licence is MIT.

When your agent uses it

  • Tasks that involve Crypto and DeFi analysis

Example prompts

  • “/wash-sale-detection”

Requirements

  • Python 3

Workflow steps

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

  1. End-of-Year Tax Review
  2. Real-Time Monitoring
  3. Copy-Trade and Bot Audit
  4. Tax-Loss Harvesting Coordination
  5. Multi-Account Wash Sale Detection

What it can do on your machine

Read from SKILL.md and the folder at commit 981e1d7. 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.

Context cost

Wash Sale Detection loads about 2.3k tokens when it runs, and up to ~4.3k if it reads all its reference files. Until then it costs about 38 tokens; SKILL.md has 1,038 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~38
When it runs · the whole SKILL.md, loaded when a task matches
~2.3k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~4.3k

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 agiprolabs/claude-trading-skills at commit 981e1d7, republished under its MIT licence (© agiprolabs). 1,038 words, ~2,271 tokens.

Download SKILL.mdSave it as .claude/skills/wash-sale-detection/SKILL.md (or your agent's skills folder). This skill also uses 2 other files; get the full folder from GitHub.
name
wash-sale-detection
description
Wash sale detection under 2025 US crypto rules with 61-day window monitoring, disallowed loss tracking, and safe re-entry countdown
license
MIT
metadata.author
agipro
metadata.version
0.1.0
metadata.category
trading

Wash Sale Detection

Detect wash sales under current US crypto tax rules (effective 2025), monitor the 61-day window around realized losses, track disallowed losses with basis adjustments, and compute safe re-entry countdowns.

Disclaimer: This skill provides informational analysis only. It is NOT tax advice. Consult a qualified tax professional or CPA for guidance on your specific situation. Tax law is complex, and the application of wash sale rules to cryptocurrency may vary based on individual circumstances, IRS guidance updates, and court rulings.

Background

Before 2025, cryptocurrency was not subject to the wash sale rule because digital assets were classified as property rather than securities. The Infrastructure Investment and Jobs Act and subsequent IRS rulemaking extended wash sale treatment to digital assets beginning January 1, 2025.

Under IRC Section 1091 (as amended for digital assets), if you sell or dispose of a cryptocurrency at a loss and acquire a substantially identical asset within a 61-day window (30 days before the sale through 30 days after), the loss is disallowed for tax purposes. The disallowed loss is added to the cost basis of the replacement position.

Key Concepts

The 61-Day Window
Day -30 ................. Day 0 ................. Day +30
  |--- 30 days before ---|--- sale day ---|--- 30 days after ---|
  ^                       ^                                      ^
  Window opens        Loss realized                    Window closes
  • Day 0: The day you sell a position at a realized loss
  • Days -30 to -1: Purchases in this range trigger a wash sale retroactively
  • Days +1 to +30: Purchases in this range trigger a wash sale prospectively
  • The window is calendar days, not trading days
Substantially Identical Assets

For crypto, "substantially identical" generally means the same token. Selling SOL at a loss and buying SOL within 30 days is a wash sale. Selling SOL and buying ETH is not (they are different assets).

Edge cases that may be scrutinized:

  • Wrapped vs unwrapped versions of the same token (e.g., SOL vs wSOL)
  • Tokens across different chains (e.g., USDC on Solana vs USDC on Ethereum)
  • Derivative tokens that track the same underlying (e.g., stSOL and SOL)
Disallowed Loss and Basis Adjustment

When a wash sale occurs:

  1. The realized loss is disallowed — you cannot deduct it in the current tax year
  2. The disallowed loss is added to the cost basis of the replacement position
  3. The holding period of the original position may carry over to the replacement

Example:

  • Buy 10 SOL at $100 each (cost basis: $1,000)
  • Sell 10 SOL at $80 each (proceeds: $800, loss: $200)
  • Buy 10 SOL at $85 within 15 days (wash sale triggered)
  • New cost basis: $850 + $200 disallowed loss = $1,050
  • The $200 loss is not gone — it is deferred into the new position

Prerequisites

  • Python 3.10+
  • No external dependencies required (standard library only)
  • Trade history data in CSV or structured format with: date, action (buy/sell), token, quantity, price, proceeds, cost basis

Capabilities

  1. Wash Sale Scanning — Analyze a trade history and flag all wash sale violations
  2. 61-Day Window Monitoring — Track open windows for recent loss-generating sales
  3. Disallowed Loss Calculation — Compute the exact disallowed amount per wash sale
  4. Basis Adjustment Tracking — Show adjusted cost basis for replacement positions
  5. Safe Re-Entry Countdown — For each token sold at a loss, show days remaining until safe to re-enter
  6. Automation Hazard Detection — Flag copy-trade systems or bot strategies that may inadvertently trigger wash sales

Quick Start

python
from datetime import date

# Define your trade history
trades = [
    {"date": date(2025, 3, 1), "action": "buy",  "token": "SOL", "qty": 10, "price": 100.0},
    {"date": date(2025, 3, 15), "action": "sell", "token": "SOL", "qty": 10, "price": 80.0},
    {"date": date(2025, 3, 25), "action": "buy",  "token": "SOL", "qty": 10, "price": 85.0},
]

# Check for wash sales
from scripts.wash_sale_scanner import WashSaleScanner

scanner = WashSaleScanner(trades)
results = scanner.scan()

for ws in results.wash_sales:
    print(f"WASH SALE: {ws.token} — Loss ${ws.disallowed_loss:.2f} disallowed")
    print(f"  Sale: {ws.sale_date} | Re-entry: {ws.replacement_date}")
    print(f"  Adjusted basis: ${ws.adjusted_basis:.2f}")

# Check safe re-entry countdowns
for countdown in results.countdowns:
    print(f"{countdown.token}: {countdown.days_remaining} days until safe re-entry")

Use Cases

1. End-of-Year Tax Review

Scan your full year of trading activity to identify all wash sales before filing taxes. Generate a report showing total disallowed losses and adjusted cost bases.

2. Real-Time Monitoring

Before placing a buy order, check whether the token has an open wash sale window from a recent loss. Avoid inadvertent wash sales by waiting for the countdown to expire.

3. Copy-Trade and Bot Audit

Automated trading systems (copy-trading bots, DCA bots, grid bots) frequently trigger wash sales because they buy and sell the same tokens repeatedly. Run this scanner on bot trade exports to quantify the tax impact.

Show full SKILL.md (402 more words)Show less
4. Tax-Loss Harvesting Coordination

When executing a tax-loss harvesting strategy, use the safe re-entry countdown to plan when you can re-enter positions. Swap into a non-identical asset during the 30-day window if you want to maintain market exposure.

5. Multi-Account Wash Sale Detection

The wash sale rule applies across all accounts controlled by the same taxpayer. If you trade SOL on multiple exchanges or wallets, aggregate the trade history before scanning.

Edge Cases and Automation Hazards

DCA Bots and Grid Bots

Dollar-cost averaging bots that buy a token weekly will almost certainly trigger wash sales if the token is also sold at a loss during the same period. The scanner flags overlapping buy/sell patterns within the 61-day window.

Copy-Trading

If a copy-trade system sells a token at a loss and the leader re-enters within 30 days, your copied trades inherit the wash sale. There is no "I didn't place the trade" exception.

Partial Fills and Multiple Lots

When a sale at a loss is followed by multiple smaller purchases, the wash sale applies to each purchase up to the quantity of the loss-generating sale. The scanner handles partial matching.

Cross-Wallet Transfers

Transferring tokens to another wallet you control and selling there does not avoid the wash sale rule. The rule follows the taxpayer, not the account.

Safe Re-Entry Strategy

After selling a token at a loss:

  1. Wait 31 calendar days before repurchasing the same token
  2. During the waiting period, consider holding a non-identical substitute (e.g., sell SOL, hold ETH for exposure to crypto broadly)
  3. Use the countdown timer to know exactly when re-entry is safe
  4. Set calendar reminders for window expiration dates
Token: SOL
Sale Date: 2025-03-15
Loss: $200.00
Window Closes: 2025-04-14
Days Remaining: 12
Status: DO NOT BUY — wash sale window active

Basis Adjustment Walkthrough

Detailed step-by-step basis adjustment example:

TRADE 1: Buy 100 SOL @ $150.00    → Basis: $15,000.00
TRADE 2: Sell 100 SOL @ $120.00   → Proceeds: $12,000.00, Loss: $3,000.00
TRADE 3: Buy 100 SOL @ $125.00    → Basis before adjustment: $12,500.00
         (within 30 days of Trade 2)

WASH SALE TRIGGERED:
  Disallowed loss:    $3,000.00
  Adjusted basis:     $12,500.00 + $3,000.00 = $15,500.00
  Effective price:    $155.00 per SOL (not $125.00)

Later sale at $160.00:
  Proceeds:    $16,000.00
  Adj. basis:  $15,500.00
  Gain:        $500.00 (not $3,500.00)
  The $3,000 loss is recovered through the higher basis.

Files

References
  • references/planned_features.md — Wash sale rules in depth, 61-day window mechanics, basis adjustment examples, automation edge cases, IRS guidance references
Scripts
  • scripts/wash_sale_scanner.py — Complete wash sale scanner: loads trade history, identifies wash sales, computes disallowed losses and basis adjustments, shows safe re-entry countdowns. Run with --demo for example scenarios.

Limitations

  • This tool implements a simplified interpretation of wash sale rules as applied to crypto
  • "Substantially identical" determination for wrapped tokens and derivatives may require professional judgment
  • The scanner does not handle options, futures, or other derivative instruments on crypto
  • Multi-account detection requires you to aggregate trade data manually
  • Rules may change as IRS issues further guidance on digital asset wash sales
  • State tax rules may differ from federal treatment

© agiprolabs, 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 2 other files (scripts, references) in skills/wash-sale-detection of agiprolabs/claude-trading-skills.

  • SKILL.md
  • references/planned_features.md
  • scripts/wash_sale_scanner.py

Open the folder on GitHubat commit 981e1d7

Compare with similar skills

Wash Sale Detection 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.

Wash Sale Detection compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Wash Sale Detection this skillagiprolabs/claude-trading-skills410—~2.3kAutomated safety check: PassMIT
Technical Analysttradermonty/claude-trading-skills3k4 repos~4.6kAutomated safety check: PassMIT
Polyclawchainstacklabs/polyclaw3591 repos~2kAutomated safety check: PassApache-2.0
Longbridge Researchhelsome/folio2713 repos~2.1kAutomated safety check: PassMIT
Stock Analysis24mlight/StockClaw1012 repos~2kAutomated safety check: NotesMIT
Swapper Depositswapperfinance/swapper-toolkit852—~1.8kAutomated safety check: PassMIT

Similar skills

  • 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
    Business, Finance & HRAuto-check passed
  • Polyclaw

    chainstacklabs/polyclaw

    Trade on Polymarket via split + CLOB execution. An agent skill from chainstacklabs/polyclaw.

    359 GitHub starsUsed in 1 repo~2k tokens
    Business, Finance & HRAuto-check passed
  • Longbridge Research

    helsome/folio

    Institution ratings, consensus price targets, EPS/revenue forecasts, finance calendar, shareholder data, fund holders, insider trades (SEC Form 4), short interest, industry rankings, peer group…

    271 GitHub starsUsed in 3 repos~2.1k tokens
    Business, Finance & HRAuto-check passed
  • Stock Analysis

    24mlight/StockClaw

    Analyze stocks and cryptocurrencies using Yahoo Finance data.

    101 GitHub starsUsed in 2 repos~2k tokens
    Business, Finance & HRAuto-check: notes
  • Swapper Deposit

    swapperfinance/swapper-toolkit

    Deposit and bridge funds into a wallet or protocol using Swapper Finance.

    852 GitHub stars~1.8k tokensUpdated 6 mo ago
    Business, Finance & HRAuto-check passed
  • Okx Cex Earn

    okx/agent-skills

    Manages OKX Simple Earn (flexible savings/lending), Flash Earn, On-chain Earn (staking/DeFi), Dual Investment (DCD/双币赢), and AutoEarn (自动赚币) via the okx CLI.

    187 GitHub starsUsed in 2 repos~3.3k tokens
    Business, Finance & HRAuto-check passed

More from agiprolabs/claude-trading-skills

All 68 skills in this repo
  • Backtrader

    agiprolabs/claude-trading-skills

    Event-driven backtesting with bar-by-bar execution, complex order types, multiple analyzers, and custom indicators

    410 GitHub stars~2.4k tokensUpdated 1 mo ago
    Auto-check passed
  • Birdeye API

    agiprolabs/claude-trading-skills

    Solana token market data via Birdeye — prices, OHLCV, trades, token metadata, security checks, and trader activity

    410 GitHub stars~1.8k tokensUpdated 1 mo ago
    Auto-check passed
  • Coingecko API

    agiprolabs/claude-trading-skills

    Broad crypto market data from CoinGecko covering 13,000+ tokens.

    410 GitHub stars~1.6k tokensUpdated 1 mo ago
    Auto-check passed
  • Cointegration Analysis

    agiprolabs/claude-trading-skills

    Cointegration testing for pairs trading using Engle-Granger, Johansen, and rolling stability analysis

    410 GitHub stars~2.1k tokensUpdated 1 mo ago
    Auto-check passed
  • Copy Trading

    agiprolabs/claude-trading-skills

    Wallet evaluation, monitoring, and copy-trade strategy design for Solana DEX trading

    410 GitHub stars~2.4k tokensUpdated 1 mo ago
    Auto-check passed
  • Correlation Analysis

    agiprolabs/claude-trading-skills

    Cross-asset correlation analysis including rolling correlation, hierarchical clustering, tail dependence, and regime-dependent correlation

    410 GitHub stars~2.4k tokensUpdated 1 mo ago
    Auto-check passed

Questions about Wash Sale Detection

What does Wash Sale Detection do?

Wash sale detection under 2025 US crypto rules with 61-day window monitoring, disallowed loss tracking, and safe re-entry countdown. Wash Sale Detection is an agent skill from agiprolabs/claude-trading-skills.

When should I use Wash Sale Detection?

Wash Sale Detection fits situations like: tasks that involve Crypto and DeFi analysis.

How do I install Wash Sale Detection in Claude Code?

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

How do I install Wash Sale Detection in Codex?

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

Can I use Wash Sale Detection 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 agiprolabs/claude-trading-skills --skill wash-sale-detection -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/wash-sale-detection, .gemini/skills/wash-sale-detection, .github/skills/wash-sale-detection and .opencode/skills/wash-sale-detection in your project.

What does Wash Sale Detection need to run?

Going by SKILL.md and its folder, Wash Sale Detection needs Python for the scripts in its folder. Our summary lists: Python 3.

Does Wash Sale Detection 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 Wash Sale Detection 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 Wash Sale Detection use?

Wash Sale Detection 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 Wash Sale Detection use?

About 2.3k tokens (SKILL.md is roughly 9.1k 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 2k tokens, read only when the agent opens those files.

What are the alternatives to Wash Sale Detection?

Skills that share tags, products or a category with Wash Sale Detection: Technical Analyst (tradermonty/claude-trading-skills, 3k stars), Polyclaw (chainstacklabs/polyclaw, 359 stars), Longbridge Research (helsome/folio, 271 stars) and Stock Analysis (24mlight/StockClaw, 101 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Wash Sale Detection?

agiprolabs (a GitHub user) maintains it in agiprolabs/claude-trading-skills, which has 410 GitHub stars. The repository holds 68 skills in this directory. The repository was last updated on September 3, 2026.

Source: agiprolabs/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.