> Reprice swap transaction legs under ASC 845 (Nonmonetary Transactions) to ensure clearing accounts apply equal-value exchange to swap legs, run setBatchUseCounterpartyFiatValue, zero out a clearing account, apply ASC 845, fix swap pricing mismatches, ensure no gain/loss on swaps, or close a month where a swaps/trade clearing account has a residual balance. Also trigger when the user mentions "counterparty fiat value", "swap repricing", "clearing account net to zero", or "equal value exchange".
npx skills add https://github.com/anthropics/claude-plugins-community --skill tres-asc845-swap-reprice-skill
Implements equal-value exchange under ASC 845 (Nonmonetary Transactions) for swap transactions
in TRES Finance. In a simultaneous swap, the fair value of the asset surrendered (outflow) is the
best evidence of the fair value of the asset received (inflow). This skill reprices inflow legs to
match outflow legs so that clearing accounts net to zero.
All GraphQL calls use the user-tres-finance MCP server (execute tool).
Variable keys and nested input fields MUST use camelCase (e.g. timestamp_Gte, not timestamp_gte).
user-tres-finance)Ask the user for:
(e.g. "STAKING LOCKUP", "SWAP"). None, one, or many may be selected. If omitted, all activities
are included. Use tx_Classification_Activity_In on the TRES query.
Use the TRES subTransaction query to fetch all subtransactions in scope. Include these fields:
{
id
amount
balanceFactor
timestamp
fiatValue
isManualFiatValue
belongsTo { id name }
asset { assetClass { symbol } }
tx { id identifier classification { activity } }
flowRule {
ruleName
integrationAccount { name value }
}
}
If activity tags were specified, pass them as tx_Classification_Activity_In: ["STAKING LOCKUP", "SWAP"]
on the query. Note: transactions with classification: null will be excluded when this filter is used,
so only apply it when the user explicitly requests it.
Paginate in batches of 50 (to avoid timeouts). Save the combined results to a JSON file for the orchestrator script.
From the skill scripts/ directory, run orchestrate_reprice.py (handles MCP response shapes, account filter, preview, and mutation JSON):
cd "${CLAUDE_PLUGIN_ROOT}/skills/tres-asc845-swap-reprice-skill/scripts" && \
python3 orchestrate_reprice.py \
--input /path/to/swap_reprice_input.json \
--account-name "Swaps Clearing Account" \
--output /path/to/reprice_plan.json \
--mutations-output /path/to/reprice_mutations.json
Use --account-value instead of --account-name when filtering by ERP account number. Pass --activity-tags SWAP "STAKING LOCKUP" when the user requested activity filters.
The script prints a preview to stdout and writes:
reprice_plan.json — full plan with per-transaction adjustmentsreprice_mutations.json — ready-to-execute setManualFiatValue variablesFor lower-level repricing only (no orchestration), use reprice_swaps.py directly — see scripts/reprice_swaps.py for flags.
The orchestrator implements the logic below. Read scripts/reprice_swaps.py for the canonical implementation.
The core principle: calculate the difference between total outflow fiat and total inflow fiat,
then distribute that difference across inflows in proportion to their token amounts. This
preserves the original pricing as a base and makes the minimum adjustment needed.
For each parent transaction:
Case 1: One outflow, one inflow
inflow.newFiatValue = outflow.fiatValue
Case 2: One outflow, many inflows
difference = outflow.fiatValue - sum(inflow.fiatValue for each inflow)
totalInflowTokens = sum(inflow.amount for each inflow)
for each inflow:
tokenProportion = inflow.amount / totalInflowTokens
inflow.newFiatValue = inflow.fiatValue + (difference * tokenProportion)
Case 3: Many outflows, one inflow
inflow.newFiatValue = sum(outflow.fiatValue for each outflow)
Case 4: Many outflows, many inflows
totalOutflowFiat = sum(outflow.fiatValue for each outflow)
totalInflowFiat = sum(inflow.fiatValue for each inflow)
difference = totalOutflowFiat - totalInflowFiat
totalInflowTokens = sum(inflow.amount for each inflow)
for each inflow:
tokenProportion = inflow.amount / totalInflowTokens
inflow.newFiatValue = inflow.fiatValue + (difference * tokenProportion)
Worked example (Case 2):
Before: Outflow = 100 tokens @ $100 | Inflows = 25 tokens @ $25, 25 @ $25, 35 @ $35 (total $85)
Difference = $100 - $85 = $15 | Total inflow tokens = 85
After: Inflow 1: $25 + ($15 × 25/85) = $25 + $4.41 = $29.41
Inflow 2: $25 + ($15 × 25/85) = $25 + $4.41 = $29.41
Inflow 3: $35 + ($15 × 35/85) = $35 + $6.18 = $41.18
Total inflows after = $100.00 ✓ (clearing account nets to zero)
Edge cases:
totalInflowTokens == 0, distribute the difference equally across inflowsisManualFiatValue == true, flag it for user review (it was already manually repriced)Present the orchestrator stdout summary and/or the plan JSON to the user:
TX Identifier | Outflow Total | Inflow Before | Inflow After | Adjustment
------------- | ------------- | ------------- | ------------ | ----------
0xabc... | $1,234.56 | $1,230.00 | $1,234.56 | +$4.56
0xdef... | $5,678.90 | $5,670.00 | $5,678.90 | +$8.90
Also show aggregate stats:
Never run mutations without explicit user confirmation.
Only after the user confirms, execute setManualFiatValue for each inflow subtransaction (use variables from reprice_mutations.json):
mutation SetManualFiatValue($id: ID!, $newFiatValue: String!, $currency: String) {
setManualFiatValue(id: $id, newFiatValue: $newFiatValue, currency: $currency) {
subTransaction {
id
fiatValue
isManualFiatValue
}
}
}
Execute one at a time (not batch) to handle locked-period errors gracefully.
If setBatchManualFiatValue is preferred for speed, group inflows by asset
where a uniform per-unit price applies.
Important: setManualFiatValue takes newFiatValue as a string.
setBatchManualFiatValue takes ids (list) and newUnitValue (Float) and computes
newUnitValue * amount — only use this if all subtxs in the batch should have the same unit price.
Re-query the subtransactions and re-aggregate to confirm the clearing account now nets to zero.
via deleteLockedPeriod, apply changes, then re-lock via createLockedPeriod.
| Script | Role |
|--------|------|
| scripts/orchestrate_reprice.py | Primary entry — parse MCP JSON, filter, preview, write plan + mutations |
| scripts/reprice_swaps.py | Core ASC 845 repricing engine (imported by orchestrator; usable standalone) |
Comprehensive web quality audit covering performance, accessibility, SEO, and best practices in a single review. Use when asked to "audit my site", "review web quality", "run lighthouse audit", "check page quality", or "optimize my website" across multiple areas at once. Orchestrates specialized skills for depth. Do NOT use for single-area audits — prefer core-web-vitals, web-accessibility, seo, or web-best-practices for focused work.
| Use when launching a new product end-to-end from market research through post-launch monitoring. Orchestrates 15+ specialist agents across 5 phases in a 10-week coordinated workflow including research, development, marketing, sales preparation, launch execution, and ongoing optimization. Employs hierarchical coordination with parallel execution for efficiency and comprehensive coverage.
Analyze Copilot session history for standup reports, usage tips, session search, and session reindexing. Use when the user asks for a standup, daily summary, usage tips, workflow recommendations, wants to search or find past sessions by keyword/file/PR, wants to reindex their session store, or asks about deleting session data.
| Create visually strong landing pages, websites, and app UIs with restrained composition. OpenAI's production frontend playbook.
Pre-build product and feature risk review for founders, product managers, and AI-assisted builders. Use this skill when the user is about to build a landing page, MVP, SaaS product, internal tool, agent workflow, or major feature and needs to check demand, positioning, monetization, retention, trust, distribution, and adoption risk before implementation starts.
This skill helps users extract structured best-selling product data from Amazon via the BrowserAct API. Agent should proactively apply this skill when users express needs like search for best selling products on Amazon, extract Amazon product data based on keywords, find top rated Amazon products, monitor Amazon competitor prices and sales, discover trending products on Amazon marketplace, extract Amazon product titles prices and ratings, gather Amazon product sales volume for market research, search Amazon best sellers in specific region, collect Amazon product reviews and promotion details, analyze Amazon product availability and badges, get Amazon product data for market analysis.
This skill is designed to help users automatically extract product data from Amazon search results. The Agent should proactively apply this skill when users request searching for products related to keywords, finding best-selling items from specific brands, monitoring product prices and availability on Amazon, extracting product listings for market research, collecting product ratings and review counts for competitive analysis, finding specific products with a maximum count, searching Amazon in different languages for localized results, tracking monthly sales estimates for brand products, gathering product URLs and titles for a product catalog, scanning Amazon for Best Seller tags in a specific category, monitoring shipping and delivery information for brand items, building a structured dataset of Amazon search results.
This skill is designed to help users automatically extract reviews from Google Maps via the Google Maps Reviews API. Agent should proactively apply this skill when users request to find reviews for local businesses (e.g., coffee shops, clinics), monitor customer feedback for a specific brand or location, analyze sentiment of reviews for competitors, extract reviews for a chain of stores or services, track reputation of a local restaurant, gather user testimonials for a specific venue, conduct market research on service quality of local businesses, monitor reviews for a new retail location, collect feedback on public attractions or parks, identify common complaints for a specific service provider, research the best-rated places in a city, analyze recurring themes in reviews for a specific industry.
Take anthropics/tres-asc845-swap-reprice-skill from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.