ariga/atlas/atlas

Claude Code and agent skill by ariga/atlas

Trust tier 2
  • community
  • ext:[{"type":"config","description":"Configuration overrides"}]
LLM review pending
Source check pending

Checking that the SKILL.md file is still in the repository.

Database schema management, migrations, data scripts, and Atlas Cloud operations with the Atlas CLI. Use when: generating or applying migrations, diffing, linting, validating, or testing schemas, working with atlas.hcl, schema.hcl, or ORM schemas (GORM, Drizzle, SQLAlchemy, Django, Ent, Sequelize, TypeORM, Prisma), running data backfills, purges, or reports with atlas script, or answering questions about Atlas Cloud: which databases are synced, pending, or failed, recent or failed deployments,…

Install

npx vskill@latest install ariga/atlas/atlas

Semi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard

SKILL.md

The same SKILL.md was published earlier as ariga/atlas/atlas.

Atlas: Schema Migrations, Data Scripts, and Cloud Operations

Files

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.

Security

Never hardcode credentials. Use environment variables in atlas.hcl:

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.

Quick Reference

Use --help on any command for full docs and examples: atlas migrate diff --help.

bash
# 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

Choosing a Workflow

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.

Example

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)

Core Concepts

Configuration File (atlas.hcl)

Always read the project's atlas.hcl first. It contains the environment configurations:

hcl
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
}
}
Dev Database

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.

bash
# 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:

hcl
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
}

Workflows

1. Schema Inspection

Start with an overview before diving into details. The default output is HCL. Use --format "{{ json . }}" for JSON or --format "{{ sql . }}" for SQL.

bash
# 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
2. Schema Comparison (Diff)
bash
# 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
3. Migration Generation
bash
# 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"
4. Schema Validation

Validate schema definitions after every edit and before generating migrations:

bash
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).

5. Migration Linting
bash
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:

  • Unapplied migrations: edit the file, then run atlas migrate hash --env <name>.
  • Applied migrations: create a corrective migration. Never edit an applied migration.
  • -- atlas:nolint <code> only with the user's approval.

Codes, policy configuration, and custom rules: references/lint.md.

6. Testing

This is the start of the file. Read the full SKILL.md on GitHub.

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

Popularity

Repository stars
8,764
Repository forks
379
7-day trend score
50

Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.

Extension points

  • configConfiguration overrides

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
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/ariga/atlas/atlas/badge)](https://verified-skill.com/skills/ariga/atlas/atlas)

Something wrong with this skill or its page? Tell us.