Skip to main content
ClaudeWave
Skill3.3k repo starsupdated 11d ago

tres-invoice-bill-matching

>

Install in Claude Code
Copy
git clone --depth 1 https://github.com/anthropics/claude-plugins-community /tmp/tres-invoice-bill-matching && cp -r /tmp/tres-invoice-bill-matching/tres-finance-plugin/skills/tres-invoice-bill-matching ~/.claude/skills/tres-invoice-bill-matching
Then start a new Claude Code session; the skill loads automatically.

SKILL.md

# TRES — Invoice/Bill Matching & ERP Sync

End-to-end workflow that lets the user close an open ERP invoice or bill against a blockchain transaction in
the TRES ledger, then optionally push the matched entry to the connected ERP.

The flow is the same regardless of which side the user starts from (a transaction hash or an invoice/bill ID).
The skill walks through seven conversational steps (verify ERP → identify input → fetch & suggest → user picks
→ configure payment account & fiat → confirm & apply → loop). Stay terse — show numbered options, capture the
user's pick, move on. Never run a mutation without explicit "yes" from the user.

---

## Ground rules

1. **Identify the org first.** Begin with `get_viewer` and tell the user "You're connected to **{orgName}**."
   This makes mistakes recoverable when someone has the wrong token.
2. **Read before write.** Always fetch the current state of the transaction, invoice/bill, and payment account
   before showing a change summary. Surprises are worse than slow.
3. **Mutations require explicit approval.** Show a summary table (Transaction · Invoice/Bill · Payment Account ·
   Fiat alignment · Sync) and ask "Apply these changes?" before any mutation. Only proceed on a clear yes.
4. **Use schema introspection when in doubt.** Field names, enum values, and argument shapes can drift. If a
   query/mutation errors with "unknown field" or "invalid enum", call `introspect(<TypeName>)` or
   `build_query(<operationName>)` and adjust — don't guess. Operations specifically called out as "verify at
   runtime" below are the ones most likely to need this.
5. **The skill is a loop.** After a successful match, ask "Match another?" and restart from Step 2. Don't
   re-check the ERP — that only happens once per session.

---

## Step 1 — Verify ERP is connected

Run:
```graphql
query { integration(first: 50) { results { id integratedApp isErp connectionStatus companyName } } }
```

Filter the results where `isErp == true` and `connectionStatus == "ACTIVE"`. The supported ERPs you should
recognize are **Xero**, **QuickBooks Online (QBO)**, and **NetSuite** — `integratedApp` values are `XERO`,
`QUICKBOOKS`, and `NETSUITE`. (If you encounter unknown values, `introspect("IntegrationsQueryNode")` will
confirm the enum.) Ignore rows where `integratedApp` is empty — the API occasionally returns a null row.

- **No connected ERP:** Tell the user they need to connect one before matching can happen, point them at
  `https://app.tres.finance/settings/integrations`, and stop.
- **One connected ERP:** Use it implicitly and just mention "Matching against **{companyName}** ({integratedApp})."
- **Multiple connected ERPs:** Ask which one to use — different ERPs have separate invoice/bill stores.

Cache the chosen ERP's `id`, `integratedApp`, and `companyName` for later steps and the loop.

---

## Step 2 — Identify what the user has

Ask whether they have:
- a **transaction hash** (e.g. `0x…`) — best case, pins the match immediately,
- an **invoice/bill ID or number** (numeric internal ID, or the human-facing `invoiceNumber`/`billNumber`),
- or **both**.

If they have neither, require at least one. If they're not sure whether their identifier is an invoice or a
bill, accept it and try both lookups in Step 3.

Also accept loose forms — "INV-123", "Bill 9988", "the bill for Acme last week". The `freeText` filter on
`erpInvoices` / `erpBills` handles these.

**Before moving on, always ask for the transaction date (or an approximate date range) if they haven't given
a tx hash.** Ledger volume is high — date is the single most useful filter for narrowing candidates. Also
offer: *"If you happen to have the tx hash, paste it now — it pins the match exactly."* Date matters both
directions (tx→bill and bill→tx).

---

