Manages database schemas, migrations, and data scripts via the Atlas CLI. Inspects, diffs, lints, validates, and tests schemas; runs data backfills and purges; queries Atlas Cloud for deployment status and pending approvals.
Ships in Atlas. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
This skill is SKILL.md plus nine reference files under references/, each served at
https://atlasgo.io/skills/atlas/references/<name>: schema-sources.md, versioned.md, declarative.md,
cicd.md, lint.md, testing.md, drift.md, cloud.md, and scripts.md. Read a reference only when
the task needs it; "Choosing a Workflow" below says which.
Never hardcode credentials. Use environment variables in atlas.hcl:
env "prod" {
url = getenv("DATABASE_URL")
}
Always run commands with --env <name> so database URLs stay in atlas.hcl and never enter the
conversation. Read atlas.hcl first to learn the environment names.
Use --help on any command for full docs and examples: atlas migrate diff --help.
# Setup
atlas version # Installed version
atlas whoami # Login status and org
atlas login # Needed by lint, test, drift, plan, scripts, schema lint, and cloud
# Schema
atlas schema inspect --env <name> # Inspect current schema
atlas schema validate --env <name> # Validate schema syntax/semantics
atlas schema diff --env <name> --from env://url --to file://schema.hcl # Live database vs desired schema
atlas schema lint --env <name> # Check schema policies
atlas schema test --env <name> # Test schema logic
# Declarative workflow
atlas schema plan --env <name> # Pre-plan changes for review
atlas schema apply --env <name> --dry-run # Preview changes
atlas schema apply --env <name> # Apply schema changes
# Versioned workflow
atlas migrate diff --env <name> "migration_name" # Generate migration
atlas migrate lint --env <name> --latest 1 # Lint the newest migration
atlas migrate test --env <name> # Test migrations
atlas migrate apply --env <name> --dry-run # Preview changes
atlas migrate apply --env <name> # Apply migration
atlas migrate status --env <name> # Live database vs migration directory
atlas migrate down --env <name> --dry-run # Preview reverting the last migration
atlas migrate hash --env <name> # Recompute atlas.sum after manual edits
atlas migrate new --env <name> "name" # Empty migration file for hand-written SQL
atlas migrate checkpoint --env <name> # Squash history into a checkpoint file
atlas migrate rebase --env <name> <version> # Rebase a migration onto newer files
atlas migrate push --env <name> # Push the directory to the Atlas Registry
# Linting and testing (see references/lint.md, references/testing.md)
atlas migrate lint --env ci # CI: new files vs the registry repo they match
atlas migrate lint --env ci --base atlas://<repo> # The same, naming the repo: when several match
atlas migrate lint --env ci --git-base master # No registry: new files vs the base branch
atlas schema lint --env <name> # Lint the whole schema against policy
atlas schema test --env <name> --run <case> # Schema tests: functions, views, triggers
atlas schema plan test --env <name> # Test a declarative plan file
# Drift (see references/drift.md)
atlas migrate drift --env <name> # Database vs migration history, exit 1 on drift (login)
atlas schema diff --from <url> --to <url> --dev-url <dev> # Any two states
# Atlas Cloud (see references/cloud.md)
atlas cloud repo list # Registry repos with synced/failed/pending counts
atlas cloud database list --env-name <env> # Every tracked database and its status
atlas cloud migration list --status FAILED # Failed deployments
atlas schema plan list --env <name> --pending # Plans waiting for approval
# Data Scripts (see references/scripts.md)
atlas script exec --env <name> --run '^name$' # Transactional mutation
atlas script query --env <name> --run '^name$' -q # Read or report
atlas script loop --env <name> --run '^name$' # Batched backfill or purge
atlas script test --env <name> # Test scripts on the dev database
What is the request?
├─ A schema change
│ ├─ Project has migrations/ dir or a migration block in atlas.hcl?
│ │ ├─ Yes → Versioned: migrate diff → lint → test → apply (references/versioned.md)
│ │ └─ No → Declarative: schema apply --dry-run → apply (references/declarative.md)
│ ├─ Change must be reviewed and approved before it runs?
│ │ └─ schema plan (declarative) or a PR with migrate lint (versioned)
│ ├─ Iterating on a local database?
│ │ └─ schema apply --auto-approve for fast edit-apply cycles
│ └─ Not sure → Read atlas.hcl first
├─ CI/CD: lint on PRs, push to the registry, deploy from it
│ └─ references/cicd.md (each step's inputs and errors on each platform: the atlas-action skill)
├─ A data change (backfill, purge, report, invariant check)
│ └─ Data Scripts: references/scripts.md
├─ A lint failure, a lint policy, or a custom rule
│ └─ references/lint.md
├─ Tests for functions, views, triggers, data migrations, or plans
│ └─ references/testing.md
├─ "Has this database drifted?" or a drift check for deploys
│ └─ references/drift.md
├─ A question about deployments, database status, or the registry
│ └─ Atlas Cloud: references/cloud.md
└─ ORM or schema source setup
└─ references/schema-sources.md
atlas schema apply applies schema changes directly to a database without migration files. Use it for
fast iteration during development: edit the schema, run schema apply, see the result.
Versioned project (a migration block in atlas.hcl):
User: Add an email column to the users table
Agent steps:
1. atlas schema inspect --env dev # understand current state
2. Edit schema source file # add email column
3. atlas schema validate --env dev # verify syntax
4. atlas migrate diff --env dev "add_users_email" # generate migration
5. atlas migrate lint --env dev --latest 1 # check for issues
6. atlas migrate apply --env dev --dry-run # preview before applying
Declarative project (a schema block, no migration directory):
Agent steps:
1. Edit schema source file # add email column
2. atlas schema validate --env dev # verify syntax
3. atlas schema apply --env dev --dry-run # read the planned SQL to the user
4. atlas schema apply --env dev # apply (or --auto-approve on a local database)
Always read the project's atlas.hcl first. It contains the environment configurations:
env "<name>" {
url = getenv("DATABASE_URL")
dev = "docker://postgres/17/dev?search_path=public"
migration {
dir = "file://migrations" # or "atlas://<repo>" for the Atlas Registry
}
schema {
src = "file://schema.hcl"
}
script {
src = "file://scripts" # Data Scripts source
}
}
Atlas uses a temporary dev database to process and validate schemas. The URL scope must match the target: schema-scoped when the project manages one schema, database-scoped when it manages several schemas, extensions, or event triggers.
# Schema-scoped (single schema, most common)
--dev-url "docker://mysql/8/dev"
--dev-url "docker://postgres/17/dev?search_path=public"
--dev-url "sqlite://dev?mode=memory"
--dev-url "docker://sqlserver/2022-latest/dev?mode=schema"
# Database-scoped (multiple schemas, extensions, or event triggers)
--dev-url "docker://mysql/8"
--dev-url "docker://postgres/17/dev"
--dev-url "docker://sqlserver/2022-latest/dev?mode=database"
Using the wrong scope causes errors such as
modify schema "public" is not allowed when migration plan is scoped to one schema, or silently drops database-level
objects (extensions, event triggers) from migrations. For PostGIS or pgvector schemas, use
docker://postgis/latest/dev or docker://pgvector/pg17/dev.
If the schema depends on extensions or external objects, use a docker block with a baseline:
docker "postgres" "dev" {
image = "postgres:17"
schema = "public"
baseline = <<SQL
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
SQL
}
env "local" {
src = "file://schema.hcl"
dev = docker.postgres.dev.url
}
Start with an overview before diving into details. The default output is HCL. Use
--format "{{ json . }}" for JSON or --format "{{ sql . }}" for SQL.
# List tables (overview first, JSON output)
atlas schema inspect --env <name> --format "{{ json . }}" | jq ".schemas[].tables[].name"
# Full SQL schema
atlas schema inspect --env <name> --format "{{ sql . }}"
# Filter with --include/--exclude (useful for large schemas)
atlas schema inspect --env <name> --include "users_*" # Only matching tables (needs atlas login)
atlas schema inspect --env <name> --exclude "*_backup" # Skip matching tables
atlas schema inspect --env <name> --exclude "*.*[type=trigger]" # Skip triggers (database scope: "*.*.*[type=trigger]")
# Open a visual ERD in the browser (requires atlas login)
atlas schema inspect --env <name> -w
# Live database vs desired schema. --from and --to are always required; --env supplies the dev database.
# env://url reads the env's url so the database URL never appears on the command line.
# On a versioned database add --exclude atlas_schema_revisions, or the revisions table shows up as a drop.
atlas schema diff --env <name> --from env://url --to file://schema.hcl --exclude atlas_schema_revisions
# Compare specific sources
atlas schema diff --env <name> --from file://migrations --to file://schema.hcl
# Generate a migration from the schema diff
atlas migrate diff --env <name> "add_users_table"
# With explicit parameters
atlas migrate diff \
--dir file://migrations \
--dev-url docker://postgres/17/dev \
--to file://schema.hcl \
"add_users_table"
Validate schema definitions after every edit and before generating migrations:
atlas schema validate --env <name>
atlas schema validate --dev-url docker://postgres/17/dev --url file://schema.hcl
If valid, the command exits successfully. If invalid, it prints the error (unresolved references, syntax issues, unsupported attributes).
atlas migrate lint --env <name> --latest 1 # Lint the latest migration
atlas migrate lint --env ci # CI: new files vs the registry (no registry: --git-base master)
atlas schema lint --env <name> # Check the whole schema against policy
The analyzers catch destructive changes (DS*), data-dependent changes (MF*),
backward-incompatible changes (BC*), table locks and rewrites (MY*, PG*), naming and ownership
policy, and custom rules written in HCL. Policy lives in the lint block of atlas.hcl.
Fixing lint issues:
atlas migrate hash --env <name>.-- atlas:nolint <code> only with the user's approval.Codes, policy configuration, and custom rules: references/lint.md.
atlas schema test --env <name> # Functions, views, triggers, constraints, queries
atlas migrate test --env <name> # Data migrations between versions
atlas schema plan test --env <name> # Declarative plan files
atlas script test --env <name> # Data Scripts
Tests are HCL cases (test "schema" "<name>" { exec, catch, assert, ... }) run against the dev
database. Write a test with every function, view, trigger, and data migration you add. Block syntax,
env configuration, and the fix loop: references/testing.md.
atlas migrate apply --env <name> --dry-run # Always preview first
atlas migrate apply --env <name> # Apply
atlas migrate status --env <name> # Verify
Before applying to a shared or production environment, check Atlas Cloud state first (failed or
in-flight deployments on the same targets). See the pre-deployment checklist in references/cloud.md.
In the declarative workflow, atlas schema plan saves a migration plan to the Atlas Registry so it
can be reviewed and approved before atlas schema apply runs it:
atlas schema plan --env <name> # Plan, lint, review, approve and push
atlas schema plan --env <name> --pending # Push for someone else to approve
atlas schema plan list --env <name> --pending # Plans waiting for approval
atlas schema plan approve --url "atlas://<repo>/plans/<name>"
atlas schema apply --env <name> # Applies the approved plan as-is
Plan editing, push, pull, lint, validate, the review policy, and schema push:
references/declarative.md. Migration directory formats, the diff policy, baselines, down,
checkpoint, rebase, pre-execution checks, and multi-tenant apply: references/versioned.md.
Lint (or plan) on pull requests, push the directory or schema to the Atlas Registry on merge, deploy
from atlas://<repo> with drift and pre-execution checks. Workflows for GitHub Actions and the
equivalents for GitLab, CircleCI, Bitbucket, Azure DevOps, Kubernetes, and Terraform:
references/cicd.md. Each step's inputs, outputs, tokens, permissions, and failure messages: the
atlas-action skill (https://atlasgo.io/guides/ai-tools/agent-skills#cicd-skill).
atlas schema inspect --env <name>: understand the current state (skip on an empty database)atlas schema validate --env <name>: check syntaxatlas migrate diff --env <name> "change_name": generate the migrationatlas migrate lint --env <name> --latest 1: validate (requires login)atlas migrate test --env <name>: test (requires login)atlas migrate hashatlas migrate apply --env <name> --dry-run, then applyRun atlas whoami before inspecting, diffing, or baselining an existing database, and ask the user to
log in if it fails. Logged out, atlas schema inspect and atlas schema diff skip views, functions,
procedures, triggers, sequences, extensions, and other objects and still exit 0, so their output looks
complete when it is not.
Other commands that need a login fail with command requires 'atlas login' or
available only to Atlas Pro users. Tell the user that step was skipped and why, and continue with the
remaining steps.
Drift is a difference between a database and its source of truth. Four tools, one per question:
| Question | Tool |
|---|---|
| Does this database match its migration history, now or on a schedule? | atlas migrate drift --env <name> (exit 1 on drift, cron-friendly; requires atlas login) |
| Block a deploy if the target drifted | check "migrate_apply" { drift { on_error = FAIL } } in atlas.hcl |
| How do two states differ (declarative, or database vs database)? | atlas schema diff --from <url> --to <url> (both flags required) |
| Agent-based continuous monitoring with alerts | Schema Monitoring in Atlas Cloud |
Commands, flags, exclude patterns, and the reporting workflow: references/drift.md.
atlas cloud commands report what Atlas Cloud knows: registry repos, every tracked database with its
sync status (SYNCED, PENDING, FAILED) and current version, and every deployment event
(PASSED, FAILED, NO_ACTION, DRY_RUN). Use them to answer operational questions:
| Question | Command |
|---|---|
| Summarize our database infrastructure | atlas cloud repo list, then atlas cloud database list per env |
| Which deployments failed? | atlas cloud migration list --status FAILED |
| What happened in a deployment? | atlas cloud migration describe --id <id> |
| Which databases are waiting for a deployment? | atlas cloud database list and filter Status=PENDING |
| Which plans are waiting for approval? | atlas schema plan list --env <name> --pending |
| What version is production on? | atlas cloud database list --env-name prod |
Full command reference, report templates, and decision rules: references/cloud.md.
atlas script runs data operations written as HCL: exec for transactional mutations, query for
reads and reports, and loop for batched backfills and purges, with condition guards, assert
checks, expect_rows, output masking, and tests. Use a script for data work and a migration for schema
work. Full reference: references/scripts.md.
For HCL schemas, ORM integrations (GORM, Drizzle, SQLAlchemy, Django, Ent, Sequelize, TypeORM),
composite schemas, and dev-database dialect URLs, see references/schema-sources.md.
For a guided onboarding of a whole project or team (inventory, splitting a large database into units,
CI, and deployment, each stage verified), the user can run the atlas-onboard skill
(https://atlasgo.io/guides/ai-tools/agent-skills#onboarding-skill).
To start managing an existing database with versioned migrations, log in first: a logged-out inspect
leaves views, functions, triggers, and other objects out of the baseline without an error. Then pin the
org in atlas.hcl, so any later command that reads it (--env) aborts unless someone is logged in to
that org. Commands that take --url directly do not read it, so run atlas whoami before them:
atlas {
cloud {
org = "<org printed by atlas whoami>"
}
}
# 1. Export the current schema to code
atlas schema inspect --env <name> --format '{{ sql . | split | write "src" }}'
# 2. Generate a baseline migration from the exported schema
atlas migrate diff --env <name> "baseline" --to "file://src"
# 3. Record the baseline as applied on each existing database (the version from the filename).
# Deploy envs can set baseline = "<version>" in their migration block instead.
# Preview first; --dry-run writes nothing:
atlas migrate apply --env <name> --baseline '<version>' --dry-run
# Then, only after the user approves the named target, record it (this writes the revisions table):
atlas migrate apply --env <name> --baseline '<version>'
The baseline migration captures the current state without executing it on existing databases. On new databases, it runs in full to create the initial schema.
atlas version # Check installation
atlas whoami # Check login and org
atlas migrate hash --env <name> # Repair migration integrity after manual edits
command requires 'atlas login' or available only to Atlas Pro users: the command needs a
login. Run atlas login, or atlas login --token "$ATLAS_TOKEN" in CI. Report the skipped step and
continue.'atlas login' is required for organization <org> as specified in atlas.hcl: the project pins its
org. Ask the user to run atlas login with an account in that org.--url or --dev-url is correctly specified.add, drop, or modify schema "<name>" is not allowed when migration plan is scoped to one schema:
the dev URL scope does not match the target. See Dev Database above.migrate lint asks Multiple directories found. Select one to lint against, and fails in CI with
Error: ^D: more than one registry repo matches the local directory. Pass --base atlas://<repo>.missing data source handler for "<name>", or a documented command that prints only its parent's
usage (such as atlas migrate drift): the installed Atlas lacks it (an older release or the
Community Edition build), or the data source type is misspelled. An unknown data source fails
every env in the file, including envs that never reference it. Check the type against
https://atlasgo.io/atlas-schema/projects#data-sources, run atlas version, and install the latest
release (https://atlasgo.io/getting-started#step-1-install-atlas).Call to unknown function: atlas.hcl takes file, fileset, getenv, and the functions listed at
https://atlasgo.io/hcl/functions. There is no coalesce.docker:// dev URL starts the container, then fails with
dial tcp <address>: connect: connection refused: Atlas runs in a container that uses the host's
Docker daemon, such as a devcontainer, and cannot reach the port the daemon published. Start the dev
database container yourself and set dev to its URL at an address the container can reach, such as
its IP on the Docker network (https://atlasgo.io/faq/docker-in-docker).atlas.hcl first and use the environment names from it.getenv() and --env.atlas schema validate after schema edits.atlas migrate hash after editing migration files.atlas login once per machine. Linting, testing, drift, schema plan, the review policy,
scripts, ERD, migrate checkpoint, schema inspect --include, and Atlas Cloud need it, and fail
without it: report the skipped step and continue.
Inspecting and diffing a database do not fail without it; they skip objects. Log in before either.
A user without an account can start a free trial with atlas login.FAILED or PENDING targets
and recent failed deployments (references/cloud.md).condition, assert the outcome,
and mask PII in reports (references/scripts.md).atlas cloud says what Atlas Cloud
knows; atlas migrate status says what is in the database.references/cicd.md (opens in a new tab)references/cloud.md (opens in a new tab)references/declarative.md (opens in a new tab)references/drift.md (opens in a new tab)references/lint.md (opens in a new tab)references/schema-sources.md (opens in a new tab)references/scripts.md (opens in a new tab)references/testing.md (opens in a new tab)references/versioned.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
SQL, PostgreSQL, MySQL, SQLite
atlas-cli, schema-migrations, database-schema, atlas-cloud, data-scripts
/atlas:atlasfrom Atlas
npx claudepluginhub ariga/atlas --plugin atlas14 skills in this plugin
/atlas-actionAtlas in CI/CD pipelines with the Atlas actions: ariga/setup-atlas and ariga/atlas-action on GitHub Actions, the GitLab CI components, the CircleCI orb, the Bitbucket pipe, and the Azure DevOps AtlasAction task. The CI/CD steps (migrate lint, push, diff, hash, autorebase, test, apply, down, set, drift; schema plan, plan approve, push, apply, lint, test; script exec, query, loop, test, push; security scan; monitor schema; create-repo) with its inputs, outputs, tokens, permissions, and pull request comments, plus pinning versions, runners, and fixing a failed run. Use with the atlas skill whenever a pipeline runs Atlas or an Atlas check in CI fails./atlas-clickhouseClickHouse specifics for Atlas: the login-only driver, dev database and URL scope (database vs server), Docker dev images and version checks, cluster mode and ON CLUSTER, table engines, sort keys and table rebuilds, plans that skip destructive changes without a terminal, table recreation and the allow_recreate policy, mutations and CH lint checks, materialized views, dictionaries, UDFs and WASM, named collections, users, roles, grants, row policies and settings profiles, secret settings and the sensitive mode, no transactions and no lock, ClickHouse Cloud, schema and migration tests, and custom lint rules. Use with the atlas skill whenever Atlas manages a ClickHouse database./atlas-databricksDatabricks specifics for Atlas: the extended binary and login, connection URLs and scope (catalog vs schema), the dev catalog (no Docker), Delta table properties, managed and external tables, partitioning and liquid clustering, generated and identity columns, defaults and column mapping, renames, informational keys and checks, collations, column masks and row filters, views, metric views, and materialized views, SQL and Python functions, procedures, Unity Catalog grants, no transactions and no locks, partial failures, schema and migration tests, and custom lint rules. Use with the atlas skill whenever Atlas manages a Databricks database. For Databricks Lakebase, use atlas-lakebase./atlas-lakebaseDatabricks Lakebase specifics for Atlas: the databricks_lakebase_token data source and the Databricks credentials it uses (a CLI profile, or a service principal with the workspace-access entitlement), the endpoint host instead of the -pooler host, the Postgres role in the URL, password roles, the objects Lakebase manages in every database (__db_system, three grant_* functions, three on_create_* event triggers) and how to exclude them at schema and database scope, the first migrate apply, drift checks, object ownership, and Lakebase errors. Use with the atlas and atlas-postgres skills whenever Atlas manages a Databricks Lakebase database./atlas-mssqlSQL Server specifics for Atlas (also Azure SQL and MSSQL): login, Azure SQL sign-in with Microsoft Entra ID (fedauth, no password), dev database and URL scope (mode=schema vs mode=database, the database query parameter), compatibility level and collation, system-generated constraint names, clustered index defaults and datetime2 precision in HCL, GO batches and the delimiter directive, transactions and statements that cannot run in one, identity, computed and temporal columns, alias and table types, changes planned as a drop and an add, what Atlas leaves out (DENY, synonyms, row-level security, sparse columns), database roles, users and grants, schema and migration tests, and custom lint rules. Use with the atlas skill whenever Atlas manages a SQL Server or Azure SQL database./atlas-mysqlMySQL and MariaDB specifics for Atlas: dev database and URL scope (schema vs server), character sets and collations, users, roles and grants, enum and set columns, generated columns, foreign-key indexes, functional and prefix indexes, triggers and stored programs, table copies and MY lint checks, partial migration failures (no transactional DDL), GET_LOCK, managed services (RDS, Aurora, Cloud SQL, Azure), schema and migration tests, and custom lint rules. Use with the atlas skill whenever Atlas manages a MySQL or MariaDB database.Other plugins' skills for the same job