> ## Documentation Index
> Fetch the complete documentation index at: https://docs.meetsilicon.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Silicon YAML

> Define models in YAML, connect them through GitHub or Bitbucket Cloud, and update them without dbt

## What is Silicon YAML?

Silicon YAML defines your semantic layer in standalone model files that point to existing tables in your warehouse. You can build metrics, dimensions, charts, dashboards, and AI agents without installing dbt or maintaining a dbt project.

You can [connect the project through GitHub or Bitbucket Cloud](#connect-through-github) so Silicon compiles and refreshes it from your repository, or [deploy local files with the CLI](#step-4-deploy-your-project). A GitHub connection also lets you write custom fields and AI-proposed changes back to the repository as pull requests.

This page covers the [project layout](#project-layout), [model setup](#define-your-models), [repository connection](#connect-through-github), and [write-back support](#write-back-from-silicon).

## Choose a semantic layer format&#x20;

Use the [dbt integration](https://docs.meetsilicon.com/integrations/dbt/projects.md) when your semantic definitions live in a dbt project. Use Silicon YAML when your warehouse tables already exist and you want to define the semantic layer independently of dbt. Silicon YAML describes those tables; it does not build or transform them.

The formats share Silicon's metric and dimension concepts, but they use different file structures. Native model files have a top-level `type`, `name`, and `sql_from`; dbt model files use dbt's model and `meta` structure. Changing the connection's format does not convert your files.

## Project layout

Keep `silicon.config.yml` in the project directory, with model files under `models/`:

```text theme={null}
silicon.config.yml
models/
  users.yml
  sales/
    orders.yaml
```

Silicon reads `.yml` and `.yaml` files recursively. It also supports `silicon/models/` when there is no `models/` directory; if both exist, only `models/` is used. Each model needs a unique `name` and a `type` of `model`, `model/v1beta`, or `model/v1`.

The model name does not need to match its filename. Silicon tracks the source path so write-back updates the original file, including models nested in subdirectories. Keep native model files inside the configured project directory.

## Recommended: build with an AI coding agent

The fastest way to get started with Silicon YAML is to let an AI coding agent (Claude Code, Cursor, etc.) do the heavy lifting for you.

**1. Install the Silicon CLI**

Follow the [CLI installation guide](https://docs.meetsilicon.com/workflow/cli/install.md) and [authenticate](https://docs.meetsilicon.com/workflow/cli/authenticate.md) with Silicon.

**2. Install Silicon skills**

Run [`silicon install-skills`](https://docs.meetsilicon.com/workflow/install-agent-skills) to teach your coding agent everything it needs to know about building in Silicon, from writing YAML models to creating metrics and deploying.

```bash theme={null}
silicon install-skills
```

**3. Ask your agent to build your project**

Prompt your coding agent to:

* Create your `silicon.config.yml` and YAML model files based on tables in your warehouse
* Generate dimensions and metrics for those models
* Deploy your project to Silicon with `silicon deploy --create --no-warehouse-credentials`

Example prompt:

```text theme={null}
/developing-in-silicon Profile my warehouse, create Silicon YAML
models for the users and orders tables with sensible metrics and
dimensions, then deploy the project to Silicon.
```

Prefer to set things up manually? Follow the step-by-step guide below.

## Define your models&#x20;

### Prerequisites

Before you begin, make sure you have:

1. The [Silicon CLI installed](https://docs.meetsilicon.com/workflow/cli/install.md)
2. [Authenticated with Silicon](https://docs.meetsilicon.com/workflow/cli/authenticate.md)
3. Credentials for your data warehouse (e.g., Snowflake)
4. Tables in your warehouse that you want to explore

### Step 1: Create your project configuration

At the root of your project, create a `silicon.config.yml` file to specify your warehouse type:

```yaml theme={null}
warehouse:
  type: snowflake
```

Replace `snowflake` with your warehouse type (e.g., `bigquery`, `databricks`, `redshift`, `postgres`, `trino`).

### Step 2: Create your first model

Define the table in `sql_from`, then add dimensions and metrics using the native model structure below.

Create a directory structure for your Silicon project:

```bash theme={null}
mkdir -p models
```

Create a YAML file for your first model. For example, `models/users.yml`:

```yaml theme={null}
# Metadata
type: model
name: users

# Table definition
sql_from: 'DB.SCHEMA.USERS'

# Metric definitions
# For more configuration see: /semantic-layer/metrics
metrics:
  user_count:
    type: count_distinct
    sql: ${TABLE}.USER_ID
    description: Total unique users

# Dimension definitions
# For more configuration see: /semantic-layer/dimensions
dimensions:
  - name: subscription_type
    sql: ${TABLE}.SUBSCRIPTION
    type: string

  - name: signed_up_at
    sql: ${TABLE}.SIGNED_UP
    type: date
    time_intervals:
      - DAY
      - WEEK
      - MONTH
```

Update the configuration:

* Set `sql_from` to the fully qualified name of your table (e.g., `DATABASE.SCHEMA.TABLE`)
* Update the dimensions to match the columns in your table
* Add metrics that make sense for your data

### Step 3: Validate your YAML

Run [`silicon lint`](https://docs.meetsilicon.com/workflow/cli/lint) to check your YAML files for errors before you deploy:

```bash theme={null}
silicon lint
```

Then [compile the models](https://docs.meetsilicon.com/workflow/cli/compile.md) to check field and join references:

```bash theme={null}
silicon compile --no-warehouse-credentials --no-partial-compilation
```

The CLI uses `warehouse.type` in `silicon.config.yml` to compile SQL for your warehouse. Compilation does not create the physical tables or confirm that every physical column exists.

### Step 4: Deploy your project

Choose [GitHub or Bitbucket Cloud](#connect-through-github) to have Silicon compile the committed files, or create a project from your local files with the CLI:

```bash theme={null}
silicon deploy --create --no-warehouse-credentials
```

With `--no-warehouse-credentials`, the CLI does not read a dbt profile or send warehouse credentials. Configure the created project's warehouse connection in Silicon before querying it:

1. Go to **Settings**
2. Under **Current project**, click **Connection settings**
3. Configure your **Warehouse connection** with your database credentials

For detailed instructions on configuring your warehouse connection, see [Connect to a warehouse](https://docs.meetsilicon.com/integrations/connect-project.md#1-connect-to-a-warehouse).

### Step 5: Update your project

After your initial deployment, you can edit your `.yml` files and redeploy changes:

```bash theme={null}
silicon deploy --no-warehouse-credentials
```

For a GitHub- or Bitbucket Cloud-connected project, commit and merge the model changes, then [refresh from the repository](#refresh-a-github-connected-project).

## Connect through GitHub or Bitbucket Cloud

You need permission to manage the project's connection and access to the repository. Use the [GitHub connection settings](https://docs.meetsilicon.com/integrations/connect-project.md#github) or [Bitbucket Cloud connection settings](https://docs.meetsilicon.com/integrations/connect-project.md#bitbucket) for authentication. To use AI writeback, install the Silicon GitHub App or configure the Bitbucket API token with writeback permissions.

1. Commit your configuration and models to GitHub or Bitbucket Cloud.
2. Open **Settings -> All projects -> Create new**, or **Settings -> Current project -> Connection settings** for an existing project.
3. Configure the warehouse connection, and choose **GitHub** or **Bitbucket** as the project connection type.
4. Set **Semantic layer format** to **Native Silicon YAML**.
5. Select the repository and branch. Set **Project directory path** to `/` for the repository root, or the directory containing `silicon.config.yml` and the model directory. For example, use `/analytics` for `analytics/silicon.config.yml` and `analytics/models/`.
6. Save the connection. Silicon reads the committed files and compiles them using the project's saved warehouse connection.

You can add this connection to an existing CLI-created project. Updating that project's connection keeps its project ID, warehouse credentials, charts, and dashboards. Keep model and field names stable so saved content still resolves.

Native connections do not use dbt versions, profiles, targets, selectors, or dbt environment variables. Native YAML supports GitHub and Bitbucket Cloud (`bitbucket.org`); Bitbucket Server/Data Center and GitLab are not supported. Native projects cannot be combined with additional dbt sources.

### Refresh a Git-connected project

After merging changes to the configured branch, click **Refresh models** in Silicon or run [`silicon refresh`](https://docs.meetsilicon.com/workflow/cli/reference#silicon-refresh). The server pulls that branch and compiles the YAML using the saved warehouse connection. You do not need dbt or a local checkout to trigger a refresh.

Invalid YAML, invalid model definitions, duplicate model names, or semantic compilation errors fail the native refresh instead of publishing an incomplete model set. Open [Compilation history](https://docs.meetsilicon.com/workspace-admin/project-compilation-history.md) to inspect the result.

To test another branch with a GitHub connection, [create a preview project](https://docs.meetsilicon.com/workflow/preview-projects.md#silicon-app). The preview retains the native semantic layer format.

## Write back from Silicon

In a GitHub-connected native project, users with [project Developer permissions](https://docs.meetsilicon.com/workspace-admin/roles.md) or above can open pull requests from the Explore view:

1. Create a [custom metric or dimension](https://docs.meetsilicon.com/explore/create-custom-fields.md).
2. Open the field's menu and choose **Write back to project**. You can also use the write-back action on the Custom metrics or Custom dimensions section to select several fields.
3. Review the YAML preview and click **Open Pull Request**.
4. Review and merge the pull request, then refresh the project.

The edit stays in the original model file and preserves comments and unrelated definitions. If a field name already exists, Silicon rejects the write instead of replacing its definition.

### Supported fields and limits

| Field | Native YAML write-back |
| - | - |
| Custom metric based on a dimension | Adds the metric under that native dimension's `metrics` |
| Custom metric cloned from an existing metric | Not supported: it has no base dimension |
| Generated period-comparison metric | Not supported |
| Custom SQL dimension | Adds a dimension with its SQL and type |
| Custom bin dimension | Adds a string dimension with warehouse-specific binning SQL |

Metrics with filters that cannot be represented without changing their meaning are rejected. Write-back requires block-style YAML dimensions rather than inline, flow-style lists.

Existing saved charts keep their custom bin dimensions so their ordering is unchanged. Use the written YAML dimension in new charts; add a separate numeric ordering dimension in the model when bin order matters. Custom dimensions are not automatically replaced in saved charts after write-back.

SQL Runner's **Write back to dbt** action creates dbt SQL models and is not available for native projects. Native `sql_from` definitions point to tables that your warehouse workflow already creates.

## AI writeback and Issues

[AI writeback](https://docs.meetsilicon.com/agents/ai-writeback.md) can edit native YAML from a chat request in GitHub- and Bitbucket Cloud-connected projects. It validates the edited native models before pushing changes, using the connected warehouse's SQL dialect without passing warehouse credentials to the sandbox. A validation error prevents the pull request from being opened or updated.

[Issues](https://docs.meetsilicon.com/agents/issues.md#fixing-an-issue-with-writeback) uses the same native path for semantic layer fixes. Project context fixes update [agent context](https://docs.meetsilicon.com/agents/agent-context.md) in `silicon.project_context.yml` beside the project configuration. GitHub AI writeback also supports [automatic preview projects](https://docs.meetsilicon.com/agents/ai-writeback.md#automatic-preview-project). For Bitbucket, review and merge in Bitbucket, then refresh the project; see [Bitbucket Cloud behavior](https://docs.meetsilicon.com/agents/ai-writeback.md#bitbucket-cloud-behavior).

## Developing with AI coding agents

If you're developing with Cursor, Claude Code, or another AI coding agent, you can speed up your workflow significantly.

### Recommended setup

1. **Install Silicon skills:** Run [`silicon install-skills`](https://docs.meetsilicon.com/workflow/install-agent-skills) to give your coding agent everything it needs to build YAML models, create metrics, and deploy to Silicon. Then ask your agent to create your YAML files, add some metrics, and deploy to Silicon.

   ```bash theme={null}
   silicon install-skills
   ```

2. **Share your warehouse schema:** Give your coding agent access to your warehouse schema so it can generate YAML files that match your actual table structures.

3. **Use validation:** Prompt your coding agent to always run `silicon lint` after making any changes to catch errors early.

> [!TIP]
>
> With access to your warehouse schema, AI coding agents can auto-generate dimension and metric definitions for entire tables in seconds.

If you'd rather not install the skills, you can still point your coding agent at the [Silicon YAML format specification](https://raw.githubusercontent.com/silicon/silicon/refs/heads/main/packages/common/src/schemas/json/model-as-code-1.0.json) directly.

## Next steps

Once you've deployed your Silicon YAML project:

* [Explore your data](https://docs.meetsilicon.com/explore/explore-view) in the Silicon UI
* [Create metrics](https://docs.meetsilicon.com/semantic-layer/metrics.md) to define your key business calculations
* [Set up AI agents](https://docs.meetsilicon.com/agents) to enable natural language queries
* Learn about the [semantic layer reference](https://docs.meetsilicon.com/semantic-layer/metrics.md) for advanced configuration options


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.