AgentSkillsCN

pipeline-and-structure

在税务报告流程中,何处应进行哪些调整(新增报告类型、更换经纪商、变更税务机关)。当您需要新增功能、重构代码,或在代码库中逐层探索,寻找最合适的调整位置时,可调用此技能。

SKILL.md
--- frontmatter
name: pipeline-and-structure
description: Where to change what in the tax report pipeline (new report type, new broker, new tax authority). Use when adding features, refactoring, or navigating the codebase to find the right layer.

Pipeline and project structure

Generic guidance for this project. For country- or broker-specific details, use the complementary skills (e.g. slovenian-tax-edavki, ibkr-flex-query).

Where to change what

GoalLocationNotes
New report type (same tax authority)Tax authority provider under src/TaxAuthorityProvider/TaxAuthorities/<Country>/Extend report generation (XML/CSV) and report type enum; reuse existing grouping and lot matching.
New brokersrc/BrokerageExportProviders/Brokerages/<Broker>/Implement CommonBrokerageExportProvider: discover files, load to broker-specific type (CommonBrokerageEvents), merge, transform to sequence of StagingFinancialGrouping. See resources/docs/brokerage-development/translations/README.en.md.
New tax authority (country)src/TaxAuthorityProvider/TaxAuthorities/<Country>/Implement abstract TaxAuthorityProvider (generateExportForTaxAuthority, generateSpreadsheetExport); add config/schemas and report generation as needed.
Lot matching logicsrc/Core/LotMatching/ and tax authority report generationNONE / FIFO / PROVIDED are configured per report; implementation lives in Core and in how each tax authority uses the processor.
Staging → core processingsrc/Core/StagingFinancialEvents/Event and lot processors (stock, derivative, cash); grouping processor. Change here when the broker-agnostic staging format or core domain model changes.
Company/country/treaty lookupssrc/InfoProviders/ and lookup JSONsUse the infoproviders-lookup-data skill for when and how to edit the JSONs.

Key types (generic)

  • CommonBrokerageEvents – Broker-specific container. Transformed into StagingFinancialGrouping (sequence, one per instrument).
  • StagingFinancialGrouping – Broker-agnostic staging model. Input to StagingFinancialGroupingProcessor.
  • FinancialGrouping – Core domain model (processed events, lot-matched lots). Input to TaxAuthorityProvider.
  • TaxAuthorityConfiguration – Report window (fromDate, toDate) and lot matching method; no country-specific fields here.

Pipeline flow

imports → broker (Extract + Transform) → StagingFinancialGrouping[] → StagingFinancialGroupingProcessor → FinancialGrouping[] → TaxAuthorityProvider → exports

Broker and tax authority implementations are isolated in their own trees; the core pipeline (StagingFinancialEvents, FinancialEvents, LotMatching) stays broker- and country-agnostic.