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

# basecut init

> Generate a ready-to-run basecut.yml from your schema

`basecut init` introspects your database and generates a runnable `basecut.yml`.

It guides you through:

* root table selection
* lookup/junction table handling
* optional PII rule generation
* preflight validation against the live schema

## Usage

```bash theme={null}
basecut init [flags]
```

## Flags

| Flag                  | Default                 | Description                                 |
| --------------------- | ----------------------- | ------------------------------------------- |
| `--source <url>, -s`  | `$BASECUT_DATABASE_URL` | PostgreSQL connection string to introspect. |
| `--output <path>, -o` | `basecut.yml`           | Output config path.                         |
| `--force, -f`         | `false`                 | Overwrite existing file without prompt.     |

## Examples

### Basic Usage

```bash theme={null}
basecut init --source "postgresql://readonly@prod-db:5432/myapp"
```

Generated config shape:

```yaml theme={null}
version: '1'
name: 'my-snapshot'

from:
  - table: users
    where: 'id = :id'
    params:
      id: 42

include_all:
  - countries

traverse:
  stop_at:
    - user_roles

limits:
  rows:
    per_table: 1000
    total: 100000

sampling:
  mode: random
  seed: 0

anonymize:
  mode: auto
  rules:
    users:
      email: fake_email

output: ./snapshots
```

## Next Step

```bash theme={null}
basecut snapshot create --config basecut.yml --name dev-seed --source "$BASECUT_DATABASE_URL"
```
