agentsclimarketplace

Fabric variable library

Skill wardawgmalvicious/claude-config/skills/fabric-variable-library

Personal Claude Code config — skills, subagents, hooks, and rules for Microsoft Fabric and Power BI workflows on Windows. Cherry-pickable, no semver.

Install
npx -y skills add wardawgmalvicious/claude-config --skill fabric-variable-library

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 2 stars2 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its author says it does

Copied from the file, not written here

Use for Microsoft Fabric Variable Library — config-as-code for parameterizing notebooks and pipelines across environments. Covers definition parts (variables.json, settings.json, valueSets/<name>.json — VariableLibrary does NOT support the `format` field, omit entirely), supported variable types (String, Boolean, Number, Integer, DateTime, ItemReference), notebook consumption via `notebookutils.variableLibrary.getLibrary('Lib').<var>` dot notation (NOT `.get('lib','var')` — that signature does not exist), the `bool('false')` → True trap (compare strings with `.lower() == 'true'`), pipeline integration via `libraryVariables` block (sibling to `activities`), the Variable-Library-to-Pipeline type-name mapping (Boolean→Bool, Integer→Int, Number→Double, DateTime→String, ItemReference→String), Expression-object wrapping for dynamic references, Value Sets ordering via `valueSetsOrder` in settings.json, and the runtime-ID rule for ItemReference values.

SKILL.md

7.2 KB, as published. Nobody here has run it

Fabric Variable Library

Config-as-code for parameterizing notebooks and pipelines per environment. Stored as a Fabric item with definition parts under source control; consumed at runtime via notebookutils.variableLibrary (notebooks) or the libraryVariables block (pipelines).

Definition parts

Part PathContentRequired
variables.jsonVariable names, types, default valuesYes
settings.jsonvalueSetsOrder (empty array when no Value Sets)Yes
valueSets/<name>.jsonPer-environment overridesOnly when using Value Sets
.platformItem metadata JSONNo (handled by Git/REST layer)

Critical: VariableLibrary does NOT support the format field in definition requests. Omit it entirely — including "format": null may cause errors. (See fabric-rest-api skill for the definition envelope.)

Supported variable types

TypeDescription
StringText
Booleantrue / false (stored as a string!)
NumberFloating-point
IntegerWhole numbers
DateTimeISO 8601
ItemReferenceFabric item GUID binding ({itemId, workspaceId})

variables.json

{
  "$schema": "https://developer.microsoft.com/json-schemas/fabric/item/variableLibrary/definition/variables/1.0.0/schema.json",
  "variables": [
    { "name": "lakehouse_name", "type": "String", "value": "bronze_lakehouse" },
    { "name": "enable_logging", "type": "Boolean", "value": "true" },
    { "name": "target_warehouse", "type": "ItemReference",
      "value": { "itemId": "...", "workspaceId": "..." } }
  ]
}

settings.json + Value Sets

settings.json is always present. valueSetsOrder is an empty array when no Value Sets are used:

{ "$schema": "...", "valueSetsOrder": [] }

When Value Sets are configured, list them in priority order:

{ "$schema": "...", "valueSetsOrder": ["test", "prod"] }

Every entry in valueSetsOrder must have a matching file under valueSets/:

{
  "$schema": "...",
  "name": "dev",
  "variableOverrides": [
    { "name": "lakehouse_name", "value": "bronze_dev" }
  ]
}

Notebook consumption

Use getLibrary() + dot notation:

lib = notebookutils.variableLibrary.getLibrary("MyConfig")
name = lib.lakehouse_name        # String
flag = lib.enable_logging        # Returns string "true" / "false"

# Boolean: compare as string — bool("false") is True in Python!
if flag.lower() == "true":
    ...

Wrong patterns (cause runtime failure or silent bugs):

notebookutils.variableLibrary.get("MyConfig", "lakehouse_name")   # ❌ signature does not exist
bool(flag)                                                         # ❌ "false" → True

Pipeline consumption

Pipelines consume Variable Library values via a libraryVariables block, sibling to activities (not nested):

{
  "properties": {
    "activities": [{
      "name": "Run ETL",
      "type": "TridentNotebook",
      "typeProperties": {
        "notebookId": {
          "value": "@pipeline().libraryVariables.notebook_id",
          "type": "Expression"
        }
      }
    }],
    "libraryVariables": {
      "notebook_id": {
        "libraryName": "MyConfig",
        "libraryId": "<guid>",
        "variableName": "notebook_id",
        "type": "String"
      }
    }
  }
}

Each libraryVariables entry needs all four: libraryName, libraryId, variableName, type.

Pipeline type mapping

Pipeline type names DIFFER from Variable Library type names. Map carefully:

Variable Library TypePipeline Type
BooleanBool
IntegerInt
NumberDouble
DateTimeString
StringString
ItemReferenceString

Dynamic references must be wrapped in Expression objects: {"value": "@pipeline().libraryVariables.x", "type": "Expression"}. Bare strings are treated as literals — not resolved.

Runtime ID rule (cross-reference)

ItemReference variable values are passed verbatim to consumers — they are NOT resolved against .platform logicalId. Always store the runtime item ID (the GUID from the Fabric portal URL or GET /v1/workspaces/{wsId}/items response). See fabric-rest-api skill for the runtime-vs-logicalId distinction — using the wrong one is a leading cause of PowerBIEntityNotFound from pipelines.

Gotchas

IssueResolution
.get("lib", "var") fails at runtimeUse getLibrary("lib").var — always dot notation
bool("false")TrueCompare as string: flag.lower() == "true"
Definition rejected — format fieldOmit format entirely — VariableLibrary does not support it
Pipeline variable wrong typeMap correctly: Boolean→Bool, Integer→Int, Number→Double, DateTime/ItemReference→String
Pipeline expression treated as literalWrap in {"value": "...", "type": "Expression"}
Pipeline variable not resolvingInclude BOTH libraryName and libraryId
Value Sets ignoredAdd valueSetsOrder array to settings.json
Value Set validation errorCreate matching file under valueSets/ for every entry in valueSetsOrder
PowerBIEntityNotFound from ItemReferenceStored a .platform logicalId instead of the runtime item ID

Reference

See also

  • fabric-rest-api skill — definition envelope, runtime ID vs logicalId, ?updateMetadata=true flag
  • fabric-spark skill — notebookutils.runtime.context (sibling API to notebookutils.variableLibrary)

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.