Dump schema

From macro-inc/macro · View interactive version

Dump schema is an AI agent skill from the GitHub repository macro-inc/macro. Dump clean Postgres schema to a file and copy path to clipboard.

How to use this skill

Skill file

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):

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:
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"
  1. Copy the output path to the clipboard:
echo -n "$OUTPUT_FILE" | pbcopy
  1. Report: Schema dumped to <path> (path copied to clipboard)
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.