| Use this skill for persistent PostgreSQL storage in agent workflows — spin up databases on demand, test schema migrations safely on forks, and pass databases as assets between agents using Ghost.
npx skills add https://github.com/timescale/pg-aiguide --skill ghost-database
Ghost is a managed PostgreSQL service designed for agents. Your account is organized into Spaces, each with unlimited on-demand databases and forks sharing a pool of compute hours (billed in 15-minute chunks when queries are executed). Free tier: 100 hours/month, 1TB storage.
When you need continuous operation, promote any database to a dedicated instance — a separately billed, always-on database.
Additional features:
ghost config set read_only true locks all MCP tools into read-only — SQL queries execute in read-only mode and destructive tools (ghost_delete, ghost_password, ghost_rename) are blockedWebsite: https://ghost.build
Multiple installation methods are provided. If you aren't sure, use the first one.
curl -fsSL https://install.ghost.build | sh
irm https://install.ghost.build/install.ps1 | iex
curl -s https://packagecloud.io/install/repositories/timescale/ghost/script.deb.sh | sudo os=any dist=any bash
sudo apt-get install ghost
curl -s https://packagecloud.io/install/repositories/timescale/ghost/script.rpm.sh | sudo os=rpm_any dist=rpm_any bash
sudo yum install ghost
CLI
ghost login # Authenticate with GitHub
ghost create # Create a new database (returns an ID, e.g. abc123)
ghost list # List all databases with their IDs
ghost connect <name-or-id> # Get connection string
MCP
ghost_login() // Authenticate with GitHub
ghost_create({ name: "my-db" }) // → returns { id: "abc123", ... }
ghost_list() // List all databases with their IDs
ghost_connect({ name_or_id: "abc123" }) // Get connection string
CLI
# Create a database (returns an ID like abc123)
ghost create my-app-db
# Run SQL directly
ghost sql abc123 "CREATE TABLE users (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, email TEXT NOT NULL UNIQUE, created_at TIMESTAMPTZ NOT NULL DEFAULT now())"
# Query it
ghost sql abc123 "SELECT * FROM users"
# Open interactive psql session
ghost psql abc123
MCP
ghost_create({ name: "my-app-db" })
// → returns { id: "abc123", ... }
ghost_sql({ name_or_id: "abc123", query: "CREATE TABLE users (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, email TEXT NOT NULL UNIQUE, created_at TIMESTAMPTZ NOT NULL DEFAULT now())" })
ghost_sql({ name_or_id: "abc123", query: "SELECT * FROM users" })
Forking creates a full copy of your database in seconds — same schema, same data. Use forks to test migrations, experiment with schema changes, or let agents explore without risk to your working database. You can fork a dedicated instance into an on-demand instance — useful for testing against a production copy without paying for always-on compute.
For a complete migration testing workflow using forks — including pre/post validation queries and rollback planning — see the postgres-database-migration skill.
CLI
# Fork a database (returns the fork's ID, e.g. def456)
ghost fork abc123 my-app-db-experiment
# Test changes on the fork
ghost sql my-app-db-experiment "ALTER TABLE users ADD COLUMN role TEXT NOT NULL DEFAULT 'user'"
# If it worked: apply to original
ghost sql abc123 "ALTER TABLE users ADD COLUMN role TEXT NOT NULL DEFAULT 'user'"
# If it failed: delete the fork, original is untouched
ghost delete my-app-db-experiment --confirm
MCP
ghost_fork({ name_or_id: "abc123", name: "my-app-db-experiment" })
// → returns { id: "def456", ... }
ghost_sql({ name_or_id: "def456", query: "ALTER TABLE users ADD COLUMN role TEXT NOT NULL DEFAULT 'user'" })
// If it worked: apply to original
ghost_sql({ name_or_id: "abc123", query: "ALTER TABLE users ADD COLUMN role TEXT NOT NULL DEFAULT 'user'" })
// If it failed: delete the fork, original is untouched
ghost_delete({ name_or_id: "def456" })
Databases automatically pause after 30 days of idle time to conserve compute hours. Storage is retained. Resume a paused database when you need it again:
CLI
ghost resume abc123 --wait
MCP
ghost_resume({ name_or_id: "abc123" })
CLI
ghost schema abc123
MCP
ghost_schema({ name_or_id: "abc123" })
Returns an LLM-optimized schema representation of all tables, columns, indexes, and constraints.
Sharing creates a snapshot anyone can use to spin up their own copy — no access to your space required. Useful for sharing sample datasets, bug reproductions, or starter databases.
Agents can also use shares as a way to pass databases as assets: an agent can produce a database as output by sharing it (handing the recipient a URL to spin up their own copy), or accept a share token as input to start from a pre-populated database.
CLI
# Share a database (returns a share URL)
ghost share abc123
# Share with an expiry
ghost share abc123 --expires 24h
# Recipient creates their own database from the share token
ghost create --from-share <token>
# Manage shares
ghost share list abc123
ghost share revoke <token>
MCP
ghost_share({ name_or_id: "abc123" })
// → returns { share_token: "...", url: "..." }
ghost_share({ name_or_id: "abc123", expires: "24h" })
// Recipient creates their own database from the share token
ghost_create({ from_share: "<token>" })
// Manage shares
ghost_share_list()
ghost_share_revoke({ share_token: "<token>" })
For a full list of commands and flags, run:
ghost --help
ghost <command> --help # e.g. ghost create --help
The Ghost MCP server gives agents full database lifecycle control — create, fork, query, inspect, resume, and delete databases without human intervention.
ghost mcp install
Supports: Claude Code, Cursor, Windsurf, Codex, Gemini, VS Code, Kiro.
To give agents safe read-only access, enable read-only mode before starting the MCP server:
ghost config set read_only true
This locks all MCP tools into read-only: ghost_sql executes queries in read-only mode, and destructive tools (ghost_delete, ghost_password, ghost_rename) are blocked entirely.
Good fit:
Not the right fit:
Efficient database search tool for bioRxiv preprint server. Use this skill when searching for life sciences preprints by keywords, authors, date ranges, or categories, retrieving paper metadata, downloading PDFs, or conducting literature reviews.
Access BRENDA enzyme database via SOAP API. Retrieve kinetic parameters (Km, kcat), reaction equations, organism data, and substrate-specific enzyme information for biochemical research and metabolic pathway analysis.
Access ClinPGx pharmacogenomics data (successor to PharmGKB). Query gene-drug interactions, CPIC guidelines, allele functions, for precision medicine and genotype-guided dosing decisions.
Query NCBI ClinVar for variant clinical significance. Search by gene/position, interpret pathogenicity classifications, access via E-utilities API or FTP, annotate VCFs, for genomic medicine.
Access COSMIC cancer mutation database. Query somatic mutations, Cancer Gene Census, mutational signatures, gene fusions, for cancer research and precision oncology. Requires authentication.
Query Ensembl genome database REST API for 250+ species. Gene lookups, sequence retrieval, variant analysis, comparative genomics, orthologs, VEP predictions, for genomic research.
Query openFDA API for drugs, devices, adverse events, recalls, regulatory submissions (510k, PMA), substance identification (UNII), for FDA regulatory data analysis and safety research.
Query NCBI Gene via E-utilities/Datasets API. Search by symbol/ID, retrieve gene info (RefSeqs, GO, locations, phenotypes), batch lookups, for gene annotation and functional analysis.
Take timescale/ghost-database from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.
The instructions reference apt.
Without those the skill loads but fails at the first command.