---
name: macro-inc-dump-schema
description: "Dump clean Postgres schema to a file and copy path to clipboard."
license: "AGPL-3.0"
metadata:
  decimalai-skill-id: "d6ec7efa-682f-4355-9fd2-39b8fd751a90"
  decimalai-version-id: "8e45062b-cbaf-4534-8e83-c84016c822d8"
  decimalai-version: "1"
  decimalai-body-sha256: "7eb633524370e6c2e6c2124474508a5e5db9bb585ea610c6df2fecd5453bbffc"
  decimalai-name: "macro-inc/dump-schema"
  decimalai-format: "1"
  decimalai-invocation: "model"
  decimalai-category: "data"
  decimalai-source: "https://app.decimal.ai/s/macro-inc-dump-schema@1/SKILL.md"
---
# Dump Schema

Dump a clean PostgreSQL schema (no comments, no ownership, no privileges) from the local dev database.

## Parameters

Ask the user (if not provided):
- **output_file** – absolute path for the `.sql` file (default: prompt user)

Use this database URL unless the user specifies otherwise:
```
postgres://user:password@localhost:5432/macrodb
```

## Steps

1. Run `pg_dump` with schema-only flags, pipe through cleanup, write to file:

```bash
pg_dump --schema-only --no-owner --no-privileges --no-comments --no-publications --no-subscriptions --no-security-labels --no-tablespaces "$DB_URL" | sed '/^--/d' | sed '/^SET /d' | sed '/^SELECT pg_catalog/d' | sed '/^$/N;/^\n$/d' > "$OUTPUT_FILE"
```

2. Copy the output path to the clipboard:

```bash
echo -n "$OUTPUT_FILE" | pbcopy
```

3. Report: `Schema dumped to <path> (path copied to clipboard)`
