Terminal
Terminal/Skill
Shared rules for the mercury command line tool skills: JSON lines output, fetching every page, checking today's date, and the sign convention for debits.
By Mercury
Works with
npx skills add mercurytechnologies/mercury-skills --skill mercury-sharedThe mercury CLI handles authentication on its own. If MERCURY_API_KEY is set in the environment, the CLI uses it as a bearer token; otherwise it falls back to the OAuth token saved by mercury login. Either way, skills never construct auth headers or pass --api-key themselves — just invoke mercury <command> and the CLI picks the right credential. To check current auth state, run mercury status. If a call fails with 401/403, tell the user to either export MERCURY_API_KEY or run mercury login; do not retry.
These rules cover the few things that aren't obvious from mercury --help.
--format jsonl for readsjsonl collapses the response onto a single line with no indentation whitespace — the cheapest format to load into context. Use it for every read this skill performs:
mercury accounts list --max-items -1 --format jsonl
mercury transactions list --start 2026-04-01 --end 2026-04-29 --status sent --max-items -1 --format jsonl
Pair it with --transform (GJSON syntax — see https://github.com/tidwall/gjson/blob/master/SYNTAX.md) when you only need a few fields:
# Just the fields needed for spend analysis
mercury transactions list --start 2026-04-01 --end 2026-04-29 --status sent \
--max-items -1 --format jsonl \
--transform 'transactions.#.{id,amount,counterpartyName,category,mercuryCategory,postedAt,createdAt}'
--format json is the colorized, pretty-printed version for humans — don't use it from a skill.
--max-items -1 for list commandsWithout it, the CLI returns the first page only. --max-items -1 paginates through every page in a single call. Never answer questions that need full data ("total spend", "all transactions", "most/least") from a partial result.
If a single call would still pull an unmanageable number of rows, narrow --start/--end or filter further (--account-id, --category-id, --status, --search) instead of accepting truncation.
LLMs hallucinate dates. Before computing any window, run:
date +%Y-%m-%d
…and derive --start/--end relative to that. Never hardcode today.
abs(amount) when comparing against receipt totals or summing spend.10.00 = $10.00. Preserve full precision; only round when displaying.$ and two decimals (e.g. $1,234.56).The CLI may return full account/card numbers in responses. When showing data back to the user, mask everything except the last 4 (****4821).