- Home
- Skills
- Finance & Accounting
- Custom Tax Disbursements Architect
Works with the AI Agents you already use
Custom Tax Disbursements Architect
* Multi-Jurisdiction by Design: Explicit branching between CIF_BORDER (EU-27, UK, APAC/LATAM) and FOB_ORIGIN (US, Canada) with full Incoterms® 2020 adjustment matrices.
$49
Custom Tax Disbursements Architect
Example session with this skill installed
Implement a multi-jurisdiction TypeScript customs tax and disbursement billing service for our freight ERP. It must handle both EU_UCC (CIF_BORDER, supporting CASH_AT_BORDER and DEFERRED_REVERSE_CHARGE VAT) and US_CBP (FOB_ORIGIN, whole-dollar Entered Value, clamped border user fee), separate Balance Sheet disbursements from taxable P&L brokerage/outlay fees, and emit a SHA-256 AuditSnapshot. Verify it against an illustrative FOB 18,000 USD shipment.
- Read your context and instructions
- Compiled the custom tax disbursements
Architectural Overview
This multi-jurisdiction service enforces four core accounting and customs guardrails:
- Profile-Driven Valuation (
CIF_BORDERvs.FOB_ORIGIN):
UnderEU_UCC, international freight and insurance are added toFOBand converted via the statutoryUSD/EURmonthly customs rate (1 USD = X EUR). UnderUS_CBP, international freight and insurance are excluded andEntered Valueis rounded to0decimals (whole dollar) while duties and user fees settle to2decimals. - Cascading Import VAT & Settlement Branching:
UnderEU_UCC, Import VAT cascades overCV + Duty + Excise + First-Destination Incidentals. UnderDEFERRED_REVERSE_CHARGE, Import VAT is logged for audit only and never billed as a cash disbursement. - Strict Balance Sheet vs. P&L Separation:
Official duties, border user fees, and cash-at-border Import VAT post toDISBURSEMENT_BALANCE_SHEET(0%local service tax). Brokerage fees and outlay fees post toREVENUE_PNLwith local service tax applied—preserving true operating margin. - Fixed-Point Decimal Math & Canonical Serialization:
Usesdecimal.js(DECIMAL(18,6)intermediates) and outputs canonical decimal strings ("4849.05") with an immutable SHA-256AuditSnapshot.
Illustrative Verification Matrix (FOB 18000.00 USD, 3.5% Duty)
| Line Item / Metric | EU_UCC (CASH_AT_BORDER) | EU_UCC (DEFERRED_REVERSE_CHARGE) | US_CBP (FOB_ORIGIN) | Accounting Ledger |
|---|---|---|---|---|
Customs Value (CV) | 18000.00 EUR | 18000.00 EUR | 18000 USD | Valuation Base |
Import Duty (3.5%) | 630.00 EUR | 630.00 EUR | 630.00 USD | Balance Sheet (0% tax) |
| Border User Fee | 0.00 EUR | 0.00 EUR | 63.00 USD | Balance Sheet (0% tax) |
Import VAT (21%) | 3990.00 EUR | 0.00 EUR (memo only) | 0.00 USD (N/A) | Balance Sheet / Memo |
| Total Cash Disbursements | 4620.00 EUR | 630.00 EUR | 693.00 USD | Excluded from P&L |
| Brokerage + Outlay Fee | 189.30 EUR | 135.00 EUR | 135.00 USD | P&L Operating Revenue |
Local Service Tax (21% / 0%) | 39.75 EUR | 28.35 EUR | 0.00 USD | Output Tax Liability |
| Total Client Invoice Payable | 4849.05 EUR | 793.35 EUR | 828.00 USD | Exact cash payable |
TypeScript Implementation (customs-tax-service.ts)
import { createHash, randomUUID } from 'node:crypto';
import Decimal from 'decimal.js';
Decimal.set({ precision: 24, rounding: Decimal.ROUND_HALF_UP });
export type JurisdictionProfile = 'EU_UCC' | 'UK_GLOBAL' | 'US_CBP' | 'CA_CBSA' | 'GENERIC_CIF';
export type VatSettlementMode = 'CASH_AT_BORDER' | 'DEFERRED_REVERSE_CHARGE' | 'NOT_APPLICABLE';
export interface CustomsTaxInput {
declarationRef: string;
jurisdictionProfile: JurisdictionProfile;
localCurrency: string;
localCurrencyMinorUnits: number; // ISO 4217: 0, 2, or 3
enteredValueScale: number; // 0 for US_CBP whole-dollar; matches minorUnits otherwise
statutoryCustomsFxRate: string; // Strictly 1 invoice_currency = X local_currency
vatSettlementMode: VatSettlementMode;
invoiceAmountDoc: string;
intlFreightDoc: string;
insuranceDoc: string;
adValoremRate: string;
exciseAmountLocal: string;
incidentalCostsFirstDestLocal: string;
importTaxRate: string;
borderUserFee?: { rate: string; min: string; max: string };
brokerageFeeLocal: string;
outlayFeeRate: string;
outlayFeeMinLocal: string;
localServiceTaxRate: string;
}
export interface LedgerEntry {
classification: 'DISBURSEMENT_BALANCE_SHEET' | 'REVENUE_PNL';
chargeCode: 'IMPORT_DUTY' | 'BORDER_USER_FEE' | 'IMPORT_VAT_GST' | 'BROKERAGE_FEE' | 'OUTLAY_FEE';
netAmount: string;
localServiceTaxAmount: string;
}
export interface CustomsAuditResult {
snapshotId: string;
calculatedAtUtc: string;
customsValueLocal: string;
totalCashDisbursements: string;
totalOperatingRevenue: string;
totalClientInvoicePayable: string;
ledgerEntries: LedgerEntry[];
inputPayloadHash: string;
}
export function calculateCustomsAndDisbursements(input: CustomsTaxInput): CustomsAuditResult {
const scale = input.localCurrencyMinorUnits;
const payloadHash = createHash('sha256').update(JSON.stringify(input)).digest('hex');
// 1. Multi-Jurisdiction Valuation (CIF_BORDER vs. FOB_ORIGIN)
const isFobOrigin = input.jurisdictionProfile === 'US_CBP' || input.jurisdictionProfile === 'CA_CBSA';
const docBase = isFobOrigin
? new Decimal(input.invoiceAmountDoc)
: new Decimal(input.invoiceAmountDoc).plus(input.intlFreightDoc).plus(input.insuranceDoc);
const cv = docBase
.times(input.statutoryCustomsFxRate)
.toDecimalPlaces(input.enteredValueScale, Decimal.ROUND_HALF_UP);
// 2. Duties & Clamped Border User Fees
const duty = cv.times(input.adValoremRate).toDecimalPlaces(scale, Decimal.ROUND_HALF_UP);
const borderFee = input.borderUserFee
? Decimal.min(
input.borderUserFee.max,
Decimal.max(input.borderUserFee.min, cv.times(input.borderUserFee.rate)),
).toDecimalPlaces(scale, Decimal.ROUND_HALF_UP)
: new Decimal(0);
// 3. Cascading Import VAT / GST
const incidentals = input.jurisdictionProfile === 'CA_CBSA'
? new Decimal(0)
: new Decimal(input.incidentalCostsFirstDestLocal);
const importTax = input.vatSettlementMode === 'NOT_APPLICABLE'
? new Decimal(0)
: cv.plus(duty).plus(input.exciseAmountLocal).plus(incidentals)
.times(input.importTaxRate)
.toDecimalPlaces(scale, Decimal.ROUND_HALF_UP);
// 4. Separate Balance Sheet Disbursements (0% tax) from P&L Revenue
const ledgerEntries: LedgerEntry[] = [];
let cashDisbursements = new Decimal(0);
if (duty.gt(0)) {
ledgerEntries.push({ classification: 'DISBURSEMENT_BALANCE_SHEET', chargeCode: 'IMPORT_DUTY', netAmount: duty.toFixed(scale), localServiceTaxAmount: (0).toFixed(scale) });
cashDisbursements = cashDisbursements.plus(duty);
}
if (borderFee.gt(0)) {
ledgerEntries.push({ classification: 'DISBURSEMENT_BALANCE_SHEET', chargeCode: 'BORDER_USER_FEE', netAmount: borderFee.toFixed(scale), localServiceTaxAmount: (0).toFixed(scale) });
cashDisbursements = cashDisbursements.plus(borderFee);
}
if (input.vatSettlementMode === 'CASH_AT_BORDER' && importTax.gt(0)) {
ledgerEntries.push({ classification: 'DISBURSEMENT_BALANCE_SHEET', chargeCode: 'IMPORT_VAT_GST', netAmount: importTax.toFixed(scale), localServiceTaxAmount: (0).toFixed(scale) });
cashDisbursements = cashDisbursements.plus(importTax);
}
// 5. Taxable P&L Brokerage & Outlay Fees
const brokerageFee = new Decimal(input.brokerageFeeLocal).toDecimalPlaces(scale, Decimal.ROUND_HALF_UP);
const outlayFee = cashDisbursements.gt(0)
? Decimal.max(input.outlayFeeMinLocal, cashDisbursements.times(input.outlayFeeRate)).toDecimalPlaces(scale, Decimal.ROUND_HALF_UP)
: new Decimal(0);
const operatingRevenue = brokerageFee.plus(outlayFee);
const serviceTaxTotal = operatingRevenue.times(input.localServiceTaxRate).toDecimalPlaces(scale, Decimal.ROUND_HALF_UP);
ledgerEntries.push({ classification: 'REVENUE_PNL', chargeCode: 'BROKERAGE_FEE', netAmount: brokerageFee.toFixed(scale), localServiceTaxAmount: brokerageFee.times(input.localServiceTaxRate).toDecimalPlaces(scale, Decimal.ROUND_HALF_UP).toFixed(scale) });
if (outlayFee.gt(0)) {
ledgerEntries.push({ classification: 'REVENUE_PNL', chargeCode: 'OUTLAY_FEE', netAmount: outlayFee.toFixed(scale), localServiceTaxAmount: serviceTaxTotal.minus(brokerageFee.times(input.localServiceTaxRate).toDecimalPlaces(scale, Decimal.ROUND_HALF_UP)).toFixed(scale) });
}
return {
snapshotId: randomUUID(),
calculatedAtUtc: new Date().toISOString(),
customsValueLocal: cv.toFixed(input.enteredValueScale),
totalCashDisbursements: cashDisbursements.toFixed(scale),
totalOperatingRevenue: operatingRevenue.toFixed(scale),
totalClientInvoicePayable: cashDisbursements.plus(operatingRevenue).plus(serviceTaxTotal).toFixed(scale),
ledgerEntries,
inputPayloadHash: payloadHash,
};
}
Recommended Next Steps
- Connect Official Tariff & FX Feeds:
BindstatutoryCustomsFxRateto official monthly customs tables (EU_UCC/UK_GLOBAL) or export-date FX feeds (US_CBP/CA_CBSA). - Add NCTS T1 / In-Bond State Machine:
LockTransitGuaranteeHoldon declaration issuance and unlock strictly upon confirmed customs discharge (IE045or In-Bond acquittal). - Add 1:N Largest Remainder Allocator:
Attribute duties directly by tariff line and prorate shared clearance fees acrossHBL/HAWBrecords so line sums match the official invoice to the exact minor unit.
Connects securely to your tools. The creator never sees your data.
About this skill
Customs Tax & Disbursements Architect — Multi-Jurisdiction Valuation, Import Tax & Pass-Through Accounting
Production-grade customs valuation, cascading import tax math, bonded transit guarantee state machines, and Balance Sheet disbursement accounting for AI coding agents.
Value Proposition
Generic LLMs routinely break customs and freight-forwarding ERP backends: they hardcode CIF valuation onto FOB-origin jurisdictions (like US CBP or Canada CBSA), apply daily commercial spot FX instead of statutory customs exchange rates, omit duties and THC from cascading Import VAT bases, bill deferred reverse-charge VAT as cash, and book pass-through customs disbursements (suplidos / débours) as operating revenue—destroying gross margin reporting.
customs-tax-disbursements-architect equips your AI coding agent with deterministic, multi-jurisdiction domain rules covering EU UCC, UK Global, US CBP, Canada CBSA, and Rest-of-World CIF regimes—complete with ISO 4217 multi-currency rounding, NCTS T1 / In-Bond guarantee lifecycles, and an immutable general-ledger data contract.
- Multi-Jurisdiction by Design: Explicit branching between
CIF_BORDER(EU-27, UK, APAC/LATAM) andFOB_ORIGIN(US, Canada) with full Incoterms® 2020 adjustment matrices. - True Margin Protection: Strict 3-part pass-through test separating 0%-tax Balance Sheet disbursements (disbursements, suplidos, débours, durchlaufende Posten) from taxable P&L brokerage and outlay fees.
- ISO 4217 & Statutory Precision: Fixed-point
DECIMAL(18,6)intermediate math, canonical JSON serialization, ISO 4217 minor-unit rounding (0/2/3decimals), and field-level whole-dollarEntered Valuesupport for US CBP Form 7501. - Stack-Agnostic & Ready to Test: Pure domain logic and a side-by-side synthetic worked example (EU
CASH_AT_BORDER, EUDEFERRED_REVERSE_CHARGE, and USFOB_ORIGIN) ready to convert directly into unit tests.
Target Audience
- Freight Forwarding & Logistics SaaS Teams building customs brokerage and billing modules.
- ERP & Accounting Engineers separating pass-through trade tax disbursements from operating revenue and COGS.
- Customs Brokerage & Trade Tech Architects implementing multi-country duty/VAT engines and NCTS T1 guarantee tracking.
- Cross-Border E-Commerce & Supply Chain Teams automating landed-cost and import tax provisioning.
What's Included
- 5 Multi-Jurisdiction Profiles:
EU_UCC(EUR & non-EUR EU-27),UK_GLOBAL(GBP + PVA),US_CBP(USD + whole-dollar Entered Value + clamped user fees),CA_CBSA(CAD + GST on Duty-Paid Value), andGENERIC_CIF. - Incoterms® 2020 Matrix: Exact valuation additions and deductions for
EXWthroughDDPunder bothCIF_BORDERandFOB_ORIGIN. - Import Tax Settlement Branching:
CASH_AT_BORDER,DEFERRED_REVERSE_CHARGE(EU reverse charge / UK PVA), andNOT_APPLICABLE. - Complete Calculation Algorithms: Customs Value, Ad Valorem / Specific / ADD-CVD Duties, Clamped Border User Fees, Cascading Import VAT/GST, Outlay Fee Floors, Transit Guarantee Locks, and 1:N Largest Remainder (Hamilton) Allocation.
- 6-Entity Normalized JSON Data Contract:
CustomsDeclaration,TariffLine,DisbursementLedgerEntry,TransitGuaranteeHold,AllocationLine, andAuditSnapshot. - 9 Production Gotchas: Engineering guardrails against FX quote inversion, spot FX misuse, margin distortion, premature T1 guarantee release, and duty proration errors.
Requires external reference data supplied by your system (official tariff schedules such as EU TARIC, UKGT, USITC HTS, or CBSA; statutory customs exchange rate tables; and active VAT/GST or border user-fee bounds). Provides deterministic architecture, tax math, and accounting contracts only—does not connect directly to customs EDI/NCTS/ACE portals or constitute formal customs or tax advice.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 13 days ago
Nothing to install. It runs in your AI agent.
No permissions are required. This skill is a pure domain architecture, mathematical specification, and accounting data contract that runs entirely inside the AI agent's context with zero external access.
Permissions
No special permissions declared or detected
What's inside
Frequently Asked Questions
New in Finance & Accounting
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Finance & Accounting.