custom-sql-to-data-model

custom-sql-to-data-model is a skill for Claude Code from twells89/sigma-migration-skills. It costs 72 tokens per session (6,814 once invoked), scanned A, original, MIT.

Instructions for finding custom SQL in Sigma workbooks and replacing it with reusable Sigma data models.

In plain words
What is it for?
Use them to scan and group SQL queries, build or reuse data models, repoint workbooks, and repair formulas after source replacement.
Why use it?
They reduce duplicated queries across workbooks and provide a planned way to reuse existing models or create new ones before changing workbook sources.

Skill for Claude Code

Written for Claude Code: user-invocable in frontmatter.

Part of the sigma-authoring plugin — 5 skills shipped together

Good fit Use them to scan and group SQL queries, build or reuse data models, repoint workbooks, and repair formulas after source replacement.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/twells89/sigma-migration-skills/custom-sql-to-data-model
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.

Any agent
npx skills add twells89/sigma-migration-skills --skill custom-sql-to-data-model
Clone the repo
git clone --depth 1 https://github.com/twells89/sigma-migration-skills

Made for: Claude Code.

Or install sigma-authoring, the plugin that ships this one along with the rest of its 5 skills.

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 custom-sql-to-data-model

README.md
[![agentmods](https://agentmods.dev/badge/skills/twells89/sigma-migration-skills/custom-sql-to-data-model/github.svg)](https://agentmods.dev/skills/twells89/sigma-migration-skills/custom-sql-to-data-model)
Your own site
<a href="https://agentmods.dev/skills/twells89/sigma-migration-skills/custom-sql-to-data-model"><img src="https://agentmods.dev/badge/skills/twells89/sigma-migration-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.

agentmods 80×15 button for custom-sql-to-data-model

Your own site · 80×15
<a href="https://agentmods.dev/skills/twells89/sigma-migration-skills/custom-sql-to-data-model"><img src="https://agentmods.dev/badge/skills/twells89/sigma-migration-skills/custom-sql-to-data-model.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 72 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 6,814 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector warn 7 Sept 2026
SkillSpector: 5 findings, up to high

These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →

  • high Supply Chain · line 250
    Remote code is downloaded and executed. This bypasses code review and could introduce malicious code.
    Fix: Avoid downloading and executing remote scripts. Use trusted packages from PyPI/npm. If remote fetch is required, verify checksums and use HTTPS.
  • high Supply Chain · line 584
    Remote code is downloaded and executed. This bypasses code review and could introduce malicious code.
    Fix: Avoid downloading and executing remote scripts. Use trusted packages from PyPI/npm. If remote fetch is required, verify checksums and use HTTPS.
  • medium Data Exfiltration · line 250
    Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
    Fix: Verify the destination URL is trusted and necessary. Remove or replace with documented APIs. Ensure no secrets, tokens, or PII are transmitted.
  • medium Data Exfiltration · line 378
    Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
    Fix: Verify the destination URL is trusted and necessary. Remove or replace with documented APIs. Ensure no secrets, tokens, or PII are transmitted.
  • medium Data Exfiltration · line 553
    Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
    Fix: Verify the destination URL is trusted and necessary. Remove or replace with documented APIs. Ensure no secrets, tokens, or PII are transmitted.
How audits are shown
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.1 $0.00072 $0.06814
Opus 5.5 $0.00029 $0.02726
Sonnet 5.5 $0.00014 $0.01363
Haiku 4.5 $0.00007 $0.00681

Measured 1mo ago against content hash 1829d39db3ff, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

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 1mo ago.

The scan reads SKILL.md. This mod also ships 20 executable files (scripts/audit-formulas.rb, scripts/bootstrap.ps1, scripts/bootstrap.sh, …), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

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 \
Origin

Copies of this mod

1 near-identical copy found in the catalogue:

plugins/sigma-authoring/skills/custom-sql-to-data-model/SKILL.md · 622 lines

How it starts

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

Custom SQL → Data Model

End-to-end flow:

  1. Scan workbooks for source.kind: "sql" elements (Phase 1).
  2. Scan data models to index every existing SQL or warehouse-table source (Phase 1.5).
  3. Group manifest entries by normalized SQL; for each group, decide reuse an existing DM element or build a new one (Phase 1.5 → plan).
  4. Build DMs only for the to-build groups (Phase 2 / 3 / 4).
  5. Drive :swapSources from the plan, one workbook at a time (Phase 5).
  6. 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.

The local get_token.py is a byte-identical synced copy of the canonical sigma-api provider. In default auto mode it uses a cached/refreshable browser session first, then client credentials. Override with SIGMA_AUTH_MODE / --auth-mode (auto, browser, or client-credentials). Before either auth mode succeeds, the provider requires a non-redirecting, valid-JSON GET /v2/whoami; 401, 403, non-JSON, and redirect responses fail without emitting or writing the token.

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

Read the full file on GitHub · 622 lines

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. 1mo ago Changed · +23 lines 1829d39db3ff
  2. 3mo ago First seen · 599 lines · 72 tokens per session scan A 47243de973ee

Subscribe to this mod's changes

custom-sql-to-data-model is a skill published in the GitHub repository twells89/sigma-migration-skills (18 stars, last pushed 1mo ago), licensed MIT. It adds 72 tokens to every session and 6,814 once invoked, about $0.0003 per session on Opus 5.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.

Related

custom-sql-to-data-model compared with skills from other repositories

custom-sql-to-data-model next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
custom-sql-to-data-modeltwells89/sigma-migration-skillsSkill181mo agoMITA72Claude Code
create-prprisma/ormSkill48ktodayApache-2.0A47Claude Code, Codex
schema-explorationlangchain-ai/deepagentsSkill32ktodayMITA57Claude Code, Codex
atlas-mssqlariga/atlasSkill8.9ktodayApache-2.0A163Claude Code
ha-data-storesshiwenwen/hope-agentSkill1.9kyesterdayMITA115Claude Code, Codex
bex-keyvaluebex-co/bexSkill1.6ktodayApache-2.0A117Claude Code, Codex
pentesting-mysqlxalgorix/xalgorixSkill1.6ktodayApache-2.0A65Claude Code, Codex