New to Claude Skills? Learn how to install them →

anthropics on GitHub

Tax-Loss Harvesting

OfficialFree

Optimize your investment losses for tax benefits.

Get this skill

Free · Opens the source repo

What Tax-Loss Harvesting does

The Tax-Loss Harvesting skill is designed for investors looking to identify and capitalize on unrealized losses in their taxable accounts. By scanning through your investment portfolio, this skill highlights positions that are underperforming, allowing you to make informed decisions about selling these assets to realize losses that can offset capital gains. This process not only helps in reducing your tax liability but also aids in maintaining a balanced portfolio by suggesting suitable replacement securities that align with your investment strategy.

The workflow begins with identifying candidates for tax-loss harvesting by evaluating various metrics such as unrealized loss, holding period, and percentage loss. This prioritization ensures that you focus on the most beneficial opportunities first. Following this, the skill assists in calculating your overall tax situation, providing a clear picture of realized gains and losses, and estimating potential tax savings based on your marginal tax rates. This comprehensive approach allows you to set a target harvesting amount tailored to your financial situation.

Once candidates are identified, the skill suggests replacement securities that maintain similar market exposure while adhering to wash sale regulations. It checks for any potential wash sales across all accounts, ensuring compliance and avoiding disallowed losses. The execution plan facilitates a structured approach to selling and buying securities, summarizing estimated losses and tax savings, which helps you make strategic investment decisions.

Finally, post-harvest tracking allows you to manage your portfolio effectively after the harvesting process. You can choose to swap back to original securities or maintain the replacements based on market conditions and personal preferences. The skill provides essential documentation for tax reporting and compliance, making it a valuable tool for both individual investors and financial advisors focused on tax efficiency in investment strategies.

When to use it

Use this skill during year-end tax planning or when you want to optimize your investment portfolio for tax efficiency throughout the year.

When not to use it

This skill may not be suitable for investors with tax-advantaged accounts, as the harvesting strategy primarily applies to taxable accounts.

What you can build with it

Year-End Tax Planning

Utilize the skill to identify unrealized losses before the tax year ends, optimizing your tax position.

Portfolio Rebalancing

When rebalancing your portfolio, use this skill to ensure you harvest losses while maintaining market exposure.

Tax Efficiency Strategy

Incorporate this skill into your overall investment strategy to enhance tax efficiency throughout the year.

How to install Tax-Loss Harvesting

View source

1. Install with the skills CLI

npx skills add anthropics/financial-services/tax-loss-harvesting --agent claude-code

2. Or install it manually

Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.

Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs

Inside SKILL.md

Written by anthropics

Tax-Loss Harvesting

Workflow

Step 1: Identify Candidates

Scan taxable accounts for positions with unrealized losses:

SecurityAsset ClassCost BasisCurrent ValueUnrealized LossHolding Period% Loss
ST / LT

Prioritize by:

  1. Largest absolute loss (biggest tax benefit)
  2. Short-term losses first (offset short-term gains taxed at ordinary income rates)
  3. Positions with the largest % loss (less likely to recover quickly)

Step 2: Gain/Loss Budget

Calculate the client's tax situation:

CategoryAmount
Realized short-term gains YTD
Realized long-term gains YTD
Realized losses YTD
Net gain/(loss) position
Carryforward losses from prior years
Target harvesting amount

Tax savings estimate:

  • Short-term losses × marginal ordinary income rate
  • Long-term losses × capital gains rate
  • Up to $3,000 net loss deduction against ordinary income
  • Excess carries forward

Step 3: Replacement Securities

For each harvest candidate, suggest a replacement that:

  • Maintains similar market exposure (same asset class, sector, geography)
  • Is NOT "substantially identical" (wash sale rule)
  • Has similar risk/return characteristics
SellReplace WithReasonTracking Error Risk
SPDR S&P 500 (SPY)iShares Core S&P 500 (IVV)Same index, different fund familyMinimal
Vanguard Total Intl (VXUS)iShares MSCI ACWI ex-US (ACWX)Similar exposure, different indexLow
Individual stock ABCSector ETF (XLK)Broader exposure, no wash sale riskModerate

Step 4: Wash Sale Check

Before executing, verify no wash sales:

  • Check ALL accounts in the household (taxable, IRA, Roth, spouse accounts)
  • 30-day lookback: Did we buy substantially identical securities in the last 30 days?
  • 30-day forward: Block repurchase of the same security for 30 days
  • Check for dividend reinvestment plans (DRIPs) that could trigger wash sales
  • Document the wash sale window for each trade
Security SoldWash Sale Window StartWindow EndDRIP Active?Risk

Step 5: Execution Plan

Trade #AccountActionSecuritySharesEst. ProceedsEst. LossReplacementNotes
Sell
Buy

Summary:

  • Total estimated losses harvested: $
  • Estimated tax savings: $ (at marginal rate of %)
  • Net portfolio impact: minimal (replacement securities maintain exposure)
  • Wash sale window management: [dates]

Step 6: Post-Harvest Tracking

After 30+ days, optionally:

  • Swap back to original securities (if preferred)
  • Maintain replacement securities (if no reason to switch back)
  • Update cost basis records
  • Document for tax reporting

Step 7: Output

  • Harvest opportunity list (Excel)
  • Trade execution sheet
  • Wash sale tracking calendar
  • Tax savings estimate summary
  • Replacement security rationale

Important Notes

  • Wash sale rules are strict — violations disallow the loss AND adjust cost basis
  • Substantially identical means same security, not same asset class — ETFs tracking different indexes are generally fine
  • Always coordinate across all household accounts including retirement accounts
  • Consider the long-term cost basis step-down — harvesting resets cost basis, which means more gains later
  • Year-end is prime harvesting season but opportunities exist throughout the year
  • Mutual fund capital gains distributions in December can create additional harvesting urgency
  • Document everything for tax reporting and compliance
  • Not all losses are worth harvesting — transaction costs and tracking error have real costs

Frequently asked questions about Tax-Loss Harvesting

Similar skills