China Tax Loss Harvesting logo

China Tax Loss Harvesting

Community
jwangkun
china-tax-loss-harvesting

Tax-loss harvesting strategies for A-share portfolios. Adapts the original tax-loss-harvesting skill for Chinese tax rules, A-share market conventions, and domestic tax treatment. Triggers on "A股税务亏损抵扣", "亏损抵扣", "tax loss harvesting China", "税务优化", "亏损抵扣策略", or "harvest tax losses [portfolio]".

Overview

Publisherjwangkun
Repositoryclaude-for-financial-services-cn
Skill namechina-tax-loss-harvesting
Stars
834
Forks
132
Bundled files
Instructions only
LicenseApache-2.0
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by jwangkun on GitHub. Read the source before you install it.

Installation

Install the China Tax Loss Harvesting AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/jwangkun/claude-for-financial-services-cn/tree/main/agent-plugins/china-earnings-reviewer/skills/china-tax-loss-harvesting
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/jwangkun/claude-for-financial-services-cn.git /tmp/claude-for-financial-services-cn
mkdir -p .claude/skills
cp -r /tmp/claude-for-financial-services-cn/agent-plugins/china-earnings-reviewer/skills/china-tax-loss-harvesting .claude/skills/china-tax-loss-harvesting
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable China Tax Loss Harvesting in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads China Tax Loss Harvesting on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so China Tax Loss Harvesting is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

china-tax-loss-harvesting

Purpose

Implement A股税务亏损抵扣 — systematic tax-loss harvesting for Chinese investment portfolios.

Data Sources

Primary: iFind MCP (Tier-1 付费) / AkShare MCP (Tier-2 免费备选)

python
get_quote(ticker)                     → Current prices for holdings
get_historical_data(ticker)           → Cost basis / purchase history

Secondary Sources

  • Broker records — cost basis, trade history
  • Tax filings — prior year losses
  • 交易所 — tax treatment rules

Workflow

Step 1: Identify Tax-Loss Positions

Loss identification:

PositionTickerCost BasisCurrent ValueUnrealized LossLoss %
¥XX¥XX¥XXX%

Loss screening criteria:

  • Unrealized loss > 10% of cost basis
  • Loss amount significant relative to portfolio
  • Holding period appropriate for tax treatment

Step 2: Understand A-share Tax Rules

China tax treatment for securities:

ItemTax RateNotes
证券买卖价差暂免 (temporarily exempt)Capital gains on stocks
股息红利20% (持股>1年减半至10%, >1年免征)Dividend tax
基金分红暂免 (some funds)Fund distributions
买卖印花税0.05% (seller only)Stamp duty
证券交易佣金0.02-0.03%Commission

Current status of capital gains tax:

  • Individuals: Capital gains on stocks are currently temporarily exempt (暂免征收)
  • However, losses can be used to offset gains within the same year
  • Loss carryforward rules may apply

Step 3: Calculate Tax Benefit

Tax benefit calculation:

ScenarioGainLossTaxable GainTax Saved
Without TLH¥XX—¥XX—
With TLH¥XX¥XX¥XX¥XX
Benefit¥XX

Note: In the current A-share environment where capital gains are largely exempt, tax-loss harvesting benefits may be limited. However:

  • Harvesting losses can be valuable if tax rules change
  • Offsetting gains within the same year
  • Potential future tax benefit if capital gains tax is introduced

Step 4: Identify Replacement Securities

Replacement criteria:

CriterionRequirement
Same sectorSimilar industry exposure
Similar characteristicsMarket cap, growth, quality
Not substantially identicalAvoid wash sale rules
Tax-efficientConsider dividend treatment

Wash sale considerations (China):

  • No explicit wash sale rule currently
  • However, substantially identical securities may be disallowed
  • Best practice: 30-day waiting period

Step 5: Execution Strategy

Execution options:

