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.
npx agentmods add rules/twells89/sigma-migration-skills/custom-sql-to-data-modelgit clone --depth 1 https://github.com/twells89/sigma-migration-skillsWrote 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-migration-skills/custom-sql-to-data-model)<a href="https://agentmods.dev/rules/twells89/sigma-migration-skills/custom-sql-to-data-model"><img src="https://agentmods.dev/badge/rules/twells89/sigma-migration-skills/custom-sql-to-data-model.svg" alt="Measured on agentmods" 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 | $0.00065 | $0.06709 |
| Opus 5 | $0.00032 | $0.03354 |
| Sonnet 5 | $0.00013 | $0.01342 |
| Haiku 4.5 | $0.00006 | $0.00671 |
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 5d 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 \ How it starts
The opening of the file, as written. The whole thing — 601 lines — stays where its author put it; the contents beside it link to each section on GitHub.
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.
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 vars: SIGMA_BASE_URL, SIGMA_CLIENT_ID, SIGMA_CLIENT_SECRET
Default (shell-neutral, works in bash/zsh/PowerShell/cmd): mint a token
with the stdlib-only Python script and let scripts/lib/sigma_rest.rb pick
it up automatically from auth.json — no eval, no shell-specific syntax:
python3 scripts/get_token.py --workdir /tmp/custom-sql-run
This writes /tmp/custom-sql-run/auth.json (mode 0600). Every Ruby script in
this skill checks $SIGMA_WORKDIR/auth.json (or ./auth.json) before
falling back to a fresh client-credentials exchange, so point SIGMA_WORKDIR
at the same directory (or run from inside it) and every subsequent ruby scripts/*.rb invocation authenticates without any shell-specific token
plumbing:
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.
- 5d ago First seen · 601 lines · 65 tokens per session scan A f235f76cda06
custom-sql-to-data-model is a cursor rule published in the GitHub repository twells89/sigma-migration-skills (14 stars, last pushed yesterday), licensed MIT. It adds 65 tokens to every session and 6,709 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other cursor rules, from other repositories
ponytail
Ponytail, lazy senior dev mode. Always pick the simplest solution that works.
angular-20
This rule provides comprehensive best practices and coding standards for Angular development, focusing on modern TypeScript, standalone components, signals, and performance optimizations.
dev-standard
Apache Superset development standards and guidelines for Cursor IDE.
cli-error-handling
CLI command error handling patterns.
prefer-direct-imports-over-module-mocks
Prefer extracting a testable core over vi.mock / vi.resetModules when unit tests need to reach production logic entangled with config, env, or singletons.
control-plane-descriptors
Control plane descriptor and instance implementation patterns.