agentleFS
edkreukedkreuk/FMD_FRAMEWORK/.github/copilot-instructions.md

FMD_FRAMEWORK

Copilot instructions165 starsChanged 21 months agoMITView on GitHub

The Fabric Metadata-Driven Framework (FMD) is an open-source Microsoft Fabric framework that automates, orchestrates, and standardises metadata-driven data pipelines. It targets a Lakehouse-first / Medallion architecture (Landing Zone → Bronze → Silver → Gold) and is fully deployed into Microsoft Fabric using two Jupyter deployment notebooks. Key resources: - Full docs: <https://erwindekreuk.com/fmd-framework/> - Wiki: <https://github.com/edkreuk/FMDFRAMEWORK/wiki> - Deployment guide: FMDFRAMEWORKDEPLOYMENT.md - Business Domain guide: FMDBUSINESSDOMAINDEPLOYMENT.md Business Domains add two more: a Gold/Reporting workspace and a separate Business Domain workspace. All pipeline…

We split this copilot-instructions.md into the rules it gives an agent

6 rules. About 0 are common, 1 is distinctive, and 5 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 5

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    All pipeline metadata is stored in the Fabric SQL Database.

    line 73
  2. Very specific:

    All notebooks live in src/NB_*.Notebook/ and are saved as notebook-content.py (PySpark, kernel synapse_pyspark).

    line 107
  3. Very specific:

    Run the notebook — it provisions all workspaces, lakehouses, pipelines, and notebooks from this repo automatically (reads from …

    line 160
  4. Very specific:

    Call integration.sp_UpsertLandingzoneBronzeSilver with the source/target metadata and primary keys.

    line 176
  5. Very specific:

    All upsert procedures follow the pattern sp_Upsert<ObjectName> and use MERGE or IF NOT EXISTS / UPDATE patterns.

    line 187
  6. Very specific:

    Test in a Fabric development workspace (workspace suffix (D)).

    line 209

≈ “Common” is an estimate: at least 1 in 5 of the 3,669 Copilot instructions files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
copilot-instructions.md

Copilot Instructions — FMD Framework

What this repository is

The Fabric Metadata-Driven Framework (FMD) is an open-source Microsoft Fabric framework that automates, orchestrates, and standardises metadata-driven data pipelines. It targets a Lakehouse-first / Medallion architecture (Landing Zone → Bronze → Silver → Gold) and is fully deployed into Microsoft Fabric using two Jupyter deployment notebooks.

Key resources:


Repository layout

/
├── .github/                      # GitHub metadata (issue templates, this file)
├── Images/                       # Documentation images
├── Taskflow/                     # Fabric Taskflow JSON + assignment diagram
├── config/                       # Environment-specific config (item_config.yaml)
├── demodata/                     # Sample CSV files (e.g. customer.csv)
├── setup/                        # Deployment notebooks (run these in Fabric)
│   ├── NB_SETUP_FMD.ipynb           – deploys the FMD Framework workspaces & artifacts
│   └── NB_SETUP_BUSINESS_DOMAINS.ipynb – deploys Business Domain workspaces
└── src/                          # All Fabric artifacts (stored as source files)
    ├── Config_Database/          – SQL Database definition (schemas: integration, execution, logging)
    ├── ENV_FMD.Environment/      – Fabric Environment (Python libraries, Spark config)
    ├── NB_*.Notebook/            – PySpark notebooks (notebook-content.py + .platform)
    ├── PL_*.DataPipeline/        – Fabric Data Pipelines (JSON)
    ├── SQL_FMD_FRAMEWORK.SQLDatabase/ – SQL project (.sqlproj)
    ├── VAR_CONFIG_FMD.VariableLibrary/ – runtime config variables
    ├── VAR_FMD.VariableLibrary/  – default framework variables
    └── business_domain/          – Gold-layer notebooks + variable libraries

Architecture overview

Workspace separation

The framework uses three separate Fabric workspaces:

WorkspaceNaming conventionPurpose
Code<DOMAIN> CODE (D/P)Notebooks, pipelines, variable libraries
Data<DOMAIN> DATA (D/P)Lakehouses (LH_DATA_LANDINGZONE, LH_BRONZE_LAYER, LH_SILVER_LAYER)
ConfigurationFMD_FRAMEWORK_CONFIGURATIONSQL_FMD_FRAMEWORK database, deployment notebooks

Business Domains add two more: a Gold/Reporting workspace and a separate Business Domain workspace.

Medallion layers

LayerLakehouseDescription
Landing ZoneLH_DATA_LANDINGZONERaw files ingested from source systems
BronzeLH_BRONZE_LAYERCleansed Delta tables with hash-based change tracking
SilverLH_SILVER_LAYERSCD Type 2 Delta tables (full history)
GoldDomain-specific lakehouseAggregated / modelled data for reporting

Pipeline naming convention

PrefixMeaning
PL_FMD_LDZ_COMMAND_*Commands a data copy from a specific source type
PL_FMD_LDZ_COPY_FROM_*Actual copy pipeline for a source type
PL_FMD_LOAD_*Orchestration pipeline (LANDINGZONE / BRONZE / SILVER / ALL)

Configuration database (SQL_FMD_FRAMEWORK)

All pipeline metadata is stored in the Fabric SQL Database. The three schemas are:

integration schema — what to load

TableKey columns
DataSourceSource connection metadata
ConnectionFabric connection IDs
WorkspaceWorkspace GUIDs
LakehouseLakehouse GUIDs per workspace/layer
LandingzoneEntitySource entity config (SourceName, FilePath, FileType, IsIncremental, …)
BronzeLayerEntityBronze target config (PrimaryKeys, CleansingRules, …)
SilverLayerEntitySilver target config (CleansingRules, …)
PipelinePipeline metadata

Important stored procedure: integration.sp_UpsertLandingzoneBronzeSilver registers a full LDZ → Bronze → Silver entity in a single transactional call.

execution schema — what is queued/running

TablePurpose
PipelineLandingzoneEntityFiles detected in landing zone, pending processing
PipelineBronzeLayerEntityBronze entities queued for processing
LandingzoneEntityLastLoadValueWatermark for incremental loads

logging schema — audit trail

TableKey columns
PipelineExecutionWorkspaceGuid, PipelineRunGuid, EntityId, EntityLayer, LogType, LogData
NotebookExecutionNotebook-level audit rows
CopyActivityExecutionCopy activity metrics

Notebooks

All notebooks live in src/NB_*.Notebook/ and are saved as notebook-content.py (PySpark, kernel synapse_pyspark).

NotebookRole
NB_FMD_UTILITY_FUNCTIONSShared helper functions — always referenced via %run or notebookutils.notebook.run. Contains execute_with_outputs (pyodbc + AAD token) and build_exec_statement.
NB_FMD_LOAD_LANDING_BRONZEReads Landing Zone files → applies DQ + cleansing → writes Bronze Delta
NB_FMD_LOAD_BRONZE_SILVERBronze → Silver SCD Type 2 merge
NB_FMD_DQ_CLEANSINGApplies framework cleansing rules
NB_FMD_CUSTOM_DQ_CLEANSINGUser-extensible cleansing notebook
NB_FMD_PROCESSING_LANDINGZONE_MAINWrapper that invokes custom extraction notebooks
NB_FMD_PROCESSING_PARALLEL_MAINParallel orchestration of Bronze/Silver loads
NB_UTILITIES_SETUP_FMDOne-time setup utilities
business_domain/NB_LOAD_GOLDLoads data into Gold layer
business_domain/NB_CREATE_DIMDATECreates dimension date table
business_domain/NB_CREATE_SHORTCUTSCreates OneLake shortcuts

Notebook conventions

  • Settings are loaded at the top of every notebook via:
    config_settings = notebookutils.variableLibrary.getLibrary("VAR_CONFIG_FMD")
    default_settings = notebookutils.variableLibrary.getLibrary("VAR_FMD")
  • SQL connections use AAD token authentication via pyodbc (no passwords stored):
    token = notebookutils.credentials.getToken('https://analysis.windows.net/powerbi/api').encode("UTF-16-LE")
    token_struct = struct.pack(f'<I{len(token)}s', len(token), token)
    conn = pyodbc.connect(f"DRIVER={driver};SERVER={connstring};...", attrs_before={1256: token_struct})
  • ODBC driver default: {ODBC Driver 18 for SQL Server}.
  • Notebooks are parameterised — parameters are declared in a dedicated # PARAMETERS CELL section.

Variable Libraries

LibraryFilePurpose
VAR_CONFIG_FMDsrc/VAR_CONFIG_FMD.VariableLibrary/variables.jsonRuntime config: DB connection string, DB name, workspace/database GUIDs
VAR_FMDsrc/VAR_FMD.VariableLibrary/variables.jsonDefault flags: Key Vault URIs, lakehouse_schema_enabled

VAR_CONFIG_FMD key variables:

  • fmd_fabric_db_connection — ODBC connection string to SQL_FMD_FRAMEWORK
  • fmd_fabric_db_name — database name
  • fmd_config_workspace_guid — config workspace GUID
  • fmd_config_database_guid — SQL database GUID

Deployment

FMD Framework

  1. Download setup/NB_SETUP_FMD.ipynb and import it into a Fabric workspace.
  2. Edit the configuration cell (capacity, domain names, workspace roles, connection IDs).
  3. Run the notebook — it provisions all workspaces, lakehouses, pipelines, and notebooks from this repo automatically (reads from repo_owner="edkreuk", repo_name="FMD_FRAMEWORK", branch="main").

Business Domains

  1. Download setup/NB_SETUP_BUSINESS_DOMAINS.ipynb and import it into a Fabric workspace.
  2. Edit settings (business_domain_names, configuration_database_workspace, etc.).
  3. Run the notebook.

Config files

  • config/item_config.yaml — maps workspace names to GUIDs and connection IDs for a deployed environment (do not commit real GUIDs for shared/production environments).
  • config/item_deployment.json, config/item_initial_setup.json, etc. — deployment manifests used by the setup notebooks.

How to add a new data source (integration entity)

  1. Register a Data Source in integration.DataSource.
  2. Call integration.sp_UpsertLandingzoneBronzeSilver with the source/target metadata and primary keys. This atomically creates LandingzoneEntity, BronzeLayerEntity, and SilverLayerEntity rows.
  3. The pipeline PL_FMD_LOAD_LANDINGZONE will pick up the new entity on the next run.

SQL Database project conventions

  • Project file: src/SQL_FMD_FRAMEWORK.SQLDatabase/SQL_FMD_FRAMEWORK.sqlproj
  • Schema folders: integration/, execution/, logging/, Security/
  • Each object lives in its own .sql file named after the object.
  • Stored procedures use WITH EXECUTE AS CALLER.
  • All upsert procedures follow the pattern sp_Upsert<ObjectName> and use MERGE or IF NOT EXISTS / UPDATE patterns.
  • GO statement always appears at the end of each file.

Common pitfalls & workarounds

IssueWorkaround
Fabric Admin role needed for domain creationSet create_domains = False in the setup notebook if the executing identity is not a Fabric Admin.
Workspace Identity vs. Service PrincipalWorkspace Identity is auto-assigned as Contributor; Service Principals must be manually added. Use Object ID from Enterprise Applications in Entra ID, not the App Registration Object ID.
Spark session timeout during long deploymentsSet Spark session timeout ≥ 1 hour in Workspace Settings → Data Engineering → Jobs.
ODBC driver versionDefault is {ODBC Driver 18 for SQL Server}. Change driver variable in setup notebook if a different driver is installed.
Variable Library overwritten on re-deploySet overwrite_variable_library = False to preserve custom changes.
VAR_CONFIG_FMD empty after fresh deployRun the setup notebook first; it populates the variable library with the correct GUIDs and connection strings.

Contributing workflow

  1. Fork the repo and create a feature branch from main.
  2. Make changes under src/ (notebooks, pipelines, SQL objects).
  3. Test in a Fabric development workspace (workspace suffix (D)).
  4. Submit a pull request with documentation describing what changed.
  5. The default branch is main; do not push directly to it.

Download now (ZIP)

  • Where files are headingNew Copilot instructions files have more rules about branches and pull requests, and fewer about code style.

    Of the Copilot instructions files we read, the 2,297 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

Reviews can't be read right now.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.