
ghost-database
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. Trigger when user asks to: - Create a new PostgreSQL database quickly - Manage database lifecycle in agent workflows - Fork a database to test changes safely - Run analytics or heavy queries on a fork without impacting the production database - Share a database snapshot so others can spin up their own copy - Pass a database as an input or output between agents - Create a database for agents - Need many databases that are billed only when queried - Set up the Ghost MCP server or CLI Note: If the Ghost MCP server is already installed, use its tools directly — this skill is for environments without the MCP or as a reference for what's possible. Keywords: Ghost, ghost.build, database, create database, fork database, PostgreSQL, managed Postgres, MCP, agent database, connection string
- Installs
- 61
- Last 24h
- —
- Trending rank
- —
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/timescale/pg-aiguide --skill ghost-database- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads ghost-database automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
Ghost Database Management
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:
- CLI and MCP native: create and query databases from the terminal or any MCP-compatible agent
- Instant forking: full database copies in seconds for safe experimentation
- Shareable snapshots: share a database snapshot via URL — anyone with the link can spin up their own copy in their own space
- MCP read-only mode:
ghost config set read_only truelocks all MCP tools into read-only — SQL queries execute in read-only mode and destructive tools (ghost_delete,ghost_password,ghost_rename) are blocked
Website: https://ghost.build
Installation
Multiple installation methods are provided. If you aren't sure, use the first one.
Install Script (macOS/Linux/WSL)
curl -fsSL https://install.ghost.build | sh
Install Script (Windows PowerShell)
irm https://install.ghost.build/install.ps1 | iex
Debian/Ubuntu
curl -s https://packagecloud.io/install/repositories/timescale/ghost/script.deb.sh | sudo os=any dist=any bash
sudo apt-get install ghost
Red Hat/Fedora
curl -s https://packagecloud.io/install/repositories/timescale/ghost/script.rpm.sh | sudo os=rpm_any dist=rpm_any bash
sudo yum install ghost
Getting Started
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
Core Workflows
Create and Query a Database
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" })
Fork for Safe Experimentation
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" })
Auto-Pause and Resume
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" })
Inspect Schema
CLI
ghost schema abc123
MCP
ghost_schema({ name_or_id: "abc123" })
Returns an LLM-optimized schema representation of all tables, columns, indexes, and constraints.
Share a Database
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>" })
CLI Command Reference
For a full list of commands and flags, run:
ghost --help
ghost <command> --help # e.g. ghost create --help
MCP Integration
The Ghost MCP server gives agents full database lifecycle control — create, fork, query, inspect, resume, and delete databases without human intervention.
Install the MCP Server
ghost mcp install
Supports: Claude Code, Cursor, Windsurf, Codex, Gemini, VS Code, Kiro.
MCP Read-Only Mode
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.
When to Use Ghost
Good fit:
- Persistent Postgres storage for agent workflows
- Giving each agent or even agentic execution a dedicated database
- Creating and discarding databases freely without cost anxiety
- Database forking for safe experimentation and migration testing
- Hard spending caps with predictable billing (compute hours in 15-minute chunks)
Not the right fit:
- You need a web dashboard (Ghost is CLI/MCP only)
- You need non-Postgres databases
FAQ
What does the ghost-database skill do?
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. Trigger when user asks to: - Create a new PostgreSQL database quickly - Manage database lifecycle in agent workflows - Fork a database to test changes safely - Run analytics or heavy queries on a fork without impacting the production database - Share a database snapshot so others can spin up their own copy - Pass a database as an input or output between agents - Create a database for agents - Need many databases that are billed only when queried - Set up the Ghost MCP server or CLI Note: If the Ghost MCP server is already installed, use its tools directly — this skill is for environments without the MCP or as a reference for what's possible. Keywords: Ghost, ghost.build, database, create database, fork database, PostgreSQL, managed Postgres, MCP, agent database, connection string
How do I install ghost-database?
Run npx skills add https://github.com/timescale/pg-aiguide --skill ghost-database in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/ghost-database/ (personal) or .claude/skills/ghost-database/ (project).
Which AI agents can use ghost-database?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is ghost-database safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains ghost-database?
It is published by timescale in timescale/pg-aiguide. It has 61 recorded installs.
More from timescale/pg-aiguide
postgres
timescale/pg-aiguide
Use this skill for any PostgreSQL database work — table design, indexing, data types, constraints, extensions (pgvector, PostGIS, TimescaleDB), search, and migrations. Trigger when user asks to: - Explore an existing PostgreSQL database to understand its objects and relationships - Design or modify PostgreSQL tables, schemas, or data models - Choose data types, constraints, indexes, or partitioning strategies - Work with pgvector embeddings, semantic search, or RAG - Set up full-text search, hybrid search, or BM25 ranking - Use PostGIS for spatial/geographic data - Set up TimescaleDB hypertables for time-series data - Migrate tables to hypertables or evaluate migration candidates - Plan or execute safe schema migrations with zero downtime Keywords: PostgreSQL, Postgres, SQL, schema, table design, indexes, constraints, pgvector, PostGIS, TimescaleDB, hypertable, semantic search, hybrid search, BM25, time-series, migration
pgvector-semantic-search
timescale/pg-aiguide
Use this skill for setting up vector similarity search with pgvector for AI/ML embeddings, RAG applications, or semantic search. Trigger when user asks to: - Store or search vector embeddings in PostgreSQL - Set up semantic search, similarity search, or nearest neighbor search - Create HNSW or IVFFlat indexes for vectors - Implement RAG (Retrieval Augmented Generation) with PostgreSQL - Optimize pgvector performance, recall, or memory usage - Use binary quantization for large vector datasets Keywords: pgvector, embeddings, semantic search, vector similarity, HNSW, IVFFlat, halfvec, cosine distance, nearest neighbor, RAG, LLM, AI search Covers: halfvec storage, HNSW index configuration (m, efconstruction, efsearch), quantization strategies, filtered search, bulk loading, and performance tuning.
design-postgres-tables
timescale/pg-aiguide
Use this skill for general PostgreSQL table design. Trigger when user asks to: - Design PostgreSQL tables, schemas, or data models when creating new tables and when modifying existing ones. - Choose data types, constraints, or indexes for PostgreSQL - Create user tables, order tables, reference tables, or JSONB schemas - Understand PostgreSQL best practices for normalization, constraints, or indexing - Design update-heavy, upsert-heavy, or OLTP-style tables Keywords: PostgreSQL schema, table design, data types, PRIMARY KEY, FOREIGN KEY, indexes, B-tree, GIN, JSONB, constraints, normalization, identity columns, partitioning, row-level security Comprehensive reference covering data types, indexing strategies, constraints, JSONB patterns, partitioning, and PostgreSQL-specific best practices.
setup-timescaledb-hypertables
timescale/pg-aiguide
Use this skill when creating database schemas or tables for Timescale, TimescaleDB, TigerData, or Tiger Cloud, especially for time-series, IoT, metrics, events, or log data. Use this to improve the performance of any insert-heavy table. Trigger when user asks to: - Create or design SQL schemas/tables AND Timescale/TimescaleDB/TigerData/Tiger Cloud is available - Set up hypertables, compression, retention policies, or continuous aggregates - Configure partition columns, segmentby, orderby, or chunk intervals - Optimize time-series database performance or storage - Create tables for sensors, metrics, telemetry, events, or transaction logs Keywords: CREATE TABLE, hypertable, Timescale, TimescaleDB, time-series, IoT, metrics, sensor data, compression policy, continuous aggregates, columnstore, retention policy, chunk interval, segmentby, orderby Step-by-step instructions for hypertable creation, column selection, compression policies, retention, continuous aggregates, and index
find-hypertable-candidates
timescale/pg-aiguide
Use this skill to analyze an existing PostgreSQL database and identify which tables should be converted to Timescale/TimescaleDB hypertables. Trigger when user asks to: - Analyze database tables for hypertable conversion potential - Identify time-series or event tables in an existing schema - Evaluate if a table would benefit from Timescale/TimescaleDB - Audit PostgreSQL tables for migration to Timescale/TimescaleDB/TigerData - Score or rank tables for hypertable candidacy Keywords: hypertable candidate, table analysis, migration assessment, Timescale, TimescaleDB, time-series detection, insert-heavy tables, event logs, audit tables Provides SQL queries to analyze table statistics, index patterns, and query patterns. Includes scoring criteria (8+ points = good candidate) and pattern recognition for IoT, events, transactions, and sequential data.
postgres-hybrid-text-search
timescale/pg-aiguide
Open the skill to read its SKILL.md instructions.
Popular data & databases skills
supabase-postgres-best-practices
supabase/agent-skills
Postgres best practices maintained by Supabase, for Postgres running anywhere. Load this skill BEFORE writing or changing anything that lives in a Postgres database: creating or altering tables and columns (including choosing column types), schema design, migrations and declarative schema files, RLS policies and the tests that verify them, indexes, triggers, database functions, queues and scheduled jobs (pgcron, pgmq), vector/semantic search (pgvector), and restoring dumps (pgrestore) or importing data. Also load it when diagnosing slow queries, high CPU, timeouts, EXPLAIN plans, connection exhaustion, locking, bloat, or rows visible to the wrong user or tenant. This is not just a performance guide — schema, migration, security, and SQL authoring tasks need these rules too, even for a one-column change or a single query.
prisma-client-api
prisma/skills
Prisma Client API reference covering model queries, filters, operators, and client methods. Use when writing database queries, using CRUD operations, filtering data, or configuring Prisma Client. Triggers on "prisma query", "findMany", "create", "update", "delete", "$transaction".
prisma-database-setup
prisma/skills
Deprecated compatibility name for prisma-orm-setup. Use only when a user or existing integration explicitly invokes prisma-database-setup; otherwise select prisma-orm-setup.
prisma-cli
prisma/skills
Prisma ORM 7 CLI reference for existing Prisma 7 applications or explicitly selected Prisma 7 workflows. Covers prisma init, generate, migrate, db, dev, studio, and mcp. For setup, connection repair, or Prisma 8, use prisma-orm-setup; not the Prisma Platform CLI.
prisma-postgres
prisma/skills
Deprecated compatibility name for prisma-postgres-setup. Use only when a user or existing integration explicitly invokes prisma-postgres; otherwise select prisma-postgres-setup.
prisma-driver-adapter-implementation
prisma/skills
Required reference for Prisma ORM 7 SQL driver adapter work. Use when implementing or modifying adapters, adding database drivers, or touching SqlDriverAdapter, Transaction, savepoint, result mapping, or DriverAdapterError behavior. Covers current transaction lifecycle, optional savepoint hooks, original database-error preservation, and verification.