Skip to content
Finance
Skill

/tres-tx-story

Analyze a blockchain transaction by its hash using TRES Finance MCP and generate a visual flow diagram showing all asset movements, followed by a plain-language explanation of what happened. Use this skill whenever the user provides a transaction hash and asks to "analyze",

BOOST
From plugin
claude-plugins-community
4.7k32 skills2 MCP
Install
$ npx -y skills add anthropics/claude-plugins-community --skill tres-tx-story --agent claude-code

How it fires

How this skill gets triggered: by you, by Claude, or both.

  • Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
  • You can call itInvoke it directly when you want it.
  • Slash command/tres-tx-story

Context preview

The summary Claude sees to decide when to auto-load this skill.

Analyze a blockchain transaction by its hash using TRES Finance MCP and generate a visual flow diagram showing all asset movements, followed by a plain-language explanation of what happened. Use this skill whenever the user provides a transaction hash and asks to "analyze",

SKILL.md

tres-tx-story.SKILL.md
name: tres-tx-story
description: >
  Analyze a blockchain transaction by its hash using TRES Finance MCP and generate
  a visual flow diagram showing all asset movements, followed by a plain-language
  explanation of what happened. Use this skill whenever the user provides a
  transaction hash and asks to "analyze", "explain", "visualize", "diagram",
  "show me what happened in", or "tell the story of" a transaction. Also trigger
  when the user pastes a tx hash (long hex string starting with 0x) and asks
  anything about it. Always use this skill for transaction hash analysis — do not
  attempt to answer from memory alone.

TRES Transaction Story

Fetch a transaction by hash from TRES Finance, render a flow diagram of all asset movements, and explain in plain English what happened.

MCP Server

All calls use the `TRES Finance MCP` server (URL: `https://ai.tres.finance/mcp`).

---

Step 1 — Authenticate

Call `get_viewer` (no arguments) to verify the session.

---

Step 2 — Fetch the Transaction

Query the transaction using its hash as the `identifier`:

query GetTransactionByHash($hash: String!, $currency: String) {
  transaction(identifier: $hash, currency: $currency, limit: 1) {
    results {
      id
      identifier
      platform
      timestamp
      success
      decodedFunctionName
      methodId
      fromAddress { identifier displayName isInternal customAccountName }
      toAddress   { identifier displayName isInternal customAccountName }
      contract    { identifier contractName protocols applications }
      classification { activity action functionName }
      ledgerSummary
      applications
      protocols
      internalAccounts { id name }
      children {
        id
        amount
        balanceFactor
        platform
        type
        fiatValue
        nonTaxableType
        isInternalTransfer
        financialActionGroup
        belongsTo { id name identifier }
        sender    { identifier displayName isInternal customAccountName }
        recipient { identifier displayName isInternal customAccountName }
        asset {
          identifier
          symbol: key
          assetClass { id symbol verificationStatus }
        }
      }
    }
  }
}

Variables: `{ "hash": "<user_provided_hash>", "currency": "usd" }`

> **Fallback**: If `identifier` returns 0 results, retry with `identifier_Contains` > using the last 20 characters of the hash. Hashes on some chains may be stored > without the `0x` prefix — strip it and retry if still empty.

---

Step 3 — Parse the Data

From the result, extract:

| Field | Purpose | |---|---| | `identifier` | The tx hash | | `platform` | Blockchain (ETHEREUM, SOLANA, etc.) | | `timestamp` | Date/time | | `success` | Did it succeed? | | `decodedFunctionName` | What smart-contract function was called | | `fromAddress` / `toAddress` | Top-level sender → receiver | | `contract.contractName` | Smart contract involved (if any) | | `classification.activity` + `.action` | TRES classification label | | `children[]` | Each sub-transaction (individual token movement) |

For each child sub-transaction, extract:

  • `asset.assetClass.symbol` — the token symbol (e.g. ETH, USDC)
  • `amount` — quantity moved
  • `fiatValue` — USD equivalent
  • `balanceFactor` — `1` = inflow, `-1` = outflow
  • `belongsTo.name` — which internal wallet this belongs to
  • `sender.identifier` / `recipient.identifier` — counterparties
  • `type` — GAS, TOKEN_TRANSFER, etc.

---

Step 4 — Render the Diagram

Use the `show_widget` tool (Visualizer) to render an HTML widget containing an inline SVG diagram.

---

PRE-RENDER CHECKLIST — do this before writing a single SVG element

**A. Prepare all label strings first**

For every arrow label (token amount + symbol), apply these formatting rules: 1. Format the amount:

  • amount ≥ 1,000,000 → `"1.2M"` style (1 decimal)
  • amount ≥ 1,000 → `"264K"` or `"12,233"` (comma-separated integer)
  • amount ≥ 1 → round to 2 decimal places max
  • amount < 1 → keep up to 4 significant figures (e.g. `"0.033"`)

2. Truncate the symbol:

  • symbol ≤ 6 chars → use as-is (ETH, USDC, DAI, CRV)
  • symbol 7–10 chars → use as-is only if the full label fits (see step 3)
  • symbol > 10 chars OR contains `+` OR is a compound LP token → replace with `"LP tokens"`

3. Measure the full label: `label = amount + " " + symbol`. Count characters. Multiply by 7. That's the pixel width. 4. The available space for a label = the arrow's x-span minus 20px safety margin.

  • Left gap (wallet→contract): x goes from 136 to 248 → span = 112px → max label = 13 chars
  • Right gap (contract→wallet): x goes from 408 to 504 → span = 96px → max label = 11 chars

5. If `label_px_width > available_space`, shorten further: abbreviate amount to 1 sig fig, or use symbol-only if still too wide.

**B. Count the arrows and calculate SVG height**

  • Count non-gas arrows (outflows + inflows). Call this `N`.
  • Each arrow row occupies 34px of vertical space.
  • Base node centre Y = 50 + (N × 34) / 2 (so arrows fan symmetrically around the node centre).
  • Gas arrow hangs 60px below the bottom of the left wallet circle.
  • SVG height = node_centre_y + node_radius + 80 (gas arrow + label + padding).
  • Minimum SVG height = 230px.

**C. Lay out arrow Y positions**

  • Space arrows evenly, 34px apart, centred on `node_centre_y`.
  • First arrow y = node_centre_y - ((N-1) × 34) / 2
  • Each subsequent arrow y += 34
  • Outflow arrows (wallet → contract) use left half of diagram.
  • Inflow arrows (contract → wallet) use right half.
  • If there is exactly 1 inflow and multiple outflows, centre the inflow arrow at `node_centre_y`.

---

Fixed node positions (do not change these)

ViewBox width: 640
Left wallet circle:    cx=90,  cy=node_centre_y, r=46
Contract rect:         x=248,  y=node_centre_y-55, width=160, height=110, rx=12
Right wallet circle:   cx=550, cy=node_centre_y, r=46

Arrow x coordinates:
  Outflow (left→centre): x1=136, x2=246   midpo
Read more
Ships withclaude-plugins-community

Community-contributed plugins for Claude Cowork and Claude Code.

Get the whole plugin
Stats
4,664
Stars
335
Forks
Active
Maintenance
JavaScript
Language
Apache-2.0
License
49m ago
Last commit
7mo ago
Created
4h ago
Added

Repo: anthropics/claude-plugins-community

Other skills on claude-plugins-community.