StrategyDescriptionProsCons
Full exitSell and replaceClean loss realizationMarket risk
Partial exitReduce positionPartial benefitPartial benefit only
SwapSell loss, buy similarMaintain exposureTiming risk
DelayWait for recoveryNo transaction costsMissed opportunity

Step 6: Implementation Plan

Step-by-step plan:

StepActionTiming
1Identify loss positionsPre-year-end
2Evaluate replacement optionsPre-year-end
3Check wash sale rulesPre-year-end
4Execute salesBefore year-end
5Execute purchasesAfter sale (or simultaneously)
6Document transactionsImmediately
7File tax formsTax filing deadline

Step 7: Document for Tax Filing

Required documentation:

DocumentContent
Trade confirmationsSale and purchase tickets
Cost basis recordsPurchase prices, dates
Loss calculationsRealized loss amounts
Replacement securitiesIdentified alternatives
Market rationaleInvestment thesis

Step 8: Year-End Checklist

Year-end TLH checklist:

DateAction
NovReview portfolio for loss positions
Dec 1-15Identify replacement securities
Dec 15-20Execute loss sales
Dec 20-31Execute replacements
Dec 31Final portfolio review
JanFile tax documentation

China-Specific TLH Considerations

Current Tax Environment

FactorStatusImplication
资本利得税暂免 (temporarily exempt)Limited current benefit
印花税0.05%Cost on sale
股息红利税20% (10% for >1yr)Consider in replacement
交易佣金0.02-0.03%Trading cost

When TLH Makes Sense in China

ScenarioBenefit
Offset short-term gainsUse losses against gains
Reset cost basisLower future gains if taxed
Prepare for tax changesIf capital gains taxed in future
Portfolio rebalancingCombine with rebalancing

A-share Market Timing

ConsiderationGuidance
年末效应Year-end selling pressure
涨跌停限制May prevent execution
流动性Ensure liquidity for exit
政策窗口Tax policy change risk

TLH for Different Client Types

Individual Investors

ConsiderationGuidance
持股期限>1 year for dividend tax benefit
高频交易May trigger scrutiny
金额门槛Focus on significant positions

Institutional Investors

ConsiderationGuidance
交易成本Factor in commission impact
市场冲击Large position impact
会计处理NAV impact timing
合规审查Documentation requirements

Quality Checks

Before executing:

  • Loss positions identified
  • Tax benefit calculated
  • Replacement securities identified
  • Wash sale rules considered
  • Execution plan clear
  • Documentation prepared
  • Timing appropriate

Data Source Mode Switch: Set env var IFIND_DATA_SOURCE_MODE to control data source preference.

  • ifind-only (strict): Use iFind only, error if unavailable
  • ifind-fallback (default): iFind preferred, fallback to AkShare
  • akshare-only, wind-only (Wind only), wind-fallback (Wind first, fallback to iFind → AkShare): Skip iFind, use AkShare only

Frequently asked questions

What does the China Tax Loss Harvesting AI skill do?

Tax-loss harvesting strategies for A-share portfolios. Adapts the original tax-loss-harvesting skill for Chinese tax rules, A-share market conventions, and domestic tax treatment. Triggers on "A股税务亏损抵扣", "亏损抵扣", "tax loss harvesting China", "税务优化", "亏损抵扣策略", or "harvest tax losses [portfolio]".

Why use China Tax Loss Harvesting on TypingMind?

Because you install it once and use it with any model. China Tax Loss Harvesting is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install China Tax Loss Harvesting in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/jwangkun/claude-for-financial-services-cn/tree/main/agent-plugins/china-earnings-reviewer/skills/china-tax-loss-harvesting. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use China Tax Loss Harvesting?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with China Tax Loss Harvesting?

As many as you like. As long as a model supports skills, you can use China Tax Loss Harvesting with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the China Tax Loss Harvesting AI skill free?

Yes. It is published on GitHub by jwangkun under the Apache-2.0 license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