atlaslisted
Install: claude install-skill fmind/dot
# Atlas
Manage the database schema as code with the Atlas CLI: a declarative `schema.sql` (or HCL) is the desired state, `atlas` plans changes against a throwaway dev database, and versioned migration files carry them to Cloud SQL. Query code generation stays with `sqlc` in [go-stack](../go-stack/SKILL.md); provisioning Cloud SQL belongs to [google-cloud](../google-cloud/SKILL.md).
## Workflow
1. **Project file**: commit `atlas.hcl` with one env per target; `dev` is a disposable Docker database Atlas uses to normalize and lint.
```hcl
env "local" {
src = "file://schema.sql"
url = getenv("DATABASE_URL")
dev = "docker://postgres/17/dev?search_path=public"
migration { dir = "file://migrations" }
lint { latest = 1 }
}
```
1. **Declarative (dev and prototypes)**: edit `schema.sql`, preview, then apply.
```bash
atlas schema apply --env local --dry-run
atlas schema apply --env local --auto-approve
```
1. **Versioned (shared and production)**: generate a migration from the schema change, lint it, and apply it as a deploy step.
```bash
atlas migrate diff add_users --env local
atlas migrate lint --env local
atlas migrate apply --env local --dry-run
atlas migrate apply --env local
```
1. **Pair with sqlc**: point `sqlc.yaml` `schema:` at the same `schema.sql` (or at `migrations/`, whose Atlas files sqlc parses) so generated Go types and migrations never disagree; run `sqlc generate` after every diff.
1. **Cloud SQL**: