slingdata-io/sling-cli/sling-build
Claude Code and agent skill by slingdata-io/sling-cli
- community
Checking that the SKILL.md file is still in the repository.
Build SQL models with Sling Build — `sling build`, `sling_build.yml`, model selectors, materialization modes, incremental ranges, and dbt compatibility. Use when asked to author or run SQL models / transformations.
Install
npx vskill@latest install slingdata-io/sling-cli/sling-buildSKILL.md
Sling Build — SQL Models with Dependency Resolution
sling build is Sling's lightweight SQL model builder with Jinja-style templating, dependency resolution from ref() calls, and incremental materializations. The single canonical reference is https://docs.slingdata.io/llms.txt — load that first if you need anything beyond the quick reference below.
Gather first
Resolve each row before you write YAML, in this order: the user's request, existing files, discovery (MCP / CLI), then the default in the table. Ask the user only for rows that stay unresolved, one at a time, with a proposed default. If every row resolves, do not ask — build, and state the assumptions you took. Confirm first only for destructive resolutions (for example a mode that drops or rewrites existing tables).
| Decision | Resolve by | Default | |
|---|---|---|---|
| model name | request, existing SQL | stg_<source>__<entity> / fct_<entity> by layer | |
| target conn | request, sling_build.yml, connection.list | target: in sling_build.yml | |
| layer / folder | request, name prefix, STRUCTURE.md | staging | |
| materialization | request, layer table | view (staging/intermediate); full-refresh (marts) | |
| incremental key | request, columns | none unless mode is incremental | |
| upstreams | request, ref() / src(), discover | raw/staging tables for that entity |
When you update a model, read the files first. Preserve incremental-state semantics unless asked otherwise.
Project layout
A build project is any directory containing sling_build.yml. Models are .sql files — usually grouped under schema folders or, with dbt_project: true, under models/ and seeds/.
In a full Sling project, put this tree under models/ (see PROJECT.md in the sling skill). First folder = schema. Naming rules: STRUCTURE.md.
| Layer | Folder = Schema | Naming | Materialization | |
|---|---|---|---|---|
| raw | raw_<source> | source-native | replication target — not a build folder | |
| staging | staging | stg_<source>__<entity> | view | |
| intermediate | intermediate | int_<entity>__<verb> | view | |
| marts | marts | fct_*, dim_* | table / incremental |
Staging selects from raw via src(). Marts use ref() to staging or intermediate only. Marts never touch raw.
src() and ref()
src() is a passthrough. It does not add a raw_ prefix.
source() is an alias of src().
ref('name') resolves a model or seed in this project to its full table name. An unknown name is a compile error.
Duplicate model names in the project are a hard error at load time.
Front-matter
Put YAML in a /** **/ block. It must be the first content in the file. Leading whitespace is allowed. Comments before the block are not. The engine treats the rest of the file as SQL.
You can also use /* { ... } */ or -- { ... } with a brace object.
Front-matter does not rename the model. The model name is the file stem. ref(), selectors, and @name accept the stem or the prod table schema.table. Model names are unique across the project.
sling_build.yml essentials
Model materialization modes
Canonical modes: view, full-refresh, incremental, append. Prefer these names.
view—CREATE OR REPLACE VIEW.full-refresh— drop and rebuild every run (default).tableis an accepted alias.incremental— append/merge based onupdate_key+unique_key.append— insert only.snapshotis a deprecated alias.truncate— truncate target then reload.
Per-model overrides go in a YAML front-matter block at the top of the SQL. Jinja {%- config(...) -%} is dbt-compat only — prefer YAML:
Front-matter range: (start, advance, lookback) is the durable backfill window. Pair it with update_key and unique_key. Do not reverse-engineer the binary for this.
Read raw table columns before you write SQL (sling conns discover CONN --columns or MCP database.get_columns). Do not guess column names or types.
Never reference a SELECT alias inside the same query's JOIN or WHERE. Use the source column (c_nationkey, not c.nation_key).
Common workflows
When the warehouse stores an authoritative total (for example o_totalprice), aggregate that column. Recompute from components only when asked.
| Goal | Command | |
|---|---|---|
| Compile (no execute) | sling build compile | |
| Run a subset | sling build run -s stg_users,fct_orders | |
| Run a model + downstream | sling build run -s +stg_users | |
| Run models by tag | sling build run -s tag:daily | |
| List selected models (no execute) | sling build list -s tag:daily | |
| Path glob | sling build list -s analytics/plausible/* | |
| Force full-refresh on incrementals | sling build run --full-refresh | |
| Dev mode override | sling build run --schema dev_alice | |
| Force prod mode | sling build run --prod | |
| Backfill range | sling build run -s fct_orders --range 2024-01-01,2024-12-31,1mo | |
| Pass variables | sling build run --vars '{start_date: 2024-01-01}' | |
| Parallel model runs | sling build run --threads 4 | |
| Skip seed loading | sling build run --no-seeds | |
| Stop on first failure | sling build run --fail-fast | |
| Sub-project discovery | sling build run -R (scans immediate subdirectories) | |
| Run declarative tests only | sling build test | |
| Create a project | sling init (writes models/sling_build.yml) |
Notes:
- Seeds (CSV files, in
seeds/withdbt_project: true) load before models unless--no-seedsis passed. --rangeis a one-shot CLI backfill (start,end[,step], e.g.2024-01-01,2024-12-31,1mo). Prefer front-matterrange:for a durable window.--schemaforces dev mode and cannot combine with--prod.- One project root. Do not leave nested scratch projects (
probe/,.probe/). Parent compile skips a subdirectory that has its ownsling_build.ymlunless you pass-R. - Resolve the Gather first checklist before you write a new model. When you edit an incremental model, preserve saved-state semantics unless asked otherwise.
Definition of done: sling build run . --target X (or sling build test) completes with 0 failures. Compile alone does not execute SQL, so it does not prove correctness.
${VAR} in sling_build.yml (for example dev.schema: dev_${USER}) is expanded from the environment. An unset variable in an active field is an error; use ${VAR:-fallback} or --prod / --schema to skip the field.
Use the MCP tools to validate
database.get_columns/database.get_schemata— read columns before you write SQL.database.query— sanity-check the SQL against the target before committing.connection.test— make suretarget:resolves before the firstsling build.
When the user asks for a new model, prefer to:
- Inspect upstream columns with
database.get_columns(orsling conns discover CONN --columns). - Draft the SQL, including YAML frontmatter when materialization isn't
full-refresh. - Run
sling build compile -s <model>to confirm the SQL renders cleanly. - Run
sling build run . --target <conn>(or-s <model>) until it completes with 0 failures. - Remove scratch files and nested probe projects before you finish.
Full Documentation
Append .md paths to https://docs.slingdata.io to fetch raw markdown. Full index: https://docs.slingdata.io/llms.txt
| Topic | Doc | |
|---|---|---|
| Build overview | https://docs.slingdata.io/concepts/build.md | |
| Structure & naming | https://docs.slingdata.io/concepts/build/structure.md | |
| Models | https://docs.slingdata.io/concepts/build/models.md | |
| Modes | https://docs.slingdata.io/concepts/build/modes.md | |
| Incremental | https://docs.slingdata.io/concepts/build/incremental.md | |
| Selectors | https://docs.slingdata.io/concepts/build/selectors.md | |
| Seeds | https://docs.slingdata.io/concepts/build/seeds.md | |
| Macros | https://docs.slingdata.io/concepts/build/macros.md | |
| Dev & Prod | https://docs.slingdata.io/concepts/build/dev-prod.md | |
| Project layout (four layers) | https://docs.slingdata.io/concepts/project-structure.md |
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingcore/sling/assist/skills/sling-build/SKILL.md
Popularity
- Repository stars
- 917
- Repository forks
- 87
- 7-day trend score
- 0
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/slingdata-io/sling-cli/sling-build)