## Step 3 — Fetch the known object and produce ranked match suggestions

There are two branches. Pick by what the user provided. If they provided both a tx hash *and* an invoice/bill
ID, skip ahead to Step 5 (match is already determined).

### Branch A — User has a transaction hash

1. Fetch the transaction with its sub-transactions:
   ```graphql
   query GetTx($hash: String!) {
     transaction(identifier: $hash, currency: "usd", limit: 1) {
       results {
         id identifier timestamp platform
         children {
           id amount balanceFactor isInternalTransfer
           fiatValue
           sender    { identifier displayName isInternal }
           recipient { identifier displayName isInternal }
           asset { symbol identifier }
         }
       }
     }
   }
   ```
2. Pick the **relevant sub-transaction**. Skip gas, skip internal transfers, prefer the one with the user's
   wallet on one side and an external counterparty on the other. Determine direction:
   - `balanceFactor` negative → outflow → look for a **bill** to close.
   - `balanceFactor` positive → inflow → look for an **invoice** to close.
   If multiple sub-txs qualify (e.g., a swap with multiple legs), present them and let the user pick one.
3. **For invoices (inflow), try backend match suggestions first** — they are pre-computed and ranked:
   ```graphql
   query Suggest($subTxIds: [String]!) {
     subTransactionToInvoiceMatchSuggestions(
       subTransactionId_In: $subTxIds, minScore: 0.3, ordering: "-score", first: 10
     ) {
       results {
         id score confidenceTier
         scoreBreakdown { txHashMatch primaryMatchFactors }
         invoice {
           id invoiceId invoiceNumber customerName origAmount balance dueDate billingStatus
           integration { integratedApp companyName }
         }
       }
     }
   }
   ```
   Important: this endpoint is **invoice-only**. For **bills (outflow), skip straight to the fallback below**
   — there is no backend bill-suggestion query exposed in the schema.
4. **Fallback (zero invoice suggestions, or always for bills):** query `erpInvoices` (inflow) or `erpBills`
   (outflow), filtered by:
   - amount window: `±20%` of the su
eli5Skill

Explain a topic like I'm a 5 year old. Use when the user types /eli5 <topic> or asks for a dead-simple picture explainer of how something works.

quickdesignSkill

Use the `quickdesign` CLI to generate AI media — UGC promo videos, image edits, product creatives, video upscales — through Seedance, Kling, Sora2, Nano Banana, and GPT Image. Invoke this skill whenever the user asks for a talking-avatar video, multi-segment ad / promo / explainer, image edit (object swap, angle change, state change), product photoshoot, or video upscale via QuickDesign.

testdino-auditSkill

Use only when the user explicitly asks for a TestDino audit of Playwright automated test code. Routes through the audit tools the TestDino MCP server exposes (get_audit_report + submit_audit_report, or the legacy test_audit). For generic code review or non-Playwright targets, do a normal review instead.

testdino-healthSkill

Use when the user wants to check TestDino connection status, validate their PAT, discover available organizations and projects, or find the right projectId. Always call this first when the project context is ambiguous before any other TestDino tool.

testdino-manual-runsSkill

Use when the user wants to manage a manual execution run or update case-level results inside a run — listing runs, creating runs for a release, inspecting a run, assigning cases, or marking case results (passed/failed/blocked/skipped/retest/untested). Accepts counter-style IDs like RUN-12 and TC-156.

testdino-manual-testsSkill

Use when the user wants to create, update, or browse manual QA test cases and suites in TestDino — not execution runs. Covers list_manual_test_suites, list_manual_test_cases, get_manual_test_case, create_manual_test_case, update_manual_test_case, create_manual_test_suite.

testdino-releasesSkill

Use when the user wants to browse, inspect, create, or update releases/milestones in a TestDino project. Covers list_releases, get_release, create_release, and update_release. Accepts counter-style IDs like MS-12.

testdino-runsSkill

Use when the user wants to inspect automated test runs, list failed or flaky tests, debug a failing testcase with historical context, or filter runs by branch, commit, author, environment, browser, status, or tags. Includes list_testruns, get_run_details, list_testcase, get_testcase_details, and debug_testcase.