Getting it into your agent
It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.
git clone --depth 1 https://github.com/twells89/sigma-skillsnpx agentmods add rules/twells89/sigma-skills/custom-sql-to-data-modelWrote 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.
[](https://agentmods.dev/rules/twells89/sigma-skills/custom-sql-to-data-model)<a href="https://agentmods.dev/rules/twells89/sigma-skills/custom-sql-to-data-model"><img src="https://agentmods.dev/badge/rules/twells89/sigma-skills/custom-sql-to-data-model/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/rules/twells89/sigma-skills/custom-sql-to-data-model"><img src="https://agentmods.dev/badge/rules/twells89/sigma-skills/custom-sql-to-data-model.svg" alt="Reviewed on agentmods" width="80" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00065 | $0.07021 |
| Opus 5.5 | $0.00026 | $0.02808 |
| Sonnet 5.5 | $0.00013 | $0.01404 |
| Haiku 4.5 | $0.00006 | $0.00702 |
Grade A, and why
custom-sql-to-data-model scanned grade A with 1 finding 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 24d 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.
Makes network callslowCapability
Not a fault in itself. Listed so you know the mod talks to something, and to what.
curl -s -X POST \ This is a copy
88% identical to custom-sql-to-data-model — 15 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.
How it starts
The opening of the file, as written. The whole thing — 635 lines — stays where its author put it; the contents beside it link to each section on GitHub.
custom-sql-to-data-model
Scan Sigma workbooks for custom SQL elements, dedupe across workbooks, build or reuse Sigma data models, then repoint the workbooks via the v3alpha
:swapSourcesendpoint. Use when you want to find ad-hoc SQL in workbooks and promote it to one reusable data model per unique query.
Installed runtime
When installed with scripts/install-into-project.sh, the complete runnable
skill is copied to <project>/.sigma-skills/custom-sql-to-data-model/ (project install) or
~/.sigma-skills/custom-sql-to-data-model/ (global install). Resolve every relative
scripts/, reference/, refs/, and docs/ path below from that runtime
directory; cd there before running a command. The installer also copies
sigma-api beside skills that need authentication.
Custom SQL → Data Model
End-to-end flow:
- Scan workbooks for
source.kind: "sql"elements (Phase 1). - Scan data models to index every existing SQL or warehouse-table source (Phase 1.5).
- Group manifest entries by normalized SQL; for each group, decide reuse an existing DM element or build a new one (Phase 1.5 → plan).
- Build DMs only for the to-build groups (Phase 2 / 3 / 4).
- Drive
:swapSourcesfrom the plan, one workbook at a time (Phase 5). - Audit and repair residual
[Prefix/SNAKE_CASE]formulas left behind by Sigma's auto-match (Phase 6).
The key win versus the legacy GET/mutate/PUT approach: one workbook with N
SQL elements is one API call with N entries in sourceMapping, and the
auto-match handles formula rewrites — except for the rough edges Phase 6
catches.
Prerequisites
Required env var: SIGMA_BASE_URL. For an interactive terminal, prefer a
one-time browser login through the sigma-api skill:
eval "$(bash <repo-root>/sigma-api/scripts/browser-login.sh)"
It keeps the refresh token exclusively in the OS keychain. For unattended
hosts, set SIGMA_CLIENT_ID and SIGMA_CLIENT_SECRET (Sigma Administration →
Developer Access) as the fallback.
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.
- 24d ago Changed · +9 lines e3089d22c381
- 1mo ago Changed · +11 lines 2787959d76d2
- 2mo ago First seen · 615 lines · 65 tokens per session scan A 5957fb886990
custom-sql-to-data-model is a cursor rule published in the GitHub repository twells89/sigma-skills (16 stars, last pushed 14d ago), licensed Apache-2.0. It adds 65 tokens to every session and 7,021 once invoked, about $0.0003 per session on Opus 5.5. A static security scan graded it A with 1 finding (makes network calls). It is 88% identical to custom-sql-to-data-model, differing in 15 lines, and is treated as a copy.
Other cursor rules, from other repositories
as-contract-cast-smell
// ❌ WRONG — bypasses the family ContractSerializer seam const contract = JSON.parse(raw) as Contract; const contract = JSON.parse(raw) as Contract .
no-backward-compatibility
Do not add backward-compatibility shims or migration scaffolding.
postgresql
This guide defines the definitive best practices for writing clean, performant, and maintainable PostgreSQL SQL, focusing on modern conventions and avoiding common pitfalls.
ehs-ims-conventions
EHS IMS app — RBAC, data layer, tRPC, migrations, AI boundaries.
sync-timedb-archive-janitor-contract
Day-close / cold-path worker contracts for synctimedb (A invariants; B tick coordinator retired).
schema
Scalable and secure schema design patterns for relational databases, NoSQL, and APIs. / TR: İlişkisel veri tabanları, NoSQL ve API'ler için ölçeklenebilir ve güvenli şema tasarım kalıpları.