query-language

query-language is a skill for Claude Code, Codex from yaniv-golan/affinity-sdk. It costs 27 tokens per session (2,767 once invoked), scanned A, original, MIT.

A way to run structured JSON queries against Affinity, a customer-relationship management system for tracking people, companies, and interactions.

In plain words
What is it for?
Filtering records with combined conditions, grouping and counting data, searching through related entities, including connected records, calculating relationship details, and previewing query cost.
Why use it?
It handles complex filters, summaries, related records, and calculated information that simple individual lookups cannot provide.

Skill for Claude CodeCodex

Part of the affinity-crm-mcp-unofficial plugin — 3 skills, 1 MCP server shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/yaniv-golan/affinity-sdk/query-language
Any agent
npx skills add yaniv-golan/affinity-sdk --skill query-language
Clone the repo
git clone --depth 1 https://github.com/yaniv-golan/affinity-sdk

Made for: Claude Code, Codex.

Or install affinity-crm-mcp-unofficial, the plugin that ships this one along with the rest of its 3 skills, 1 MCP server.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for query-language

README.md
[![agentmods](https://agentmods.dev/badge/skills/yaniv-golan/affinity-sdk/query-language.svg)](https://agentmods.dev/skills/yaniv-golan/affinity-sdk/query-language)
Your own site
<a href="https://agentmods.dev/skills/yaniv-golan/affinity-sdk/query-language"><img src="https://agentmods.dev/badge/skills/yaniv-golan/affinity-sdk/query-language.svg" alt="Measured on agentmods" height="20"></a>
Per session 27 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,767 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00027 $0.02767
Opus 5 $0.00014 $0.01384
Sonnet 5 $0.00005 $0.00553
Haiku 4.5 $0.00003 $0.00277

Measured 4d ago against content hash abd1f2d4d162, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

query-language scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

mcp/.claude-plugin/skills/query-language/SKILL.md · 298 lines

How it starts

The opening of the file, as written. The whole thing — 298 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Affinity Query Language

Structured query language for the query MCP tool. For simple lookups, prefer execute-read-command with individual CLI commands.

Before running queries, complete these pre-flight steps:

  1. Read the data model: read-xaffinity-resource(uri: "xaffinity://data-model")
  2. Discover relevant commands: discover-commands(query: "your task keywords")
  3. State what you learned from each step before proceeding

When to Use Query vs CLI Commands

Need Use
Simple lookup by name/email/ID execute-read-command with person get / company get
Quick search execute-read-command with person ls --query "..."
List metadata execute-read-command with list ls / field ls
Write operations execute-write-command
Complex AND/OR/NOT filtering query
Aggregation / groupBy query
Cross-entity filtering (quantifiers) query
Include related entities query
Computed data (interaction dates, unreplied) query
Preview API cost before running query with dryRun: true

Quick Start

// Simplest query - get 10 persons
{"from": "persons", "limit": 10}

// Add a filter
{"from": "persons", "where": {"path": "email", "op": "contains", "value": "@acme.com"}, "limit": 10}

// Include related companies
{"from": "persons", "include": ["companies"], "limit": 10}

// Query list entries (MUST filter by listName or listId)
{"from": "listEntries", "where": {"path": "listName", "op": "eq", "value": "Dealflow"}, "limit": 10}

Query Structure

{
  "$version": "1.0",
  "from": "persons",
  "where": {"path": "email", "op": "contains", "value": "@acme.com"},
  "select": ["id", "firstName", "lastName", "email"],
  "include": ["companies", "opportunities"],
  "expand": ["interactionDates"],
  "groupBy": "fields.Status",
  "aggregate": {"count": {"count": true}, "total": {"sum": "fields.Deal Value"}},
  "having": {"path": "count", "op": "gte", "value": 5},
  "orderBy": [{"field": "lastName", "direction": "asc"}],
  "limit": 100
}

Read the full file on GitHub · 298 lines

Files

What ships with it

4 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 298 lines · 27 tokens per session scan A abd1f2d4d162

Subscribe to this mod's changes

query-language is a skill published in the GitHub repository yaniv-golan/affinity-sdk (0 stars, last pushed 1mo ago), licensed MIT. It adds 27 tokens to every session and 2,767 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

merit-lhv

How to pull an LHV bank statement straight into Merit Aktiva without touching a file export — LHV's own MCP server returns camt.053 XML, which is exactly what Merit's bank-statement import accepts. Covers connecting LHV (OAuth2 + Smart-ID, read-only), the 31-day window, the multi-currency trap, and where the statement…

Elnora-AI/elnora-merit-aktiva · 227 tokens

merit-payments-bank

How to record payments and reconcile the bank statement correctly in Merit Aktiva (maksed / pank) via the elnora-merit CLI. The core skill is choosing the right transaction type for each line — customer receipt, vendor/tax payment, other income, or other expenditure — plus bank-statement import, settlements…

Elnora-AI/elnora-merit-aktiva · 215 tokens

merit-stripe

How Stripe payments must be set up and recorded in Merit Aktiva — the canonical clearing-account method. Stripe is a payment intermediary, not your bank: never book the bank deposit as revenue (it arrives NET of fees). Each Stripe payout is booked as ONE summary GL batch — gross card sales as revenue + output VAT…

Elnora-AI/elnora-merit-aktiva · 201 tokens

merit-tsd

The Estonian TSD (tulu- ja sotsiaalmaksu deklaratsioon) annexes that are NOT payroll: lisa 5 (gifts, donations, entertainment/vastuvõtukulud) and lisa 6 (expenses unrelated to business — fines, sunniraha, tax-authority interest). Covers what makes a TSD mandatory for a month, the 22/78 gross-up, the exact e-MTA form…

Elnora-AI/elnora-merit-aktiva · 298 tokens

merit-vat-kmd

How VAT and the Estonian VAT return (käibedeklaratsioon / KMD) work in Merit Aktiva, and how to get them right from the elnora-merit CLI. Covers the tax-code model, paying the VAT, what feeds each KMD line, time-of-supply, and pulling supporting VAT figures. The KMD itself is generated and filed in the Merit UI — the…

Elnora-AI/elnora-merit-aktiva · 213 tokens

merit-palk-employees

How to onboard employees and maintain contracts, contacts, and base salary agreements in Merit Palk via elnora-merit palk. Covers the sendemployees-vs-sendpayterms distinction, required import codes, and reading the employee / agreement lists. Use when: adding a new employee, creating a first contract, setting or…

Elnora-AI/elnora-merit-aktiva · 159 tokens